From: fomichev Date: Wed, 9 Apr 2025 14:36:21 +0000 (+0300) Subject: Правки в подсчете активных недель X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=26070f06b4f8d3a2363bd4e62441aef5f707695d;p=erp24_rep%2Fyii-erp24%2F.git Правки в подсчете активных недель --- 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; }