| Current Path : /var/www/html/crm/models/ |
| Current File : /var/www/html/crm/models/SalesSummaryDataSearch.php |
<?php
namespace app\models;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use app\models\SalesSummaryData;
/**
* SalesSummaryDataSearch represents the model behind the search form of `app\models\SalesSummaryData`.
*/
class SalesSummaryDataSearch extends SalesSummaryData
{
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['id', 'parent_id'], 'integer'],
[['sales_date', 'sales_doc_no', 'sales_person', 'sales_item_no', 'sales_descr', 'sales_tax', 'sales_qty', 'sales_cost', 'sales_price', 'sales_up', 'sales_amount', 'sales_profit'], 'safe'],
];
}
/**
* {@inheritdoc}
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = SalesSummaryData::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,
'parent_id' => $this->parent_id,
]);
$query->andFilterWhere(['like', 'sales_date', $this->sales_date])
->andFilterWhere(['like', 'sales_doc_no', $this->sales_doc_no])
->andFilterWhere(['like', 'sales_person', $this->sales_person])
->andFilterWhere(['like', 'sales_item_no', $this->sales_item_no])
->andFilterWhere(['like', 'sales_descr', $this->sales_descr])
->andFilterWhere(['like', 'sales_tax', $this->sales_tax])
->andFilterWhere(['like', 'sales_qty', $this->sales_qty])
->andFilterWhere(['like', 'sales_cost', $this->sales_cost])
->andFilterWhere(['like', 'sales_price', $this->sales_price])
->andFilterWhere(['like', 'sales_up', $this->sales_up])
->andFilterWhere(['like', 'sales_amount', $this->sales_amount])
->andFilterWhere(['like', 'sales_profit', $this->sales_profit]);
return $dataProvider;
}
}