radiantrh/Vue/Ajaxrequeteresumesinistres/index.php
2026-03-29 09:37:45 +00:00

127 lines
6.9 KiB
PHP

<?php $nbligne = 0; ?>
<div id="div_detail_requete" class="card border-0 shadow-sm animate__animated animate__fadeIn">
<div class="card-header bg-dark text-white p-3 border-0" style="border-radius: 12px 12px 0 0;">
<div class="row align-items-center">
<div class="col-md-2 border-end border-secondary text-center">
<small class="text-uppercase opacity-75 d-block" style="font-size: 7pt; letter-spacing: 0.5px;">
<?= _("Volume Total") ?>
</small>
<span class="h5 fw-bold mb-0"><?= format_N($rpsinistres_total['nbLigne']) ?> <?= _("Lignes") ?></span>
</div>
<div class="col-md-2 border-end border-secondary text-center">
<small class="text-uppercase opacity-75 d-block" style="font-size: 7pt; letter-spacing: 0.5px;">
<?= _("Cumul Sinistres") ?>
</small>
<span class="h5 fw-bold text-warning mb-0"><?= format_N($rpsinistres_total['sinistres_total']) ?></span>
</div>
<div class="col-md-2 border-end border-secondary text-center">
<small class="text-uppercase opacity-75 d-block" style="font-size: 7pt; letter-spacing: 0.5px;">
<?= _("Ratio Moyen") ?>
</small>
<span class="h5 fw-bold text-info mb-0">
<?= number_format((float)$rpsinistres_total['ratio_moyen'], 2, ',', ' ') ?> %
</span>
</div>
<div class="col-md-6 ps-4">
<div class="d-flex align-items-center bg-secondary bg-opacity-10 p-2 rounded">
<i class="fas fa-info-circle me-3 text-info fs-4"></i>
<div class="text-start">
<p class="mb-0 fw-medium" style="font-size: 8.5pt; line-height: 1.3; color: #e0e0e0;">
<?= _("Affichage limité aux 200 premières lignes.") ?>
<span class="d-block text-muted small mt-1">
<?= _("Pour obtenir l'intégralité des données, veuillez utiliser l'export Excel.") ?>
</span>
</p>
</div>
</div>
</div>
</div>
</div>
<div class="table-responsive">
<table id="table_resume_sinistres" class="table table-striped table-bordered table-hover tabliste compact w-100" style="font-size:0.85rem; white-space:nowrap;">
<thead class="table-light border-bottom text-uppercase small fw-bold">
<tr>
<th class="text-center"><?= _("N° Adhérent") ?></th>
<th><?= _("Adhérent Principal") ?></th>
<th class="text-center"><?= _("Date de début") ?></th>
<th class="text-center"><?= _("Période passée") ?></th>
<th class="text-center"><?= _("Sinistres") ?></th>
<th class="text-center"><?= _("Ratio (%)") ?></th>
<th class="text-center">Cat</th>
</tr>
</thead>
<tbody>
<?php foreach ($rpsinistres as $rpsinistre):
$nbligne++;
$ratio = (float)$rpsinistre['ratio'];
$ratioClass = ($ratio > 100) ? 'text-danger fw-bold' : (($ratio > 70) ? 'text-warning' : 'text-success');
?>
<tr>
<td class="text-center fw-bold text-primary"><?= $this->nettoyer($rpsinistre['numeroAdherent']) ?></td>
<td class="text-uppercase"><?= $this->nettoyer($rpsinistre['Adherent']) ?></td>
<td class="text-center text-muted"><?= dateLang($this->nettoyer($rpsinistre['dateEffetAdherent']), $_SESSION['lang']) ?></td>
<td class="text-center"><?= $this->nettoyer($rpsinistre['duree_acquise']) ?> <small><?= _("j") ?></small></td>
<td class="text-center fw-bold"><?= format_N($rpsinistre['sinistres']) ?></td>
<td class="text-center <?= $ratioClass ?>"><?= number_format($ratio, 2, ',', ' ') ?> %</td>
<td class="text-center">
<span class="badge bg-secondary-subtle text-secondary border border-secondary-subtle">
<?= $this->nettoyer($rpsinistre['codeProduit']) ?>
</span>
</td>
</tr>
<?php if ($nbligne == 200) { $nbligne = "> 200"; break; } ?>
<?php endforeach; ?>
</tbody>
<tfoot class="table-light border-top border-dark">
<tr>
<td colspan="4" class="text-center fw-bold text-uppercase"><?= _("Total Général") ?></td>
<td class="text-center fw-bold text-dark fs-6"><?= format_N($rpsinistres_total['sinistres_total']) ?></td>
<td class="text-center fw-bold text-info fs-6"><?= number_format((float)$rpsinistres_total['ratio_moyen'], 2, ',', ' ') ?> %</td>
<td class="bg-light"></td>
</tr>
</tfoot>
</table>
</div>
<div class="card-footer bg-white d-flex justify-content-between align-items-center py-2">
<span class="text-muted small italic"><i class="fas fa-clock me-1"></i><?= _("Généré le") ?> <?= date('d/m/Y H:i') ?></span>
<span class="badge bg-dark px-3"><?= $_SESSION['numeroPolice_C'] ?></span>
</div>
<input class="sr-only" type="text" id="nbligne_info" name="nbligne_info" value="<?= $nbligne ?>">
</div>
<script>
$(document).ready(function() {
// 1. Préparation des textes
const titreRapport = <?= json_encode(mb_strtoupper(_('RAPPORT RÉSUMÉ DES SINISTRES'), 'UTF-8')) ?>;
// 2. Préparation du bloc d'infos Subscriber/Policy/Period
const infosEntete =
"<?= _('Souscripteur') ?> : <?= $_SESSION['nomClient_C'] ?>\n" +
"<?= _('Numéro Police') ?> : <?= $_SESSION['numeroPolice_C'] ?>\n" +
"<?= _('Période du') ?> : <?= $_SESSION['dateDebutRequete'] ?> <?= _('au') ?> <?= $_SESSION['dateFinRequete'] ?>";
// 3. Appel de la fonction COMMUNE appliquerDataTable()
// On passe 'footer: true' dans les boutons pour que le <tfoot> soit exporté
appliquerDataTable('#table_resume_sinistres', {
pageLength: 50,
order: [[5, "desc"]], // Tri par Ratio décroissant
buttons: [
{ extend: 'excel', title: titreRapport, messageTop: infosEntete, footer: true },
{ extend: 'pdf', title: titreRapport, messageTop: infosEntete, orientation: 'landscape', footer: true },
{ extend: 'print', title: titreRapport, messageTop: infosEntete, footer: true }
]
}, titreRapport, infosEntete);
// 4. Mise à jour du compteur global (l'input dans ton formulaire de recherche)
$('#nbligne').val($('#nbligne_info').val());
});
</script>