$allAdminsInPeriod = TimetableFactModel::find()
->select(['admin_id'])
- ->distinct()
+ //->distinct()
->where(['store_id' => $data->stores])
->andWhere($cond)
->andWhere(['>', 'work_time', 0])
foreach ($data->stores as $store_id) {
$employees = TimetableFactModel::find()
->select(['admin_id'])
- ->distinct()
+ //->distinct()
->where(['store_id' => $store_id])
->andWhere(['>=', 'date', date("Y-m-d", strtotime($dateStartEnd[0]))])
->andWhere(['<=', 'date', date("Y-m-d", strtotime($dateStartEnd[1]))])
}
}
- // Дедупликация $allDayEmployees для корректного подсчета total
- // Для shift_type == 0 дедуплицируем по (admin_id, shift_id)
- // Для других типов дедуплицируем по admin_id
-// $uniqueEmployees = [];
-// foreach ($allDayEmployees as $employee) {
-// if ($data->shift_type == 0) {
-// $key = $employee['admin_id'] . '_' . $employee['shift_id'];
-// } else {
-// $key = $employee['admin_id'];
-// }
-// if (!isset($uniqueEmployees[$key])) {
-// $uniqueEmployees[$key] = $employee;
-// }
-// }
- // $allDayEmployees = array_values($uniqueEmployees);
-
-
$storeVisitorsQuantityTotal = [];
$storeSaleQuantityTotal = [];
$storeSaleTotalTotal = [];