Ejemplo n.º 1
0
 public function auth2_saved()
 {
     if ($this->validate()) {
         $roHeader = Purchaseorder::find()->where(['KD_PO' => $this->kdpo])->one();
         $poSignStt = Statuspo::find()->where(['KD_PO' => $this->kdpo, 'ID_USER' => $this->getProfile()->EMP_ID])->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()) {
             if (!$poSignStt) {
                 $poHeaderStt = new Statuspo();
                 $poHeaderStt->KD_PO = $this->kdpo;
                 $poHeaderStt->ID_USER = $this->getProfile()->EMP_ID;
                 //$poHeaderStt->TYPE
                 $poHeaderStt->STATUS = 102;
                 $poHeaderStt->UPDATE_AT = date('Y-m-d H:m:s');
                 if ($poHeaderStt->save()) {
                 }
             }
             return $roHeader;
         }
         return $roHeader;
     }
     return null;
 }
Ejemplo n.º 2
0
 /**
  * Generate PO | PO PLUS | PO Normal | Purchaseorder
  * PO PLUS ['POA.'.date('ymdhis')] -> PO DENGAN LIMIT HARGA
  * PO Normal ['PO.'.date('ymdhis')] -> PO Dengan Persetujuan orderby | RequestOrder|SalesOrder
  * @author ptrnov  <*****@*****.**>
  * @since 1.1
  */
 public function generatepo_saved()
 {
     $poHeader = new Purchaseorder();
     if ($this->validate()) {
         $poHeader->KD_PO = $this->PO_GNR == 0 ? 'PO.' . date('ymdhis') : 'POA.' . date('ymdhis');
         $poHeader->STATUS = '0';
         $poHeader->CREATE_AT = date("Y-m-d H:i:s");
         $poHeader->CREATE_BY = Yii::$app->user->identity->EMP_ID;
         if ($poHeader->save()) {
             $this->PO_RSLT = $poHeader->KD_PO;
             return $poHeader->KD_PO;
         }
         return $poHeader->KD_PO;
     }
     return null;
 }
Ejemplo n.º 3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Purchaseorder::find()->orderBy(['CREATE_AT' => SORT_DESC]);
     $query->joinWith(['suplier' => function ($q) {
         $q->where('s1000.NM_SUPPLIER LIKE "%' . $this->namasuplier . '%"');
     }]);
     /*  $query->joinWith(['employe' => function ($q) {
                 $q->where('a0001.EMP_NM LIKE "%' . $this->pembuat . '%"');
             }]);
     
             $query->joinWith(['employe' => function ($q) {
                 $q->where('a0001.EMP_NM LIKE "%' . $this->disetujui . '%"');
             }]);
     
             $query->joinWith(['employe' => function ($q) {
                 $q->where('a0001.EMP_NM LIKE "%' . $this->approved . '%"');
             }]); */
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10]]);
     $dataProvider->setSort(['attributes' => ['KD_PO']]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['STATUS' => $this->STATUS]);
     $query->andFilterWhere(['like', 'KD_PO', $this->KD_PO])->andFilterWhere(['like', 'SIG1_NM', $this->SIG1_NM])->andFilterWhere(['like', 'SIG2_NM', $this->SIG2_NM])->andFilterWhere(['like', 'SIG3_NM', $this->SIG3_NM])->andFilterWhere(['like', 'SIG4_NM', $this->SIG4_NM])->andFilterWhere(['like', 'CREATE_BY', $this->CREATE_BY]);
     //->andFilterWhere(['like', 'NOTE', $this->NOTE]);
     if ($this->CREATE_AT != '') {
         $date_explode = explode(' - ', $this->CREATE_AT);
         $date1 = trim($date_explode[0]);
         $date2 = trim($date_explode[1]);
         $query->andFilterWhere(['between', 'CREATE_AT', $date1, $date2]);
     }
     return $dataProvider;
 }
