bakance_filter
This commit is contained in:
@ -19,14 +19,17 @@ class BalanceSearch extends Balance
|
||||
public $summ_to;
|
||||
public $dt_from;
|
||||
public $dt_to;
|
||||
public $field_name;
|
||||
public $field_value;
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['id', 'type', 'summ', 'summ_from', 'summ_to'], 'integer'],
|
||||
[['id', 'type', 'summ', 'summ_from', 'field_name', 'summ_to'], 'integer'],
|
||||
[['dt_from', 'dt_to', 'dt_add'], 'safe'],
|
||||
[['field_value'], 'string']
|
||||
];
|
||||
}
|
||||
|
||||
@ -49,7 +52,7 @@ class BalanceSearch extends Balance
|
||||
public function search($params)
|
||||
{
|
||||
$query = Balance::find();
|
||||
|
||||
$query->leftJoin('fields_value_new','fields_value_new.item_id=balance.id AND fields_value_new.item_type=3');
|
||||
// add conditions that should always apply here
|
||||
$dataProvider = new ActiveDataProvider([
|
||||
'query' => $query,
|
||||
@ -63,6 +66,7 @@ class BalanceSearch extends Balance
|
||||
return $dataProvider;
|
||||
}
|
||||
|
||||
|
||||
// grid filtering conditions
|
||||
$query->andFilterWhere([
|
||||
'id' => $this->id,
|
||||
@ -76,6 +80,10 @@ class BalanceSearch extends Balance
|
||||
|
||||
|
||||
$query->andFilterWhere(['between', 'summ', $this->summ_from ?: 0, $this->summ_to ?: 9999999999]);
|
||||
$query->andFilterWhere(['fields_value_new.field_id'=>$this->field_name]);
|
||||
$query->andFilterWhere(['LIKE', 'fields_value_new.value', $this->field_value]);
|
||||
|
||||
$query->orderBy('balance.dt_add DESC');
|
||||
|
||||
return $dataProvider;
|
||||
}
|
||||
|
Reference in New Issue
Block a user