{{-- Header --}}
Customer Advances
Filter, review and manage customer prepayments
{{-- KPI Cards --}}
@php
$selectedCurrencyId = request('currency_id', 'all');
$isAllCurrency = $selectedCurrencyId === 'all' || $selectedCurrencyId === null;
$renderTotals = function ($arr) use ($isAllCurrency, $selectedCurrencyId, $currencyTitles) {
if ($isAllCurrency) {
$hasAny = false;
$html = '';
foreach ($currencyTitles as $cid => $title) {
$v = (float) ($arr[$cid] ?? 0);
if ($v != 0) {
$hasAny = true;
$html .=
'
' .
number_format($v, 2) .
' ' .
$title .
'
';
}
}
return $hasAny ? $html : '
0
';
}
$v = (float) ($arr[$selectedCurrencyId] ?? 0);
$t = $currencyTitles[$selectedCurrencyId] ?? '';
return '
' .
number_format($v, 2) .
' ' .
$t .
'
';
};
@endphp
Total Sale
{!! $renderTotals($totals['sale']) !!}
Total Received
{!! $renderTotals($totals['received']) !!}
Total Advance
{!! $renderTotals($totals['advance']) !!}
Balance
{!! $renderTotals($totals['balance']) !!}
{{-- Filters (GET to index) --}}
{{-- Table --}}
| # |
Number |
Customer |
Title |
Date |
Advance |
Action |
@forelse($data as $row)
| {{ $loop->iteration }} |
{{ $row->invoice_number }} |
{{ optional($row->customer)->name }} |
{{ $row->title }} |
{{ $row->date }} |
{{ $row->amount }}
{{ optional($row->currency)->title_en }}
|
|
@empty
| No data found. |
@endforelse
{{-- Pagination --}}
{{ $data->links('pagination::bootstrap-4') }}