From eae4d8b77421980b7ffc041d8b1988465685cb3a Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Thu, 12 Sep 2024 12:49:08 +0300 Subject: [PATCH] =?utf8?q?[ERP-187]=20=D0=9F=D0=B5=D1=80=D0=B5=D1=81=D1=87?= =?utf8?q?=D1=91=D1=82=20=D0=BF=D0=B5=D1=80=D1=81=D0=BE=D0=BD=D0=B0=D0=BB?= =?utf8?q?=D0=B0=20=D1=81=20=D0=BD=D0=BE=D1=80=D0=BC=D0=BE=D0=B9=20=D1=81?= =?utf8?q?=D0=BC=D0=B5=D0=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/services/MotivationService.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/erp24/services/MotivationService.php b/erp24/services/MotivationService.php index eba80a07..e49cacbd 100644 --- a/erp24/services/MotivationService.php +++ b/erp24/services/MotivationService.php @@ -5,6 +5,7 @@ namespace yii_app\services; use Yii; use PhpOffice\PhpSpreadsheet\IOFactory; use yii\helpers\Json; +use yii_app\helpers\HtmlHelper; use yii_app\records\EmployeePayment; use yii_app\records\AdminGroup; use yii_app\records\ExportImportTable; @@ -756,12 +757,8 @@ class MotivationService $timetableFactModel = TimetableFactModel::find()->select(['COUNT(*) as total', 'admin_group_id'])->where(['store_id' => $store_id, 'admin_id' => $admin_id]) ->andWhere(['between', 'date_shift', $monthStart, $monthEnd])->groupBy(['admin_group_id'])->asArray()->one(); - $norma = 15; - if ($timetableFactModel['admin_group_id'] != AdminGroup::GROUP_WORKERS) { - $timetablePlan = Timetable::find()->select(['COUNT(*) as total'])->where(['store_id' => $store_id, 'admin_id' => $admin_id, 'tabel' => 0, 'slot_type_id' => Timetable::TIMESLOT_WORK]) - ->andWhere(['between', 'date', $monthStart, $monthEnd])->asArray()->one(); - $norma = $timetablePlan['total']; - } + $norma = $timetableFactModel['admin_group_id'] == AdminGroup::GROUP_ADMINISTRATORS ? + HtmlHelper::getWorkDays($month, $year) : 15; $result += $norma == 0 ? 0 : $timetableFactModel['total'] / $norma; } self::saveOrUpdateMotivationValue($motivation->id, 'fact', MotivationCostsItem::CODE_EMPLOYEES_QUANTITY, 'float', $result); -- 2.39.5