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; }
/** * Saved Data Rodetail * @author ptrnov <*****@*****.**> * @since 1.1 */ public function addnewitem_saved() { if ($this->validate()) { $barangNew = new Barang(); $this->kD_BARANG = Yii::$app->esmcode->kdbarangUmum(0, $this->kD_CORP, $this->kD_TYPE, $this->kD_KATEGORI, $this->uNIT); $barangNew->KD_BARANG = $this->kD_BARANG; $barangNew->NM_BARANG = $this->nM_BARANG; $barangNew->KD_UNIT = $this->uNIT; $barangNew->HARGA_SPL = $this->hARGA; $barangNew->PARENT = 0; $barangNew->KD_CORP = $this->kD_CORP; $barangNew->KD_TYPE = $this->kD_TYPE; $barangNew->KD_KATEGORI = $this->kD_KATEGORI; $barangNew->KD_SUPPLIER = $this->kD_SUPPLIER; $barangNew->STATUS = 1; $barangNew->CREATED_BY = Yii::$app->user->identity->username; $barangNew->CREATED_AT = date('Y-m-d H:i:s'); $barangNew->UPDATED_BY = Yii::$app->user->identity->username; if ($barangNew->validate()) { $barangNew->save(); $rodetail = new Rtdetail(); $rodetail->CREATED_AT = date('Y-m-d H:i:s'); $rodetail->KD_RO = $this->kD_RO; //required $rodetail->KD_CORP = $this->kD_CORP; //required $rodetail->PARENT_ROSO = 0; // RO=1 //required $rodetail->KD_BARANG = $this->kD_BARANG; $rodetail->NM_BARANG = $this->nM_BARANG; $rodetail->UNIT = $this->uNIT; $rodetail->RQTY = $this->rQTY; $rodetail->SQTY = $this->rQTY; $rodetail->NOTE = $this->nOTE; $rodetail->HARGA = $this->hARGA; $rodetail->STATUS = 0; if ($rodetail->save()) { // print_r($rodetail->geterrors()); return $rodetail; } } } 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; }
public function getDetro() { return $this->hasMany(Rtdetail::className(), ['KD_RO' => 'KD_RO']); }
/** * 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.'); } }