/** * 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; }
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; }
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; }
/** * Check KD_PO Purchaseorder * @author ptrnov <*****@*****.**> * @since 1.1 */ public function findcheck($attribute, $params) { if (!$this->hasErrors()) { $cntDetailPo = Purchaseorder::find()->where(['KD_PO' => $this->kD_PO])->count(); if (!$cntDetailPo) { $this->addError($attribute, 'PO Not Found, Please Generate PO'); } } }
/** * Check KD_PO Generate * @author ptrnov <*****@*****.**> * @since 1.1 */ public function findcheck($attribute, $params) { if (!$this->hasErrors()) { $cntDetailPo = Purchaseorder::find()->where(['KD_PO' => $this->PO_GNR])->count(); if (!$cntDetailPo) { $this->addError($attribute, 'ID PO, have been taken, use other'); } } }
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; }
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; }
public function actionTempCetakpdf($kdpo) { $poHeader = Purchaseorder::find()->where(['KD_PO' => $kdpo])->one(); //$poDetail = Purchasedetail::find()->where(['KD_PO'=>$kdpo])->all(); $poDetailQry = "SELECT ID,KD_PO,KD_RO,KD_BARANG,NM_BARANG,UNIT,NM_UNIT,UNIT_QTY,UNIT_WIGHT,SUM(QTY) AS QTY,HARGA,STATUS,STATUS_DATE,NOTE\n\t\t\t\t\t\tFROM `p0002` WHERE KD_PO='" . $kdpo . "' GROUP BY KD_BARANG,NM_UNIT,HARGA"; $poDetail = Purchasedetail::findBySql($poDetailQry)->all(); $dataProvider = new ArrayDataProvider(['key' => 'KD_PO', 'allModels' => $poDetail, 'pagination' => ['pageSize' => 20]]); $content = $this->renderPartial('pdf_tmp', ['poHeader' => $poHeader, 'dataProvider' => $dataProvider]); $pdf = new Pdf(['mode' => Pdf::MODE_CORE, 'format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'cssFile' => '@lukisongroup/web/widget/pdf-asset/kv-mpdf-bootstrap.min.css', 'cssInline' => '.kv-heading-1{font-size:12px}', 'options' => ['title' => 'Form Request Order', 'subject' => 'ro'], 'methods' => ['SetHeader' => ['Copyright@LukisonGroup ' . date("r")], 'SetFooter' => ['{PAGENO}']]]); return $pdf->render(); /* $mpdf=new mPDF(); $mpdf->WriteHTML($this->renderPartial( 'pdf', [ 'model' => Purchaseorder::find()->where(['KD_PO'=>$kdpo])->one(), ])); $mpdf->Output(); exit; */ }
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; }
public function actionCetakpdf($kdpo) { $poHeader = Purchaseorder::find()->where(['KD_PO' => $kdpo])->one(); $poDetail = Purchasedetail::find()->where(['KD_PO' => $kdpo])->all(); $dataProvider = new ArrayDataProvider(['key' => 'KD_PO', 'allModels' => $poDetail, 'pagination' => ['pageSize' => 20]]); $content = $this->renderPartial('pdf', ['poHeader' => $poHeader, 'dataProvider' => $dataProvider]); $pdf = new Pdf(['mode' => Pdf::MODE_CORE, 'format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'cssFile' => '@lukisongroup/web/widget/pdf-asset/kv-mpdf-bootstrap.min.css', 'cssInline' => '.kv-heading-1{font-size:12px}', 'options' => ['title' => 'Form Request Order', 'subject' => 'ro'], 'methods' => ['SetHeader' => ['Copyright@LukisonGroup ' . date("r")], 'SetFooter' => ['{PAGENO}']]]); return $pdf->render(); /* $mpdf=new mPDF(); $mpdf->WriteHTML($this->renderPartial( 'pdf', [ 'model' => Purchaseorder::find()->where(['KD_PO'=>$kdpo])->one(), ])); $mpdf->Output(); exit; */ }