From 26070f06b4f8d3a2363bd4e62441aef5f707695d Mon Sep 17 00:00:00 2001 From: fomichev Date: Wed, 9 Apr 2025 17:36:21 +0300 Subject: [PATCH] =?utf8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=B2=20?= =?utf8?q?=D0=BF=D0=BE=D0=B4=D1=81=D1=87=D0=B5=D1=82=D0=B5=20=D0=B0=D0=BA?= =?utf8?q?=D1=82=D0=B8=D0=B2=D0=BD=D1=8B=D1=85=20=D0=BD=D0=B5=D0=B4=D0=B5?= =?utf8?q?=D0=BB=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/services/StorePlanService.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/erp24/services/StorePlanService.php b/erp24/services/StorePlanService.php index a292ae57..76c6f5c3 100755 --- a/erp24/services/StorePlanService.php +++ b/erp24/services/StorePlanService.php @@ -394,21 +394,26 @@ class StorePlanService foreach ($periods as $periodKey => $periodData) { $weeksCount = count($periodData['weeks']); - $checkWeeksCount = min(4, $weeksCount); if (!isset($monthsData[$periodKey])) { $hasHistoryInAllPeriods = false; + // Заполняем пустыми значениями столько недель, сколько их есть в периоде. $weekData = array_fill(0, $weeksCount, 0); } else { $weekData = []; $activeWeeks = 0; - for ($weekIndex = 0; $weekIndex < $checkWeeksCount; $weekIndex++) { + + for ($weekIndex = 0; $weekIndex < $weeksCount; $weekIndex++) { $salesCount = isset($monthsData[$periodKey][$weekIndex]) ? $monthsData[$periodKey][$weekIndex] : 0; $weekData[$weekIndex] = $salesCount; + if ($weekIndex == 4) { + continue; //пропускаем 5 неполную неделю в учете активных продаж + } if ($salesCount > 0) { $activeWeeks++; } } + if ($activeWeeks < 2) { $hasHistoryInAllPeriods = false; } -- 2.39.5