Maj graphique évolution des sinistres mensuels.
This commit is contained in:
parent
2c58716451
commit
3951a18b98
|
|
@ -44,10 +44,12 @@ class ControleurAccueil extends Controleur {
|
|||
|
||||
// Evolution des sinistres par mois
|
||||
$claimsMonth = $this->synthese->getClaimsMonth();
|
||||
$claimsMonth = $this->synthese->getClaimsSingleMonth();
|
||||
|
||||
$tabclaimsMonth = [
|
||||
'months' => array_column($claimsMonth, 'months'),
|
||||
'monthlyClaims' => array_column($claimsMonth, 'monthlyClaims')
|
||||
'monthlyClaims' => array_column($claimsMonth, 'monthlyClaims'),
|
||||
'singleClaims' => array_column($claimsMonth, 'singleClaims')
|
||||
];
|
||||
|
||||
$dataTabClaimsMonth = json_encode($tabclaimsMonth, JSON_NUMERIC_CHECK);
|
||||
|
|
|
|||
|
|
@ -52,6 +52,17 @@ class Synthese extends Modele {
|
|||
|
||||
$resultat = $this->executerRequete($sql, array($idClient));
|
||||
|
||||
return $resultat->fetchAll();
|
||||
}
|
||||
|
||||
public function getClaimsSingleMonth()
|
||||
{
|
||||
$idClient = $_SESSION['idClient_C'];
|
||||
|
||||
$sql = 'call sp_c_sinistres_mois(?)';
|
||||
|
||||
$resultat = $this->executerRequete($sql, array($idClient));
|
||||
|
||||
return $resultat->fetchAll();
|
||||
}
|
||||
}
|
||||
|
|
@ -172,7 +172,7 @@
|
|||
<!-- Graphiques (placeholders) -->
|
||||
<div class="grid-1">
|
||||
<div class="card">
|
||||
<h3><?= _('Évolution des sinistres mensuelles') ?></h3>
|
||||
<h3><?= _('Évolution des sinistres mensuels') ?></h3>
|
||||
<div class="chart">
|
||||
<canvas id="claimsLine"></canvas>
|
||||
</div>
|
||||
|
|
@ -233,7 +233,7 @@
|
|||
|
||||
// --- Graphiques ---
|
||||
addChartToPdf(pdf, 'claimsPie', 'Sinistres par garantie', 125);
|
||||
addChartToPdf(pdf, 'claimsLine', 'Évolution des sinistres par mois', 200);
|
||||
addChartToPdf(pdf, 'claimsLine', 'Évolution des sinistres mensuels', 200);
|
||||
|
||||
// Nouvelle page pour le dernier graphique
|
||||
pdf.addPage();
|
||||
|
|
@ -271,16 +271,29 @@
|
|||
|
||||
// Evolution des sinistres par mois
|
||||
const dataClaimsMonth = <?= $dataTabClaimsMonth ?>;
|
||||
|
||||
new Chart(document.getElementById('claimsLine'), {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: dataClaimsMonth.months,
|
||||
datasets: [{
|
||||
label: "Sinistres",
|
||||
data: dataClaimsMonth.monthlyClaims,
|
||||
tension: 0.4,
|
||||
fill: true
|
||||
}]
|
||||
datasets: [
|
||||
{
|
||||
label: "Cumulés",
|
||||
data: dataClaimsMonth.monthlyClaims, // cumulés
|
||||
tension: 0.4,
|
||||
fill: true,
|
||||
borderColor: "blue",
|
||||
backgroundColor: "rgba(0,0,255,0.2)"
|
||||
},
|
||||
{
|
||||
label: "Mensuels",
|
||||
data: dataClaimsMonth.singleClaims, // valeurs brutes du mois
|
||||
tension: 0.4,
|
||||
fill: false,
|
||||
borderColor: "red",
|
||||
backgroundColor: "rgba(255,0,0,0.2)"
|
||||
}
|
||||
]
|
||||
},
|
||||
options: {
|
||||
scales: {
|
||||
|
|
@ -289,6 +302,7 @@
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
// Sinistralité
|
||||
new Chart(document.getElementById('lossRatioBar'), {
|
||||
type: 'bar',
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user