From: marina Date: Mon, 9 Sep 2024 08:07:42 +0000 (+0300) Subject: правка расходных материалов X-Git-Tag: 1.5~34^2~1 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=3cb59158cb346c8fd94ec7cecbc945e1a872dc6e;p=erp24_rep%2Fyii-erp24%2F.git правка расходных материалов --- 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);