From b5d1d86c5d74b798b707ebe5780a937e519167d5 Mon Sep 17 00:00:00 2001 From: fomichev Date: Fri, 6 Jun 2025 15:51:04 +0300 Subject: [PATCH] =?utf8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5?= =?utf8?q?=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=BE=20=D1=80=D0=B5=D0=B2=D1=8C?= =?utf8?q?=D1=8E=20=D0=B8=20=D0=BE=D1=87=D0=B8=D1=81=D1=82=D0=BA=D0=B0=20?= =?utf8?q?=D0=BA=D0=BE=D0=B4=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/controllers/AutoPlannogrammaController.php | 7 +------ erp24/services/AutoPlannogrammaService.php | 4 ++-- 2 files changed, 3 insertions(+), 8 deletions(-) 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 = []; -- 2.39.5