From ef5ad9c42bb85054fce433c4b42b25e8efa7e53c Mon Sep 17 00:00:00 2001 From: Vladimir Fomichev Date: Fri, 12 Sep 2025 12:43:56 +0300 Subject: [PATCH] =?utf8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD?= =?utf8?q?=D0=B8=D0=B5=20=D1=84=D0=B8=D0=BB=D1=8C=D1=82=D1=80=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/records/AdminPersonBonusesSearch.php | 51 ++++++++++++++++++++-- erp24/views/admin_person_bonuses/index.php | 24 ++++++++-- 2 files changed, 68 insertions(+), 7 deletions(-) diff --git a/erp24/records/AdminPersonBonusesSearch.php b/erp24/records/AdminPersonBonusesSearch.php index 038cf5f4..9b75758e 100755 --- a/erp24/records/AdminPersonBonusesSearch.php +++ b/erp24/records/AdminPersonBonusesSearch.php @@ -17,12 +17,26 @@ class AdminPersonBonusesSearch extends AdminPersonBonuses public function rules() { return [ - [['id', 'admin_id', 'year', 'month', 'vacation_day', 'bonuses', 'retention', 'prepaid_expense', 'counting'], 'integer'], + [['id', + 'admin_id', + 'year', + 'month', + 'vacation_day', + 'bonuses', + 'retention', + 'prepaid_expense', + 'counting', + 'color_ruble_bonuses' + ], 'integer'], + [['adminName', 'adminGroup', 'store'], 'safe'], [['date', 'shift_correction', 'date_time'], 'safe'], + [['overtime'], 'number'], ]; } - public string $adminName; + public string $adminName = ''; + public string $adminGroup = ''; + public string $store = ''; /** * {@inheritdoc} @@ -42,7 +56,10 @@ class AdminPersonBonusesSearch extends AdminPersonBonuses */ public function search($params) { - $query = AdminPersonBonuses::find(); + $query = AdminPersonBonuses::find() + ->joinWith(['admin a']) + ->joinWith(['adminGroup ag']) + ->joinWith(['store s']); // add conditions that should always apply here @@ -50,6 +67,28 @@ class AdminPersonBonusesSearch extends AdminPersonBonuses 'query' => $query, ]); + $dataProvider->setSort([ + 'attributes' => [ + 'id','admin_id','year','month','date_time', + 'adminName' => [ + 'asc' => ['a.name' => SORT_ASC], + 'desc' => ['a.name' => SORT_DESC], + 'label'=> 'Сотрудник', + ], + 'adminGroup' => [ + 'asc' => ['ag.name' => SORT_ASC], + 'desc' => ['ag.name' => SORT_DESC], + 'label' => 'Должность', + ], + 'store' => [ + 'asc' => ['s.name' => SORT_ASC], + 'desc' => ['s.name' => SORT_DESC], + 'label' => 'Магазин', + ], + ], + 'defaultOrder' => ['id' => SORT_DESC], + ]); + $this->load($params); if (!$this->validate()) { @@ -69,11 +108,15 @@ class AdminPersonBonusesSearch extends AdminPersonBonuses 'retention' => $this->retention, 'prepaid_expense' => $this->prepaid_expense, 'counting' => $this->counting, + 'color_ruble_bonuses' => $this->color_ruble_bonuses, + 'overtime' => $this->overtime, 'date_time' => $this->date_time, ]); $query->andFilterWhere(['like', 'date', $this->date]); - + $query->andFilterWhere(['ilike', 'a.name', $this->adminName]); + $query->andFilterWhere(['ilike', 'ag.name', $this->adminGroup]); + $query->andFilterWhere(['ilike', 's.name', $this->store]); return $dataProvider; } } diff --git a/erp24/views/admin_person_bonuses/index.php b/erp24/views/admin_person_bonuses/index.php index a8cffb8c..c5b47d2c 100755 --- a/erp24/views/admin_person_bonuses/index.php +++ b/erp24/views/admin_person_bonuses/index.php @@ -40,9 +40,27 @@ $this->params['breadcrumbs'][] = $this->title; 'filter' => ArrayHelper::map(\yii_app\records\Admin::find()->andWhere(['group_id' => Admin::ADMIN_CABINET_GROUP_IDS])->orderBy(['name_full' => SORT_ASC])->all(), 'id', 'name_full'), 'filterInputOptions' => ['class' => 'form-control form-control-sm'] ], - 'admin.name:text:Сотрудник', - 'adminGroup.name:text:Должность', - 'store.name:text:Магазин', + [ + 'attribute' => 'adminName', + 'value' => 'admin.name', + 'label' => 'Сотрудник', + 'filter' => ArrayHelper::map(\yii_app\records\Admin::find()->andWhere(['group_id' => Admin::ADMIN_CABINET_GROUP_IDS])->orderBy(['name' => SORT_ASC])->all(), 'name', 'name'), + 'filterInputOptions' => ['class' => 'form-control form-control-sm'] + ], + [ + 'attribute' => 'adminGroup', + 'value' => 'adminGroup.name', + 'label' => 'Должность', + 'filter' => ArrayHelper::map(\yii_app\records\AdminGroup::find()->andWhere(['id' => Admin::ADMIN_CABINET_GROUP_IDS])->orderBy(['name' => SORT_ASC])->all(), 'name', 'name'), + 'filterInputOptions' => ['class' => 'form-control form-control-sm'] + ], + [ + 'attribute' => 'store', + 'value' => 'store.name', + 'label' => 'Магазин', + 'filter' => ArrayHelper::map(\yii_app\records\CityStore::find()->orderBy(['name' => SORT_ASC])->all(), 'name', 'name'), + 'filterInputOptions' => ['class' => 'form-control form-control-sm'] + ], // 'date', // 'year', // 'month', -- 2.39.5