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');
$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) {
$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) {
'category' => $cat,
'subcategory' => $sub,
'species' => $spec,
- 'percent' => $percent,
- 'monthly_goal' => $monthlyGoal,
+ 'percent' => $percent ?? 0,
+ 'monthly_goal' => $monthlyGoal ?? 0,
'weekly_goal' => $weeklyGoal,
];
}