From 5fa9820a732f60534f58c3e99c43cdb21409af16 Mon Sep 17 00:00:00 2001 From: Vladimir Fomichev Date: Tue, 9 Dec 2025 11:09:18 +0300 Subject: [PATCH] =?utf8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D1=8F=D0=B5?= =?utf8?q?=D0=BC=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=20=D0=BE=D0=BF=D1=80?= =?utf8?q?=D0=B5=D0=B4=D0=B5=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=81=D0=BF?= =?utf8?q?=D0=B8=D1=81=D0=BA=D0=B0=20=D1=81=D0=BC=D0=B5=D0=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/api3/core/services/ReportService.php | 13 +++++++++---- erp24/records/Shift.php | 4 ++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/erp24/api3/core/services/ReportService.php b/erp24/api3/core/services/ReportService.php index dac199c5..82f302d8 100644 --- a/erp24/api3/core/services/ReportService.php +++ b/erp24/api3/core/services/ReportService.php @@ -344,7 +344,7 @@ class ReportService while ($currentDate <= $data->date_end) { $report = []; - $shift_id = $data->shift_type == 0 ? [1, 2, 5, 8] : ($data->shift_type == 1 ? [1, 5, 8] : [2]); + $shift_id = Shift::getShiftIdsByShiftType($data->shift_type); // Получаем сотрудников из фактических смен за месяц $timetablesMonthData = TimetableFactModel::find() @@ -682,7 +682,7 @@ class ReportService // Определяем админов из продаж, которых нет в смене $missingAdminIds = []; - foreach ($salesAdminIds as $adminId => $_) { + foreach ($salesAdminIds as $adminId => $value) { $adminExists = false; foreach ($adminNames[$store->id] as $admin) { if ($admin['id'] == $adminId) { @@ -705,6 +705,11 @@ class ReportService ->all(); foreach ($missingAdminIds as $adminId) { + // Если запрашивается конкретный тип смены (не 0), не добавляем из продаж без shift_id + if ($data->shift_type != 0) { + continue; + } + $adminNames[$store->id][] = [ 'id' => $adminId, 'name' => $missingAdmins[$adminId]['name'] ?? 'Unknown', @@ -949,7 +954,7 @@ class ReportService $cityStoreNames = ArrayHelper::map(CityStore::find()->where(['visible' => '1'])->all(), 'id', 'name'); // Набор идентификаторов смен согласно типу (день/ночь/обе) - $shiftIds = $data->shift_type == 0 ? [1, 2, 5, 8] : ($data->shift_type == 1 ? [1, 5, 8] : [2]); + $shiftIds = Shift::getShiftIdsByShiftType($data->shift_type); $eitStores = ExportImportTable::find()->where(['export_val' => $data->stores]) ->select(['entity_id', 'export_val']) @@ -1456,7 +1461,7 @@ class ReportService $cityStoreNames = ArrayHelper::map(CityStore::find()->where(['visible' => '1'])->all(), 'id', 'name'); - $shiftIds = $data->shift_type == 0 ? [1, 2, 5, 8] : ($data->shift_type == 1 ? [1, 5, 8] : [2]); + $shiftIds = Shift::getShiftIdsByShiftType($data->shift_type); $eitStores = ExportImportTable::find()->where(['export_val' => $data->stores]) ->select(['entity_id', 'export_val']) diff --git a/erp24/records/Shift.php b/erp24/records/Shift.php index e420a04e..78063bb8 100755 --- a/erp24/records/Shift.php +++ b/erp24/records/Shift.php @@ -109,4 +109,8 @@ class Shift extends ActiveRecord { return Shift::NIGHT === (int) $shiftId ; } + + public static function getShiftIdsByShiftType ($shiftType) { + return $shiftType == 0 ? [1, 2, 5, 8] : ($shiftType == 1 ? [1, 5, 8] : [2]); + } } \ No newline at end of file -- 2.39.5