From: Alexander Smirnov Date: Wed, 4 Sep 2024 05:36:45 +0000 (+0300) Subject: [ERP-140] рефактор 3 X-Git-Tag: 1.4~5^2~5 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=ddbaa1afc29be8253fa59ecc84d9951846a57ac2;p=erp24_rep%2Fyii-erp24%2F.git [ERP-140] рефактор 3 --- 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);