]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Правки
authorAleksey Filippov <Aleksey.Filippov@erp-flowers.ru>
Thu, 30 Jan 2025 08:15:57 +0000 (11:15 +0300)
committerAleksey Filippov <Aleksey.Filippov@erp-flowers.ru>
Thu, 30 Jan 2025 08:15:57 +0000 (11:15 +0300)
erp24/services/SalesService.php

index 39d27885a895763733625362d977d09152531172..da932537ec1064478d99a10bf30d66d50623a409 100755 (executable)
@@ -1125,7 +1125,8 @@ class SalesService
         $connection = Yii::$app->getDb();
 
         if ($dateFrom > '2022-12-07') {
-            $command = $connection->createCommand("
+            if ($dateFrom > '2025-01-01') {
+                $command = $connection->createCommand("
                 SELECT
                     DISTINCT (sales.id),
                     sales.seller_id,
@@ -1145,11 +1146,6 @@ class SalesService
                     sales.seller_id IN ('$adminGuid')
                 AND 
                     sales.id = p.check_id
-                AND (
-                    sales.order_id='' 
-                         OR 
-                    sales.order_id='0'
-                )
                 AND
                     p.product_id IN (
                         SELECT 
@@ -1172,13 +1168,12 @@ class SalesService
                     sales.date ASC 
             
             ",
-                [
-                    ':date_from' => DateHelper::getDateTimeStartDay($dateFrom, $dateTimeStartDay, $adminId),
-                    ':date_to' => DateHelper::getDateTimeEndDay($dateTo, $dateTimeEndDay, $adminId),
-                ]
-            );
-        } else if ($dateFrom > '2025-01-01') {
-            $command = $connection->createCommand("
+                    [
+                        ':date_from' => DateHelper::getDateTimeStartDay($dateFrom, $dateTimeStartDay, $adminId),
+                        ':date_to' => DateHelper::getDateTimeEndDay($dateTo, $dateTimeEndDay, $adminId),
+                    ]);
+            } else {
+                $command = $connection->createCommand("
                 SELECT
                     DISTINCT (sales.id),
                     sales.seller_id,
@@ -1198,6 +1193,11 @@ class SalesService
                     sales.seller_id IN ('$adminGuid')
                 AND 
                     sales.id = p.check_id
+                AND (
+                    sales.order_id='' 
+                         OR 
+                    sales.order_id='0'
+                )
                 AND
                     p.product_id IN (
                         SELECT 
@@ -1220,10 +1220,13 @@ class SalesService
                     sales.date ASC 
             
             ",
-                [
-                    ':date_from' => DateHelper::getDateTimeStartDay($dateFrom, $dateTimeStartDay, $adminId),
-                    ':date_to' => DateHelper::getDateTimeEndDay($dateTo, $dateTimeEndDay, $adminId),
-                ]);
+                    [
+                        ':date_from' => DateHelper::getDateTimeStartDay($dateFrom, $dateTimeStartDay, $adminId),
+                        ':date_to' => DateHelper::getDateTimeEndDay($dateTo, $dateTimeEndDay, $adminId),
+                    ]
+                );
+            }
+
         } else {
             $command = $connection->createCommand("
                     SELECT