From 599aa1cdc7d490ff61addd1f5c690c7b6d745008 Mon Sep 17 00:00:00 2001 From: Aleksey Filippov Date: Thu, 30 Jan 2025 11:15:57 +0300 Subject: [PATCH] =?utf8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/services/SalesService.php | 37 ++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/erp24/services/SalesService.php b/erp24/services/SalesService.php index 39d27885..da932537 100755 --- a/erp24/services/SalesService.php +++ b/erp24/services/SalesService.php @@ -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 -- 2.39.5