]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Замена на константы
authorVladimir Fomichev <vladimir.fomichev@erp-flowers.ru>
Wed, 10 Dec 2025 08:08:24 +0000 (11:08 +0300)
committerVladimir Fomichev <vladimir.fomichev@erp-flowers.ru>
Wed, 10 Dec 2025 08:08:24 +0000 (11:08 +0300)
erp24/api3/core/services/ReportService.php

index 94e16d89f72553bc7a50928534100b09a2496ac4..af90d302176430fd392908406bd336eed32f2867 100644 (file)
@@ -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',
                     [