Ejemplo n.º 1
0
 /**
  * Finds the Rodetail model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Rodetail the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Rodetail::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Ejemplo n.º 2
0
 /**
  * Action Prosess Approval Colomn Row
  * @param string $id
  * @author ptrnov  <*****@*****.**>
  * @since 1.1
  */
 public function actionApproved($kd)
 {
     /*
      * Init Models
      * @author ptrnov  <*****@*****.**>
      * @since 1.1    
      **/
     //$ro = new Requestorder();
     $roHeader = Requestorder::find()->where(['KD_RO' => $kd])->one();
     $detro = $roHeader->detro;
     $employ = $roHeader->employe;
     $dept = $roHeader->dept;
     /*
      * Convert $roHeader->detro to ArrayDataProvider | Identity 'key' => 'ID',
      * @author ptrnov  <*****@*****.**>
      * @since 1.1    
      **/
     $detroProvider = new ArrayDataProvider(['key' => 'ID', 'allModels' => $detro, 'pagination' => ['pageSize' => 10]]);
     /*
      * Process Editable Row [Columm SQTY]
      * @author ptrnov  <*****@*****.**>
      * @since 1.1    
      **/
     if (Yii::$app->request->post('hasEditable')) {
         $id = Yii::$app->request->post('editableKey');
         $model = Rodetail::findOne($id);
         $out = Json::encode(['output' => '', 'message' => '']);
         $post = [];
         $posted = current($_POST['Rodetail']);
         $post['Rodetail'] = $posted;
         if ($model->load($post)) {
             $model->save();
             $output = '';
             if (isset($posted['RQTY'])) {
                 $output = $model->RQTY;
             }
             if (isset($posted['SQTY'])) {
                 $output = $model->SQTY;
             }
             if (isset($posted['NOTE'])) {
                 // $output =  Yii::$app->formatter->asDecimal($model->EMP_NM, 2);
                 $output = $model->NOTE;
             }
             $out = Json::encode(['output' => $output, 'message' => '']);
         }
         // return ajax json encoded response and exit
         echo $out;
         return;
     }
     /*
      * Render Approved View
      * @author ptrnov  <*****@*****.**>
      * @since 1.1    
      **/
     return $this->render('approved', ['roHeader' => $roHeader, 'detro' => $detro, 'employ' => $employ, 'dept' => $dept, 'dataProvider' => $detroProvider]);
 }
 /**
  * Prosess Agree Manager
  * @param string $id
  * @return mixed
  * @author ptrnov  <*****@*****.**>
  * @since 1.1
  */
 public function actionSimpanproses()
 {
     //$rodetails = new Rodetail();
     $ts = Yii::$app->request->post();
     if (count($ts) == 0) {
         return $this->redirect([' ']);
     }
     $kd = $ts['kd'];
     foreach ($ts['ck'] as $ts) {
         $rodetail = Rodetail::findOne($ts);
         $rodetail->STATUS = 1;
         if ($rodetail->save()) {
             $reqro = Requestorder::find()->where(['KD_RO' => $kd])->one();
             $reqro->STATUS = 1;
             $reqro->save();
         }
     }
     return $this->redirect(['proses', 'kd' => $kd]);
     //$rodetail->save();
 }