{!! $print['head'] !!}
@foreach ($reports as $report)
@php
$grouped = collect();
if (isset($report)) {
// $grouped = $report->transactions->groupBy('process_id');
$grouped = $report->transactions
->groupBy('supervisor_id')
->map(function ($groupedBySupervisor) {
return $groupedBySupervisor->groupBy('process_id');
});
}
dd($grouped);
@endphp
| Process |
@foreach ($shifts as $shift)
{{ date('h:i A', strtotime($shift->start_time)) }} -
{{ date('h:i A', strtotime($shift->end_time)) }}
|
@endforeach
Total |
Remarks |
@foreach ($grouped as $item)
| {{ $item[0]->getProcess->name ?? '' }} |
@php
$rowTotal = 0;
@endphp
@foreach ($shifts as $shift)
@php
$quantity = $item->where('shift_id', $shift->id)->sum('quantity');
$rowTotal += $quantity;
@endphp
{{ $quantity }} |
@endforeach
{{ $rowTotal }} |
|
@endforeach
| Total |
@php
$colTotal = 0;
@endphp
@foreach ($shifts as $shift)
@php
$quantity = $grouped->sum(function ($item) use ($shift) {
return $item->where('shift_id', $shift->id)->sum('quantity');
});
$colTotal += $quantity;
@endphp
{{ $quantity }} |
@endforeach
{{ $colTotal }} |
|
@endforeach