@php $totalDiscount = 0; @endphp
| Date |
Brick Type |
Qty |
Subtotal |
Final |
Discount |
@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
| {{ \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) }} |
@endforeach
| Total Discount |
{{ number_format($totalDiscount, 2) }} |
| Total Revenue |
{{ number_format($totalRevenue, 2) }} |