Ejemplo n.º 4
0
 public function loginform_saved()
 {
     if ($this->validate()) {
         $roHeader = Purchaseorder::find()->where(['KD_PO' => $this->kdpo])->one();
         $profile = Yii::$app->getUserOpt->Profile_user();
         $roHeader->STATUS = $this->status;
         if ($this->status == 1) {
             $roHeader->SIG1_SVGBASE64 = $profile->emp->SIGSVGBASE64;
             $roHeader->SIG1_SVGBASE30 = $profile->emp->SIGSVGBASE30;
             $roHeader->SIG1_NM = $profile->emp->EMP_NM . ' ' . $profile->emp->EMP_NM_BLK;
             $roHeader->SIG1_TGL = date('Y-m-d');
         } elseif ($this->status == 101) {
             $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');
         } elseif ($this->status == 102) {
             $roHeader->SIG3_SVGBASE64 = $profile->emp->SIGSVGBASE64;
             $roHeader->SIG3_SVGBASE30 = $profile->emp->SIGSVGBASE30;
             $roHeader->SIG3_NM = $profile->emp->EMP_NM . ' ' . $profile->emp->EMP_NM_BLK;
             $roHeader->SIG3_TGL = date('Y-m-d');
         }
         if ($roHeader->save()) {
             return $roHeader;
         }
         return $roHeader;
     }
     return null;
 }
Ejemplo n.º 5
0
 /**
  * Generate PO | PO PLUS | PO Normal | Purchaseorder
  * PO PLUS ['POA.'.date('ymdhis')] -> PO DENGAN LIMIT HARGA
  * PO Normal ['PO.'.date('ymdhis')] -> PO Dengan Persetujuan orderby | RequestOrder|SalesOrder
  * @author ptrnov  <*****@*****.**>
  * @since 1.1
  */
 public function generatepo_saved()
 {
     $this->poRSLT = \Yii::$app->ambilkonci->getPoCode($this->kD_CORP, $this->pARENT_PO);
     $poHeader = new Purchaseorder();
     if ($this->validate()) {
         $poHeader->KD_PO = $this->poRSLT;
         $poHeader->KD_CORP = $this->kD_CORP;
         $poHeader->PARENT_PO = $this->pARENT_PO == 'POC' ? 1 : 0;
         $poHeader->STATUS = '0';
         $poHeader->CREATE_AT = date("Y-m-d H:i:s");
         $poHeader->CREATE_BY = Yii::$app->user->identity->EMP_ID;
         if ($poHeader->save()) {
             return $this->poRSLT;
         }
         return $this->poRSLT;
     }
     return null;
 }
Ejemplo n.º 6
0
 /**
  * Saved Data Purchaseorder
  * @author ptrnov  <*****@*****.**>
  * @since 1.1
  */
 public function discount_saved()
 {
     if ($this->validate()) {
         $poHeader = Purchaseorder::findOne($this->kD_PO);
         $poHeader->PAJAK = $this->pAJAK;
         if ($poHeader->save()) {
             return $poHeader;
         }
         return $poHeader;
     }
     return null;
 }
Ejemplo n.º 7
0
 /**
  * Saved Data Purchaseorder
  * @author ptrnov  <*****@*****.**>
  * @since 1.1
  */
 public function eta_saved()
 {
     if ($this->validate()) {
         $poHeader = Purchaseorder::findOne($this->kD_PO);
         $poHeader->ETA = \Yii::$app->formatter->asDate($this->eTA, 'Y-M-d');
         if ($poHeader->save()) {
             return $poHeader;
         }
         return $poHeader;
     }
     return null;
 }
Ejemplo n.º 8
0
 /**
  * Saved Data Purchaseorder
  * @author ptrnov  <*****@*****.**>
  * @since 1.1
  */
 public function delevery_saved()
 {
     if ($this->validate()) {
         $poHeader = Purchaseorder::findOne($this->kD_PO);
         $poHeader->DELIVERY_COST = $this->dELIVERY;
         if ($poHeader->save()) {
             return $poHeader;
         }
         return $poHeader;
     }
     return null;
 }
