From: Alexander Smirnov Date: Wed, 14 Aug 2024 13:01:35 +0000 (+0300) Subject: [ERP-140] Подсчёт БУ НУ доставки курьером и юридические услуги X-Git-Tag: 1.4~5^2~29 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=63f3708a7c571ed9271e5162e29426bafc15c49e;p=erp24_rep%2Fyii-erp24%2F.git [ERP-140] Подсчёт БУ НУ доставки курьером и юридические услуги --- diff --git a/erp24/actions/motivation/TestFactAction.php b/erp24/actions/motivation/TestFactAction.php index 97ba3397..b604f9de 100644 --- a/erp24/actions/motivation/TestFactAction.php +++ b/erp24/actions/motivation/TestFactAction.php @@ -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')); diff --git a/erp24/scripts/tasks/task_32_motivation_fact.php b/erp24/scripts/tasks/task_32_motivation_fact.php index 496647a0..2aa53064 100644 --- a/erp24/scripts/tasks/task_32_motivation_fact.php +++ b/erp24/scripts/tasks/task_32_motivation_fact.php @@ -61,6 +61,12 @@ try { MotivationService::calculateMonthSalary($year, $month); + MotivationService::calculateMonthDeliveryCurier($year, $month); + + MotivationService::calculateMonthAccauntingAndTax($year, $month); + + MotivationService::calculateMonthLegalServices($year, $month); + ////////////////////////////////////////////// diff --git a/erp24/services/MotivationService.php b/erp24/services/MotivationService.php index b18e0541..27528d24 100644 --- a/erp24/services/MotivationService.php +++ b/erp24/services/MotivationService.php @@ -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); + } + } }