Agregada fila de suma mensual en reporte de pagos y PDF
This commit is contained in:
@@ -61,6 +61,8 @@
|
||||
<?php
|
||||
$grandTotal = 0;
|
||||
$grandTotalExpected = 0;
|
||||
$monthTotals = array_fill_keys($months, 0);
|
||||
|
||||
foreach ($houses as $house):
|
||||
$total = 0;
|
||||
$totalExpected = 0;
|
||||
@@ -78,6 +80,8 @@
|
||||
<?php foreach ($months as $month):
|
||||
$payment = $payments[$month][$house['id']] ?? null;
|
||||
$amount = $payment['amount'] ?? 0;
|
||||
$monthTotals[$month] += $amount; // Accumulate monthly total
|
||||
|
||||
$expected = Payment::getExpectedAmount($house, $year, $month);
|
||||
$total += $amount;
|
||||
$totalExpected += $expected;
|
||||
@@ -128,6 +132,15 @@
|
||||
<td class="text-end fw-bold">$<?= number_format($total, 2) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<tr class="table-info">
|
||||
<td colspan="2" class="text-end fw-bold">SUMA MENSUAL:</td>
|
||||
<?php foreach ($months as $month): ?>
|
||||
<td class="text-center fw-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';
|
||||
@@ -216,6 +229,16 @@
|
||||
<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>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user