This commit is contained in:
KONE SOREL 2026-03-29 14:19:53 +00:00
parent c7e7d534ff
commit dc72167c5f
5 changed files with 123 additions and 57 deletions

View File

@ -12,16 +12,15 @@ class ControleurAjaxrequetefrequencesprestataires extends Controleur
public function index()
{
$dateFacture1 = $this->requete->getParametreDate("dateFacture1");
$dateFacture2 = $this->requete->getParametreDate("dateFacture2");
$dateDebut = $this->requete->getParametreDate("dateFacture1");
$dateFin = $this->requete->getParametreDate("dateFacture2");
$_SESSION['dateDebutRequete'] = $this->requete->getParametreFormulaire("dateFacture1");
$_SESSION['dateFinRequete'] = $this->requete->getParametreFormulaire("dateFacture2");
$rpsinistres = $this->sppolice->requeteresumesinistres($dateFacture2);
$rpsinistres = $this->sppolice->requetefrequenceinistres($dateDebut, $dateFin);
$rpsinistres_total = $this->sppolice->requeteresumesinistres_total($dateFacture2);
$rpsinistres_total = $this->sppolice->requetefrequencesinistres_total($dateDebut, $dateFin);
$this->genererVueAjax(array(
'rpsinistres' => $rpsinistres,

View File

@ -949,13 +949,35 @@ class Police extends Modele {
return $liste->fetchAll(PDO::FETCH_ASSOC);
}
public function requetedetailsinistres_total($dateDebut, $dateFacture2) {
public function requetedetailsinistres_total($dateDebut, $dateFin) {
$idPolice = $_SESSION['idPolice_C'];
$sql = 'CALL sp_requetedetailsinistres_total_rh(?, ?, ?);';
$liste = $this->executerRequete($sql,array($idPolice, $dateDebut, $dateFacture2));
$liste = $this->executerRequete($sql,array($idPolice, $dateDebut, $dateFin));
return $liste->fetch(PDO::FETCH_ASSOC);
}
public function requetefrequenceinistres($dateDebut, $dateFin) {
$idPolice = $_SESSION['idPolice_C'];
$sql = 'CALL sp_requetefrequencesinistres_rh(?, ?, ?);';
$liste = $this->executerRequete($sql,array($idPolice, $dateDebut, $dateFin));
return $liste->fetchAll(PDO::FETCH_ASSOC);
}
public function requetefrequencesinistres_total($dateDebut, $dateFin) {
$idPolice = $_SESSION['idPolice_C'];
$sql = 'CALL sp_requetefrequencesinistres_total_rh(?, ?, ?);';
$liste = $this->executerRequete($sql,array($idPolice, $dateDebut, $dateFin));
return $liste->fetch(PDO::FETCH_ASSOC);
}

View File

@ -79,7 +79,7 @@
<script>
$(document).ready(function() {
const titreRapport = "<?= mb_strtoupper(_('RAPPORT DÉTAIL DES SINISTRES'), 'UTF-8'); ?>";
const titreRapport = "<?= mb_strtoupper(_('RAPPORT DU DÉTAIL DES SINISTRES'), 'UTF-8'); ?>";
const infosPolice =
"\n<?= _('Souscripteur') ?> : <?= $_SESSION['nomClient_C'] ?>\n" +

View File

@ -1,76 +1,121 @@
<?php $nbligne = 0; ?>
<<?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-4 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 class="card-header bg-dark text-white p-4 border-0" style="border-radius: 12px 12px 0 0;">
<div class="row w-100 m-0 align-items-center">
<div class="col-md-3 border-end border-secondary text-center py-2">
<div class="text-uppercase opacity-75 mb-2" style="font-size: 8pt; letter-spacing: 1px;">
<i class="fas fa-layer-group me-2 text-primary"></i> <?= _("Volume Total") ?>
</div>
<div class="display-6 fw-bold" style="font-size: 1.8rem;">
<?= format_N($rpsinistres_total['nbLigne']) ?>
<small class="h6 opacity-50 fw-normal"><?= _("Lignes") ?></small>
</div>
</div>
<div class="col-md-4 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 class="col-md-3 border-end border-secondary text-center py-2">
<div class="text-uppercase opacity-75 mb-2" style="font-size: 8pt; letter-spacing: 1px;">
<i class="fas fa- hospital-user me-2 text-warning"></i> <?= _("Cumul Cas") ?>
</div>
<div class="display-6 fw-bold text-warning" style="font-size: 1.8rem;">
<?= format_N($rpsinistres_total['nbrCas_total']) ?>
</div>
</div>
<div class="col-md-4">
<i class="fas fa-info-circle me-1 text-info"></i>
<small><?= _("Affichage limité aux 200 premières lignes") ?></small>
<div class="col-md-3 border-end border-secondary text-center py-2">
<div class="text-uppercase opacity-75 mb-2" style="font-size: 8pt; letter-spacing: 1px;">
<i class="fas fa-file-invoice-dollar me-2 text-info"></i> <?= _("Montant Total") ?>
</div>
<div class="display-6 fw-bold text-info" style="font-size: 1.8rem;">
<?= format_N($rpsinistres_total['montant_total']) ?>
</div>
</div>
<div class="col-md-3 text-center py-2">
<div class="text-uppercase opacity-75 mb-2" style="font-size: 8pt; letter-spacing: 1px;">
<i class="fas fa-divide me-2 text-success"></i> <?= _("Montant / Cas") ?>
</div>
<div class="display-6 fw-bold text-success" style="font-size: 1.8rem;">
<?= format_N($rpsinistres_total['montantSurCas_total']) ?>
</div>
</div>
</div>
</div>
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover table-condensed tabliste compact w-100" style="font-size:0.85rem; white-space:nowrap;">
<table class="table table-striped table-bordered table-hover tabliste compact w-100" id="table_frequence_sinistres" 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>
<th><?= _("Catégories") ?></th>
<th class="text-center"><?= _("Nombre Cas") ?></th>
<th class="text-center"><?= _("% Cas") ?></th>
<th class="text-center"><?= _("Montant") ?></th>
<th class="text-center"><?= _("% Montant") ?></th>
<th class="text-center"><?= _("Montant / Cas") ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($rpsinistres as $rpsinistre):
$nbligne++;
$ratio = (float)$rpsinistre['ratio'];
// Couleur dynamique pour le ratio
$ratioClass = ($ratio > 100) ? 'text-danger fw-bold' : (($ratio > 70) ? 'text-warning' : 'text-success');
$categorie = est_anglophone()
? $this->nettoyer($rpsinistre['categorieEng'])
: $this->nettoyer($rpsinistre['categorie']);
?>
<tr>
<td class="text-center fw-bold text-primary"><?= $this->nettoyer($rpsinistre['numeroAdherent']) ?></td>
<td><?= $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>
<td class="fw-bold text-uppercase text-primary"><?= $categorie ?></td>
<td class="text-center"><?= format_N($this->nettoyer($rpsinistre['nbrCas'])); ?></td>
<td class="text-center text-muted"><?= number_format($this->nettoyer($rpsinistre['tauxCas']), 2, ',', ' ') ?> %</td>
<td class="text-end fw-bold px-3"><?= format_N($this->nettoyer($rpsinistre['montant'])); ?></td>
<td class="text-center text-muted"><?= number_format($this->nettoyer($rpsinistre['tauxMontant']), 2, ',', ' ') ?> %</td>
<td class="text-end fw-bold px-3 text-info"><?= format_N($this->nettoyer($rpsinistre['montantSurCas'])); ?></td>
</tr>
<?php
if ($nbligne == 200) {
$nbligne = "> " . $nbligne . " => " . _("Utilisez l'export Excel");
break;
}
?>
<?php endforeach; ?>
</tbody>
<tfoot class="table-dark">
<tr class="fw-bold">
<td class="text-center text-uppercase"><?= _("Total Général") ?></td>
<td class="text-center"><?= format_N($rpsinistres_total['nbrCas_total']); ?></td>
<td class="text-center">100 %</td>
<td class="text-end px-3"><?= format_N($rpsinistres_total['montant_total']); ?></td>
<td class="text-center">100 %</td>
<td class="text-end px-3 text-warning"><?= format_N($rpsinistres_total['montantSurCas_total']); ?></td>
</tr>
</tfoot>
</table>
</div>
<div class="card-footer bg-white text-end py-2">
<small class="text-muted italic"><?= _("Généré le") ?> <?= date('d/m/Y H:i') ?></small>
<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-history me-1"></i><?= _("Généré le") ?> <?= dateheureLang(date('Y-m-d H:i:s'), $_SESSION['lang']) ?>
</span>
<span class="badge bg-secondary opacity-75"><?= $_SESSION['numeroPolice_C'] ?></span>
</div>
<input class="sr-only" type="text" id="nbligne_info" name="nbligne_info" value="<?= $nbligne ?>">
</div>
</div>
<script>
$(document).ready(function() {
const titreRapport = "<?= mb_strtoupper(_('RAPPORT DES FRÉQUENCES DE SINISTRES'), 'UTF-8'); ?>";
const infosPolice =
"\n<?= _('Souscripteur') ?> : <?= $_SESSION['nomClient_C'] ?>\n" +
"<?= _('Numéro Police') ?> : <?= $_SESSION['numeroPolice_C'] ?>\n" +
"<?= _('Période couverte') ?> : <?= dateLang($_SESSION['dateEffet_C'], $_SESSION['lang']) ?> <?= _('au') ?> <?= dateLang($_SESSION['dateEcheance_C'], $_SESSION['lang']) ?>\n" +
"<?= _('Période analyse') ?> : <?= $_SESSION['dateDebutRequete'] ?> <?= _('au') ?> <?= $_SESSION['dateFinRequete'] ?>\n";
// Utilisation de l'ID spécifique pour éviter les conflits
appliquerDataTable('#table_frequence_sinistres', {
pageLength: 50,
order: [[1, "desc"]], // Tri par nombre de cas décroissant
buttons: [
{ extend: 'excel', title: titreRapport, messageTop: infosPolice, footer: true },
{ extend: 'pdf', title: titreRapport, messageTop: infosPolice, orientation: 'landscape', footer: true },
{ extend: 'print', title: titreRapport, messageTop: infosPolice, footer: true }
]
}, titreRapport, infosPolice);
$('#nbligne').val($('#nbligne_info').val());
});
</script>

View File

@ -90,7 +90,7 @@
<script>
$(document).ready(function() {
const titreRapport = <?= json_encode(mb_strtoupper(_('RAPPORT RÉSUMÉ DES SINISTRES'), 'UTF-8')) ?>;
const titreRapport = <?= json_encode(mb_strtoupper(_('RAPPORT DU RÉSUMÉ DES SINISTRES'), 'UTF-8')) ?>;
const infosEntete =
"\n<?= _('Souscripteur') ?> : <?= $_SESSION['nomClient_C'] ?>\n" +