From caa8a362c40444a286f91d37790e2762c9872dc4 Mon Sep 17 00:00:00 2001 From: Vladimir Fomichev Date: Mon, 8 Dec 2025 11:43:21 +0300 Subject: [PATCH] =?utf8?q?=D0=9A=D0=BE=D1=80=D1=80=D0=B5=D0=BA=D1=82=D0=B8?= =?utf8?q?=D1=80=D0=BE=D0=B2=D0=BA=D0=B0=20=D0=BD=D0=B5=D0=B4=D0=B5=D0=BB?= =?utf8?q?=D1=8C=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=BE=D1=82=D1=87=D0=B5=D1=82?= =?utf8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/api3/core/services/ReportService.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/erp24/api3/core/services/ReportService.php b/erp24/api3/core/services/ReportService.php index 58208ef5..dac199c5 100644 --- a/erp24/api3/core/services/ReportService.php +++ b/erp24/api3/core/services/ReportService.php @@ -948,6 +948,9 @@ 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]); + $eitStores = ExportImportTable::find()->where(['export_val' => $data->stores]) ->select(['entity_id', 'export_val']) ->where(['export_id' => 1, 'entity' => 'city_store']) @@ -973,6 +976,7 @@ class ReportService ->where(['store_id' => $data->stores]) ->andWhere($cond) ->andWhere(['>', 'work_time', 0]) + ->andWhere(['shift_id' => $shiftIds]) ->asArray() ->all(); @@ -992,12 +996,13 @@ class ReportService // Получаем сотрудников из фактических смен за неделю foreach ($data->stores as $store_id) { $employees = TimetableFactModel::find() - ->select(['admin_id']) + ->select(['admin_id', 'shift_id']) //->distinct() ->where(['store_id' => $store_id]) ->andWhere(['>=', 'date', date("Y-m-d", strtotime($dateStartEnd[0]))]) ->andWhere(['<=', 'date', date("Y-m-d", strtotime($dateStartEnd[1]))]) ->andWhere(['>', 'work_time', 0]) + ->andWhere(['shift_id' => $shiftIds]) ->asArray() ->all(); -- 2.39.5