Sale Report (Customer Wise)

Run time: {{ $runAt->format('Y-m-d h:i A') }}
User: {{ auth()->user()->name ?? 'System' }}
Duration: {{ $startDate }} to {{ $endDate }}
@php $netProfit = $totalAmount - $totalCost; @endphp @foreach($rowsByDate as $group)
Date: {{ $group['date'] }}
@foreach($group['lines'] as $line) @php $profit = (float)$line->sale_amount - (float)$line->cost; @endphp @endforeach
Customer Items Income Cost Profit
{{ $line->customer }} {{ number_format($line->qty, 2) }} {{ number_format($line->sale_amount, 2) }} {{ number_format($line->cost, 2) }} {{ number_format($profit, 2) }}
Sub Amount ({{ $group['date'] }}) {{ number_format($group['sub_amount'], 2) }} {{ number_format($group['sub_cost'], 2) }} {{ number_format($group['sub_amount'] - $group['sub_cost'], 2) }}
@endforeach
Net Amount {{ number_format($totalAmount, 2) }} {{ number_format($totalCost, 2) }} {{ number_format($netProfit, 2) }}