@php $globalIndex = 0; @endphp @foreach ($sales as $customerData) @php $customerName = $customerData['customer_name']; $customerBills = $customerData['sales']; $previousBalance = (float) $customerData['previous_balance']; @endphp @if ($globalIndex % 2 == 0)
@endif

{{ $customerName }}

مورخہ: {{ $selectedDate ? \Carbon\Carbon::parse($selectedDate)->format('d/m/Y') : now()->format('d/m/Y') }}

@php $totalCustomerAmount = 0; $totalCustomerBori = 0; $totalCustomerWeight = 0; $totalCustomerRate = 0; @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; $totalCustomerRate += $item->rate; @endphp @endforeach @endforeach {{-- Totals row --}} {{-- موجودہ بل --}} {{-- سابقہ بیلنس --}} @php // حالیہ بیلنس = سابقہ بیلنس + موجودہ بل $currentBalance = $previousBalance + $totalCustomerAmount; @endphp {{-- حالیہ بیلنس --}}
مال بوری وزن ریٹ قیمت
{{ $item->productChildCate?->name_urdu }} {{ $item->bori }} {{ $item->weight }} {{ number_format((int) $item->rate, 0) }} {{ number_format((int) $item->amount, 0) }}
ٹوٹل {{ $totalCustomerBori }} {{ $totalCustomerWeight }} {{ $totalCustomerRate }} {{ number_format($totalCustomerAmount, 0) }}
{{ number_format($totalCustomerAmount, 0) }} بنام (موجودہ بل)
{{ number_format($previousBalance, 0) }} سابِقہ بیلنس
{{ number_format($currentBalance, 0) }} حالیہ بیلنس (ٹوٹل)
@php $globalIndex++; @endphp @if ($globalIndex % 2 == 0 || $loop->last)
@endif @if ($globalIndex % 6 == 0 && !$loop->last)
@endif @endforeach