Ejemplo n.º 9
0
 /**
  * Saved Data Purchaseorder
  * @author ptrnov  <*****@*****.**>
  * @since 1.1
  */
 public function billing_saved()
 {
     if ($this->validate()) {
         $poHeader = Purchaseorder::findOne($this->kD_PO);
         $poHeader->BILLING = $this->bILLING;
         if ($poHeader->save()) {
             return $poHeader;
         }
         return $poHeader;
     }
     return null;
 }
Ejemplo n.º 10
0
 /**
  * Saved Data Purchaseorder
  * @author ptrnov  <*****@*****.**>
  * @since 1.1
  */
 public function supplier_saved()
 {
     if ($this->validate()) {
         $poHeader = Purchaseorder::findOne($this->kD_PO);
         $poHeader->KD_SUPPLIER = $this->kD_SUPPLIER;
         if ($poHeader->save()) {
             return $poHeader;
         }
         return $poHeader;
     }
     return null;
 }
Ejemplo n.º 11
0
 /**
  * Saved Data Purchaseorder
  * @author ptrnov  <*****@*****.**>
  * @since 1.1
  */
 public function shipping_saved()
 {
     if ($this->validate()) {
         $poHeader = Purchaseorder::findOne($this->kD_PO);
         $poHeader->SHIPPING = $this->sHIPPING;
         if ($poHeader->save()) {
             return $poHeader;
         }
         return $poHeader;
     }
     return null;
 }
Ejemplo n.º 12
0
 public function auth4_saved()
 {
     if ($this->validate()) {
         $roHeader = Purchaseorder::find()->where(['KD_PO' => $this->kdpo])->one();
         $poSignStt = Statuspo::find()->where(['KD_PO' => $this->kdpo, 'ID_USER' => $this->getProfile()->EMP_ID])->one();
         $profile = Yii::$app->getUserOpt->Profile_user();
         $roHeader->STATUS = $this->status;
         $roHeader->SIG4_SVGBASE64 = $profile->emp->SIGSVGBASE64;
         $roHeader->SIG4_SVGBASE30 = $profile->emp->SIGSVGBASE30;
         $roHeader->SIG4_NM = $profile->emp->EMP_NM . ' ' . $profile->emp->EMP_NM_BLK;
         $roHeader->SIG4_TGL = date('Y-m-d');
         if ($roHeader->save()) {
             if (!$poSignStt) {
                 $poHeaderStt = new Statuspo();
                 $poHeaderStt->KD_PO = $this->kdpo;
                 $poHeaderStt->ID_USER = $this->getProfile()->EMP_ID;
                 //$poHeaderStt->TYPE
                 $poHeaderStt->STATUS = 101;
                 $poHeaderStt->UPDATE_AT = date('Y-m-d H:m:s');
                 if ($poHeaderStt->save()) {
                     Notification::notify(Notification::KEY_NEW_MESSAGE, 23, Yii::$app->user->identity->id, $this->kdpo);
                     $msgNotify = new MessageNotify();
                     $msgNotify->USER_CREATE = Yii::$app->user->identity->id;
                     //integer
                     $msgNotify->USER_FROM_ID = $this->getProfile()->EMP_ID;
                     $msgNotify->USER_FROM = $this->getProfile()->EMP_NM;
                     //varchar 50
                     $msgNotify->USER_TO = 'Stephen';
                     //varchar 50 -> catatan multi name user permission purchasing sign3 harus di revisi
                     $msgNotify->USER_TO_ID = 'LG.2016.000001';
                     //catatan multi name EMP_ID permission purchasing sign3 harus di revisi
                     $msgNotify->SUBJECT = 'PO';
                     //varchar 10
                     $msgNotify->CREATE_AT = date('Y-m-d H:m:s');
                     //varchar 10
                     $msgNotify->IMG = '';
                     //TEXT
                     $msgNotify->REF = $this->kdpo;
                     //TEXT
                     $msgNotify->save();
                 }
             }
             return $roHeader;
         }
         return $roHeader;
     }
     return null;
 }
