extend('layout/management_layout') ?> section('content') ?>

Refunds

'$' . number_format(((int) $cents) / 100, 2); $dateOnly = static function($dt) { if (empty($dt) || $dt === '0000-00-00 00:00:00') return '-'; return local_date($dt, 'm-d-Y'); }; $normalizeRefundStatus = static function($status): string { $key = strtolower(str_replace(' ', '_', trim((string) $status))); if ($key === 'requested') return 'pending'; if ($key === 'partially_paid') return 'partial'; return $key !== '' ? $key : 'pending'; }; $summary = [ 'reviews' => count($withdrawalReviews), 'approval' => 0, 'payment' => 0, 'complete' => 0, ]; foreach ($refunds as $refund) { $key = $normalizeRefundStatus($refund['status'] ?? ''); $isWithdrawalRefund = (string)($refund['source_type'] ?? '') === 'tuition_withdrawal'; $amount = (float) ($refund['refund_amount'] ?? 0); $paid = (float) ($refund['refund_paid_amount'] ?? 0); $remaining = max(0, $amount - $paid); if ($key === 'pending' && !$isWithdrawalRefund) { $summary['approval']++; } elseif (in_array($key, ['approved', 'partial'], true) && $remaining > 0) { $summary['payment']++; } elseif (in_array($key, ['paid', 'rejected'], true)) { $summary['complete']++; } } ?> getFlashdata('success')): ?>
getFlashdata('success') ?>
getFlashdata('error')): ?>
getFlashdata('error') ?>
getFlashdata('info')): ?>
getFlashdata('info') ?>
Withdrawal reviews
Need approval
Ready to pay
Closed
Withdrawal Review Queue pending
Parent Student Invoice # Requested Expected Refund Balance Due Status Actions
Calculated

Refund Queue

'Pending', 'approved' => 'Approved', 'rejected' => 'Rejected', 'partial' => 'Partial', 'paid' => 'Paid', ][$statusKey] ?? ($statusRaw !== '' ? $statusRaw : 'Pending'); $statusClass = [ 'pending' => 'warning text-dark', 'approved' => 'primary', 'rejected' => 'danger', 'partial' => 'info text-dark', 'paid' => 'success', ][$statusKey] ?? 'secondary'; $refundAmount = (float)($r['refund_amount'] ?? 0); $paidAmount = (float)($r['refund_paid_amount'] ?? 0); $remainingAmount = max(0, $refundAmount - $paidAmount); $hasSource = !empty($r['source_type']) && !empty($r['source_id']); $isWithdrawalRefund = (string)($r['source_type'] ?? '') === 'tuition_withdrawal'; $canApprove = !$isWithdrawalRefund && $statusKey === 'pending' && $refundAmount > 0 && $hasSource; $canReject = !$isWithdrawalRefund && $statusKey === 'pending'; $canRecord = in_array($statusKey, ['approved', 'partial'], true) && $remainingAmount > 0; $nextStep = 'Closed'; if ($statusKey === 'pending') { $nextStep = $isWithdrawalRefund ? 'Approved by withdrawal review' : ($canApprove ? 'Needs approval' : 'Needs review'); } elseif ($canRecord) { $nextStep = 'Ready to pay'; } elseif ($statusKey === 'paid') { $nextStep = 'Paid'; } elseif ($statusKey === 'rejected') { $nextStep = 'Rejected'; } ?>
Parent Invoice # Amount Status Payment Actions
$
by
Paid: $
Remaining: $
Check #:
Check File: View -
No action
endSection() ?> section('scripts') ?> endSection() ?>