Payment: {{ $supplierPayment->payment_number }}

@if ($supplierPayment->status === 'draft') @can('supplier-payment-edit') Edit @endcan @can('supplier-payment-post')
@csrf
@endcan @can('supplier-payment-delete') @endcan @elseif ($supplierPayment->status === 'posted') @can('supplier-payment-reverse')
@csrf
@endcan @endif
@push('header') @endpush

{{ config('app.name') }}
Supplier Payment Voucher
Printed by: {{ auth()->user()->name }} | {{ now()->format('d-M-Y h:i A') }}

@if ($supplierPayment->bankAccount) @endif @if ($supplierPayment->reference_number) @endif @if ($supplierPayment->posted_at) @else @endif @if ($supplierPayment->reversed_at) @endif
Payment #: {{ $supplierPayment->payment_number }} Payment Date: {{ \Carbon\Carbon::parse($supplierPayment->payment_date)->format('d M Y') }}
Supplier: {{ $supplierPayment->supplier->supplier_name }} Status: {{ ucfirst($supplierPayment->status) }}
Payment Method: {{ ucfirst(str_replace('_', ' ', $supplierPayment->payment_method)) }} Amount: ₨ {{ number_format($supplierPayment->amount, 2) }}
Bank Account: {{ $supplierPayment->bankAccount->account_name }} Account #: {{ $supplierPayment->bankAccount->account_number }}
Reference #: {{ $supplierPayment->reference_number }}
Created By: {{ $supplierPayment->createdBy->name ?? 'N/A' }} {{ $supplierPayment->created_at->format('d M Y H:i') }} Posted By: {{ $supplierPayment->postedBy->name ?? 'N/A' }} {{ $supplierPayment->posted_at->format('d M Y H:i') }}
Reversed By: {{ $supplierPayment->reversedBy->name ?? 'N/A' }} {{ $supplierPayment->reversed_at->format('d M Y H:i') }}
@if ($supplierPayment->description)
Description: {{ $supplierPayment->description }}
@endif {{-- GRN Allocations --}} @if ($supplierPayment->grnAllocations->count() > 0)

GRN Allocations

@foreach ($supplierPayment->grnAllocations as $allocation) @endforeach
GRN Number GRN Date GRN Amount Allocated Amount
{{ $allocation->grn->grn_number }} {{ \Carbon\Carbon::parse($allocation->grn->receipt_date)->format('d M Y') }} {{ number_format($allocation->grn->grand_total, 2) }} {{ number_format($allocation->allocated_amount, 2) }}
Total Allocated ₨ {{ number_format($supplierPayment->grnAllocations->sum('allocated_amount'), 2) }}
@else

GRN Allocations

No GRN allocations found for this payment.

@endif {{-- Journal Entry --}} @if ($supplierPayment->journalEntry)

Journal Entry Details

Entry: {{ $supplierPayment->journalEntry->entry_number }} | Date: {{ \Carbon\Carbon::parse($supplierPayment->journalEntry->entry_date)->format('d M Y') }}

@foreach ($supplierPayment->journalEntry->details->sortBy('line_no') as $detail) @endforeach
Account Description Debit Credit
{{ $detail->account->account_code }}
{{ $detail->account->account_name }}
{{ $detail->description }} @if ($detail->debit > 0) {{ number_format($detail->debit, 2) }} @else — @endif @if ($detail->credit > 0) {{ number_format($detail->credit, 2) }} @else — @endif
Totals ₨ {{ number_format($supplierPayment->journalEntry->details->sum('debit'), 2) }} ₨ {{ number_format($supplierPayment->journalEntry->details->sum('credit'), 2) }}
@endif