Finalización del módulo Luz Cámara: Corrección de errores JS, exportación profesional a PDF y reportes de deudores
This commit is contained in:
123
views/reports/pdf_electricity_debtors.php
Executable file
123
views/reports/pdf_electricity_debtors.php
Executable file
@@ -0,0 +1,123 @@
|
||||
<style>
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 8pt;
|
||||
}
|
||||
|
||||
th,
|
||||
td {
|
||||
border: 1px solid #000;
|
||||
padding: 4px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
th {
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
.print-title {
|
||||
text-align: center;
|
||||
font-size: 14pt;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.print-date {
|
||||
text-align: right;
|
||||
font-size: 8pt;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.text-danger {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.text-warning {
|
||||
color: orange;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="print-title">Condominio IBIZA-Cto Sierra Morena 152 - Reporte de Deudores de Luz - Energía Cámara</div>
|
||||
<div class="print-date">Fecha de generación:
|
||||
<?= date('d/m/Y H:i')?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$hasFilters = !empty($electricityDebtors['filters']['year']) || !empty($electricityDebtors['filters']['periods']) || !empty($electricityDebtors['filters']['house_id']);
|
||||
$filterText = [];
|
||||
if (!empty($electricityDebtors['filters']['year'])) {
|
||||
$filterText[] = "Año: " . $electricityDebtors['filters']['year'];
|
||||
}
|
||||
if (!empty($electricityDebtors['filters']['periods'])) {
|
||||
$filterText[] = "Periodos: " . implode(', ', $electricityDebtors['filters']['periods']);
|
||||
}
|
||||
if (!empty($electricityDebtors['filters']['house_id'])) {
|
||||
require_once __DIR__ . '/../../models/House.php';
|
||||
$house = House::findById($electricityDebtors['filters']['house_id']);
|
||||
$filterText[] = "Casa: " . ($house['number'] ?? 'N/A');
|
||||
}
|
||||
if ($hasFilters):
|
||||
?>
|
||||
<div style="font-size: 9pt; margin-bottom: 10px;">
|
||||
<strong>Filtros aplicados:</strong>
|
||||
<?= implode(' | ', $filterText)?>
|
||||
</div>
|
||||
<?php
|
||||
endif; ?>
|
||||
|
||||
<?php if (empty($electricityDebtors['debtors'])): ?>
|
||||
<p>No hay deudores de luz registrados con los filtros actuales.</p>
|
||||
<?php
|
||||
else: ?>
|
||||
<table>
|
||||
<thead>
|
||||
<tr style="background-color: #ffc107;">
|
||||
<th>Casa</th>
|
||||
<th>Propietario</th>
|
||||
<th>Periodos Adeudados</th>
|
||||
<th>Total Debe</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($electricityDebtors['debtors'] as $debtor): ?>
|
||||
<tr>
|
||||
<td><strong>
|
||||
<?= $debtor['house_number']?>
|
||||
</strong></td>
|
||||
<td>
|
||||
<?= htmlspecialchars($debtor['owner_name'] ?? '-')?>
|
||||
</td>
|
||||
<td>
|
||||
<table style="width:100%; border: none;">
|
||||
<?php foreach ($debtor['periods_due'] as $period): ?>
|
||||
<tr>
|
||||
<td style="border: none; text-align: left;">
|
||||
<?= $period['year']?> -
|
||||
<?= $period['period']?>
|
||||
</td>
|
||||
<td style="border: none; text-align: right;">$
|
||||
<?= number_format($period['due'], 2)?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
endforeach; ?>
|
||||
</table>
|
||||
</td>
|
||||
<td class="text-end fw-bold text-danger">$
|
||||
<?= number_format($debtor['total_due'], 2)?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
endforeach; ?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr style="background-color: #343a40; color: #fff;">
|
||||
<th colspan="3" style="text-align: right;">TOTAL GENERAL:</th>
|
||||
<th style="text-align: right;">$
|
||||
<?= number_format($electricityDebtors['total_due'], 2)?>
|
||||
</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
<?php
|
||||
endif; ?>
|
||||
Reference in New Issue
Block a user