From: marina Date: Tue, 17 Jun 2025 10:09:21 +0000 (+0300) Subject: ERP-360 Сборка страницы автопм X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=0b12759a52867e681270e424378cad7a3ec41648;p=erp24_rep%2Fyii-erp24%2F.git ERP-360 Сборка страницы автопм --- diff --git a/erp24/controllers/AutoPlannogrammaController.php b/erp24/controllers/AutoPlannogrammaController.php index 309a9825..51c36b5a 100644 --- a/erp24/controllers/AutoPlannogrammaController.php +++ b/erp24/controllers/AutoPlannogrammaController.php @@ -220,21 +220,21 @@ class AutoPlannogrammaController extends BaseController $channelData = $forecast[$storeId][$channel] ?? []; $titleData = []; + // Always use share-based value if it exists if (isset($channelData['share']) && is_numeric($channelData['share'])) { - $titleData = [round($quantity * $channelData['share'], 2)]; + $titleData[0] = round($quantity * $channelData['share'], 2); } + // Add product-specific details if available if (isset($productData['product_id']) && isset($forecast[$storeId][$productData['product_id']][$channel])) { $details = $forecast[$storeId][$productData['product_id']][$channel]; - $total = array_sum($details); - $titleData = [ - isset($titleData[0]) ? $titleData[0] : round($quantity * $total, 2), - 'details' => array_map(fn($val) => round($val, 2), $details), - ]; + $titleData[0] = $titleData[0] ?? round($quantity * array_sum($details), 2); + $titleData[1] = ['details' => array_map(fn($val) => round($val, 2), $details)]; } $value['title'][$channel] = $titleData ?: []; } + } }