Exemple #1
0
 public function auth2_saved()
 {
     if ($this->validate()) {
         $roHeader = Salesorder::find()->where(['KD_RO' => $this->kdro])->one();
         $roSignStt = Salesorderstatus::find()->where(['KD_RO' => $this->kdro, 'ID_USER' => $this->getProfile()->EMP_ID])->one();
         $roHeader->STATUS = $this->status;
         $roHeader->SIG2_SVGBASE64 = $this->getProfile()->SIGSVGBASE64;
         $roHeader->SIG2_SVGBASE30 = $this->getProfile()->SIGSVGBASE30;
         $roHeader->SIG2_NM = $this->getProfile()->EMP_NM . ' ' . $this->getProfile()->EMP_NM_BLK;
         $roHeader->SIG2_ID = $this->getProfile()->EMP_ID;
         $roHeader->SIG2_TGL = date('Y-m-d');
         if ($roHeader->save()) {
             if (!$roSignStt) {
                 $roHeaderStt = new Salesorderstatus();
                 $roHeaderStt->KD_RO = $this->kdro;
                 $roHeaderStt->ID_USER = $this->getProfile()->EMP_ID;
                 $roHeaderStt->TYPE = 102;
                 $roHeaderStt->STATUS = 1;
                 $roHeaderStt->UPDATED_AT = date('Y-m-d H:m:s');
                 if ($roHeaderStt->save()) {
                 }
             }
             return $roHeader;
         }
         return $roHeader;
     }
     return null;
 }
Exemple #2
0
 public function auth1_saved()
 {
     if ($this->validate()) {
         $roHeader = Salesorder::find()->where(['KD_RO' => $this->kdro])->one();
         $empAuth2 = Employe::find()->where(['EMP_ID' => $this->empID])->one();
         $roSignStt = Salesorderstatus::find()->where(['KD_RO' => $this->kdro, 'ID_USER' => $this->getProfile()->EMP_ID])->one();
         //Auth1|Create Destination
         $roHeader->STATUS = $this->status;
         $roHeader->SIG1_SVGBASE64 = $this->getProfile()->SIGSVGBASE64;
         $roHeader->SIG1_SVGBASE30 = $this->getProfile()->SIGSVGBASE30;
         $roHeader->SIG1_NM = $this->getProfile()->EMP_NM . ' ' . $this->getProfile()->EMP_NM_BLK;
         $roHeader->SIG1_ID = $this->getProfile()->EMP_ID;
         $roHeader->SIG1_TGL = date('Y-m-d');
         //Auth2|Checked Destination
         $roHeader->USER_CC = $this->empID;
         $roHeader->SIG2_NM = $empAuth2->EMP_NM . ' ' . $empAuth2->EMP_NM_BLK;
         if ($roHeader->save()) {
             if (!$roSignStt) {
                 $roHeaderStt = new Salesorderstatus();
                 $roHeaderStt->KD_RO = $this->kdro;
                 $roHeaderStt->ID_USER = $this->getProfile()->EMP_ID;
                 $roHeaderStt->TYPE = 101;
                 $roHeaderStt->STATUS = 1;
                 $roHeaderStt->UPDATED_AT = date('Y-m-d H:m:s');
                 if ($roHeaderStt->save()) {
                 }
             }
             return $roHeader;
         }
         return $roHeader;
     }
     return null;
 }
