/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Penjualanpromo::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, 'WAKTU' => $this->WAKTU, 'STOCK_PROMO_OUT' => $this->STOCK_PROMO_OUT, 'PRODAK_LINE' => $this->PRODAK_LINE, 'UPDATED_TIME' => $this->UPDATED_TIME, 'STATUS' => $this->STATUS]); $query->andFilterWhere(['like', 'CUST_KD', $this->CUST_KD])->andFilterWhere(['like', 'CUST_NM', $this->CUST_NM])->andFilterWhere(['like', 'KD_BARANG', $this->KD_BARANG])->andFilterWhere(['like', 'NM_BARANG', $this->NM_BARANG])->andFilterWhere(['like', 'CORP_ID', $this->CORP_ID])->andFilterWhere(['like', 'KD_DISTRIBUTOR', $this->KD_DISTRIBUTOR])->andFilterWhere(['like', 'KD_SUBDIST', $this->KD_SUBDIST])->andFilterWhere(['like', 'CREATED_BY', $this->CREATED_BY])->andFilterWhere(['like', 'UPDATED_BY', $this->UPDATED_BY]); return $dataProvider; }
/** * Finds the Penjualanpromo model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Penjualanpromo the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Penjualanpromo::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }