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;
$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);