/** * Check KD_RO dan KD_BARANG * @author ptrnov <*****@*****.**> * @since 1.1 */ public function findcheck($attribute, $params) { $groupradio = $this->addnew; // print_r($barang); // die(); if ($groupradio == 2) { if (!$this->hasErrors()) { // $kondisiTrue = Rodetail::find()->where(['KD_RO' => $this->kD_RO, 'KD_BARANG' => $this->kD_BARANG ])->one(); $kondisiTrue = Rtdetail::find()->where("KD_RO='" . $this->kD_RO . "' AND KD_BARANG='" . $this->kD_BARANG . "' AND STATUS<>3")->one(); if ($kondisiTrue) { $this->addError($attribute, 'Duplicated Items Barang !, Better (-/+) Request.Qty '); } } } }
public function auth2_saved() { if ($this->validate()) { $rtHeader_2 = Requesttermheader::find()->where(['KD_RIB' => $this->kdrib])->one(); #header $rtdetail = Rtdetail::find()->where(['KD_RIB' => $this->kdrib])->one(); #detail $poSignStt = Requesttermstatus::find()->where(['KD_RIB' => $this->kdrib, 'ID_USER' => $this->getProfile()->EMP_ID])->one(); $profile = Yii::$app->getUserOpt->Profile_user(); $rtHeader_2->STATUS = $this->status; $rtHeader_2->SIG2_SVGBASE64 = $profile->emp->SIGSVGBASE64; $rtHeader_2->SIG2_SVGBASE30 = $profile->emp->SIGSVGBASE30; $rtHeader_2->SIG2_NM = $profile->emp->EMP_NM . ' ' . $profile->emp->EMP_NM_BLK; $rtHeader_2->SIG2_TGL = date('Y-m-d'); if ($rtHeader_2->save()) { $rtdetail->STATUS = 101; $rtdetail->save(); if (!$poSignStt) { $rtHeader_2Stt = new Requesttermstatus(); $rtHeader_2Stt->KD_RIB = $this->kdrib; $rtHeader_2Stt->ID_USER = $this->getProfile()->EMP_ID; //$rtHeader_2Stt->TYPE $rtHeader_2Stt->STATUS = 101; $rtHeader_2Stt->UPDATED_AT = date('Y-m-d H:m:s'); if ($rtHeader_2Stt->save()) { // Notification::notify(Notification::KEY_NEW_MESSAGE, 23,Yii::$app->user->identity->id,$this->kdrib); // // $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 // $msgNotify->SUBJECT='PO'; //varchar 10 // $msgNotify->CREATE_AT=date('Y-m-d H:m:s'); //varchar 10 // $msgNotify->IMG=''; //TEXT // $msgNotify->REF = $this->kdrib; //TEXT // $msgNotify->save(); } } return $rtHeader_2; } return $rtHeader_2; } return null; }
public function auth1_saved() { if ($this->validate()) { $rtheader = Requesttermheader::find()->where(['KD_RIB' => $this->kdrib])->one(); #header $rtdetail = Rtdetail::find()->where(['KD_RIB' => $this->kdrib])->one(); #detail $rtSignStt = Requesttermstatus::find()->where(['KD_RIB' => $this->kdrib, 'ID_USER' => $this->getProfile()->EMP_ID])->one(); $rtheader->STATUS = $this->status; $rtheader->SIG1_SVGBASE64 = $this->getProfile()->SIGSVGBASE64; $rtheader->SIG1_SVGBASE30 = $this->getProfile()->SIGSVGBASE30; $rtheader->SIG1_NM = $this->getProfile()->EMP_NM . ' ' . $this->getProfile()->EMP_NM_BLK; $rtheader->SIG1_TGL = date('Y-m-d'); if ($rtheader->save()) { $rtdetail->STATUS = 100; $rtdetail->save(); if (!$rtSignStt) { $rtheaderStt = new Requesttermstatus(); $rtheaderStt->KD_RIB = $this->kdrib; $rtheaderStt->ID_USER = $this->getProfile()->EMP_ID; //$rtheaderStt->TYPE $rtheaderStt->STATUS = 100; $rtheaderStt->UPDATED_AT = date('Y-m-d H:m:s'); if ($rtheaderStt->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->kdrib); // $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 // $msgNotify->SUBJECT='PO'; //varchar 10 // $msgNotify->CREATE_AT=date('Y-m-d H:m:s'); //varchar 10 // $msgNotify->IMG=''; //TEXT // $msgNotify->REF = $this->kdrib; //TEXT // $msgNotify->save(); } } return $rtheader; } return $rtheader; } return null; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Rtdetail::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['ID' => $this->ID, 'QTY' => $this->QTY, 'STATUS' => $this->STATUS, 'CREATED_AT' => $this->CREATED_AT, 'UPDATED_AT' => $this->UPDATED_AT]); $query->andFilterWhere(['like', 'KD_RO', $this->KD_RO])->andFilterWhere(['like', 'KD_BARANG', $this->KD_BARANG])->andFilterWhere(['like', 'NM_BARANG', $this->NM_BARANG])->andFilterWhere(['like', 'NO_URUT', $this->NO_URUT])->andFilterWhere(['like', 'NOTE', $this->NOTE]); return $dataProvider; }
/** * Finds the Requestorder model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return Requestorder the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModeldetail($id) { if (($model = Rtdetail::find(['KD_RIB' => $id])) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }