@if($production->isEmpty())
No brick production data found for the selected filters.
@else
| Date |
Cement Used (Bags) |
Good Bricks |
Expected Output |
Variance |
Status |
@php
$totalCement = 0;
$totalGoodBricks = 0;
$totalExpected = 0;
@endphp
@foreach($production as $prod)
@php
$stockBrick = App\Models\StockBrick::where('stock_id', $prod->id)->first();
$goodBricks = $stockBrick?->total_bricks_without_fault ?? 0;
$expected = $stockBrick?->expected_output ?? 0;
$variance = $goodBricks - $expected;
$status = ($expected > 0 && $goodBricks == 0)
? 'Missing Output'
: ($goodBricks < $expected ? 'Below Expectation' : 'Met Target');
$totalCement += $prod->total;
$totalGoodBricks += $goodBricks;
$totalExpected += $expected;
@endphp
| {{ $prod->created_at->format('d M Y') }} |
{{ number_format($prod->total) }} |
{{ number_format($goodBricks) }} |
{{ number_format($expected) }} |
{{ $variance >= 0 ? '+' : '' }}{{ number_format($variance) }}
|
{{ $status }}
|
@endforeach
| Totals: |
{{ number_format($totalCement) }} bags
|
{{ number_format($totalGoodBricks) }}
|
{{ number_format($totalExpected) }}
|
{{ ($totalGoodBricks - $totalExpected) >= 0 ? '+' : '' }}{{ number_format($totalGoodBricks - $totalExpected) }}
|
{{ $totalGoodBricks >= $totalExpected ? 'Target Achieved' : 'Below Target' }}
|
@endif
@endsection
@section('scripts')
@endsection