@if (session()->has('success'))
{{ session('success') }}
@endif @if (session()->has('error'))
{{ session('error') }}
@endif

Payment Details

Invoice #{{ $invoice->invoice_number }}

Customer Details

{{ $invoice->customer->name }}

{{ $invoice->customer->phone }}

@if($invoice->customer->address)

{{ $invoice->customer->address }}

@endif

Invoice Details

Date: {{ $invoice->invoice_date->format('M d, Y') }}

Type: {{ ucfirst($invoice->invoice_type) }}

@if($customer_old_balance > 0)

Previous Outstanding Balance

₹{{ number_format($customer_old_balance, 2) }}

This customer has {{ count($old_invoices) }} pending invoice(s)

@foreach($old_invoices as $old_inv) @endforeach
Invoice # Date Total Balance Due Status
{{ $old_inv['invoice_number'] }} {{ $old_inv['invoice_date'] }} ₹{{ number_format($old_inv['total'], 2) }} ₹{{ number_format($old_inv['balance_amount'], 2) }} {{ ucfirst($old_inv['payment_status']) }}
Total Outstanding: ₹{{ number_format($customer_old_balance, 2) }}

💡 Tip: Any payment over the current invoice amount will be automatically applied to these old invoices (oldest first)

@endif
@if($customer_old_balance > 0)

Previous Balance

₹{{ number_format($customer_old_balance, 2) }}

@endif

Current Invoice

₹{{ number_format($invoice->total, 2) }}

@if($customer_old_balance > 0)

Total Amount Due

₹{{ number_format($total_amount_due, 2) }}

@endif

Enter Payment Information

@error('bank_payment') {{ $message }} @enderror
@error('cash_payment') {{ $message }} @enderror

Payment Breakdown

Bank + Cash: ₹{{ number_format($paid_amount, 2) }}
→ Applied to Current Invoice: ₹{{ number_format($payment_to_current_invoice, 2) }}
@if($customer_old_balance > 0)
→ Applied to Old Balance: ₹{{ number_format($payment_to_old_balance, 2) }}
@endif
Current Invoice Balance: ₹{{ number_format($balance_amount, 2) }}
@if($customer_old_balance > 0)
Remaining Total Outstanding: ₹{{ number_format($customer_old_balance + $balance_amount - $payment_to_old_balance, 2) }}
@endif
Payment Status: {{ ucfirst($payment_status) }}
@if($customer_old_balance > 0) @endif
Cancel