Exemple #3
0
 public function auth3_saved()
 {
     if ($this->validate()) {
         $roHeader = Salesorder::find()->where(['KD_RO' => $this->kdro])->one();
         $roSignStt = Salesorderstatus::find()->where(['KD_RO' => $this->kdro, 'ID_USER' => $this->getProfile()->EMP_ID, 'TYPE' => $this->status])->one();
         $roHeader->STATUS = $this->status;
         if ($this->status == 103) {
             //
             $roHeader->SIG3_SVGBASE64 = $this->getProfile()->SIGSVGBASE64;
             $roHeader->SIG3_SVGBASE30 = $this->getProfile()->SIGSVGBASE30;
         }
         $roHeader->SIG3_NM = $this->getProfile()->EMP_NM . ' ' . $this->getProfile()->EMP_NM_BLK;
         $roHeader->SIG3_ID = $this->getProfile()->EMP_ID;
         $roHeader->SIG3_TGL = date('Y-m-d');
         if ($roHeader->save()) {
             /* Status Item RO Details 0 menjadi 1 */
             if ($this->status == 103) {
                 /* Direct SQL command and execcute update */
                 $cons = \Yii::$app->db_esm;
                 $command = $cons->createCommand("Update r0003 Set STATUS=1 WHERE KD_RO='" . $this->kdro . "' AND STATUS=0");
                 $command->execute();
             } elseif ($this->status == 4) {
                 $cons = \Yii::$app->db_esm;
                 $command = $cons->createCommand("Update r0003 Set STATUS=4 WHERE KD_RO='" . $this->kdro . "' AND STATUS=0");
                 $command->execute();
             }
             /*Status Auth Signature*/
             if (!$roSignStt and ($this->status == 101 or $this->status == 102)) {
                 /*Status Notify*/
                 $roHeaderStt = new Salesorderstatus();
                 $roHeaderStt->KD_RO = $this->kdro;
                 $roHeaderStt->ID_USER = $this->getProfile()->EMP_ID;
                 $roHeaderStt->TYPE = $this->status;
                 $roHeaderStt->STATUS = 1;
                 $roHeaderStt->UPDATED_AT = date('Y-m-d H:m:s');
                 if ($roHeaderStt->save()) {
                 }
             } else {
                 $roSignSttAuth3 = Salesorderstatus::find()->where("(KD_RO='" . $this->kdro . "' AND ID_USER='******' AND TYPE=103) OR\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t (KD_RO='" . $this->kdro . "' AND ID_USER='******' AND TYPE=4) OR\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t (KD_RO='" . $this->kdro . "' AND ID_USER='******' AND TYPE=5)")->one();
                 if (!$roSignSttAuth3) {
                     /*Status Notify*/
                     $roHeaderStt = new Salesorderstatus();
                     $roHeaderStt->KD_RO = $this->kdro;
                     $roHeaderStt->ID_USER = $this->getProfile()->EMP_ID;
                     $roHeaderStt->TYPE = $this->status;
                     $roHeaderStt->STATUS = 1;
                     $roHeaderStt->UPDATED_AT = date('Y-m-d H:m:s');
                     $roHeaderStt->save();
                 } else {
                     $cons = \Yii::$app->db_esm;
                     $command = $cons->createCommand("Update r0002 Set TYPE='" . $this->status . "' WHERE KD_RO='" . $this->kdro . "' AND ID_USER='******' AND (TYPE=103 or TYPE=4 or TYPE=5)");
                     $command->execute();
                 }
             }
             return $roHeader;
         }
         return $roHeader;
     }
     return null;
 }
Exemple #4
0
 public function loginform_saved()
 {
     if ($this->validate()) {
         $roHeader = Salesorder::find()->where(['KD_RO' => $this->kdro])->one();
         $profile = Yii::$app->getUserOpt->Profile_user();
         $roHeader->STATUS = $this->status;
         $roHeader->SIG2_SVGBASE64 = $profile->emp->SIGSVGBASE64;
         $roHeader->SIG2_SVGBASE30 = $profile->emp->SIGSVGBASE30;
         $roHeader->SIG2_NM = $profile->emp->EMP_NM . ' ' . $profile->emp->EMP_NM_BLK;
         $roHeader->SIG2_TGL = date('Y-m-d');
         if ($roHeader->save()) {
             return $roHeader;
         }
         return $roHeader;
     }
     return null;
 }
 /**
  * Finds the Salesorder model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Salesorder the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Salesorder::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemple #6
0
 public function getParentro()
 {
     return $this->hasOne(Salesorder::className(), ['KD_RO' => 'KD_RO']);
 }
 public function cariSO($params)
 {
     $query = Salesorder::find()->where("r0001.KD_RO LIKE 'SO%' and r0001.status <> 3 and r0001.status <> 0");
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 15]]);
     $dataProvider->setSort(['attributes' => ['KD_RO']]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['like', 'KD_RO', $this->KD_RO]);
     return $dataProvider;
 }
 public function actionViewSo($kd)
 {
     $ro = new Salesorder();
     $roHeader = Salesorder::find()->where(['KD_RO' => $kd])->one();
     if (count($roHeader['KD_RO']) != 0) {
         $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]]);
         return $this->renderAjax('view_so', ['roHeader' => $roHeader, 'detro' => $detro, 'employ' => $employ, 'dept' => $dept, 'dataProvider' => $detroProvider]);
     } else {
         return $this->redirect('index');
     }
 }