From 3cb59158cb346c8fd94ec7cecbc945e1a872dc6e Mon Sep 17 00:00:00 2001 From: marina Date: Mon, 9 Sep 2024 11:07:42 +0300 Subject: [PATCH] =?utf8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B0=20=D1=80?= =?utf8?q?=D0=B0=D1=81=D1=85=D0=BE=D0=B4=D0=BD=D1=8B=D1=85=20=D0=BC=D0=B0?= =?utf8?q?=D1=82=D0=B5=D1=80=D0=B8=D0=B0=D0=BB=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/services/MotivationService.php | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/erp24/services/MotivationService.php b/erp24/services/MotivationService.php index b85e6e27..b10c52cf 100644 --- a/erp24/services/MotivationService.php +++ b/erp24/services/MotivationService.php @@ -194,30 +194,26 @@ class MotivationService $result = []; $groupAliases = self::getMotivationValueGroupAliases(); - $consumable = self::getConsumable($motivation->id); - foreach ($motivationValues as $value) { $valueId = $value->value_id; $groupId = $value->motivation_group_id; $groupAlias = isset($groupAliases[$groupId]) ? $groupAliases[$groupId] : $groupId; - if (!isset($costsItems[$valueId])) { continue; // Пропускаем значения, для которых нет соответствующего MotivationCostsItem } $costsItem = $costsItems[$valueId]; - if (!isset($result[$costsItem->order])) { $result[$costsItem->order] = [ 'code' => $costsItem->code, 'name' => $costsItem->name, 'plan' => null, 'adjustment' => null, - 'week1' => $value->value_id == self::CODE_CONSUMABLES_SALES_SUPPORT ? $consumable['week1'] : null, - 'week2' => $value->value_id == self::CODE_CONSUMABLES_SALES_SUPPORT ? $consumable['week2'] : null, - 'week3' => $value->value_id == self::CODE_CONSUMABLES_SALES_SUPPORT ? $consumable['week3'] : null, - 'week4' => $value->value_id == self::CODE_CONSUMABLES_SALES_SUPPORT ? $consumable['week4'] : null, - 'week5' => $value->value_id == self::CODE_CONSUMABLES_SALES_SUPPORT ? $consumable['week5'] : null, + 'week1' => null, + 'week2' => null, + 'week3' => null, + 'week4' => null, + 'week5' => null, 'forecast' => null, 'fact' => null, 'deviation' => null, @@ -237,11 +233,18 @@ class MotivationService break; } - if ($value->value_id != self::CODE_CONSUMABLES_SALES_SUPPORT) { $result[$costsItem->order][$groupAlias] = $actualValue; - } } + // Подстановка значений расходных материалов + $consumable = self::getConsumable($motivation->id); + $result[190]['week1'] = $consumable['week1']; + $result[190]['week2'] = $consumable['week2']; + $result[190]['week3'] = $consumable['week3']; + $result[190]['week4'] = $consumable['week4']; + $result[190]['week5'] = $consumable['week5']; + + // Сортировка результата по ключу (order) ksort($result); -- 2.39.5