radiantrh/Vue/Ajaxrequeteresumesinistres/index.php
2026-03-29 08:55:42 +00:00

111 lines
5.7 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">
<div class="row align-items-center text-center">
<div class="col-md-3 border-end border-secondary">
<small class="text-uppercase opacity-75 d-block"><?= _("Volume Total") ?></small>
<span class="h5 fw-bold"><?= format_N($rpsinistres_total['nbLigne']) ?> <?= _("Lignes") ?></span>
</div>
<div class="col-md-3 border-end border-secondary">
<small class="text-uppercase opacity-75 d-block"><?= _("Cumul Sinistres") ?></small>
<span class="h5 fw-bold text-warning"><?= format_N($rpsinistres_total['sinistres_total']) ?></span>
</div>
<div class="col-md-3 border-end border-secondary">
<small class="text-uppercase opacity-75 d-block"><?= _("Ratio Moyen") ?></small>
<span class="h5 fw-bold text-info"><?= number_format((float)$rpsinistres_total['ratio_moyen'], 2, ',', ' ') ?> %</span>
</div>
<div class="col-md-3">
<i class="fas fa-info-circle me-1 text-info"></i>
<small class="small d-block text-start" style="font-size: 7.5pt;">
<?= _("Affichage limité aux 200 premières lignes. Utilisez l'export Excel pour le rapport complet.") ?>
</small>
</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'];
// Couleur dynamique pour le ratio selon la gravité
$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 = "> " . $nbligne . " => " . _("Excel");
break;
}
?>
<?php endforeach; ?>
</tbody>
</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() {
const titreRapport = "<?= mb_strtoupper(_('RAPPORT RÉSUMÉ DES SINISTRES'), 'UTF-8'); ?>";
// Construction des informations de police pour l'export
const infosPolice =
"<?= _('Souscripteur') ?> : <?= $_SESSION['nomClient_C'] ?>\n" +
"<?= _('Numéro Police') ?> : <?= $_SESSION['numeroPolice_C'] ?>\n" +
"<?= _('Période du') ?> : <?= $_SESSION['dateDebutRequete'] ?> <?= _('au') ?> <?= $_SESSION['dateFinRequete'] ?>";
// Initialisation DataTable
appliquerDataTable('#table_resume_sinistres', {
pageLength: 50,
order: [[5, "desc"]], // Tri par ratio décroissant pour voir les dossiers critiques
buttons: [
{ extend: 'excel', title: titreRapport, messageTop: infosPolice },
{ extend: 'pdf', title: titreRapport, messageTop: infosPolice, orientation: 'landscape' },
{ extend: 'print', title: titreRapport, messageTop: infosPolice }
]
}, titreRapport, infosPolice);
// Mise à jour automatique du champ "Lignes" dans l'entête de recherche
$('#nbligne').val($('#nbligne_info').val());
});
</script>