diff --git a/Controleur/ControleurFicheadherent.php b/Controleur/ControleurFicheadherent.php index b5ef345..cc353d2 100644 --- a/Controleur/ControleurFicheadherent.php +++ b/Controleur/ControleurFicheadherent.php @@ -21,6 +21,7 @@ class ControleurFicheadherent extends Controleur { $_SESSION['modeDevis'] = "0"; } + public function index() { $idPolice = $_SESSION['idPolice_C']; @@ -37,9 +38,48 @@ class ControleurFicheadherent extends Controleur { $_SESSION['controlerPlafondBeneficiaire'] = "0"; $limite_adherent = $this->garantieadherent->getLimitesAdherent($idAdherent); + + $prestationsParMois = $this->adherent->getPrestationsmensuelles($idAdherent); + $prestationsParLiens = $this->adherent->getPrestationsLiensParente($idAdherent); + + // Prestations par mois + $tabPrestationsParMois = [ + 'mois' => array_column($prestationsParMois, 'mois'), + 'consos' => array_column($prestationsParMois, 'consommationAdherent') + ]; + + // Prestations par liens de parenté + $tabPrestationsParLiens = [ + 'lienparente' => array_column($prestationsParLiens, 'lienparente'), + 'consos_liens' => array_column($prestationsParLiens, 'consommation') + ]; + + $nbreLienParente = count($tabPrestationsParLiens['lienparente']); + + // Consommations par garanties + $tabConsoParGaranties = [ + 'garanties' => array_column($garantieadherents, 'codeGarantie'), + 'depenses' => array_column($garantieadherents, 'consommationFamille'), + 'plafonds' => array_column($garantieadherents, 'plafondFamille') + ]; + + // Encodage JSON + $dataConsoParMois = json_encode($tabPrestationsParMois, JSON_NUMERIC_CHECK); + $dataConsoParLiens = json_encode($tabPrestationsParLiens, JSON_NUMERIC_CHECK); + $dataConsoParGaranties = json_encode($tabConsoParGaranties, JSON_NUMERIC_CHECK); + - $this->genererVue(array('adherent' => $adherent, 'beneficiaires' => $beneficiaires, 'totalbeneficiaires' => $totalbeneficiaires, - 'garantieadherents' => $garantieadherents, 'limite_adherent' => $limite_adherent)); + $this->genererVue(array( + 'adherent' => $adherent, + 'beneficiaires' => $beneficiaires, + 'totalbeneficiaires' => $totalbeneficiaires, + 'garantieadherents' => $garantieadherents, + 'limite_adherent' => $limite_adherent, + 'dataConsoParMois' => $dataConsoParMois, + 'dataConsoParLiens' => $dataConsoParLiens, + 'dataConsoParGaranties' => $dataConsoParGaranties, + 'nbreLienParente' => $nbreLienParente + )); } public function supprimer() { diff --git a/Modele/Adherent.php b/Modele/Adherent.php index 41bf3f0..aa930a4 100755 --- a/Modele/Adherent.php +++ b/Modele/Adherent.php @@ -846,5 +846,34 @@ class Adherent extends Modele { $resultat = $this->executerRequete($sql, array($idAdherent)); return $resultat->fetch(PDO::FETCH_ASSOC); } + + // Ajouté par Sorel le 12-01-2026 => Gestion des graphiques de la famille + + public function getPrestationsmensuelles($idAdherent){ + + if (isset($_SESSION['lang']) && $_SESSION['lang']=="en_US"){ + $sql = 'call prestations_mensuelles_famille_eng(?)'; + }else{ + $sql = 'call prestations_mensuelles_famille(?)'; + } + + $resultat = $this->executerRequete($sql, array($idAdherent)); + + return $resultat->fetchAll(PDO::FETCH_ASSOC); + } + + public function getPrestationsLiensParente($idAdherent){ + + if (isset($_SESSION['lang']) && $_SESSION['lang']=="en_US"){ + + $sql = 'call prestations_lienparente_famille_eng(?)'; + }else{ + $sql = 'call prestations_lienparente_famille(?)'; + } + + $resultat = $this->executerRequete($sql, array($idAdherent)); + + return $resultat->fetchAll(PDO::FETCH_ASSOC); + } } \ No newline at end of file diff --git a/Vue/Ficheadherent/index.php b/Vue/Ficheadherent/index.php index 06e7462..71c7f3f 100644 --- a/Vue/Ficheadherent/index.php +++ b/Vue/Ficheadherent/index.php @@ -265,6 +265,68 @@ + + +