From 63f3708a7c571ed9271e5162e29426bafc15c49e Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Wed, 14 Aug 2024 16:01:35 +0300 Subject: [PATCH] =?utf8?q?[ERP-140]=20=D0=9F=D0=BE=D0=B4=D1=81=D1=87=D1=91?= =?utf8?q?=D1=82=20=D0=91=D0=A3=20=D0=9D=D0=A3=20=D0=B4=D0=BE=D1=81=D1=82?= =?utf8?q?=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=BA=D1=83=D1=80=D1=8C=D0=B5=D1=80?= =?utf8?q?=D0=BE=D0=BC=20=D0=B8=20=D1=8E=D1=80=D0=B8=D0=B4=D0=B8=D1=87?= =?utf8?q?=D0=B5=D1=81=D0=BA=D0=B8=D0=B5=20=D1=83=D1=81=D0=BB=D1=83=D0=B3?= =?utf8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/actions/motivation/TestFactAction.php | 6 ++++ .../scripts/tasks/task_32_motivation_fact.php | 6 ++++ erp24/services/MotivationService.php | 36 +++++++++++++++++++ 3 files changed, 48 insertions(+) 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); + } + } } -- 2.39.5