@foreach ($contractors as $contractor)
@foreach ($shifts as $shift) @endforeach @foreach ($shifts as $shift) @endforeach @php $totalArray = []; @endphp @foreach ($departments as $department) @foreach ($designations as $designation) @php $totalPlan = 0; $totalPresent = 0; $tatalDifference = 0; $differenceCount = 0; @endphp @foreach ($shifts as $shift) @php $plannedCount = $rotaProcess->getPlanEmployees($organization->id, $contractor->id, $shift->id, $department->id, $date, $designation->id); $presentEmps = $rotaProcess->getPresentEmployees($organization, $contractor->id, $shift, $department->id, $date, $designation->id); $presentCount = $presentEmps['present_count']; $differenceCount = $plannedCount - $presentCount; if (!isset($totalArray[$shift->id])) { $totalArray[$shift->id] = [ 'planned' => 0, 'present' => 0, 'diff' => 0, ]; } $totalPlan += $plannedCount; $totalPresent += $presentCount; $tatalDifference += $differenceCount; $totalArray[$shift->id]['planned'] = $plannedCount; $totalArray[$shift->id]['present'] = $presentCount; $totalArray[$shift->id]['diff'] = $differenceCount; @endphp @endforeach @endforeach @endforeach @php $totalPlanG = 0; $totalPresentG = 0; $tatalDifferenceG = 0; @endphp @foreach ($shifts as $shift) @php $totalPlanG += $totalArray[$shift->id]['planned']; $totalPresentG += $totalArray[$shift->id]['present']; $tatalDifferenceG += $totalArray[$shift->id]['diff']; @endphp @endforeach
{{ $contractor->name }}
{{ $shift->name }} {{ trans('master/master.total') }}
{{ trans('master/master.department') }} {{ trans('master/master.designation') }}{{ trans('master/master.planned') }} {{ trans('master/master.present') }} {{ trans('master/master.difference') }}{{ trans('master/master.planned') }} {{ trans('master/master.present') }} {{ trans('master/master.difference') }}
{{ $department->name }} {{ $designation->name }}{{ $plannedCount }} {{ $presentCount }} {{ $plannedCount - $presentCount }}{{ $totalPlan }} {{ $totalPresent }} {{ $tatalDifference }}
{{ trans('master/master.total') }} {{ $totalArray[$shift->id]['planned'] }} {{ $totalArray[$shift->id]['present'] }} {{ $totalArray[$shift->id]['diff'] }} {{ $totalPlanG }} {{ $totalPresentG }} {{ $tatalDifferenceG }}
@endforeach