From affa5bd230369232fbf10be3e8e3eb8eb9911cdf Mon Sep 17 00:00:00 2001 From: vladfo Date: Thu, 10 Oct 2024 11:56:05 +0300 Subject: [PATCH] =?utf8?q?=D0=9F=D0=BE=D0=BC=D0=B5=D0=BD=D1=8F=D0=BB=20?= =?utf8?q?=D0=B7=D0=B0=D0=BF=D1=80=D0=BE=D1=81=20=D0=BA=20=D1=82=D0=B0?= =?utf8?q?=D0=B1=D0=BB=D0=B8=D1=86=D0=B5=20TimetableFact=20=D0=B4=D0=BB?= =?utf8?q?=D1=8F=20=D0=BF=D0=BE=D0=BB=D1=83=D1=87=D0=B5=D0=BD=D0=B8=D1=8F?= =?utf8?q?=20=D1=83=D0=BD=D0=B8=D0=BA=D0=B0=D0=BB=D1=8C=D0=BD=D1=8B=D1=85?= =?utf8?q?=20=D0=B7=D0=B0=D0=BF=D0=B8=D1=81=D0=B5=D0=B9=20=D0=BF=D0=BE=20?= =?utf8?q?=D0=B4=D0=B0=D1=82=D0=B5=20=D1=81=D0=BC=D0=B5=D0=BD=D1=8B=20?= =?utf8?q?=D0=B8=20=D1=81=D0=BE=D1=82=D1=80=D1=83=D0=B4=D0=BD=D0=B8=D0=BA?= =?utf8?q?=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/services/MotivationService.php | 8 +++++--- erp24/views/motivation/run-sum-salary.php | 5 ++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/erp24/services/MotivationService.php b/erp24/services/MotivationService.php index 3ab5b416..aa10cae2 100644 --- a/erp24/services/MotivationService.php +++ b/erp24/services/MotivationService.php @@ -765,13 +765,13 @@ class MotivationService $motivation = Motivation::find()->where(['store_id' => $store_id, 'year' => $year, 'month' => $month])->one(); if ($motivation) { $timetableFactModels = TimetableFactModel::find()->select(['DISTINCT(admin_id) as admin_id'])->where(['store_id' => $store_id]) - ->andWhere(['between', 'date', $monthStart, $monthEnd])->all(); + ->andWhere(['between', 'date_shift', $monthStart, $monthEnd])->all(); $adminIds = ArrayHelper::getColumn($timetableFactModels, 'admin_id'); $result = 0; foreach ($adminIds as $admin_id) { $timetableFactModel = TimetableFactModel::find()->select(['COUNT(*) as total', 'admin_group_id'])->where(['store_id' => $store_id, 'admin_id' => $admin_id]) - ->andWhere(['between', 'date', $monthStart, $monthEnd])->groupBy(['admin_group_id'])->asArray()->one(); + ->andWhere(['between', 'date_shift', $monthStart, $monthEnd])->groupBy(['admin_group_id'])->asArray()->one(); $norma = 15; if ($timetableFactModel['admin_group_id'] != AdminGroup::GROUP_WORKERS) { @@ -801,8 +801,10 @@ class MotivationService // Делаем запрос к TimetableFactModel $records = TimetableFactModel::find() + ->select(['DISTINCT ON (date_shift, admin_id) *']) ->where(['store_id' => $storeId]) - ->andWhere(['between', 'date', $startDate, $endDate]) + ->andWhere(['between', 'date_shift', $startDate, $endDate]) + ->orderBy(['date_shift' => SORT_ASC, 'admin_id' => SORT_ASC, 'id' => SORT_ASC]) ->all(); return $records; diff --git a/erp24/views/motivation/run-sum-salary.php b/erp24/views/motivation/run-sum-salary.php index b6a95e0f..8de82d62 100644 --- a/erp24/views/motivation/run-sum-salary.php +++ b/erp24/views/motivation/run-sum-salary.php @@ -1,6 +1,9 @@ title = 'Запуск экшенов для расчета ФОТ'; - + -- 2.39.5