From: Alexander Smirnov Date: Thu, 26 Sep 2024 13:26:08 +0000 (+0300) Subject: Merge branch 'develop' into feature_smirnov_erp-187_personal_recalculation X-Git-Tag: 1.6~38^2~5 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=8d352033aae054a65e032b233101a0f093fa23d4;p=erp24_rep%2Fyii-erp24%2F.git Merge branch 'develop' into feature_smirnov_erp-187_personal_recalculation --- 8d352033aae054a65e032b233101a0f093fa23d4 diff --cc erp24/services/MotivationService.php index e49cacbd,a3058570..313f2c41 --- a/erp24/services/MotivationService.php +++ b/erp24/services/MotivationService.php @@@ -755,10 -770,14 +771,10 @@@ class MotivationServic $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_shift', $monthStart, $monthEnd])->groupBy(['admin_group_id'])->asArray()->one(); + ->andWhere(['between', 'date', $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);