@extends('master.app') @section('title','Accounts Receivable Summary') @section('body') @php $fmt = fn($n)=> number_format((float)$n,2); $fltCustomer = request('customer_id'); $fltCurrency = request('currency_id'); $onlyOpen = request('only_open') == 1; $sumInv = (float)($totals['invoice_total'] ?? 0); $sumRec = (float)($totals['received_total'] ?? 0); $sumRet = (float)($totals['return_total'] ?? 0); $sumOut = (float)($totals['outstanding'] ?? 0); $sumOutB = (float)($totals['outstanding_base'] ?? 0); @endphp @push('styles') @endpush
{{-- Header --}}
Accounts Receivable Summary
Invoices - Received - Returns
Customer: {{ $fltCustomer ?: 'All' }} Currency: {{ $fltCurrency ?: 'All' }} {{ request('date_from') ?: '-' }} → {{ request('date_to') ?: '-' }} Only Open: {{ $onlyOpen ? 'Yes' : 'No' }}
Invoices
{{ $fmt($sumInv) }}
Total billed amount
Received
{{ $fmt($sumRec) }}
Total collected
Returns
{{ $fmt($sumRet) }}
Total returns
Outstanding (Base)
{{ $fmt($sumOutB) }}
Converted to base currency
{{-- Filters --}}
Filters
Filter by customer, currency, and date range
Reset
{{-- Table --}}
Summary Table Rows: {{ $rows->count() }}
Outstanding = Invoices - Received - Returns
@forelse($rows as $r) @php $cust = $customerLookup[$r['customer_id']] ?? null; $cur = $currencyLookup[$r['currency_id']] ?? null; $custName = $cust->name ?? ('Customer #'.$r['customer_id']); $curName = $cur->title_en ?? $cur->title_ps ?? ('CUR #'.($r['currency_id'] ?? 1)); $out = (float)$r['outstanding']; $outBase = (float)$r['outstanding_base']; @endphp @empty @endforelse @if($rows->count()) @endif
Customer Currency Inv Invoices Received Returns Outstanding Outstanding (Base)
{{ $custName }}
ID: {{ $r['customer_id'] }}
{{ $curName }} {{ $r['invoice_count'] }} {{ $fmt($r['invoice_total']) }} {{ $fmt($r['received_total']) }} {{ $fmt($r['return_total']) }} {{ $fmt($out) }} {{ $fmt($outBase) }}
No data found.
Totals {{ $fmt($sumInv) }} {{ $fmt($sumRec) }} {{ $fmt($sumRet) }} {{ $fmt($sumOut) }} {{ $fmt($sumOutB) }}
@endsection