From: Vladimir Fomichev Date: Wed, 10 Dec 2025 08:08:24 +0000 (+0300) Subject: Замена на константы X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=67135e03ebf01fa85647385d44e070ac3ac86098;p=erp24_rep%2Fyii-erp24%2F.git Замена на константы --- diff --git a/erp24/api3/core/services/ReportService.php b/erp24/api3/core/services/ReportService.php index 94e16d89..af90d302 100644 --- a/erp24/api3/core/services/ReportService.php +++ b/erp24/api3/core/services/ReportService.php @@ -448,14 +448,14 @@ class ReportService ->indexBy('store_id') ->asArray()->all(); - $date_start = $data->shift_type == 2 ? + $date_start = $data->shift_type == Shift::NIGHT ? date("Y-m-d 20:00:00", strtotime($currentDate)) : - ($data->shift_type == 1 ? + ($data->shift_type == Shift::DAY ? date("Y-m-d 08:00:00", strtotime($currentDate)) : date("Y-m-d 00:00:00", strtotime($currentDate))); - $date_end = $data->shift_type == 1 ? + $date_end = $data->shift_type == Shift::DAY ? date("Y-m-d 20:00:00", strtotime($currentDate)) : - ($data->shift_type == 2 ? + ($data->shift_type == Shift::NIGHT ? date("Y-m-d 08:00:00", strtotime("+1 day", strtotime($currentDate))) : date("Y-m-d 00:00:00", strtotime("+1 day", strtotime($currentDate)))); @@ -465,11 +465,11 @@ class ReportService 'store_id', ]); - if ($data->shift_type == 1) { + if ($data->shift_type == Shift::DAY) { $storeVisitorsQuery->andWhere(['>=', 'date_hour', 8])->andWhere(['<=', 'date_hour', 20]) ->andWhere(['date' => date("Y-m-d", strtotime($currentDate))]); } - if ($data->shift_type == 2) { + if ($data->shift_type == Shift::NIGHT) { $storeVisitorsQuery->andWhere([ 'or', [ @@ -1080,14 +1080,14 @@ class ReportService ->indexBy('store_id') ->asArray()->all(); - $date_start = $data->shift_type == 2 ? + $date_start = $data->shift_type == Shift::NIGHT ? date("Y-m-d 20:00:00", strtotime($currentDate)) : - ($data->shift_type == 1 ? + ($data->shift_type == Shift::DAY ? date("Y-m-d 08:00:00", strtotime($currentDate)) : date("Y-m-d 00:00:00", strtotime($currentDate))); - $date_end = $data->shift_type == 1 ? + $date_end = $data->shift_type == Shift::DAY ? date("Y-m-d 20:00:00", strtotime($currentDate)) : - ($data->shift_type == 2 ? + ($data->shift_type == Shift::NIGHT ? date("Y-m-d 08:00:00", strtotime("+1 day", strtotime($currentDate))) : date("Y-m-d 00:00:00", strtotime("+1 day", strtotime($currentDate)))); @@ -1098,11 +1098,11 @@ class ReportService 'store_id' ]); - if ($data->shift_type == 1) { + if ($data->shift_type == Shift::DAY) { $storeVisitorsQuery->andWhere(['>=', 'date_hour', 8])->andWhere(['<=', 'date_hour', 20]) ->andWhere(['date' => date("Y-m-d", strtotime($currentDate))]); } - if ($data->shift_type == 2) { + if ($data->shift_type == Shift::NIGHT) { $storeVisitorsQuery->andWhere([ 'or', [ @@ -1599,11 +1599,11 @@ class ReportService ->indexBy('store_id') ->asArray()->all(); - if ($data->shift_type == 2) { + if ($data->shift_type == Shift::NIGHT) { // Ночная смена $date_start = date("Y-m-d 20:00:00", strtotime($day)); $date_end = date("Y-m-d 08:00:00", strtotime("+1 day", strtotime($day))); - } elseif ($data->shift_type == 1) { + } elseif ($data->shift_type == Shift::DAY) { // Дневная смена $date_start = date("Y-m-d 08:00:00", strtotime($day)); $date_end = date("Y-m-d 20:00:00", strtotime($day)); @@ -1620,11 +1620,11 @@ class ReportService 'store_id' ]); - if ($data->shift_type == 1) { + if ($data->shift_type == Shift::DAY) { $storeVisitorsQuery->andWhere(['>=', 'date_hour', 8])->andWhere(['<=', 'date_hour', 20]) ->andWhere(['date' => date("Y-m-d", strtotime($day))]); } - if ($data->shift_type == 2) { + if ($data->shift_type == Shift::NIGHT) { $storeVisitorsQuery->andWhere([ 'or', [