From 068500ce936f02c99b01bac3ccfb7e7ce5ea8d20 Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Tue, 3 Sep 2024 11:05:51 +0300 Subject: [PATCH] =?utf8?q?[ERP-140]=20=D0=BF=D0=BE=D0=B4=D1=81=D1=87=D1=91?= =?utf8?q?=D1=82=20=D0=A0=D0=B0=D1=81=D1=85=D0=BE=D0=B4=D0=BD=D1=8B=D0=B5?= =?utf8?q?=20=D0=BC=D0=B0=D1=82=D0=B5=D1=80=D0=B8=D0=B0=D0=BB=D1=8B=20(?= =?utf8?q?=D0=BE=D0=B1=D0=B5=D1=81=D0=BF=D0=B5=D1=87=D0=B5=D0=BD=D0=B8?= =?utf8?q?=D0=B5=20=D0=BF=D1=80=D0=BE=D0=B4=D0=B0=D0=B6)=20=D1=84=D0=B0?= =?utf8?q?=D0=BA=D1=82=20=D0=BC=D0=BE=D1=82=D0=B8=D0=B2=D0=B0=D1=86=D0=B8?= =?utf8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/actions/motivation/TestFactAction.php | 2 ++ erp24/scripts/tasks/task_32_motivation_fact.php | 2 ++ erp24/services/MotivationService.php | 12 ++++++++++++ 3 files changed, 16 insertions(+) diff --git a/erp24/actions/motivation/TestFactAction.php b/erp24/actions/motivation/TestFactAction.php index 3148ebc5..da921ee6 100644 --- a/erp24/actions/motivation/TestFactAction.php +++ b/erp24/actions/motivation/TestFactAction.php @@ -74,6 +74,8 @@ class TestFactAction extends Action MotivationService::calculateMonthCostMotivation($model->year, $model->month); + MotivationService::calculateMonthMaterials($model->year, $model->month); + MotivationService::initMonth1cFields($model->year, $model->month); } diff --git a/erp24/scripts/tasks/task_32_motivation_fact.php b/erp24/scripts/tasks/task_32_motivation_fact.php index 06d21f26..f5de4bbb 100644 --- a/erp24/scripts/tasks/task_32_motivation_fact.php +++ b/erp24/scripts/tasks/task_32_motivation_fact.php @@ -77,6 +77,8 @@ try { MotivationService::calculateMonthCostMotivation($year, $month); + MotivationService::calculateMonthMaterials($year, $month); + MotivationService::initMonth1cFields($year, $month); ////////////////////////////////////////////// diff --git a/erp24/services/MotivationService.php b/erp24/services/MotivationService.php index 8fdf2b87..b13d9cb3 100644 --- a/erp24/services/MotivationService.php +++ b/erp24/services/MotivationService.php @@ -1509,6 +1509,18 @@ class MotivationService } } + public static function calculateMonthMaterials($year, $month) { + $motivations = Motivation::find() + ->where(['year' => $year, 'month' => $month]) + ->all(); + + foreach ($motivations as $motivation) { + $materials = self::getMotivationValue($motivation->id, 10, self::CODE_CONSUMABLES_SALES_SUPPORT); + self::saveOrUpdateMotivationValue($motivation->id, + "fact", self::CODE_CONSUMABLES_SALES_SUPPORT, "float", $materials); + } + } + public static function initMonth1cFields($year, $month) { $motivations = Motivation::find() ->where(['year' => $year, 'month' => $month]) -- 2.39.5