while ($currentDate <= $data->date_end) {
$report = [];
- $shift_id = $data->shift_type == 0 ? [1, 2, 5, 8] : ($data->shift_type == 1 ? [1, 5, 8] : [2]);
+ $shift_id = Shift::getShiftIdsByShiftType($data->shift_type);
// Получаем сотрудников из фактических смен за месяц
$timetablesMonthData = TimetableFactModel::find()
// Определяем админов из продаж, которых нет в смене
$missingAdminIds = [];
- foreach ($salesAdminIds as $adminId => $_) {
+ foreach ($salesAdminIds as $adminId => $value) {
$adminExists = false;
foreach ($adminNames[$store->id] as $admin) {
if ($admin['id'] == $adminId) {
->all();
foreach ($missingAdminIds as $adminId) {
+ // Если запрашивается конкретный тип смены (не 0), не добавляем из продаж без shift_id
+ if ($data->shift_type != 0) {
+ continue;
+ }
+
$adminNames[$store->id][] = [
'id' => $adminId,
'name' => $missingAdmins[$adminId]['name'] ?? 'Unknown',
$cityStoreNames = ArrayHelper::map(CityStore::find()->where(['visible' => '1'])->all(), 'id', 'name');
// Набор идентификаторов смен согласно типу (день/ночь/обе)
- $shiftIds = $data->shift_type == 0 ? [1, 2, 5, 8] : ($data->shift_type == 1 ? [1, 5, 8] : [2]);
+ $shiftIds = Shift::getShiftIdsByShiftType($data->shift_type);
$eitStores = ExportImportTable::find()->where(['export_val' => $data->stores])
->select(['entity_id', 'export_val'])
$cityStoreNames = ArrayHelper::map(CityStore::find()->where(['visible' => '1'])->all(), 'id', 'name');
- $shiftIds = $data->shift_type == 0 ? [1, 2, 5, 8] : ($data->shift_type == 1 ? [1, 5, 8] : [2]);
+ $shiftIds = Shift::getShiftIdsByShiftType($data->shift_type);
$eitStores = ExportImportTable::find()->where(['export_val' => $data->stores])
->select(['entity_id', 'export_val'])