]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Исправление по ревью и очистка кода
authorfomichev <vladimir.fomichev@erp-flowers.ru>
Fri, 6 Jun 2025 12:51:04 +0000 (15:51 +0300)
committerfomichev <vladimir.fomichev@erp-flowers.ru>
Fri, 6 Jun 2025 12:51:04 +0000 (15:51 +0300)
erp24/controllers/AutoPlannogrammaController.php
erp24/services/AutoPlannogrammaService.php

index 57ee035b39139bdd9d0288a139a5614cd8b7d100..d5c776ffdc5d59f67214b89b0663ff9372c575d5 100644 (file)
@@ -1434,8 +1434,6 @@ class AutoPlannogrammaController extends BaseController
                 );
             }
 
-
-
             $monthSpeciesGoals = $service->calculateFullGoalChainWeighted($filters);
             $monthSpeciesGoalsMap = [];
             foreach ($monthSpeciesGoals as $monthSpeciesGoal) {
@@ -1445,15 +1443,12 @@ class AutoPlannogrammaController extends BaseController
                 [$monthSpeciesGoal['species']] = $monthSpeciesGoal['goal'] ;
             }
 
-
-
-
             $weeksShareResult = $service->getHistoricalWeeklySpeciesShare($model->month, $filters, null, 'writeOffs');
             $weeksData = $service->calculateWeeklySpeciesGoals($weeksShareResult['weeksData'], $monthSpeciesGoals) ;
 
             $datePlan = $filters['plan_date'];
             $monthCategoryShare = $service->getMonthCategoryShareOrWriteOffWeighted($datePlan, $filters, null, $filters['type']);
-            $monthCategoryGoal = $service->getMonthCategoryGoal($monthCategoryShare, $datePlan, $filters);
+            $monthCategoryGoal = $service->getMonthCategoryGoal($monthCategoryShare, $datePlan, $filters['type']);
             foreach ($monthCategoryShare as $sid => $cats) {
                 foreach($cats as $cat) {
                     $monthCategoryShareResult[$sid][$cat['category']]['total_sum_cat'] = $cat['total_sum_cat'];
index 4fc64cb05ec8022cb518cec5bd81023529400ec1..f868f682d15e3fbc6aeb24e578055b6e1c97d71e 100644 (file)
@@ -773,7 +773,7 @@ class AutoPlannogrammaService
         $dateFromForCategory = (new \DateTime($datePlan))->modify('-' . (self::CATEGORY_LOOKBACK_MONTHS + self::LOOKBACK_MONTHS) . ' months')->format('Y-m-d');
 
         $monthCategoryShare = $this->getMonthCategoryShareOrWriteOff($dateFromForCategory, $filters);
-        $monthCategoryGoal = $this->getMonthCategoryGoal($monthCategoryShare, $datePlan, $filters);
+        $monthCategoryGoal = $this->getMonthCategoryGoal($monthCategoryShare, $datePlan, $filters['type']);
 
         $monthSubcategoryShare = $this->getMonthSubcategoryShareOrWriteOff($datePlan, $filters);
         $monthSubcategoryGoal = $this->getMonthSubcategoryGoal($monthSubcategoryShare, $monthCategoryGoal);
@@ -1300,7 +1300,7 @@ class AutoPlannogrammaService
         ?array $productFilter = null,
         string $type = 'sales'
     ): array {
-        [$yearStr, $monthStr, $_ ] = explode('-', $monthYear);
+        [$monthStr, $yearStr] = explode('-', $monthYear);
         $month = (int)$monthStr;
         $year  = (int)$yearStr;
         $yearData = [];