@php use App\Support\InvoiceDisplayFormatter as F; // Receipt reuses the SHARED invoice document design system // (doc-page, doc-header, doc-info, doc-items, doc-totals-wrap, etc.) // so every bordered box lines up exactly with the invoice — same // width, same borders, same typography, same single centred // watermark. Only the section semantics differ: // • Hero says PAYMENT RECEIPT + receipt number + PAID badge // • Info grid: Received From (student/parent/contact) + Payment // Details (receipt #, invoice #, date, method, status) // • Line table: one row per payment (Description · Method · Amount) // • Totals: Invoice Total / Previously Paid / This Payment / Total // Paid / Remaining Balance // • Footer: payment thank-you sentence $logoSrc = null; $tryEncode = function ($path) { if (!$path || !is_file($path) || !is_readable($path)) return null; $ext = strtolower(pathinfo($path, PATHINFO_EXTENSION)); $mime = $ext === 'jpg' || $ext === 'jpeg' ? 'image/jpeg' : ($ext === 'gif' ? 'image/gif' : ($ext === 'svg' ? 'image/svg+xml' : 'image/png')); return 'data:' . $mime . ';base64,' . base64_encode(file_get_contents($path)); }; foreach ([ public_path('images/stepup-circular-logo.png'), public_path('images/step-up-logo.png'), public_path('images/logo-round.png'), ] as $candidate) { if ($encoded = $tryEncode($candidate)) { $logoSrc = $encoded; break; } } try { $s = \App\Models\Setting::find(1); } catch (\Throwable $e) { $s = null; } // White-label: strictly use Company Settings + config('company.*'). // Legal name preferred for receipts; fall back to display name. $rawCompanyName = trim((string) ($s->companyName ?? '')); $companyName = $rawCompanyName !== '' ? F::titleCase($rawCompanyName) : trim((string) (config('company.legal') ?: config('company.name', ''))); $companyAddress = $s->companyAddress ?? trim((string) (config('company.address.line1', '') . ' ' . config('company.address.line2', ''))); $companyPhone = $s->companyPhone ?? (string) config('company.phone', ''); $companyEmail = trim((string) ($s->companyEmail ?? config('company.email', ''))); $companyWebsite = $s->companyWebsite ?? (string) config('company.website', ''); $fmtMoney = fn ($v) => '$' . number_format((float) $v, 2); // Data $studentName = F::titleCase((string) ($receipt['student']['name'] ?? '')) ?: '—'; $studentEmail = $receipt['student']['email'] ?? null; $locationName = F::titleCase((string) ($receipt['student']['location'] ?? '')) ?: null; $parentName = F::titleCase((string) ($receipt['parent']['name'] ?? '')) ?: null; $parentEmail = $receipt['parent']['email'] ?? null; $parentRel = $receipt['parent']['relationship'] ?? 'Parent / Guardian'; $receiptNumber = $receipt['receipt_number'] ?? '—'; $invoiceNumber = $receipt['invoice']['number'] ?? '—'; $invoiceTotal = (float) ($receipt['invoice']['total'] ?? 0); $previousPaid = (float) ($receipt['previous_paid'] ?? 0); $thisPayment = (float) ($receipt['amount'] ?? 0); $totalPaid = (float) ($receipt['total_paid'] ?? 0); $remaining = (float) ($receipt['remaining_balance'] ?? 0); $paymentMethod = $receipt['payment_method'] ?? '—'; $paymentDate = $receipt['payment_date'] ? \Carbon\Carbon::parse($receipt['payment_date'])->format('M j, Y') : '—'; $isRenderPdf = ($renderMode ?? 'html') === 'pdf'; @endphp
|
@if($logoSrc)
|
{{ $companyName }}
{{ $companyAddress }}
Tel: {{ $companyPhone }}
·
Email: {{ $companyEmail }}
@if($companyWebsite)
· Web: {{ $companyWebsite }}
@endif
|
|
Payment Receipt
{{ $receiptNumber }}
|
Paid |
|
Received From
Student{{ $studentName }}
@if($parentName)
{{ $parentRel }}{{ $parentName }}
@endif
@if($parentEmail || $studentEmail)
Email{{ $parentEmail ?: $studentEmail }}
@endif
@if($locationName)
Location{{ $locationName }}
@endif
|
Payment Details
Receipt Number{{ $receiptNumber }}
Invoice Number{{ $invoiceNumber }}
Payment Date{{ $paymentDate }}
Payment Method{{ $paymentMethod }}
Payment StatusCompleted
|
| Description | Method | Amount |
|---|---|---|
| Payment received toward invoice {{ $invoiceNumber }} | {{ $paymentMethod }} | {{ $fmtMoney($thisPayment) }} |
|