From b941aee9c90742ca366a7a6cd2cdefb98773e36a Mon Sep 17 00:00:00 2001 From: Vladimir Fomichev Date: Fri, 4 Jul 2025 10:48:44 +0300 Subject: [PATCH] =?utf8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=B8=20?= =?utf8?q?=D1=87=D0=B8=D1=81=D1=82=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/commands/CronController.php | 6 +++++- erp24/services/AutoPlannogrammaService.php | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/erp24/commands/CronController.php b/erp24/commands/CronController.php index cf432ec0..70ffee7c 100644 --- a/erp24/commands/CronController.php +++ b/erp24/commands/CronController.php @@ -1611,7 +1611,7 @@ class CronController extends Controller public function actionAutoplannogrammaCalculate(): void { $date = new DateTime(); - $date->modify('+2 months'); // TODO модифицировать + $date->modify('+2 months'); $planDate = $date->format('Y-m-01'); $month = (int)$date->format('m'); $year = (int)$date->format('Y'); @@ -1666,6 +1666,8 @@ class CronController extends Controller $writeOffs = $writeOffsForecast[$productId][$week]['writeOffs']; $details['writeOffs']['quantity'] = $writeOffs; $total += is_array($writeOffs) ? array_sum($writeOffs) : (float)$writeOffs; + } else { + $details['writeOffs']['quantity'] = 0; } foreach (['offline', 'online', 'marketplace'] as $type) { @@ -1834,6 +1836,8 @@ class CronController extends Controller $writeOffs = $writeOffsForecast[$productId][$week]['writeOffs']; $details['writeOffs']['quantity'] = $writeOffs; $total += is_array($writeOffs) ? array_sum($writeOffs) : (float)$writeOffs; + } else { + $details['writeOffs']['quantity'] = 0; } foreach (['offline', 'online', 'marketplace'] as $type) { diff --git a/erp24/services/AutoPlannogrammaService.php b/erp24/services/AutoPlannogrammaService.php index b6c3ebee..39751ab9 100644 --- a/erp24/services/AutoPlannogrammaService.php +++ b/erp24/services/AutoPlannogrammaService.php @@ -1566,8 +1566,8 @@ class AutoPlannogrammaService 'category' => $cat, 'subcategory' => $sub, 'species' => $spec, - 'percent' => $percent, - 'monthly_goal' => $monthlyGoal, + 'percent' => $percent ?? 0, + 'monthly_goal' => $monthlyGoal ?? 0, 'weekly_goal' => $weeklyGoal, ]; } -- 2.39.5