@php $org = auth()->user()->organization ?? \App\Models\System\Organization::find(auth()->user()->organization_id); @endphp @extends('documents.procurement._layout', [ 'documentTitle' => 'Production Cost Analysis', 'reference' => null, 'documentDate' => $reportDate, 'noAutoPrint' => true, ]) @section('header-meta')
No completed production orders found for this period.
@else| Reference | Product | Material | Labour | Overhead | Other | Total ({{ $currency }}) | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Est. | Act. | Est. | Act. | Est. | Act. | Est. | Act. | Est. | Act. | Var. | ||
| {{ $order->production_reference }} | {{ $order->product?->name ?? 'โ' }} | @foreach($types as $type) @php $line = $lines[$type] ?? null; @endphp{{ number_format((float)($line?->estimated_amount_base ?? 0), 0) }} | {{ number_format((float)($line?->amount_base ?? 0), 0) }} | @endforeach{{ number_format($totalEst, 0) }} | {{ number_format($totalAct, 0) }} | {{ $variance >= 0 ? '+' : '' }}{{ number_format($variance, 0) }} | ||||||
| Grand Totals | @foreach($types as $type) @php $estSum = $orders->sum(fn($o) => (float)($o->costLines->firstWhere('cost_type', $type)?->estimated_amount_base ?? 0)); $actSum = $orders->sum(fn($o) => (float)($o->costLines->firstWhere('cost_type', $type)?->amount_base ?? 0)); @endphp{{ number_format($estSum, 0) }} | {{ number_format($actSum, 0) }} | @endforeach{{ number_format($grandEst, 0) }} | {{ number_format($grandAct, 0) }} | {{ $grandVar >= 0 ? '+' : '' }}{{ number_format($grandVar, 0) }} | |||||||
Variance = Actual โ Estimated. Red = over budget. Green = under budget.
@endif @endsection