public function CekBarang($model) { $explode = explode(',', $this->KD_BARANG); $kondisi = SoT2::find()->where(['KD_BARANG' => $explode[0], 'KODE_REF' => $this->KODE_REF])->andwhere('STATUS<>3')->one(); if ($kondisi) { $this->addError($model, 'Duplicated Product because the Product already exists in this Salesman Order !, attention change name Product or change code '); } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = SoT2::find(); // add conditions that should always apply here $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; } // grid filtering conditions $query->andFilterWhere(['ID' => $this->ID, 'TGL' => $this->TGL, 'SO_QTY' => $this->SO_QTY, 'SO_TYPE' => $this->SO_TYPE, 'UNIT_QTY' => $this->UNIT_QTY, 'UNIT_BERAT' => $this->UNIT_BERAT, 'HARGA_PABRIK' => $this->HARGA_PABRIK, 'HARGA_DIS' => $this->HARGA_DIS, 'HARGA_SALES' => $this->HARGA_SALES, 'HARGA_LG' => $this->HARGA_LG, 'STATUS' => $this->STATUS, 'WAKTU_INPUT_INVENTORY' => $this->WAKTU_INPUT_INVENTORY, 'SUBMIT_QTY' => $this->SUBMIT_QTY, 'SUBMIT_PRICE' => $this->SUBMIT_PRICE]); $query->andFilterWhere(['like', 'CUST_KD', $this->CUST_KD])->andFilterWhere(['like', 'CUST_KD_ALIAS', $this->CUST_KD_ALIAS])->andFilterWhere(['like', 'CUST_NM', $this->CUST_NM])->andFilterWhere(['like', 'KD_BARANG', $this->KD_BARANG])->andFilterWhere(['like', 'KD_BARANG_ALIAS', $this->KD_BARANG_ALIAS])->andFilterWhere(['like', 'NM_BARANG', $this->NM_BARANG])->andFilterWhere(['like', 'POS', $this->POS])->andFilterWhere(['like', 'KD_DIS', $this->KD_DIS])->andFilterWhere(['like', 'NM_DIS', $this->NM_DIS])->andFilterWhere(['like', 'USER_ID', $this->USER_ID])->andFilterWhere(['like', 'UNIT_BARANG', $this->UNIT_BARANG])->andFilterWhere(['like', 'NOTED', $this->NOTED])->andFilterWhere(['like', 'ID_GROUP', $this->ID_GROUP])->andFilterWhere(['like', 'KODE_REF', $this->KODE_REF]); return $dataProvider; }
public function actionCetakpdf($id) { $modelSoT2 = SoT2::find()->with('cust')->where("KODE_REF='" . $id . "' AND SO_TYPE=10")->one(); $soHeaderData = SoHeader::find()->where(['KD_SO' => $id])->one(); $getSoType = 10; $getTGL = $modelSoT2->TGL; $getCUST_KD = $modelSoT2->CUST_KD; $getUSER_ID = $modelSoT2->USER_ID; $searchModelDetail = new SoDetailSearch(['KODE_REF' => $id, 'CUST_KD' => $getCUST_KD, 'USER_ID' => $getUSER_ID]); $aryProviderSoDetail = $searchModelDetail->searchDetail(Yii::$app->request->queryParams); $content = $this->renderPartial('pdf', ['soHeaderData' => $soHeaderData, 'aryProviderSoDetail' => $aryProviderSoDetail]); $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}']]]); /* KIRIM ATTACH emaiL */ //$to=['*****@*****.**']; //\Yii::$app->kirim_email->pdf($contentMailAttach,'PO',$to,'Purchase-Order',$contentMailAttachBody); return $pdf->render(); }
public function actionTestContent($id) { $soHeaderData = SoHeader::find()->where(['id' => $id])->one(); $modelSoT2 = SoT2::find()->with('cust')->where("KODE_REF='" . $soHeaderData->KD_SO . "' AND SO_TYPE=10")->one(); $getSoType = 10; $getTGL = $modelSoT2->TGL; $getCUST_KD = $modelSoT2->CUST_KD; $getUSER_ID = $modelSoT2->USER_ID; /*Body Notify*/ return $this->renderPartial('postman_body', ['soHeaderData' => $soHeaderData]); }