@extends('layouts.school') @section('title', 'Invoice ' . $invoice->invoice_no) @section('header', 'Invoice: ' . $invoice->invoice_no) @php $balance = round((float) $invoice->amount - (float) $invoice->discount - (float) $invoice->total_paid, 2); $canRecord = auth()->guard('school')->user()?->hasPermission('record_payments'); @endphp @section('content')
← Back to invoices @unless ($invoice->isCancelled()) @if (auth()->guard('school')->user()?->hasPermission('apply_adjustments') || auth()->guard('school')->user()?->role === 'school_admin')
@csrf
@endif @endunless
Student
{{ $invoice->student?->full_name ?? '—' }}
Class
{{ optional($invoice->student?->class)->name ?? '—' }}
Period
{{ $invoice->academicYear?->name }}{{ $invoice->term ? ' · ' . $invoice->term->name : '' }}
Due Date
{{ $invoice->due_date->format('d M Y') }}
Amount
₦{{ number_format($invoice->amount, 0) }}
Discounts & Waivers
₦{{ number_format($invoice->discount, 0) }}
Total Paid
₦{{ number_format($invoice->total_paid, 0) }}
Balance
₦{{ number_format($balance, 0) }}
{{-- Line items --}}

Line Items

@forelse ($invoice->items as $item) @empty @endforelse
{{ $item->description }}{{ optional($item->feeCategory)->name }} ×{{ $item->quantity }} ₦{{ number_format($item->amount, 0) }} @if (!$invoice->isCancelled && (float) $invoice->total_paid == 0 && (auth()->guard('school')->user()?->hasPermission('create_invoices') || auth()->guard('school')->user()?->hasPermission('manage_fee_structures')))
@csrf
@endif
Legacy single-line invoice
@if (!$invoice->isCancelled() && $canRecord)
+ Add line item
@csrf
@endif

Status

{{ ucfirst($invoice->status) }}
@if ($credits->isNotEmpty())
Credit balance available: ₦{{ number_format($credits->sum('remaining'), 0) }} @if (!$invoice->isCancelled() && $balance > 0 && $canRecord)
@csrf
@endif
@endif @if (!$invoice->isCancelled() && (auth()->guard('school')->user()?->hasPermission('apply_adjustments') || auth()->guard('school')->user()?->role === 'school_admin'))
Apply Discount / Waiver
@csrf
@endif
@if(!$invoice->isCancelled() && $canRecord)

Record Payment

@csrf

Bank transfers/cheques may require verification before they count as paid (see Finance Settings). Overpayments become student credit.

@endif @if($invoice->payments->count())

Payment History

@foreach($invoice->payments as $p) @php $reversible = in_array($p->status, ['confirmed','verified','reconciled']) && !$p->reversed_at; @endphp @endforeach
DateMethodReceiptStatusAmountActions
{{ $p->payment_date->format('d M Y') }} {{ str_replace('_', ' ', $p->payment_method) }}{{ $p->payer_name }} {{ $p->receipt_no ?? '—' }} {{ str_replace('_', ' ', $p->status) }} @if($p->reversed_at) (reversed) @endif @if($p->rejection_reason) {{ $p->rejection_reason }} @endif ₦{{ number_format($p->amount, 0) }} @if((float)$p->refunded_amount > 0) −₦{{ number_format($p->refunded_amount, 0) }} refunded @endif @if ($reversible && (auth()->guard('school')->user()?->hasPermission('refund_payments'))) Refund @endif
@endif @if($invoice->adjustments->count())

Discounts & Adjustments

@foreach($invoice->adjustments as $adj) @endforeach
TypeReasonAmountStatus
{{ \App\Models\FinanceAdjustment::TYPES[$adj->type] ?? $adj->type }} ({{ $adj->basis === 'percentage' ? $adj->value . '%' : '₦' . number_format($adj->value, 0) }}) {{ $adj->reason ?? '—' }} −₦{{ number_format($adj->amount, 0) }} {{ $adj->isReversed() ? 'reversed' : 'active' }}
@endif @endsection