Generate Customer Statement

@if($this->customer)

Customer Details

Name

{{ $this->customer->name }}

Company

{{ $this->customer->company ?? 'N/A' }}

Email

{{ $this->customer->email }}

Phone

{{ $this->customer->phone }}

Invoices

@forelse($this->invoices as $invoice) @empty @endforelse @if(count($this->invoices) > 0) @endif
Invoice # Date Due Date Total Paid Balance Status
{{ $invoice['invoice_number'] }} {{ \Carbon\Carbon::parse($invoice['created_at'])->format('M d, Y') }} {{ \Carbon\Carbon::parse($invoice['due_date'])->format('M d, Y') }} KES {{ number_format($invoice['total'], 2) }} KES {{ number_format($invoice['amount_paid'], 2) }} KES {{ number_format($invoice['total'] - $invoice['amount_paid'], 2) }} {{ ucfirst($invoice['status']) }}
No invoices found
Total KES {{ number_format(array_sum(array_column($this->invoices, 'total')), 2) }} KES {{ number_format(array_sum(array_column($this->invoices, 'amount_paid')), 2) }} KES {{ number_format(array_sum(array_map(fn($i) => $i['total'] - $i['amount_paid'], $this->invoices)), 2) }}
@if(count($this->payments) > 0)

Payments Received

@foreach($this->payments as $payment) @endforeach
Payment # Date Method Reference Amount
{{ $payment['payment_number'] }} {{ \Carbon\Carbon::parse($payment['payment_date'])->format('M d, Y') }} {{ ucfirst(str_replace('_', ' ', $payment['payment_method'])) }} {{ $payment['transaction_reference'] ?? '-' }} KES {{ number_format($payment['amount'], 2) }}
@endif @endif