@extends('templates.report_layout')
@section('content')
Daily Production Summary ({{ $date }})
| Item |
UnitOfMeasure |
Quantity Produced |
@php
// Group by both item_id and uom from production output
$groupedOutputs = $outputs->groupBy(function($item) {
return $item->item_id.'|'.$item->uom;
});
@endphp
@foreach($groupedOutputs as $groupKey => $groupItems)
@php
[$itemId, $uomId] = explode('|', $groupKey);
$firstItem = $groupItems->first();
// Get item and UOM details
$itemName = $firstItem->schedule->productionOrder->item->name ?? 'N/A';
$uomName = $firstItem->unit_of_measure->name ?? 'N/A';
$totalQuantity = $groupItems->sum('quantity');
$outputCount = $groupItems->count();
@endphp
| {{ $itemName }} |
{{ $uomName }} |
{{ number_format($totalQuantity, 2) }} |
@endforeach
| Grand Totals |
{{ number_format($outputs->sum('quantity'), 2) }} |
@endsection