From ddbaa1afc29be8253fa59ecc84d9951846a57ac2 Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Wed, 4 Sep 2024 08:36:45 +0300 Subject: [PATCH] =?utf8?q?[ERP-140]=20=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?utf8?q?=D0=BE=D1=80=203?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/services/MotivationService.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/erp24/services/MotivationService.php b/erp24/services/MotivationService.php index 0a34bb15..e25dff6a 100644 --- a/erp24/services/MotivationService.php +++ b/erp24/services/MotivationService.php @@ -1256,13 +1256,11 @@ class MotivationService $returnSalesIds = ArrayHelper::getColumn($returnSales, 'sales_check'); // Ищем продукты из категории services - $salesProduct = SalesProducts::find()->alias('p') - ->select(['SUM(p.summ) as total']) - ->leftJoin('sales s', 's.id = p.check_id') + $salesProduct = SalesProducts::find() + ->select(['SUM(summ) as total']) ->where(['check_id' => $salesIds]) ->andWhere(['NOT IN', 'check_id', $returnSalesIds]) ->andWhere(['product_id' => array_keys($products1c)]) - ->andWhere(['s.store_id' => $store_id]) ->asArray()->one(); $correction = self::getMotivationValue($motivations[$store_id]->id, 8, self::CODE_ASSEMBLY_SERVICES); @@ -1285,13 +1283,11 @@ class MotivationService $returnSalesIdsDelivery = ArrayHelper::getColumn($returnSalesDelivery, 'sales_check'); // Ищем продукты из категории services_delivery - $salesProductDelivery = SalesProducts::find()->alias('p') - ->select(['SUM(p.summ) as total']) - ->leftJoin('sales s', 's.id = p.check_id') + $salesProductDelivery = SalesProducts::find() + ->select(['SUM(summ) as total']) ->where(['check_id' => $salesIdsDelivery]) ->andWhere(['NOT IN', 'check_id', $returnSalesIdsDelivery]) ->andWhere(['product_id' => array_keys($products1cDelivery)]) - ->andWhere(['s.store_id' => $store_id]) ->asArray()->one(); $correctionDelivery = self::getMotivationValue($motivations[$store_id]->id, 8, self::CODE_DELIVERY_SERVICES); -- 2.39.5