@extends('layouts.portal')
@php
$status = $invoice->status;
$eff = $invoice->effectiveStatus();
$bal = $invoice->balance();
$pct = (float) $invoice->total > 0 ? min(100, round($invoice->amount_paid / $invoice->total * 100)) : 0;
$isVoid = $status === 'void';
$canPay = ! $isVoid && $bal > 0;
$enr = $invoice->enrollment;
$thr = rtrim(rtrim(number_format($threshold, 2), '0'), '.');
$pendingPay = $invoice->payments->where('status', 'pending');
$payLink = route('invoices.show', $invoice->token);
@endphp
@section('title', 'Invoice '.$invoice->number)
@section('subtitle', $invoice->customer_name.($invoice->company ? ' · '.$invoice->company : '').' · due '.($invoice->due_date?->format('d M Y') ?? '—'))
@section('actions')
The invoice will stop counting as billed or outstanding and the customer's pay link will refuse payments. This cannot be undone.
The customer is emailed the reason and can submit a new proof from their invoice page.
Marks receipt {{ $p->receipt_no }} as refunded and recalculates the invoice balance. Money is not moved automatically — return it to the customer yourself.