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