]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
правка расходных материалов
authormarina <m.zozirova@gmail.com>
Mon, 9 Sep 2024 08:07:42 +0000 (11:07 +0300)
committermarina <m.zozirova@gmail.com>
Mon, 9 Sep 2024 08:07:42 +0000 (11:07 +0300)
erp24/services/MotivationService.php

index b85e6e27f0ac7c65c694e1ed9743d5d9e92dd4d3..b10c52cf18929ccfe3a50e19c0c60f81842fc8ae 100644 (file)
@@ -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);