// Получаем все уникальные admin_id сотрудников за период
$allAdminsInPeriod = Timetable::find()->alias('t')
->select(['admin_id'])
+ ->distinct()
->where(['t.store_id' => $data->stores])
->andWhere(['>=', 'date', date("Y-m-01", strtotime($data->date_start))])
->andWhere(['<=', 'date', $data->date_end])
->andWhere(['tabel' => 0, 'slot_type_id' => Timetable::TIMESLOT_WORK])
- ->andWhere(['IS', 't.deleted_at', null])
- ->groupBy(['admin_id'])
+ ->andWhere(['active' => 1])
->asArray()->all();
$adminIdsInPeriod = ArrayHelper::getColumn($allAdminsInPeriod, 'admin_id');
->andWhere(['>=', 'date', date("Y-m-01", strtotime($currentDate))])
->andWhere(['<=', 'date', $currentDate])
->andWhere(['shift_id' => $shift_id, 'tabel' => 0, 'slot_type_id' => Timetable::TIMESLOT_WORK])
- ->andWhere(['IS', 't.deleted_at', null])
+ ->andWhere(['active' => 1])
->asArray()->all();
$timetables = Timetable::find()->alias('t')->select(['admin_id', 'a.name as adminName', 't.store_id', 't.shift_id'])
->where(['t.store_id' => $data->stores])
->andWhere(['date' => $currentDate, 'tabel' => 0])
->andWhere(['shift_id' => $shift_id, 'slot_type_id' => Timetable::TIMESLOT_WORK])
- ->andWhere(['IS', 't.deleted_at', null])
+ ->andWhere(['active' => 1])
->asArray()->all();
$adminIdsMonth = ArrayHelper::getColumn($timetablesMonth, 'admin_id');