From 0b12759a52867e681270e424378cad7a3ec41648 Mon Sep 17 00:00:00 2001 From: marina Date: Tue, 17 Jun 2025 13:09:21 +0300 Subject: [PATCH] =?utf8?q?ERP-360=20=D0=A1=D0=B1=D0=BE=D1=80=D0=BA=D0=B0?= =?utf8?q?=20=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D1=8B=20=D0=B0?= =?utf8?q?=D0=B2=D1=82=D0=BE=D0=BF=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/controllers/AutoPlannogrammaController.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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 ?: []; } + } } -- 2.39.5