{!! $print['head'] !!} @php $grouped = collect(); if (isset($reports)) { $grouped = $reports->groupBy(function ($item) { return $item['supervisor_id'] . ',' . $item['line_id']; }); } @endphp @foreach ($shifts as $shift) @endforeach @foreach ($grouped as $lineSuperVisor => $item) @php $processGroup = $item->groupBy('process_id'); $groupBySupervisor = explode(',', $lineSuperVisor); $lineId = $groupBySupervisor[1] ?? null; $supervisorId = $groupBySupervisor[0] ?? null; @endphp @foreach ($processGroup as $processIndex => $processItem) @php $rowTotal = 0; @endphp @foreach ($shifts as $shift) @php $quantity = $processItem ->where('shift_id', $shift->id) ->sum('quantity'); $rowTotal += $quantity; @endphp @endforeach @endforeach @endforeach
Process {{ $shift->name }} Total Remarks
{{ $supervisors->where('id', $supervisorId)->first()->name ?? '' }} - {{ $lines->where('id', $lineId)->first()->name ?? '' }}
{{ $process->where('id', $processIndex)->first()->name ?? '' }}{{ $quantity }}{{ $rowTotal }} {{ $processItem->first()->remarks ?? '' }}
{!! $print['foot'] !!}