@extends('layouts.main') @section('content')

Brick Production Report

Filter Production Report
Reset
@if($production->isEmpty())
No brick production data found for the selected filters.
@else
Brick Production Summary ({{ $startDate->format('d M Y') }} - {{ $endDate->format('d M Y') }})
@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 @endforeach
Date Cement Used (Bags) Good Bricks Expected Output Variance Status
{{ $prod->created_at->format('d M Y') }} {{ number_format($prod->total) }} {{ number_format($goodBricks) }} {{ number_format($expected) }} {{ $variance >= 0 ? '+' : '' }}{{ number_format($variance) }} {{ $status }}
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