Example #1
0
 public function search($params)
 {
     $query = CustomerModel::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id_customer' => $this->id_customer, 'update_by' => $this->update_by, 'create_by' => $this->create_by]);
     $query->andFilterWhere(['like', 'cd_customer', $this->cd_customer])->andFilterWhere(['like', 'nm_customer', $this->nm_customer])->andFilterWhere(['like', 'contact_name', $this->contact_name])->andFilterWhere(['like', 'contact_number', $this->contact_number])->andFilterWhere(['like', 'status', $this->status])->andFilterWhere(['like', 'update_at', $this->update_at])->andFilterWhere(['like', 'create_at', $this->create_at]);
     return $dataProvider;
 }
Example #2
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [[['nmCustomer'], 'in', 'range' => Customer::find()->select(['nm_customer'])->column()], [['id_branch', 'id_customer', 'nmCustomer', 'id_warehouse', 'salesDate', 'status', 'sales_value'], 'required'], [['id_branch', 'id_cashdrawer', 'status', 'id_warehouse'], 'integer'], [['discount', 'sales_value'], 'number'], [['sales_date'], 'safe']];
 }