142 lines
6.9 KiB
PHP
142 lines
6.9 KiB
PHP
<?php
|
|
$this->titre = "INTER-SANTE - Synthèse Consommations";
|
|
// Initialisation des totaux pour le footer
|
|
$totStat = $totTtc = $totAll = 0;
|
|
$natures = ['OUT', 'INP', 'OPT', 'MON', 'DEN', 'FUN'];
|
|
$totPlafonds = array_fill_keys($natures, 0);
|
|
$totConsos = array_fill_keys($natures, 0);
|
|
?>
|
|
|
|
<style>
|
|
/* --- STYLES ÉCRAN --- */
|
|
.nowrap { white-space: nowrap !important; }
|
|
|
|
.table-responsive-custom {
|
|
overflow: auto;
|
|
max-height: 70vh;
|
|
border: 1px solid #dee2e6;
|
|
background: white;
|
|
}
|
|
|
|
/* Colonne Nom figée à gauche */
|
|
.sticky-col {
|
|
position: sticky;
|
|
left: 0;
|
|
z-index: 5;
|
|
background-color: #f8f9fa !important;
|
|
border-right: 2px solid #dee2e6 !important;
|
|
}
|
|
|
|
/* En-tête figé en haut */
|
|
.sticky-header {
|
|
position: sticky;
|
|
top: 0;
|
|
z-index: 10;
|
|
}
|
|
|
|
/* --- STYLES IMPRESSION PDF --- */
|
|
@media print {
|
|
@page { size: A4 landscape; margin: 10mm; }
|
|
body * { visibility: hidden; }
|
|
#section-to-print, #section-to-print * { visibility: visible; }
|
|
#section-to-print {
|
|
position: absolute;
|
|
left: 0; top: 0; width: 100%;
|
|
}
|
|
.no-print { display: none !important; }
|
|
.table-responsive-custom { overflow: visible !important; max-height: none !important; }
|
|
.sticky-col { position: static !important; background-color: white !important; }
|
|
table { font-size: 7pt !important; width: 100% !important; }
|
|
.nowrap { white-space: nowrap !important; }
|
|
body { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
|
|
}
|
|
</style>
|
|
|
|
<div class="container-fluid py-3" id="main-container">
|
|
|
|
<div id="section-to-print">
|
|
|
|
<div class="d-none d-print-block mb-3 border-bottom pb-2">
|
|
<h3 class="text-uppercase"><?= _("Synthèse des Consommations Adhérents") ?></h3>
|
|
<p>Police: <b><?= $_SESSION['numeroPolice_C'] ?></b> | Date: <?= date('d/m/Y H:i') ?></p>
|
|
</div>
|
|
|
|
<div id="div_detail_sp" class="table-responsive-custom shadow-sm rounded">
|
|
<table class="table table-sm table-hover align-middle mb-0" style="font-size: 0.75rem;">
|
|
<thead class="text-white sticky-header">
|
|
<tr class="bg-dark text-center">
|
|
<th colspan="2" class="py-2 sticky-col bg-dark"><?= _("Bénéficiaire") ?></th>
|
|
<th colspan="2" class="bg-primary bg-opacity-75"><?= _("Primes") ?></th>
|
|
<th colspan="6" class="bg-info bg-opacity-50 text-dark"><?= _("Plafonds") ?></th>
|
|
<th colspan="7" class="bg-danger bg-opacity-75"><?= _("Consommations") ?></th>
|
|
</tr>
|
|
<tr class="bg-light text-dark small text-center border-bottom">
|
|
<th class="sticky-col bg-light"><?= _("Nom & Prénoms") ?></th>
|
|
<th class="border-end">N° Adh</th>
|
|
<th>Stat</th>
|
|
<th class="border-end">TTC</th>
|
|
<?php foreach ($natures as $n): ?><th><?= $n ?></th><?php endforeach; ?>
|
|
<?php foreach ($natures as $n): ?><th class="border-start border-white"><?= $n ?></th><?php endforeach; ?>
|
|
<th class="bg-dark text-white fw-bold">TOTAL</th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
<?php foreach ($conommations as $conso):
|
|
// Cumul des totaux
|
|
$totStat += (float)$conso['primeStat'];
|
|
$totTtc += (float)$conso['primeTtc'];
|
|
$totAll += (float)$conso['consommation_ALL'];
|
|
?>
|
|
<tr class="text-center">
|
|
<td class="text-start ps-2 sticky-col fw-bold text-uppercase"><?= $this->nettoyer($conso['nomAdherent']) ?></td>
|
|
<td class="border-end text-muted small"><?= $this->nettoyer($conso['numeroAdherent']) ?></td>
|
|
|
|
<td class="nowrap"><?= format_N($conso['primeStat']) ?></td>
|
|
<td class="nowrap border-end fw-semibold"><?= format_N($conso['primeTtc']) ?></td>
|
|
|
|
<?php foreach ($natures as $n):
|
|
$totPlafonds[$n] += (float)$conso['plafond_'.$n];
|
|
?>
|
|
<td class="nowrap text-muted"><?= format_N($conso['plafond_'.$n]) ?></td>
|
|
<?php endforeach; ?>
|
|
|
|
<?php foreach ($natures as $n):
|
|
$totConsos[$n] += (float)$conso['consommation_'.$n];
|
|
?>
|
|
<td class="nowrap bg-danger bg-opacity-10 text-danger fw-medium border-start border-white">
|
|
<?= format_N($conso['consommation_'.$n]) ?>
|
|
</td>
|
|
<?php endforeach; ?>
|
|
|
|
<td class="nowrap bg-dark text-white fw-bold"><?= format_N($conso['consommation_ALL']) ?></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
|
|
<tfoot class="bg-warning bg-opacity-10 fw-bold border-top border-dark text-center shadow-lg sticky-bottom">
|
|
<tr>
|
|
<td colspan="2" class="text-end pe-3 bg-dark text-white"><?= _("TOTAL GÉNÉRAL") ?> :</td>
|
|
<td class="nowrap bg-primary bg-opacity-25"><?= format_N($totStat) ?></td>
|
|
<td class="nowrap bg-primary bg-opacity-25 border-end border-dark"><?= format_N($totTtc) ?></td>
|
|
<?php foreach ($natures as $n): ?><td class="nowrap bg-info bg-opacity-25"><?= format_N($totPlafonds[$n]) ?></td><?php endforeach; ?>
|
|
<?php foreach ($natures as $n): ?><td class="nowrap bg-danger bg-opacity-25 text-danger border-start border-white"><?= format_N($totConsos[$n]) ?></td><?php endforeach; ?>
|
|
<td class="nowrap bg-dark text-warning fw-bolder fs-6 border-start border-white"><?= format_N($totAll) ?></td>
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
// Script pour s'assurer que le scroll est fluide et les colonnes figées bien alignées
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
const tableCont = document.querySelector('.table-responsive-custom');
|
|
if(tableCont) {
|
|
tableCont.addEventListener('scroll', function() {
|
|
// Optionnel : ajouter une ombre sur la colonne figée lors du scroll
|
|
});
|
|
}
|
|
});
|
|
</script>
|