Agregada fila de suma mensual en reporte de pagos y PDF

This commit is contained in:
Administrador Ibiza
2025-12-29 23:53:46 -06:00
parent 5289fd4133
commit d20a51197d
7 changed files with 36 additions and 1629 deletions

View File

@@ -53,6 +53,8 @@
<?php
$grandTotal = 0;
$grandTotalExpected = 0;
$monthTotals = array_fill_keys($months, 0);
foreach ($houses as $house):
$total = 0;
$totalExpected = 0;
@@ -63,6 +65,8 @@
<?php foreach ($months as $month):
$payment = $payments[$month][$house['id']] ?? null;
$amount = $payment['amount'] ?? 0;
$monthTotals[$month] += $amount;
$expected = Payment::getExpectedAmount($house, $year, $month);
$total += $amount;
$totalExpected += $expected;
@@ -95,6 +99,15 @@
<td><strong>$<?= number_format($total, 2) ?></strong></td>
</tr>
<?php endforeach; ?>
<tr style="background-color: #bee5eb;">
<td colspan="2" style="text-align: right; font-weight: bold;">SUMA MENSUAL:</td>
<?php foreach ($months as $month): ?>
<td style="text-align: center; font-weight: bold;">
$<?= number_format($monthTotals[$month], 2) ?>
</td>
<?php endforeach; ?>
<td colspan="2"></td>
</tr>
<?php
$grandDifference = $grandTotal - $grandTotalExpected;
$grandDiffClass = $grandDifference < 0 ? 'text-danger' : 'text-success';