@extends('templates.report_layout') @section('content')

Machine Production Detail Report ({{ $date }})

@php // Group outputs by machine first $machineGroups = $outputs->groupBy('schedule.machine_id'); @endphp @foreach($machineGroups as $machineId => $machineOutputs) @php $machine = $machineOutputs->first()->schedule->machine ?? null; // Group by UOM within this machine $uomGroups = $machineOutputs->groupBy('uom'); @endphp

{{ $machine->name ?? 'Unassigned Machine' }} Total: {{ number_format($machineOutputs->sum('quantity'), 2) }}

@foreach($uomGroups as $uomId => $uomOutputs) @php $uom = $uomOutputs->first()->unit_of_measure ?? null; // Sort productions chronologically $productions = $uomOutputs->sortBy('produced_at'); @endphp
{{ $uom->name ?? 'N/A' }} ({{ $uom->code ?? '' }}) {{ number_format($uomOutputs->sum('quantity'), 2) }} total
@foreach($productions as $production) @endforeach
Item Order # Quantity Operator
{{ $production->schedule->productionOrder->item->name ?? 'N/A' }} {{ $production->schedule->productionOrder->order_number ?? 'N/A' }} {{ number_format($production->quantity, 2) }} {{ $production->schedule->operator->first_name ?? 'N/A' }} {{ $production->schedule->operator->last_name ?? '' }}
@endforeach
@endforeach
@endsection