Files
ibiza_sistema/views/reports/pdf_balance.php

122 lines
4.4 KiB
PHP
Executable File

<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-success {
color: green;
}
</style>
<div class="print-title">Condominio IBIZA-Cto Sierra Morena 152 - Reporte de Balance General</div>
<div class="print-date">Fecha de generación: <?= date('d/m/Y H:i') ?></div>
<table>
<thead>
<tr style="background-color: #d4edda;">
<th colspan="2">Resumen Financiero</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">Total Ingresos (Conceptos):</td>
<td class="text-end text-success">$<?= number_format($balance['total_incomes'], 2) ?></td>
</tr>
<?php if (!Auth::isLector()): ?>
<tr>
<td style="text-align: left;">Total Egresos:</td>
<td class="text-end text-danger">$<?= number_format($balance['total_expenses'], 2) ?></td>
</tr>
<tr style="background-color: #343a40; color: #fff;">
<td style="text-align: left; font-weight: bold;">Balance Neto:</td>
<td class="text-end fw-bold <?= $balance['balance'] >= 0 ? 'text-success' : 'text-danger' ?>">
$<?= number_format($balance['balance'], 2) ?>
</td>
</tr>
<?php endif; ?>
</tbody>
</table>
<br>
<?php if (!empty($conceptDetails['concepts'])): ?>
<h3 style="text-align: center; margin-bottom: 10px;">Detalle de Conceptos Especiales</h3>
<?php if (!empty($conceptDetails['year'])): ?>
<p style="text-align: center; font-size: 9pt; margin-bottom: 15px;">Año: <?= $conceptDetails['year'] ?></p>
<?php endif; ?>
<table style="margin-bottom: 10px;">
<thead style="background-color: #0d6efd; color: white;">
<tr>
<th>Concepto</th>
<th>Esperado</th>
<th>Recaudado</th>
<th>Pendiente</th>
<th>Gastos</th>
<th>Balance</th>
</tr>
</thead>
<tbody>
<?php foreach ($conceptDetails['concepts'] as $cd): ?>
<tr>
<td style="text-align: left;">
<strong><?= htmlspecialchars($cd['concept']['name']) ?></strong>
<?php if (!empty($cd['concept']['description'])): ?>
<br><small style="color: #666;"><?= htmlspecialchars($cd['concept']['description']) ?></small>
<?php endif; ?>
</td>
<td>$<?= number_format($cd['expected'], 2) ?></td>
<td class="text-success">$<?= number_format($cd['collected'], 2) ?></td>
<td class="text-warning">$<?= number_format($cd['pending'], 2) ?></td>
<?php if (!Auth::isLector()): ?>
<td class="text-danger">$<?= number_format($cd['expenses'], 2) ?></td>
<td class="text-end fw-bold <?= $cd['balance'] >= 0 ? 'text-success' : 'text-danger' ?>">
$<?= number_format($cd['balance'], 2) ?>
</td>
<?php else: ?>
<td colspan="2">-</td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</tbody>
<tfoot style="background-color: #343a40; color: white; font-weight: bold;">
<tr>
<td style="text-align: left;">TOTALES:</td>
<td>$<?= number_format($conceptDetails['totals']['expected'], 2) ?></td>
<td>$<?= number_format($conceptDetails['totals']['collected'], 2) ?></td>
<td>$<?= number_format($conceptDetails['totals']['pending'], 2) ?></td>
<?php if (!Auth::isLector()): ?>
<td>$<?= number_format($conceptDetails['totals']['expenses'], 2) ?></td>
<td class="text-end <?= $conceptDetails['totals']['balance'] >= 0 ? 'text-success' : 'text-danger' ?>">
$<?= number_format($conceptDetails['totals']['balance'], 2) ?>
</td>
<?php else: ?>
<td colspan="2">-</td>
<?php endif; ?>
</tr>
</tfoot>
</table>
<?php endif; ?>