120 lines
6.0 KiB
PHP
120 lines
6.0 KiB
PHP
<div id="div_detail_sp" class="animate__animated animate__fadeIn">
|
|
<?php
|
|
// Initialisation des compteurs de totaux
|
|
$totStat = $totTtc = $totAll = 0;
|
|
$natures = ['OUT', 'INP', 'OPT', 'MON', 'DEN', 'FUN'];
|
|
$totPlafonds = array_fill_keys($natures, 0);
|
|
$totConsos = array_fill_keys($natures, 0);
|
|
|
|
// Calcul des sommes
|
|
foreach ($conommations as $conso) {
|
|
$totStat += (float)$conso['primeStat'];
|
|
$totTtc += (float)$conso['primeTtc'];
|
|
$totAll += (float)$conso['consommation_ALL'];
|
|
foreach ($natures as $n) {
|
|
$totPlafonds[$n] += (float)$conso['plafond_' . $n];
|
|
$totConsos[$n] += (float)$conso['consommation_' . $n];
|
|
}
|
|
}
|
|
?>
|
|
<button type="button" class="btn btn-danger shadow-sm mb-2" onclick="imprimerTableau();">
|
|
<i class="fas fa-file-pdf me-2"></i> <?= _("Imprimer le tableau uniquement") ?>
|
|
</button>
|
|
|
|
<div class="table-responsive shadow-sm border rounded">
|
|
<table class="table table-sm table-hover align-middle mb-0" style="font-size: 0.75rem;">
|
|
<thead class="text-white sticky-top">
|
|
<tr class="bg-dark border-bottom border-secondary text-center">
|
|
<th colspan="2" class="py-2 border-end border-secondary"><?= _("Bénéficiaire") ?></th>
|
|
<th colspan="2" class="py-2 border-end border-secondary bg-primary bg-opacity-75"><?= _("Primes") ?></th>
|
|
<th colspan="6" class="py-2 border-end border-secondary bg-info bg-opacity-50 text-dark"><?= _("Plafonds") ?></th>
|
|
<th colspan="7" class="py-2 bg-danger bg-opacity-75"><?= _("Consommations") ?></th>
|
|
</tr>
|
|
<tr class="bg-light text-dark small text-center border-bottom">
|
|
<th class="border-end"><?= _("Nom / N° Adh") ?></th>
|
|
<th class="border-end">ID</th>
|
|
<th class="bg-primary bg-opacity-10">Stat</th>
|
|
<th class="border-end bg-primary bg-opacity-10">TTC</th>
|
|
<?php foreach ($natures as $n): ?><th class="bg-info bg-opacity-10 small"><?= $n ?></th><?php endforeach; ?>
|
|
<?php foreach ($natures as $n): ?><th class="bg-danger bg-opacity-10 small border-start border-white"><?= $n ?></th><?php endforeach; ?>
|
|
<th class="bg-dark text-white fw-bold border-start border-white">TOTAL</th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
<?php foreach ($conommations as $conso): ?>
|
|
<tr class="text-center">
|
|
<td class="text-start ps-2 border-end fw-bold text-uppercase"><?= $this->nettoyer($conso['nomAdherent']) ?></td>
|
|
<td class="border-end x-small text-muted"><?= $this->nettoyer($conso['numeroAdherent']) ?></td>
|
|
<td class="bg-primary bg-opacity-10"><?= format_N($conso['primeStat']) ?></td>
|
|
<td class="border-end bg-primary bg-opacity-10 fw-semibold"><?= format_N($conso['primeTtc']) ?></td>
|
|
<?php foreach ($natures as $n): ?><td><?= format_N($conso['plafond_'.$n]) ?></td><?php endforeach; ?>
|
|
<?php foreach ($natures as $n): ?><td class="bg-danger bg-opacity-10 text-danger fw-medium border-start border-white"><?= format_N($conso['consommation_'.$n]) ?></td><?php endforeach; ?>
|
|
<td class="bg-dark text-white fw-bold"><?= format_N($conso['consommation_ALL']) ?></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
|
|
<tfoot class="sticky-bottom bg-warning bg-opacity-10 fw-bold border-top border-dark text-center shadow-lg">
|
|
<tr style="font-size: 0.8rem;">
|
|
<td colspan="2" class="text-end pe-3 bg-dark text-white fw-bold"><?= _("TOTAL GÉNÉRAL") ?> :</td>
|
|
<td class="bg-primary bg-opacity-25"><?= format_N($totStat) ?></td>
|
|
<td class="bg-primary bg-opacity-25 border-end border-dark"><?= format_N($totTtc) ?></td>
|
|
<?php foreach ($natures as $n): ?><td class="bg-info bg-opacity-25 text-dark"><?= format_N($totPlafonds[$n]) ?></td><?php endforeach; ?>
|
|
<?php foreach ($natures as $n): ?><td class="bg-danger bg-opacity-25 text-danger border-start border-white"><?= format_N($totConsos[$n]) ?></td><?php endforeach; ?>
|
|
<td class="bg-dark text-warning fw-bolder fs-6 border-start border-white"><?= format_N($totAll) ?></td>
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<style>
|
|
.x-small { font-size: 0.65rem; }
|
|
.table-responsive { position: relative; max-height: 70vh; overflow: auto; }
|
|
/* Fixation du footer et du header pour le scroll */
|
|
.sticky-top { position: sticky; top: 0; z-index: 1020; }
|
|
.sticky-bottom { position: sticky; bottom: 0; z-index: 1020; }
|
|
tfoot td { border-top: 2px solid #333 !important; }
|
|
|
|
@media print {
|
|
/* Masquer les éléments inutiles (menus, boutons, filtres) */
|
|
nav, .navbar, .btn, .footer, .no-print, .card-body.bg-light {
|
|
display: none !important;
|
|
}
|
|
|
|
/* Forcer le mode Paysage pour ce rapport large */
|
|
@page {
|
|
size: A4 landscape;
|
|
margin: 1cm;
|
|
}
|
|
|
|
/* Forcer l'affichage des couleurs de fond (Primes/Consos) */
|
|
body {
|
|
-webkit-print-color-adjust: exact !important;
|
|
print-color-adjust: exact !important;
|
|
}
|
|
|
|
/* Ajuster le tableau pour qu'il tienne sur la largeur de la page */
|
|
.table-responsive {
|
|
overflow: visible !important;
|
|
max-height: none !important;
|
|
}
|
|
|
|
table {
|
|
width: 100% !important;
|
|
border-collapse: collapse !important;
|
|
font-size: 7pt !important; /* Réduction légère pour l'impression */
|
|
}
|
|
|
|
/* Garder les en-têtes sur chaque page si le tableau est long */
|
|
thead {
|
|
display: table-header-group;
|
|
}
|
|
|
|
/* Empêcher de couper une ligne d'adhérent entre deux pages */
|
|
tr {
|
|
page-break-inside: avoid;
|
|
}
|
|
}
|
|
</style>
|