From: Vladimir Fomichev Date: Fri, 4 Jul 2025 07:48:44 +0000 (+0300) Subject: Правки и чистка X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=b941aee9c90742ca366a7a6cd2cdefb98773e36a;p=erp24_rep%2Fyii-erp24%2F.git Правки и чистка --- 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, ]; }