add refund logic and fix books inventory logic
Deploy to Shared Hosting / Shared hosting deploy (push) Failing after 47s
Tests / PHPUnit (push) Failing after 1m20s

This commit is contained in:
root
2026-08-22 13:44:25 -04:00
parent 23d1cbb64c
commit d906a915d6
45 changed files with 4711 additions and 442 deletions
@@ -13,6 +13,8 @@
$blockers = $preview['blockers'] ?? [];
$warnings = $preview['warnings'] ?? [];
$carryForward = $preview['carry_forward'] ?? [];
$inventory = $preview['inventory'] ?? ['rows' => [], 'summary' => []];
$inventoryRows = $inventory['rows'] ?? [];
$carryForwardTotal = array_reduce(
$carryForward,
static fn (float $total, array $row): float => $total + (float) ($row['carry_forward_amount'] ?? 0),
@@ -344,6 +346,44 @@
</div>
<div class="border rounded bg-white p-3 mb-4" id="carry-forward-table">
<h5>Book Inventory Reconciliation</h5>
<div class="table-responsive mb-4">
<table class="table table-sm align-middle no-mgmt-sticky" data-no-mgmt-sticky>
<thead>
<tr>
<th>Book</th>
<th class="text-end">Opening</th>
<th class="text-end">Net Movements</th>
<th class="text-end">System Closing</th>
<th class="text-end">Physical Count</th>
<th class="text-end">Variance</th>
<th class="text-end">Charge Price</th>
<th class="text-end">Target Opening</th>
</tr>
</thead>
<tbody>
<?php foreach ($inventoryRows as $row): ?>
<tr>
<td>
<div><?= esc($row['item_name'] ?? '') ?></div>
<div class="text-muted small"><?= esc(trim((string)($row['isbn'] ?? '') . ' ' . (string)($row['edition'] ?? ''))) ?></div>
</td>
<td class="text-end"><?= (int) ($row['opening_quantity'] ?? 0) ?></td>
<td class="text-end"><?= (int) ($row['movement_total'] ?? 0) ?></td>
<td class="text-end"><?= (int) ($row['system_closing_quantity'] ?? 0) ?></td>
<td class="text-end"><?= ($row['counted_closing_quantity'] ?? null) === null ? 'Missing' : (int) $row['counted_closing_quantity'] ?></td>
<td class="text-end"><?= ($row['variance_quantity'] ?? null) === null ? '-' : (int) $row['variance_quantity'] ?></td>
<td class="text-end">$<?= number_format(((int) ($row['charge_price_cents'] ?? 0)) / 100, 2) ?></td>
<td class="text-end"><?= (int) ($row['target_opening_quantity'] ?? 0) ?></td>
</tr>
<?php endforeach; ?>
<?php if ($inventoryRows === []): ?>
<tr><td colspan="8" class="text-muted">No book inventory item-year rows found for this source year.</td></tr>
<?php endif; ?>
</tbody>
</table>
</div>
<h5>Carry-Forward Families</h5>
<div class="table-responsive">
<table id="carryForwardFamiliesTable" class="table table-sm align-middle no-mgmt-sticky" data-no-mgmt-sticky>