fix payments

This commit is contained in:
root
2026-07-08 23:30:16 -04:00
parent 6e8da3cc2c
commit ed11cccecc
15 changed files with 959 additions and 132 deletions
+5 -4
View File
@@ -350,19 +350,20 @@ if ($returnUrl === '') {
<table class="table table-sm table-striped table-hover align-middle fc-table-stack">
<thead class="table-light">
<tr>
<th>Invoice</th><th>Amount</th><th>Balance</th><th>Method</th><th>Date</th><th>Status</th>
<th>Invoice</th><th>Amount</th><th>Invoice Balance</th><th>Method</th><th>Date</th><th>Payment Status</th><th>Invoice Status</th>
</tr>
</thead>
<tbody>
<?php $imap = $f['invoice_map'] ?? []; ?>
<?php foreach ($f['payments'] as $p): ?>
<tr>
<td data-label="Invoice"><?php $iid = (int)($p['invoice_id'] ?? 0); echo esc($imap[$iid] ?? ('#'.$iid)); ?></td>
<td data-label="Invoice"><?php $iid = (int)($p['invoice_id'] ?? 0); echo esc($p['invoice_number'] ?? $imap[$iid] ?? ('#'.$iid)); ?></td>
<td data-label="Amount">$<?= number_format((float)($p['paid_amount'] ?? 0), 2) ?></td>
<td data-label="Balance">$<?= number_format((float)($p['balance'] ?? 0), 2) ?></td>
<td data-label="Invoice Balance">$<?= number_format((float)($p['invoice_current_balance'] ?? 0), 2) ?></td>
<td data-label="Method"><?= esc($p['payment_method'] ?? '') ?></td>
<td data-label="Date"><?= esc(!empty($p['payment_date']) ? local_date($p['payment_date'], 'm-d-Y') : '') ?></td>
<td data-label="Status"><?= esc($p['status'] ?? '') ?></td>
<td data-label="Payment Status"><?= esc($p['payment_status'] ?? '') ?></td>
<td data-label="Invoice Status"><?= esc($p['invoice_status'] ?? '') ?></td>
</tr>
<?php endforeach; ?>
</tbody>
+5 -4
View File
@@ -263,19 +263,20 @@
<table class="table table-sm table-striped table-hover align-middle">
<thead class="table-light">
<tr>
<th>Invoice</th><th>Amount</th><th>Balance</th><th>Method</th><th>Date</th><th>Status</th>
<th>Invoice</th><th>Amount</th><th>Invoice Balance</th><th>Method</th><th>Date</th><th>Payment Status</th><th>Invoice Status</th>
</tr>
</thead>
<tbody>
<?php $imap = $f['invoice_map'] ?? []; ?>
<?php foreach ($f['payments'] as $p): ?>
<tr>
<td><?php $iid = (int)($p['invoice_id'] ?? 0); echo esc($imap[$iid] ?? ('#'.$iid)); ?></td>
<td><?php $iid = (int)($p['invoice_id'] ?? 0); echo esc($p['invoice_number'] ?? $imap[$iid] ?? ('#'.$iid)); ?></td>
<td>$<?= number_format((float)($p['paid_amount'] ?? 0), 2) ?></td>
<td>$<?= number_format((float)($p['balance'] ?? 0), 2) ?></td>
<td>$<?= number_format((float)($p['invoice_current_balance'] ?? 0), 2) ?></td>
<td><?= esc($p['payment_method'] ?? '') ?></td>
<td><?= esc(!empty($p['payment_date']) ? local_date($p['payment_date'], 'm-d-Y') : '') ?></td>
<td><?= esc($p['status'] ?? '') ?></td>
<td><?= esc($p['payment_status'] ?? '') ?></td>
<td><?= esc($p['invoice_status'] ?? '') ?></td>
</tr>
<?php endforeach; ?>
</tbody>
+9 -5
View File
@@ -21,15 +21,17 @@
<th>Date</th>
<th>Invoice</th>
<th class="text-end">Paid</th>
<th class="text-end">Balance</th>
<th class="text-end">Invoice Balance</th>
<th>Method</th>
<th>Status</th>
<th>Payment Status</th>
<th>Invoice Status</th>
<th>School Year</th>
</tr>
</thead>
<tbody>
<?php if (empty($payments)): ?>
<tr>
<td colspan="6" class="text-center text-muted py-4">No payment</td>
<td colspan="8" class="text-center text-muted py-4">No payment</td>
</tr>
<?php else: ?>
<?php foreach ($payments as $p): ?>
@@ -40,9 +42,11 @@
<?= $inv !== '' ? esc($inv) : ('#' . (int)($p['invoice_id'] ?? 0)) ?>
</td>
<td class="text-end">$<?= number_format((float)($p['paid_amount'] ?? 0), 2) ?></td>
<td class="text-end">$<?= number_format((float)($p['balance'] ?? 0), 2) ?></td>
<td class="text-end">$<?= number_format((float)($p['invoice_current_balance'] ?? 0), 2) ?></td>
<td><?= esc($p['payment_method'] ?? '') ?></td>
<td><?= esc($p['status'] ?? '') ?></td>
<td><?= esc($p['payment_status'] ?? '') ?></td>
<td><?= esc($p['invoice_status'] ?? '') ?></td>
<td><?= esc($p['school_year'] ?? '') ?></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
+7 -5
View File
@@ -219,11 +219,12 @@
<tr>
<th>Paid Date</th>
<th>Paid Amount</th>
<th>Balance</th>
<th>Invoice Balance</th>
<th>Payment Method</th>
<th>Check Number</th>
<th>Installments</th>
<th>Status</th>
<th>Payment Status</th>
<th>Invoice Status</th>
<th>Check/Card File</th>
<th>Action</th>
</tr>
@@ -242,7 +243,7 @@
?>
<td><?= esc($paidAt) ?></td>
<td>$<?= number_format((float)($payment['paid_amount'] ?? 0), 2) ?></td>
<td>$<?= number_format((float)($payment['balance'] ?? 0), 2) ?></td>
<td>$<?= number_format((float)($payment['invoice_current_balance'] ?? 0), 2) ?></td>
<td>
<?php if ($method === 'cash'): ?>
<span class="badge" style="background-color:#28a745;color:#fff;">Cash</span>
@@ -255,8 +256,9 @@
<?php endif; ?>
</td>
<td><?= !empty($payment['check_number']) ? esc($payment['check_number']) : '-' ?></td>
<td><?= esc($payment['number_of_installments'] ?? '') ?></td>
<td><?= esc($payment['status'] ?? '') ?></td>
<td><?= esc($payment['installment_seq'] ?? $payment['number_of_installments'] ?? '') ?></td>
<td><?= esc($payment['payment_status'] ?? '') ?></td>
<td><?= esc($payment['invoice_status'] ?? '') ?></td>
<td>
<?php if (!empty($payment['check_file'])): ?>
<a href="#" data-bs-toggle="modal" data-bs-target="#checkModal<?= (int)$payment['id'] ?>">View</a> /
+10 -6
View File
@@ -19,25 +19,29 @@
<th>Date</th>
<th>Invoice #</th>
<th class="text-end">Paid Amount</th>
<th class="text-end">Balance</th>
<th class="text-end">Invoice Balance</th>
<th>Method</th>
<th>Status</th>
<th>Payment Status</th>
<th>Invoice Status</th>
<th>School Year</th>
</tr>
</thead>
<tbody>
<?php if (empty($payments)): ?>
<tr>
<td colspan="6" class="text-center text-muted py-4">No payment</td>
<td colspan="8" class="text-center text-muted py-4">No payment</td>
</tr>
<?php else: ?>
<?php foreach ($payments as $p): ?>
<tr>
<td><?= esc(!empty($p['payment_date']) ? local_date($p['payment_date'], 'm-d-Y') : '') ?></td>
<td><?= esc($p['invoice_id'] ?? '') ?></td>
<td><?= esc($p['invoice_number'] ?? ('#' . (int)($p['invoice_id'] ?? 0))) ?></td>
<td class="text-end">$<?= number_format((float)($p['paid_amount'] ?? 0), 2) ?></td>
<td class="text-end">$<?= number_format((float)($p['balance'] ?? 0), 2) ?></td>
<td class="text-end">$<?= number_format((float)($p['invoice_current_balance'] ?? 0), 2) ?></td>
<td><?= esc($p['payment_method'] ?? '') ?></td>
<td><?= esc($p['status'] ?? '') ?></td>
<td><?= esc($p['payment_status'] ?? '') ?></td>
<td><?= esc($p['invoice_status'] ?? '') ?></td>
<td><?= esc($p['school_year'] ?? '') ?></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>