public function search($params) { $query = PurchaseHdrModel::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id_purchase' => $this->id_purchase, 'id_supplier' => $this->id_supplier, 'id_branch' => $this->id_branch, 'purchase_date' => $this->purchase_date, 'status' => $this->status, 'create_by' => $this->create_by, 'update_by' => $this->update_by]); $query->andFilterWhere(['like', 'purchase_num', $this->purchase_num])->andFilterWhere(['like', 'purchase_value', $this->purchase_value])->andFilterWhere(['like', 'item_discount', $this->item_discount])->andFilterWhere(['like', 'create_date', $this->create_date])->andFilterWhere(['like', 'update_date', $this->update_date]); return $dataProvider; }