]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
[ERP-140] Подсчёт БУ НУ доставки курьером и юридические услуги
authorAlexander Smirnov <fredeom@mail.ru>
Wed, 14 Aug 2024 13:01:35 +0000 (16:01 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Wed, 14 Aug 2024 13:01:35 +0000 (16:01 +0300)
erp24/actions/motivation/TestFactAction.php
erp24/scripts/tasks/task_32_motivation_fact.php
erp24/services/MotivationService.php

index 97ba3397f7ca6eb4ece848b7d097cd5a3d472b96..b604f9de3502fad5ef8bec58afe4538b53b0297d 100644 (file)
@@ -57,6 +57,12 @@ class TestFactAction extends Action
             MotivationService::calculateMonthDefect($model->year, $model->month);
 
             MotivationService::calculateMonthSalary($model->year, $model->month);
+
+            MotivationService::calculateMonthDeliveryCurier($model->year, $model->month);
+
+            MotivationService::calculateMonthAccauntingAndTax($model->year, $model->month);
+
+            MotivationService::calculateMonthLegalServices($model->year, $model->month);
         }
 
         return $this->controller->render('test-fact', compact('model', 'years', 'months'));
index 496647a048f0049787b673349dc13013d610dcba..2aa53064a0851203ca99bd5eee695e6ffc01677e 100644 (file)
@@ -61,6 +61,12 @@ try {
 
         MotivationService::calculateMonthSalary($year, $month);
 
+        MotivationService::calculateMonthDeliveryCurier($year, $month);
+
+        MotivationService::calculateMonthAccauntingAndTax($year, $month);
+
+        MotivationService::calculateMonthLegalServices($year, $month);
+
         //////////////////////////////////////////////
 
 
index b18e0541ca05fc461b89930273f64093a7b63c23..27528d2406dcaf9766572b677e7e135c0311ba62 100644 (file)
@@ -1106,4 +1106,40 @@ class MotivationService
                 6, 11, "float", $monthlyTotalSalary + $correction);
         }
     }
+
+    public static function calculateMonthDeliveryCurier($year, $month) {
+        $motivations = Motivation::find()
+            ->where(['year' => $year, 'month' => $month])
+            ->all();
+
+        foreach ($motivations as $motivation) {
+            $correction = self::getMotivationValue($motivation->id, 8, 16);
+            self::saveOrUpdateMotivationValue($motivation->id,
+                6, 16, "float", $correction);
+        }
+    }
+
+    public static function calculateMonthAccauntingAndTax($year, $month) {
+        $motivations = Motivation::find()
+            ->where(['year' => $year, 'month' => $month])
+            ->all();
+
+        foreach ($motivations as $motivation) {
+            $plan = self::getMotivationValue($motivation->id, 7, 27);
+            self::saveOrUpdateMotivationValue($motivation->id,
+                6, 27, "float", $plan);
+        }
+    }
+
+    public static function calculateMonthLegalServices($year, $month) {
+        $motivations = Motivation::find()
+            ->where(['year' => $year, 'month' => $month])
+            ->all();
+
+        foreach ($motivations as $motivation) {
+            $plan = self::getMotivationValue($motivation->id, 7, 28);
+            self::saveOrUpdateMotivationValue($motivation->id,
+                6, 28, "float", $plan);
+        }
+    }
 }