From: Vladimir Fomichev Date: Mon, 8 Dec 2025 08:43:21 +0000 (+0300) Subject: Корректировка недельного отчета X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=caa8a362c40444a286f91d37790e2762c9872dc4;p=erp24_rep%2Fyii-erp24%2F.git Корректировка недельного отчета --- 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();