@foreach ($employeeTypes as $employeeType) @endforeach @foreach ($employeeTypes as $employeeType) @foreach ($shifts as $shift) @endforeach @endforeach @foreach ($employeeTypes as $employeeType) @foreach ($shifts as $shift) @endforeach @endforeach @php $allCounts = []; foreach ($departments as $department) { foreach ($employeeTypes as $employeeType) { foreach ($shifts as $shift) { $count = $attendanceProcess->getEmployeePresentCount( $shift, $department, $date, $organization, $locationIds, $sublocationIds, $designationIds, $employeeType, $employeeGroupIds, ); $allCounts[$department->id][$employeeType][$shift->id] = $count; } } } @endphp @foreach ($departments as $department) @php $totalCountForEmployeeType = []; @endphp @foreach ($employeeTypes as $employeeType) @php $totalCountForEmployeeType[$employeeType] = 0; @endphp @foreach ($shifts as $shift) @php $count = $allCounts[$department->id][$employeeType][$shift->id] ?? 0; $totalCountForEmployeeType[$employeeType] += $count; @endphp @endforeach @endforeach @endforeach @php $grandTotalSum = 0; @endphp @foreach ($employeeTypes as $employeeType) @php $totalForEmployeeType = 0; @endphp @foreach ($shifts as $shift) @php $shiftTotal = 0; foreach ($departments as $department) { $shiftTotal += $allCounts[$department->id][$employeeType][$shift->id] ?? 0; } $totalForEmployeeType += $shiftTotal; $grandTotalSum += $shiftTotal; @endphp @endforeach @endforeach