add_additional_fields
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
namespace backend\modules\balance\models;
|
||||
|
||||
|
||||
use common\classes\Debug;
|
||||
use common\models\FieldsValue;
|
||||
use common\models\FieldsValueNew;
|
||||
use common\models\ProjectUser;
|
||||
@ -11,41 +12,5 @@ use yii\helpers\ArrayHelper;
|
||||
|
||||
class Balance extends \common\models\Balance
|
||||
{
|
||||
public $fields;
|
||||
|
||||
public function init()
|
||||
{
|
||||
parent::init();
|
||||
$fieldValue = FieldsValueNew::find()
|
||||
->where(
|
||||
[
|
||||
//'balance_id' => \Yii::$app->request->get('id'),
|
||||
'item_id' => \Yii::$app->request->get('id'),
|
||||
'item_type' => FieldsValueNew::TYPE_BALANCE,
|
||||
])
|
||||
->all();
|
||||
$array = [];
|
||||
if (!empty($fieldValue)) {
|
||||
foreach ($fieldValue as $item) {
|
||||
array_push($array, ['field_id' => $item->field_id, 'value' => $item->value, 'order' => $item->order]);
|
||||
}
|
||||
$this->fields = $array;
|
||||
} else {
|
||||
$this->fields = [
|
||||
[
|
||||
'field_id' => null,
|
||||
'value' => null,
|
||||
'order' => null,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
// $user = ArrayHelper::getColumn(ProjectUser::find()->where(['project_id' => \Yii::$app->request->get('id')])->all(),
|
||||
// 'card_id');
|
||||
//
|
||||
// if (!empty($user)) {
|
||||
// $this->user = $user;
|
||||
//
|
||||
// }
|
||||
}
|
||||
}
|
@ -3,6 +3,8 @@
|
||||
namespace backend\modules\balance\models;
|
||||
|
||||
use common\classes\Debug;
|
||||
use common\models\FieldsValueNew;
|
||||
use DateTime;
|
||||
use Yii;
|
||||
use yii\base\Model;
|
||||
use yii\data\ActiveDataProvider;
|
||||
@ -49,7 +51,6 @@ class BalanceSearch extends Balance
|
||||
$query = Balance::find();
|
||||
|
||||
// add conditions that should always apply here
|
||||
|
||||
$dataProvider = new ActiveDataProvider([
|
||||
'query' => $query,
|
||||
]);
|
||||
@ -70,19 +71,11 @@ class BalanceSearch extends Balance
|
||||
'dt_add' => $this->dt_add,
|
||||
]);
|
||||
|
||||
//Debug::dd($this);
|
||||
$query->andFilterWhere(['>=','dt_add', strtotime($this->dt_from) ?: null]);
|
||||
$query->andFilterWhere(['<=','dt_add', strtotime($this->dt_to) ?: null]);
|
||||
|
||||
if($this->dt_from && $this->dt_to){
|
||||
$query->where(['between', 'dt_add', strtotime($this->$this->dt_from), strtotime($this->$this->dt_to)]);
|
||||
}
|
||||
if($this->dt_from){
|
||||
$query->where(['>', 'dt_add', strtotime($this->$this->dt_from)]);
|
||||
}
|
||||
|
||||
$summ_from = $this->summ_from ?: 0;
|
||||
$summ_to = $this->summ_to ?: 9999999999;
|
||||
|
||||
$query->andFilterWhere(['between', 'summ', $summ_from, $summ_to]);
|
||||
$query->andFilterWhere(['between', 'summ', $this->summ_from ?: 0, $this->summ_to ?: 9999999999]);
|
||||
|
||||
return $dataProvider;
|
||||
}
|
||||
|
Reference in New Issue
Block a user