]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Убираем дублирование
authorVladimir Fomichev <vladimir.fomichev@erp-flowers.ru>
Mon, 17 Nov 2025 14:00:53 +0000 (17:00 +0300)
committerVladimir Fomichev <vladimir.fomichev@erp-flowers.ru>
Mon, 17 Nov 2025 14:00:53 +0000 (17:00 +0300)
добавляем фильтр по активности

erp24/api3/core/services/ReportService.php

index a0d3664833e580d3c9809d8d54abf49431966b4c..dea5f2dadf90ee3338acd737bf87a01662bda0fb 100644 (file)
@@ -334,12 +334,12 @@ class ReportService
         // Получаем все уникальные admin_id сотрудников за период
         $allAdminsInPeriod = Timetable::find()->alias('t')
             ->select(['admin_id'])
+            ->distinct()
             ->where(['t.store_id' => $data->stores])
             ->andWhere(['>=', 'date', date("Y-m-01", strtotime($data->date_start))])
             ->andWhere(['<=', 'date', $data->date_end])
             ->andWhere(['tabel' => 0, 'slot_type_id' => Timetable::TIMESLOT_WORK])
-            ->andWhere(['IS', 't.deleted_at', null])
-            ->groupBy(['admin_id'])
+            ->andWhere(['active' => 1])
             ->asArray()->all();
 
         $adminIdsInPeriod = ArrayHelper::getColumn($allAdminsInPeriod, 'admin_id');
@@ -359,7 +359,7 @@ class ReportService
                 ->andWhere(['>=', 'date', date("Y-m-01", strtotime($currentDate))])
                 ->andWhere(['<=', 'date', $currentDate])
                 ->andWhere(['shift_id' => $shift_id, 'tabel' => 0, 'slot_type_id' => Timetable::TIMESLOT_WORK])
-                ->andWhere(['IS', 't.deleted_at', null])
+                ->andWhere(['active' => 1])
                 ->asArray()->all();
 
             $timetables = Timetable::find()->alias('t')->select(['admin_id', 'a.name as adminName', 't.store_id', 't.shift_id'])
@@ -367,7 +367,7 @@ class ReportService
                 ->where(['t.store_id' => $data->stores])
                 ->andWhere(['date' => $currentDate, 'tabel' => 0])
                 ->andWhere(['shift_id' => $shift_id, 'slot_type_id' => Timetable::TIMESLOT_WORK])
-                ->andWhere(['IS', 't.deleted_at', null])
+                ->andWhere(['active' => 1])
                 ->asArray()->all();
 
             $adminIdsMonth = ArrayHelper::getColumn($timetablesMonth, 'admin_id');