From: fomichev Date: Fri, 6 Jun 2025 12:51:04 +0000 (+0300) Subject: Исправление по ревью и очистка кода X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=b5d1d86c5d74b798b707ebe5780a937e519167d5;p=erp24_rep%2Fyii-erp24%2F.git Исправление по ревью и очистка кода --- diff --git a/erp24/controllers/AutoPlannogrammaController.php b/erp24/controllers/AutoPlannogrammaController.php index 57ee035b..d5c776ff 100644 --- a/erp24/controllers/AutoPlannogrammaController.php +++ b/erp24/controllers/AutoPlannogrammaController.php @@ -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']; diff --git a/erp24/services/AutoPlannogrammaService.php b/erp24/services/AutoPlannogrammaService.php index 4fc64cb0..f868f682 100644 --- a/erp24/services/AutoPlannogrammaService.php +++ b/erp24/services/AutoPlannogrammaService.php @@ -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 = [];