From 5ad2f41fd98b4e8e2d06b8b33074b3fd8809e7ca Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Thu, 26 Sep 2024 17:14:33 +0300 Subject: [PATCH] =?utf8?q?[ERP-187]=20=D0=9F=D0=BE=D0=B4=D1=81=D1=87=D1=91?= =?utf8?q?=D1=82=20=D0=BF=D0=B5=D1=80=D1=81=D0=BE=D0=BD=D0=B0=D0=BB=D0=B0?= =?utf8?q?=20=D1=81=20=D0=BF=D1=80=D0=BE=D0=B8=D0=B7=D0=B2=D0=BE=D0=B4?= =?utf8?q?=D1=81=D1=82=D0=B2=D0=B5=D0=BD=D0=BD=D1=8B=D0=BC=20=D0=BA=D0=B0?= =?utf8?q?=D0=BB=D0=B5=D0=BD=D0=B4=D0=B0=D1=80=D1=91=D0=BC=20002?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/services/MotivationService.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/erp24/services/MotivationService.php b/erp24/services/MotivationService.php index 313f2c41..1c63ef67 100644 --- a/erp24/services/MotivationService.php +++ b/erp24/services/MotivationService.php @@ -6,6 +6,7 @@ use Yii; use PhpOffice\PhpSpreadsheet\IOFactory; use yii\helpers\Json; use yii_app\helpers\HtmlHelper; +use yii_app\records\Admin; use yii_app\records\EmployeePayment; use yii_app\records\AdminGroup; use yii_app\records\ExportImportTable; @@ -770,10 +771,11 @@ class MotivationService $result = 0; foreach ($adminIds as $admin_id) { - $timetableFactModel = TimetableFactModel::find()->select(['COUNT(*) as total', 'admin_group_id'])->where(['store_id' => $store_id, 'admin_id' => $admin_id]) - ->andWhere(['between', 'date', $monthStart, $monthEnd])->groupBy(['admin_group_id'])->asArray()->one(); - - $norma = $timetableFactModel['admin_group_id'] == AdminGroup::GROUP_ADMINISTRATORS ? + $timetableFactModel = TimetableFactModel::find()->select(['COUNT(*) as total', 'admin_group_id', 'admin_id'])->where(['store_id' => $store_id, 'admin_id' => $admin_id]) + ->andWhere(['between', 'date', $monthStart, $monthEnd])->groupBy(['admin_group_id', 'admin_id'])->asArray()->one(); + $admin = Admin::findOne($timetableFactModel['admin_id']); + $work_rate = $admin && $admin->work_rate > 1 ? $admin->work_rate : 1; + $norma = $timetableFactModel['admin_group_id'] == AdminGroup::GROUP_ADMINISTRATORS && $work_rate == 1 ? HtmlHelper::getWorkDays($month, $year) : 15; $result += $norma == 0 ? 0 : $timetableFactModel['total'] / $norma; } -- 2.39.5