@extends('layouts.master') @section('title', 'Supplier Statement') @section('styles') @endsection @section('content')
Back to Reports
Supplier Statement
@if($errors->any())
    @foreach($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif
@csrf
@if(count($allStatements) > 0)
@csrf
@foreach($allStatements as $idx => $statement) @php $supplier = $statement['supplier']; $metrics = $statement['metrics']; $register = $statement['invoiceRegister']; $payments = $statement['paymentHistory']; $aged = $statement['agedBalances']; @endphp

Current Balance
${{ number_format($metrics['currentBalance'], 2) }}
Total Invoices
${{ number_format($metrics['totalInvoicesAmount'], 2) }}
Total Payments
${{ number_format($metrics['totalPayments'], 2) }}
Status Counts
{{ $metrics['countPending'] }}/{{ $metrics['countApproved'] }}/{{ $metrics['countPaid'] }}/{{ $metrics['countRejected'] }}
Invoice Register
@forelse($register as $row) @empty @endforelse
Invoice # Date Description Status Total Paid Balance Days
{{ $row['invoice_number'] }} {{ $row['invoice_date'] }} {{ $row['description'] ?: 'N/A' }} {{ $row['status'] }} {{ number_format($row['total'], 2) }} {{ number_format($row['paid'], 2) }} {{ number_format($row['balance'], 2) }} {{ $row['days_outstanding'] }}
No invoices found for this supplier and date range.
Aged 0-30 Days
${{ number_format($aged['0_30'], 2) }}
Aged 31-60 Days
${{ number_format($aged['31_60'], 2) }}
Aged 61+ Days
${{ number_format($aged['61_plus'], 2) }}
Payment History
@forelse($payments as $payment) @empty @endforelse
Date Reference Description Applied To Invoice(s) Amount Unapplied
{{ $payment['date'] }} {{ $payment['reference'] }} {{ $payment['description'] }} {{ count($payment['applied_to']) > 0 ? implode(', ', $payment['applied_to']) : 'Unallocated' }} {{ number_format($payment['amount'], 2) }} {{ number_format($payment['unapplied'], 2) }}
No payments found in this period.
@endforeach
@else
Generate the report to view supplier invoice register, statuses, aged balances, current balance, and payment history.
@endif
@endsection @section('scripts') @endsection