@php $globalIndex = 0; @endphp @foreach ($sales as $customerData) @php $customerName = $customerData['customer_name']; $customerBills = $customerData['sales']; $creditTotal = (float) $customerData['credit_total']; @endphp {{-- Start new row after every 2 customers --}} @if ($globalIndex % 2 == 0)
@endif

{{ $customerName }}

Report Date: {{ now()->format('d/m/y') }}

@php $totalCustomerAmount = 0; $totalCustomerBori = 0; $totalCustomerWeight = 0; $lastSale = $customerBills->last(); $sabeqaBalance = $lastSale ? (float) str_replace(',', '', $lastSale->customerBalance()) : 0; $adjustedBalance = $sabeqaBalance - $creditTotal; @endphp @foreach ($customerBills as $sale) @php $totalCustomerAmount += (float) str_replace(',', '', $sale->total_amount); @endphp @foreach ($sale->salesItemsDetails as $item) @php $totalCustomerBori += $item->bori; $totalCustomerWeight += $item->weight; @endphp @endforeach @endforeach
مال قیمت وزن بوری
{{ $item->productChildCate?->name_urdu }} {{ number_format((int) $item->amount, 0) }} {{ $item->weight }} {{ $item->bori }}
{{ number_format($totalCustomerAmount, 0) }} {{ $totalCustomerWeight }} {{ $totalCustomerBori }} ٹوٹل
{{ number_format($totalCustomerAmount, 0) }} بنام (موجودہ بل)
{{ number_format($adjustedBalance, 0) }} سابِقہ بیلنس
{{ number_format($adjustedBalance, 0) }} حالیہ بیلنس (ٹوٹل)
@php $globalIndex++; @endphp @if ($globalIndex % 2 == 0 || $loop->last)
@endif @if ($globalIndex % 6 == 0 && !$loop->last)
@endif @endforeach