From ff7c7296571340839e399711056d68d58c36f90f Mon Sep 17 00:00:00 2001 From: fomichev Date: Thu, 10 Apr 2025 09:37:45 +0300 Subject: [PATCH] =?utf8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD?= =?utf8?q?=D0=B8=D0=B5=20=D0=B3=D0=BE=D0=B4=D0=B0=20=D0=B2=20=D0=BC=D0=B5?= =?utf8?q?=D1=82=D0=BE=D0=B4=20=D0=B4=D0=BB=D1=8F=20=D1=80=D0=B0=D1=81?= =?utf8?q?=D1=87=D0=B5=D1=82=D0=B0=20=D0=B8=D1=81=D1=82=D0=BE=D1=80=D0=B8?= =?utf8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/controllers/CategoryPlanController.php | 4 ++-- erp24/services/StorePlanService.php | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/erp24/controllers/CategoryPlanController.php b/erp24/controllers/CategoryPlanController.php index 3d35ec86..5e9cad1f 100644 --- a/erp24/controllers/CategoryPlanController.php +++ b/erp24/controllers/CategoryPlanController.php @@ -351,14 +351,14 @@ class CategoryPlanController extends Controller { $subcategory, $species ); - //var_dump($result); die(); + $weightedResults = StorePlanService::calculateWeightedSalesForProductsWithoutHistory( $storeId, $selectedMonth, + $selectedYear, $result['without_history'] ); - $productSalesShare = StorePlanService::calculateProductSalesShare( $storeId, $selectedMonth, diff --git a/erp24/services/StorePlanService.php b/erp24/services/StorePlanService.php index 76c6f5c3..10bdd8e2 100755 --- a/erp24/services/StorePlanService.php +++ b/erp24/services/StorePlanService.php @@ -445,6 +445,7 @@ class StorePlanService * * @param int $storeId Идентификатор магазина. * @param string $selectedMonth Выбранный месяц в формате "mm" (целевой месяц). + * @param string $selectedYear Год в формате "YYYY". * @param array $productsWithoutHistory Массив товаров без истории, где каждый элемент имеет вид: * [ * 'guid' => , @@ -453,9 +454,9 @@ class StorePlanService * * @return array Возвращает массив, где ключ – GUID товара, а значение – рассчитанное взвешенное значение продаж. */ - public static function calculateWeightedSalesForProductsWithoutHistory($storeId, $selectedMonth, $productsWithoutHistory) + public static function calculateWeightedSalesForProductsWithoutHistory($storeId, $selectedMonth, $selectedYear, $productsWithoutHistory) { - $targetDate = strtotime(date('Y') . "-$selectedMonth-01"); + $targetDate = strtotime("{$selectedYear}-{$selectedMonth}-01"); $periods = self::getPeriods($targetDate, 3); $weightedResults = []; @@ -680,7 +681,7 @@ class StorePlanService { $targetDate = strtotime(date('Y') . "-$selectedMonth-01"); - $weightedPeriods = self::getPeriods($targetDate, 3, false,true); + $weightedPeriods = self::getPeriods($targetDate, 3, false, true); $productsData = []; $globalTotal = 0; -- 2.39.5