Files
ibiza_sistema/views/reports/pdf_concepts.php
nickpons666 535f7c5963 feat: Agregar filtros avanzados a reporte de Deudores de Conceptos
- Filtros por casas: selección múltiple con opción 'Todas las casas'
- Filtros por conceptos: selección múltiple con opción 'Todos los conceptos'
- Estado inicial: todos los filtros marcados por defecto (muestra toda la info)
- Exportación PDF: incluye solo datos filtrados según selección
- JavaScript interactivo: lógica de checkboxes con estados intermedios
- Modelo actualizado: método getConceptDebtorsFiltered para filtrado avanzado
- Interfaz intuitiva: scrollable containers para listas largas
- Preserva permisos: respeta restricciones de acceso por casas
2026-01-05 16:12:24 -06:00

83 lines
3.4 KiB
PHP
Executable File

<style>
table {
width: 100%;
border-collapse: collapse;
font-size: 9pt;
}
th, td {
border: 1px solid #000;
padding: 4px;
}
th {
background-color: #eee;
}
</style>
<?php
$conceptCount = count($conceptsToExport);
foreach ($conceptsToExport as $index => $conceptData):
$concept = $conceptData['concept'];
$status = $conceptData['status'];
$payments = $conceptData['payments'];
?>
<h2><?= htmlspecialchars($concept['name']) ?></h2>
<p><strong>Fecha:</strong> <?= date('d/m/Y', strtotime($concept['concept_date'])) ?></p>
<?php if (!empty($concept['description'])): ?>
<p><strong>Descripción:</strong> <?= htmlspecialchars($concept['description']) ?></p>
<?php endif; ?>
<table border="1" cellpadding="5">
<tr>
<td style="background-color: #e3f2fd;"><strong>Monto por Casa:</strong></td>
<td style="background-color: #e3f2fd; text-align: right; font-weight: bold;">$<?= number_format($concept['amount_per_house'], 2) ?></td>
<td style="background-color: #d4edda;"><strong>Recaudado:</strong></td>
<td style="background-color: #d4edda; text-align: right; font-weight: bold;">$<?= number_format($status['total_collected'], 2) ?></td>
</tr>
<tr>
<td style="background-color: #e3f2fd;"><strong>Esperado:</strong></td>
<td style="background-color: #e3f2fd; text-align: right; font-weight: bold;">$<?= number_format($status['total_expected'], 2) ?></td>
<td style="background-color: #d4edda;"><strong>Balance:</strong></td>
<td style="background-color: #d4edda; text-align: right; font-weight: bold;">$<?= number_format($status['total_collected'], 2) ?></td>
</tr>
</table>
<h3>Pagos por Casa</h3>
<table border="1" cellpadding="5">
<thead style="background-color: #0d6efd; color: white;">
<tr>
<th>Casa</th>
<th>Propietario</th>
<th style="text-align: right;">Monto Pagado</th>
<th>Fecha de Pago</th>
</tr>
</thead>
<tbody>
<?php foreach ($payments as $payment):
$bgColor = $payment['amount'] > 0 ? '#d4edda' : '#f8f9fa';
?>
<tr style="background-color: <?= $bgColor ?>;">
<td><strong><?= $payment['house_number'] ?></strong></td>
<td><?= htmlspecialchars($payment['owner_name'] ?? '-') ?></td>
<td style="text-align: right;">
<?= $payment['amount'] > 0 ? '$' . number_format($payment['amount'], 2) : '-' ?>
</td>
<td>
<?= $payment['payment_date'] ? date('d/m/Y', strtotime($payment['payment_date'])) : '-' ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
<tfoot style="background-color: #343a40; color: white; font-weight: bold;">
<tr>
<td colspan="2" style="text-align: right;">Total Recaudado:</td>
<td style="text-align: right;">$<?= number_format($status['total_collected'], 2) ?></td>
<td></td>
</tr>
</tfoot>
</table>
<?php if ($index < $conceptCount - 1): ?>
<div style="page-break-after: always;"></div>
<?php endif; ?>
<?php endforeach; ?>