Files
root d906a915d6
Deploy to Shared Hosting / Shared hosting deploy (push) Failing after 47s
Tests / PHPUnit (push) Failing after 1m20s
add refund logic and fix books inventory logic
2026-08-22 13:44:25 -04:00

17 lines
3.5 KiB
PHP

<?= $this->extend('layout/management_layout') ?>
<?= $this->section('content') ?>
<?php $c = $calculation ?? []; $money = static fn ($v): string => '$' . number_format(((int) $v) / 100, 2); ?>
<div class="container py-4">
<div class="d-flex justify-content-between align-items-center mb-3"><div><h2 class="mb-1">Withdrawal Calculation #<?= (int) ($c['id'] ?? 0) ?></h2><div class="text-muted">Version <?= (int) ($c['version'] ?? 0) ?> · <?= esc($c['status'] ?? '') ?> · <?= esc($c['student_firstname'] ?? '') ?> <?= esc($c['student_lastname'] ?? '') ?></div></div><a class="btn btn-outline-secondary" href="<?= site_url('administrator/withdrawals/' . (int) ($c['enrollment_id'] ?? 0) . '/review') ?>">Review</a></div>
<?php if (session()->getFlashdata('success')): ?><div class="alert alert-success"><?= esc(session()->getFlashdata('success')) ?></div><?php endif; ?>
<?php if (!empty($c['blockers'])): ?><div class="alert alert-danger"><ul class="mb-0"><?php foreach ($c['blockers'] as $b): ?><li><?= esc($b) ?></li><?php endforeach; ?></ul></div><?php endif; ?>
<div class="card mb-3"><div class="card-body"><div class="row g-3">
<?php foreach ([
'Annual allocation'=>'annual_fee_allocation_cents','Issued books'=>'issued_book_charge_cents','Instruction component'=>'annual_instruction_cents','Earned tuition'=>'earned_tuition_cents','Retained charge'=>'retained_charge_cents','Original invoice charge'=>'original_invoice_charge_cents','Invoice adjustment'=>'invoice_adjustment_cents','Adjusted invoice charge'=>'adjusted_invoice_charge_cents','Valid payments'=>'valid_payment_cents','Completed payouts'=>'completed_payout_cents','Open reservations'=>'open_reservation_cents','Refundable credit'=>'refundable_credit_cents','New refund request'=>'new_refund_request_cents','Balance due'=>'balance_due_cents'
] as $label=>$field): ?><div class="col-md-3"><div class="text-muted small"><?= esc($label) ?></div><div class="fw-semibold"><?= $money($c[$field] ?? 0) ?></div></div><?php endforeach; ?>
</div></div></div>
<div class="card mb-3"><div class="card-header fw-semibold">Policy snapshot</div><div class="card-body"><dl class="row mb-0"><dt class="col-sm-4">Dates</dt><dd class="col-sm-8"><?= esc($c['school_year_start_date'] ?? '') ?> / <?= esc($c['enrollment_date'] ?? '') ?> / <?= esc($c['withdrawal_request_date'] ?? '') ?></dd><dt class="col-sm-4">Studied</dt><dd class="col-sm-8"><?= (int) ($c['studied_calendar_days'] ?? 0) ?> calendar day(s), rounded to <?= (int) ($c['studied_weeks'] ?? 0) ?> week(s), of <?= (int) ($c['total_instructional_weeks'] ?? 0) ?></dd><dt class="col-sm-4">Policy</dt><dd class="col-sm-8"><?= esc($c['policy_version'] ?? '') ?>; annual tuition includes books; no no-school subtraction; no book returns</dd><dt class="col-sm-4">Override reason</dt><dd class="col-sm-8"><?= esc($c['override_reason'] ?? '—') ?></dd></dl></div></div>
<div class="card"><div class="card-header fw-semibold">Book price snapshots</div><div class="table-responsive"><table class="table table-sm mb-0"><thead><tr><th>Issue</th><th>Book</th><th>Date</th><th>Status</th><th>Price</th><th>Total</th></tr></thead><tbody><?php foreach ((array) ($c['books'] ?? []) as $book): ?><tr><td>#<?= (int) ($book['id'] ?? 0) ?></td><td><?= esc($book['book_name'] ?? '') ?></td><td><?= esc($book['issued_at'] ?? '') ?></td><td><?= esc($book['status'] ?? '') ?></td><td><?= $money($book['unit_charge_price_cents'] ?? 0) ?></td><td><?= $money($book['total_charge_cents'] ?? 0) ?></td></tr><?php endforeach; ?></tbody></table></div></div>
</div>
<?= $this->endSection() ?>