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

Brick Production, Stock, Sales & Profit Report

{{-- FILTER --}}
{{-- Start Date --}}
{{-- End Date --}}
{{-- Month Filter --}}
{{-- Brick Type Filter --}}
{{-- ✅ ADDED: Workstation dropdown row --}}
{{-- SUMMARY --}}
Total Produced

{{ number_format($totalProduced) }}

Total In Stock

{{ number_format($totalInStock) }}

Total Sold

{{ number_format($totalSold) }}

Net Profit

{{ number_format($profit, 2) }}

{{-- PRODUCTION --}}
Bricks Produced
@foreach($productionRows as $r) @endforeach
Date Brick Type Actual Output
{{ optional($r->created_at)->format('d M Y') }} {{ $r->brickType->name ?? 'Unknown' }} {{ number_format($r->actual_out) }}
{{-- STOCK --}}
Current Stock
@foreach($brickTypes as $t) @endforeach
Brick Type In Stock
{{ $t->name }} {{ number_format($currentStockByType[$t->id] ?? 0) }}
{{-- SALES DETAILS --}}
Sales Details
@php $totalDiscount = 0; @endphp @foreach($salesDetails as $s) @php $sub = (float)($s->subtotal_num ?? 0); $final = (float)($s->amount_num ?? 0); $discount = max(0, $sub - $final); $totalDiscount += $discount; @endphp @endforeach
Date Brick Type Qty Subtotal Final Discount
{{ \Carbon\Carbon::parse($s->item_created_at)->format('d M Y') }} {{ $brickTypes->firstWhere('id', $s->brick_type_id)->name ?? 'Unknown' }} {{ number_format($s->sold_qty) }} {{ number_format($sub, 2) }} {{ number_format($final, 2) }} {{ number_format($discount, 2) }}
Total Discount {{ number_format($totalDiscount, 2) }}
Total Revenue {{ number_format($totalRevenue, 2) }}
{{-- PROFIT --}}
Profit & Loss
Total Revenue {{ number_format($totalRevenue, 2) }}
Total Cost {{ number_format($totalCost, 2) }}
Net Profit {{ number_format($profit, 2) }}
@endsection