Ejemplo n.º 13
0
 public function auth1_saved()
 {
     if ($this->validate()) {
         $poHeader = Purchaseorder::find()->where(['KD_PO' => $this->kdpo])->one();
         $poSignStt = Statuspo::find()->where(['KD_PO' => $this->kdpo, 'ID_USER' => $this->getProfile()->EMP_ID])->one();
         $poHeader->STATUS = $this->status;
         $poHeader->SIG1_SVGBASE64 = $this->getProfile()->SIGSVGBASE64;
         $poHeader->SIG1_SVGBASE30 = $this->getProfile()->SIGSVGBASE30;
         $poHeader->SIG1_NM = $this->getProfile()->EMP_NM . ' ' . $this->getProfile()->EMP_NM_BLK;
         $poHeader->SIG1_TGL = date('Y-m-d');
         if ($poHeader->save()) {
             if (!$poSignStt) {
                 $poHeaderStt = new Statuspo();
                 $poHeaderStt->KD_PO = $this->kdpo;
                 $poHeaderStt->ID_USER = $this->getProfile()->EMP_ID;
                 //$poHeaderStt->TYPE
                 $poHeaderStt->STATUS = 100;
                 $poHeaderStt->UPDATE_AT = date('Y-m-d H:m:s');
                 if ($poHeaderStt->save()) {
                     //Notification::notify(Notification::KEY_NEW_MESSAGE, $id_Pengirim, $id_penerima(user_login),$ref_kode);
                     Notification::notify(Notification::KEY_NEW_MESSAGE, 25, Yii::$app->user->identity->id, $this->kdpo);
                     $msgNotify = new MessageNotify();
                     $msgNotify->USER_CREATE = Yii::$app->user->identity->id;
                     //integer
                     $msgNotify->USER_FROM_ID = $this->getProfile()->EMP_ID;
                     $msgNotify->USER_FROM = $this->getProfile()->EMP_NM;
                     //varchar 50
                     $msgNotify->USER_TO = 'Melissa';
                     //varchar 50 catatan multi name user permission purchasing sign3 harus di revisi
                     $msgNotify->USER_TO_ID = 'LG.2016.000010';
                     // catatan multi name EMP_ID permission purchasing sign3 harus di revisi
                     $msgNotify->SUBJECT = 'PO';
                     //varchar 10
                     $msgNotify->CREATE_AT = date('Y-m-d H:m:s');
                     //varchar 10
                     $msgNotify->IMG = '';
                     //TEXT
                     $msgNotify->REF = $this->kdpo;
                     //TEXT
                     $msgNotify->save();
                 }
             }
             return $poHeader;
         }
         return $poHeader;
     }
     return null;
 }
Ejemplo n.º 14
0
 /**
  * Finds the Purchaseorder model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Purchaseorder the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Purchaseorder::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Ejemplo n.º 15
0
 public function searchapproval($params)
 {
     $query = Purchaseorder::find()->where('STATUS = 102');
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $dataProvider->setSort(['attributes' => ['KD_PO']]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['STATUS' => $this->STATUS]);
     $query->andFilterWhere(['like', 'KD_PO', $this->KD_PO])->andFilterWhere(['like', 'SIG1_NM', $this->SIG1_NM])->andFilterWhere(['like', 'SIG2_NM', $this->SIG2_NM])->andFilterWhere(['like', 'SIG3_NM', $this->SIG3_NM])->andFilterWhere(['like', 'SIG4_NM', $this->SIG4_NM])->andFilterWhere(['like', 'CREATE_BY', $this->CREATE_BY])->andFilterWhere(['like', 'p0001.KD_CORP', $this->nmcorp]);
     if ($this->CREATE_AT2 != '') {
         $query->andFilterWhere(['like', 'CREATE_AT', $this->CREATE_AT2]);
     }
     return $dataProvider;
 }