From c1282a0e7e995f35ca5b0ea0958e90f2a23b7b55 Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Sun, 1 Mar 2026 22:52:04 +0000 Subject: [PATCH] a --- .../ControleurAjaxavenantincorporation.php | 87 +++++++++++-------- Modele/Avenant.php | 26 ++++++ 2 files changed, 78 insertions(+), 35 deletions(-) diff --git a/Controleur/ControleurAjaxavenantincorporation.php b/Controleur/ControleurAjaxavenantincorporation.php index 645b449d..6962a7d2 100644 --- a/Controleur/ControleurAjaxavenantincorporation.php +++ b/Controleur/ControleurAjaxavenantincorporation.php @@ -19,7 +19,8 @@ class ControleurAjaxavenantincorporation extends Controleurrequete $idAvenant = $this->requete->getParametreFormulaire("idAvenant"); $entetecp = $this->avenant->getUnAvenant($idAvenant); - $listeassures = $this->avenant->getListeassuresAvenant($idAvenant); + // $listeassures = $this->avenant->getListeassuresAvenant($idAvenant); + $listeadherents = $this->avenant->getListeAdherentsAvenant($idAvenant); $pdf = new FPDF(); $pdf->AliasNbPages(); @@ -61,43 +62,59 @@ We are pleased to confirm that they have been incorporated into the current poli $pdf->SetFont('Arial','BU', 15); $pdf->Cell(50,$ht,convertirc("1. Insured Members and Premium"),0,1,'L',false); - $pdf->SetFont('Arial','B', 8); - - $pdf->Cell(20,$ht,convertirc('S / N'),1,0,'C',false); - $pdf->Cell(45,$ht,convertirc('Surname'),1,0,'C',false); - $pdf->Cell(45,$ht,convertirc('Other name'),1,0,'C',false); - $pdf->Cell(10,$ht,convertirc('Relat'),1,0,'C',false); - $pdf->Cell(20,$ht,convertirc('Net Premium'),1,0,'C',false); - - $pdf->Cell(15,$ht,convertirc('Mutualm F'),1,0,'C',false); - $pdf->Cell(15,$ht,convertirc('Access'),1,0,'C',false); - - $pdf->Cell(20,$ht,convertirc('Total Premium'),1,1,'C',false); - - $pdf->SetFont('Arial','', 8); - foreach ($listeassures as $assure) + foreach ($listeadherents as $adherent) { -/* -20 -45 -45 -10 -20 -15 -15 -20 -190 -*/ - $pdf->Cell(20,$ht,convertirc($assure['numeroBeneficiaire']),1,0,'C',false); - $pdf->Cell(45,$ht,convertirc($assure['nomBeneficiaire']),1,0,'C',false); - $pdf->Cell(45,$ht,convertirc($assure['prenomsBeneficiaire']),1,0,'C',false); - $pdf->Cell(10,$ht,convertirc($assure['codeLienParente']),1,0,'C',false); - $pdf->Cell(20,$ht,format_N($assure['primeNette']),1,0,'C',false); + $idAdherent = $adherent['idAdherent']; + $idEntetecontrat = $adherent['idEntetecontrat']; - $pdf->Cell(15,$ht,format_N($assure['taxe']),1,0,'C',false); - $pdf->Cell(15,$ht,format_N($assure['fraisCarte']),1,0,'C',false); + $pdf->Cell(50,$ht,convertirc("Family : ".$adherent['nomAdherent']),0,1,'L',false); - $pdf->Cell(20,$ht,format_N($assure['primeTtc']),1,1,'C',false); + $listeassures = $this->avenant->getListeAssuresAvenantAdherent($idAvenant, $idAdherent); + + $pdf->SetFont('Arial','B', 8); + + $pdf->Cell(20,$ht,convertirc('S / N'),1,0,'C',false); + $pdf->Cell(45,$ht,convertirc('Surname'),1,0,'C',false); + $pdf->Cell(45,$ht,convertirc('Other name'),1,0,'C',false); + $pdf->Cell(10,$ht,convertirc('Relat'),1,0,'C',false); + $pdf->Cell(20,$ht,convertirc('Net Premium'),1,0,'C',false); + + $pdf->Cell(15,$ht,convertirc('Mutualm F'),1,0,'C',false); + $pdf->Cell(15,$ht,convertirc('Access'),1,0,'C',false); + + $pdf->Cell(20,$ht,convertirc('Total Premium'),1,1,'C',false); + + $pdf->SetFont('Arial','', 8); + foreach ($listeassures as $assure) + { + $pdf->Cell(20,$ht,convertirc($assure['numeroBeneficiaire']),1,0,'C',false); + $pdf->Cell(45,$ht,convertirc($assure['nomBeneficiaire']),1,0,'C',false); + $pdf->Cell(45,$ht,convertirc($assure['prenomsBeneficiaire']),1,0,'C',false); + $pdf->Cell(10,$ht,convertirc($assure['codeLienParente']),1,0,'C',false); + $pdf->Cell(20,$ht,format_N($assure['primeNette']),1,0,'C',false); + + $pdf->Cell(15,$ht,format_N($assure['taxe']),1,0,'C',false); + $pdf->Cell(15,$ht,format_N($assure['fraisCarte']),1,0,'C',false); + + $pdf->Cell(20,$ht,format_N($assure['primeTtc']),1,1,'C',false); + } + + $pdf->SetFont('Arial','BU', 15); + $pdf->Cell(50,$ht,convertirc("LISTE DES GARANTIES"),0,1,'L',false); + + $garanties = $this->avenant->getListeGarantieAvenantAdherent($idAdherent, $idEntetecontrat); + + $pdf->SetFont('Arial','B', 8); + + $pdf->Cell(100,$ht,convertirc('BENEFITS'),1,0,'C',false); + $pdf->Cell(90,$ht,convertirc('LIMITS'),1,1,'C',false); + + $pdf->SetFont('Arial','', 8); + foreach ($garanties as $garantie) + { + $pdf->Cell(20,$ht,convertirc($garantie['garantieEng']),1,0,'C',false); + $pdf->Cell(20,$ht,format_N($garantie['plafond']),1,1,'C',false); + } } $pdf->Ln(5); diff --git a/Modele/Avenant.php b/Modele/Avenant.php index a05db8b3..591e35b3 100644 --- a/Modele/Avenant.php +++ b/Modele/Avenant.php @@ -100,4 +100,30 @@ class Avenant extends Modele { return $resultat->fetchAll(PDO::FETCH_ASSOC); } + public function getListeAdherentsAvenant($idAvenant) + { + $sql = 'call sp_get_liste_adherents_avenant(?);'; + + $resultat = $this->executerRequete($sql, array($idAvenant)); + + return $resultat->fetchAll(PDO::FETCH_ASSOC); + } + + public function getListeAssuresAvenantAdherent($idAvenant, $idAdherent) + { + $sql = 'call sp_get_liste_assures_avenant_adherent(?, ?);'; + + $resultat = $this->executerRequete($sql, array($idAvenant, $idAdherent)); + + return $resultat->fetchAll(PDO::FETCH_ASSOC); + } + + public function getListeGarantieAvenantAdherent($idAdherent, $idEntetecontrat) + { + $sql = 'call sp_garanties_adherent_avenant(?, ?);'; + + $resultat = $this->executerRequete($sql, array($idAdherent, $idEntetecontrat)); + + return $resultat->fetchAll(PDO::FETCH_ASSOC); + } }