@extends('layouts.app') @section('title', __('Customer Receipts')) @section('content')
{{ __('Customer Receipts') }}
{{ __('Add') }}
@forelse($receipts as $receipt) @php($openingAmount = max(0, (float) $receipt->amount - (float) $receipt->allocations->sum('amount'))) @php($invoiceLabel = $receipt->allocations->count() > 1 ? __('Multiple invoices') : ($receipt->invoice?->invoice_number ?? $receipt->allocations->first()?->invoice?->invoice_number ?? ($openingAmount > 0 ? __('Opening Balance') : '-'))) @if($openingAmount > 0)@endif @if($receipt->allocations->isNotEmpty())@endif @empty @endforelse
{{ __('Date') }}{{ __('Receipt No.') }}{{ __('Customer') }}{{ __('Invoice') }}{{ __('Method') }}{{ __('Amount') }}{{ __('Actions') }}
{{ $receipt->payment_date->format('Y-m-d') }}RC-{{ str_pad($receipt->id,5,'0',STR_PAD_LEFT) }}{{ $receipt->customer?->name ?? __('Walk-in Customer') }}{{ $invoiceLabel }}{{ __(ucfirst($receipt->method)) }}{{ number_format($receipt->amount,2) }} {{ $receipt->currency_code }}
@csrf @method('DELETE')
{{ __('Opening Balance') }}: {{ number_format($openingAmount,2) }}
@foreach($receipt->allocations as $allocation){{ $allocation->invoice?->invoice_number }}: {{ number_format($allocation->amount,2) }}@endforeach
{{ __('No receipts yet.') }}
{{ $receipts->links() }}
@endsection