]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Правки в подсчете активных недель
authorfomichev <vladimir.fomichev@erp-flowers.ru>
Wed, 9 Apr 2025 14:36:21 +0000 (17:36 +0300)
committerfomichev <vladimir.fomichev@erp-flowers.ru>
Wed, 9 Apr 2025 14:36:21 +0000 (17:36 +0300)
erp24/services/StorePlanService.php

index a292ae579ade1631247dbd2b30686d42725bdac6..76c6f5c3a8b0da74b8bf3ba1ca169d76b3e12112 100755 (executable)
@@ -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;
                     }