From: marina Date: Tue, 17 Jun 2025 09:33:05 +0000 (+0300) Subject: ERP-360 Сборка страницы автопм X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=634e98dfb99d07b599e0399adc96dd5f03072b69;p=erp24_rep%2Fyii-erp24%2F.git ERP-360 Сборка страницы автопм --- diff --git a/erp24/controllers/AutoPlannogrammaController.php b/erp24/controllers/AutoPlannogrammaController.php index fc8b48ec..addc9b76 100644 --- a/erp24/controllers/AutoPlannogrammaController.php +++ b/erp24/controllers/AutoPlannogrammaController.php @@ -213,14 +213,22 @@ class AutoPlannogrammaController extends BaseController $quantity = $value['quantity']; $value['title'] = []; - if (!isset($forecast[$storeId])) { + if (!isset($forecast[$storeId]) || !isset($forecast[$storeId][$productId])) { continue; } foreach (['offline', 'marketplace', 'online'] as $channel) { - if (isset($forecast[$storeId][$channel]['share']) && is_numeric($forecast[$storeId][$channel]['share'])) { - $coef = $forecast[$storeId][$channel]['share']; - $value['title'][$channel] = round($quantity * $coef, 2); + if (isset($forecast[$storeId][$productId][$channel]) && is_array($forecast[$storeId][$productId][$channel])) { + // Суммируем все коэффициенты по группам для данного канала + $coefSum = 0; + foreach ($forecast[$storeId][$productId][$channel] as $coef) { + if (is_numeric($coef)) { + $coefSum += $coef; + } + } + if ($coefSum > 0) { + $value['title'][$channel] = round($quantity * $coefSum, 2); + } } } }