From 634e98dfb99d07b599e0399adc96dd5f03072b69 Mon Sep 17 00:00:00 2001 From: marina Date: Tue, 17 Jun 2025 12:33:05 +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 | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) 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); + } } } } -- 2.39.5