This commit is contained in:
KONE SOREL 2026-03-31 17:50:09 +00:00
parent 453f58714e
commit 41099a705c

View File

@ -333,82 +333,67 @@
</div>
<!-- Section des plafonds et consommations -->
<div class="row g-4">
<?php
// --- 1. CALCULS FAMILLE (Police) ---
$plafondGlobalFamilleOut = $this->nettoyer($police['plafondOut']) ?: 0;
$consommationGlobaleFamilleOut = $this->nettoyer($police['consommationOut']) ?: 0;
$soldeConsommationOut = $this->nettoyer($police['soldeConsommationOut']) ?: 0;
$niveauGlobalConsoFamilleOut = ($plafondGlobalFamilleOut > 0) ? ($consommationGlobaleFamilleOut * 100) / $plafondGlobalFamilleOut : 0;
$plafondGlobalFamilleInp = $this->nettoyer($police['plafondInp']) ?: 0;
$consommationGlobaleFamilleInp = $this->nettoyer($police['consommationInp']) ?: 0;
$soldeConsommationInp = $this->nettoyer($police['soldeConsommationInp']) ?: 0;
$niveauGlobalConsoFamilleInp = ($plafondGlobalFamilleInp > 0) ? ($consommationGlobaleFamilleInp * 100) / $plafondGlobalFamilleInp : 0;
// --- 2. CALCULS INDIVIDUELS (Bénéficiaire) ---
$consommationGlobaleBenefOut = $this->nettoyer($college['consommation_individuOut']) ?: 0;
$niveauGlobalConsoBenefOut = ($plafondGlobalFamilleOut > 0) ? ($consommationGlobaleBenefOut * 100) / $plafondGlobalFamilleOut : 0;
$consommationGlobaleBenefInp = $this->nettoyer($college['consommation_individuInp']) ?: 0;
$niveauGlobalConsoBenefInp = ($plafondGlobalFamilleInp > 0) ? ($consommationGlobaleBenefInp * 100) / $plafondGlobalFamilleInp : 0;
?>
<div class="row g-4">
<div class="col-12 col-xl-8">
<div class="card shadow-sm border-0 h-100">
<div class="card-header bg-dark text-white py-3">
<div class="d-flex justify-content-between align-items-center">
<h6 class="mb-0 fw-bold">
<i class="fas fa-users-cog me-2 text-info"></i>
<?= _("Consommation Familiale") ?>
</h6>
<h6 class="mb-0 fw-bold"><i class="fas fa-users-cog me-2 text-info"></i><?= _("Consommation Familiale") ?></h6>
<span class="badge bg-secondary"><?= $_SESSION['exercieReference_C'] ?></span>
</div>
</div>
<div class="card-body p-4">
<?php
// Logique de calcul centralisée
$types = [
'OUT' => [
'label' => _("Soins Ambulatoires (OUTPATIENT)"),
'conso' => $this->nettoyer($police['consommationOut']),
'plafond' => $this->nettoyer($police['plafondOut']),
'solde' => $this->nettoyer($police['soldeConsommationOut']),
'percent' => ($police['plafondOut'] > 0) ? ($police['consommationOut'] * 100) / $police['plafondOut'] : 0
],
'INP' => [
'label' => _("Hospitalisation (INPATIENT)"),
'conso' => $this->nettoyer($police['consommationInp']),
'plafond' => $this->nettoyer($police['plafondInp']),
'solde' => $this->nettoyer($police['soldeConsommationInp']),
'percent' => ($police['plafondInp'] > 0) ? ($police['consommationInp'] * 100) / $police['plafondInp'] : 0
]
];
foreach ($types as $key => $data):
$colorClass = ($data['percent'] >= 90) ? 'danger' : (($data['percent'] >= 70) ? 'warning' : 'success');
?>
<div class="consumption-block mb-5">
<div class="d-flex justify-content-between align-items-end mb-2">
<h6 class="text-uppercase fw-bold text-muted small mb-0"><?= $data['label'] ?></h6>
<span class="fw-bold text-<?= $colorClass ?>"><?= number_format($data['percent'], 1) ?>%</span>
</div>
<div class="progress mb-3" style="height: 10px;">
<div class="progress-bar bg-<?= $colorClass ?> progress-bar-striped progress-bar-animated"
role="progressbar"
style="width: <?= min($data['percent'], 100) ?>%"></div>
</div>
<div class="row g-2 text-center">
<div class="col-4">
<div class="p-2 border rounded bg-light">
<small class="text-muted d-block"><?= _("Consommé") ?></small>
<span class="fw-bold fs-5"><?= format_N($data['conso']) ?></span>
</div>
</div>
<div class="col-4">
<div class="p-2 border rounded bg-light">
<small class="text-muted d-block"><?= _("Plafond") ?></small>
<span class="fw-bold fs-5 text-dark"><?= format_N($data['plafond']) ?></span>
</div>
</div>
<div class="col-4">
<div class="p-2 border rounded border-<?= $colorClass ?>-subtle bg-<?= $colorClass ?>-subtle">
<small class="text-<?= $colorClass ?> d-block fw-bold"><?= _("Solde") ?></small>
<span class="fw-bold fs-5 text-<?= $colorClass ?>"><?= format_N($data['solde']) ?></span>
</div>
</div>
</div>
<?php if($data['solde'] <= 0): ?>
<div class="alert alert-danger py-2 mt-2 mb-0 small border-0 shadow-sm">
<i class="fas fa-exclamation-circle me-2"></i><?= _("Plafond atteint pour ce poste") ?>
</div>
<?php endif; ?>
<div class="consumption-block mb-5">
<?php $colorOut = ($niveauGlobalConsoFamilleOut >= 90) ? 'danger' : (($niveauGlobalConsoFamilleOut >= 70) ? 'warning' : 'success'); ?>
<div class="d-flex justify-content-between align-items-end mb-2">
<h6 class="text-uppercase fw-bold text-muted small mb-0"><?= _("Soins Ambulatoires (OUT)") ?></h6>
<span class="fw-bold text-<?= $colorOut ?>"><?= number_format((float)$niveauGlobalConsoFamilleOut, 1) ?>%</span>
</div>
<?php endforeach; ?>
<div class="progress mb-3" style="height: 10px;">
<div class="progress-bar bg-<?= $colorOut ?> progress-bar-striped progress-bar-animated" style="width: <?= min($niveauGlobalConsoFamilleOut, 100) ?>%"></div>
</div>
<div class="row g-2 text-center">
<div class="col-4"><div class="p-2 border rounded bg-light"><small class="text-muted d-block"><?= _("Consommé") ?></small><span class="fw-bold"><?= format_N($consommationGlobaleFamilleOut) ?></span></div></div>
<div class="col-4"><div class="p-2 border rounded bg-light"><small class="text-muted d-block"><?= _("Plafond") ?></small><span class="fw-bold text-dark"><?= format_N($plafondGlobalFamilleOut) ?></span></div></div>
<div class="col-4"><div class="p-2 border rounded border-<?= $colorOut ?>-subtle bg-<?= $colorOut ?>-subtle"><small class="text-<?= $colorOut ?> d-block fw-bold"><?= _("Solde") ?></small><span class="fw-bold text-<?= $colorOut ?>"><?= format_N($soldeConsommationOut) ?></span></div></div>
</div>
</div>
<div class="consumption-block">
<?php $colorInp = ($niveauGlobalConsoFamilleInp >= 90) ? 'danger' : (($niveauGlobalConsoFamilleInp >= 70) ? 'warning' : 'success'); ?>
<div class="d-flex justify-content-between align-items-end mb-2">
<h6 class="text-uppercase fw-bold text-muted small mb-0"><?= _("Hospitalisation (INP)") ?></h6>
<span class="fw-bold text-<?= $colorInp ?>"><?= number_format((float)$niveauGlobalConsoFamilleInp, 1) ?>%</span>
</div>
<div class="progress mb-3" style="height: 10px;">
<div class="progress-bar bg-<?= $colorInp ?> progress-bar-striped progress-bar-animated" style="width: <?= min($niveauGlobalConsoFamilleInp, 100) ?>%"></div>
</div>
<div class="row g-2 text-center">
<div class="col-4"><div class="p-2 border rounded bg-light"><small class="text-muted d-block"><?= _("Consommé") ?></small><span class="fw-bold"><?= format_N($consommationGlobaleFamilleInp) ?></span></div></div>
<div class="col-4"><div class="p-2 border rounded bg-light"><small class="text-muted d-block"><?= _("Plafond") ?></small><span class="fw-bold text-dark"><?= format_N($plafondGlobalFamilleInp) ?></span></div></div>
<div class="col-4"><div class="p-2 border rounded border-<?= $colorInp ?>-subtle bg-<?= $colorInp ?>-subtle"><small class="text-<?= $colorInp ?> d-block fw-bold"><?= _("Solde") ?></small><span class="fw-bold text-<?= $colorInp ?>"><?= format_N($soldeConsommationInp) ?></span></div></div>
</div>
</div>
</div>
</div>
</div>
@ -416,9 +401,7 @@
<div class="col-12 col-xl-4">
<div class="card shadow-sm border-0 border-top border-primary border-4 h-100">
<div class="card-header bg-white py-3">
<h6 class="mb-0 fw-bold text-primary">
<i class="fas fa-user-tag me-2"></i><?= _("Dépenses Individuelles") ?>
</h6>
<h6 class="mb-0 fw-bold text-primary"><i class="fas fa-user-tag me-2"></i><?= _("Dépenses Individuelles") ?></h6>
</div>
<div class="card-body">
<?php
@ -437,15 +420,13 @@
<div class="progress-bar bg-primary" style="width: <?= min($item['percent'], 100) ?>%"></div>
</div>
<div class="text-end mt-1">
<small class="text-muted small" style="font-size: 0.7rem;"><?= _("Part du plafond familial") ?> : <?= number_format($item['percent'], 1) ?>%</small>
<small class="text-muted" style="font-size: 0.75rem;">
<?= _("Part du plafond familial") ?> : <?= number_format((float)$item['percent'], 1) ?>%
</small>
</div>
</div>
<?php endforeach; ?>
<div class="alert alert-info border-0 small">
<i class="fas fa-info-circle me-1"></i>
<?= _("Ces montants représentent votre consommation personnelle au sein du plafond familial.") ?>
</div>
<div class="alert alert-info border-0 small shadow-sm"><i class="fas fa-info-circle me-1"></i><?= _("Consommation personnelle incluse dans le plafond familial.") ?></div>
</div>
</div>
</div>