garant/Controleur/ControleurAjaximprimerlisteassureperiode.php
2025-12-05 10:57:03 +00:00

490 lines
18 KiB
PHP
Executable File

<?php
require_once 'Framework/Controleurrequete.php'; // OK
require_once 'Modele/Beneficiaire.php';
require_once 'Modele/Collegepolice.php';
class ControleurAjaximprimerlisteassureperiode extends Controleurrequete
{
private $beneficiaire;
private $college;
public function __construct()
{
$this->beneficiaire = new Beneficiaire();
$this->college = new Collegepolice();
}
public function index()
{
$idPolice = $_SESSION['idPolice_C'];
$debut = $this->requete->getParametreDate("debut");
$fin = $this->requete->getParametreDate("fin");
$enetete = $this->beneficiaire->getEnteteBeneficiairesAimprimer($idPolice);
$colleges = $this->college->getCollegesPolice($idPolice);
$nbreCollege = count($colleges);
//var_dump($nbreCollege);
//die();
$beneficiaires = $this->beneficiaire->getBeneficiairesAimprimerperiode($idPolice, $debut, $fin);
$nbFamilles = $this->beneficiaire->getnombrefamille($idPolice);
$nbassurecolleges = $this->beneficiaire->getnombreAssureCollege($idPolice);
$nombreAssures = $this->beneficiaire->getnombreAssure($idPolice);
$nombreGeniteurs = $this->beneficiaire->getnombreGeniteur($idPolice);
$nombreautresparents = $this->beneficiaire->getnombreAutreParent($idPolice);
$nombreConjoints = $this->beneficiaire->getnombreConjoint($idPolice);
$nombreStatuts = $this->college->getnombrestatutcollege($idPolice);
$nombreStatutspolices = $this->college->getnombrestatutpolice($idPolice);
$nombrestatutclients = $this->college->getnombrestatutclient($idPolice);
$codeGcAssureur = $this->beneficiaire->getCodeGarantPolice($idPolice);
$infosDuGarant = $this->beneficiaire->getInfosGarant($codeGcAssureur);
//var_dump($nombreStatuts);
//die();
//$nombreautreconjoints = $this->beneficiaire->getnombreAutreConjoint($idPolice);
//$getnombreenfants = $this->beneficiaire->getnombreEnfant($idPolice);
//$getnombreenfantsups = $this->beneficiaire->getnombreEnfantSup($idPolice);
$pdf = new FPDF();
$pdf->AliasNbPages();
$x = 1;
$pdf->AddPage();
$ht=6;
$pdf->SetMargins(10, 10, 10) ;
if ($infosDuGarant['typeGarant']=="1"){
if (file_exists($_SESSION['dossierSociete'].'/Tarifs/Img/garants/logo_'.strtolower($codeGcAssureur).'.png')){
$pdf->Image($_SESSION['dossierSociete'].'/Tarifs/Img/garants/logo_'.strtolower($codeGcAssureur).'.png',10,5,30);
}else{
$pdf->Image($_SESSION['dossierSociete'].'/Tarifs/Img/logo_vitalis.png',10,6,30);
}
}else{
$pdf->Image($_SESSION['dossierSociete'].'/Tarifs/Img/logo_vitalis.png',10,6,30);
}
$pdf->Cell(90);
//$pdf->Ln(50);
$pdf->SetFont('Arial','I',7);
//Numéro de page
$pdf->Cell(20,$ht,'Page '.$pdf->PageNo().'/{nb}',0,0,'C');
$pdf->SetFont('Arial','', 7);
$pdf->Cell(0,$ht,convertirc(_('Edité le').' : '.heureCouranteLang($_SESSION['lang'])),0,1,'R',false);
// Police Arial gras 15
$pdf->SetFont('Arial','B',13);
$pdf->Ln(12);
// Décalage à droite
$pdf->Cell(30);
$pdf->SetFillColor(217,237,247); // bleu
// Titre
$pdf->Cell(150,10,convertirc("LISTE DES ASSURES ET LEURS DEPENDANTS"),1,0,'C',true);
$pdf->Ln(15);
$pdf->Cell(0,$ht,convertirc(_("Du ").dateLang($debut,$_SESSION['lang'])._(" au ").dateLang($fin,$_SESSION['lang'])),0,0,'C',false);
//$pdf->Cell(130);
$pdf->SetFont('Arial','B', 9);
$pdf->Ln(10);
$pdf->Cell(25,$ht,convertirc(_("Garant")),0,0,'L',false);
$pdf->Cell(50,$ht,convertirc(" : ".$enetete['codeGcAssureur']),0,0,'L',false);
$pdf->Cell(2);
$pdf->Cell(0,$ht,convertirc($enetete['garant']),0,1,'L',false);
$pdf->Cell(25,$ht,convertirc(_("Effet du ")),0,0,'L',false);
$pdf->Cell(25,$ht,convertirc(" : ".$enetete['dateEffet']." au "),0,0,'L',false);
$pdf->Cell(2);
$pdf->Cell(40,$ht,convertirc(($enetete['dateEcheance']),0,0,'L',false));
$pdf->Cell(-15);
$pdf->Cell(25,$ht,convertirc(_("Statut(s) conserné(s):")),0,0,'L',false);
$pdf->Cell(25);
$pdf->Cell(50,$ht,convertirc(_("('A','C','D','E','F','O','X')")),0,1,'L',false);
$pdf->Cell(25,$ht,convertirc(_("Souscripteur")),0,0,'L',false);
$pdf->Cell(25,$ht,convertirc(" : ".$enetete['numeroClient']),0,0,'L',false);
$pdf->Cell(27);
$pdf->Cell(0,$ht,convertirc($enetete['nomClient']),0,1,'L',false);
$pdf->Cell(25,$ht,convertirc(_("Police")),0,0,'L',false);
$pdf->Cell(25,$ht,convertirc(" : ".$enetete['numeroPolice']),0,0,'L',false);
if (empty($enetete['libellePolice'])){
$libellePolice = $enetete['nomClient'];
}else{
$libellePolice = $enetete['libellePolice'];
}
$pdf->Cell(27);
$pdf->Cell(0,$ht,convertirc($libellePolice),0,1,'L',false);
//$pdf->Ln(20);
/*
$pdf->Cell(30,$ht,convertirc(_("Nom")),1,0,'C',false);
$pdf->Cell(40,$ht,convertirc(_("Prénoms")),1,0,'C',false);
$pdf->Cell(10,$ht,convertirc(_("Statut")),1,0,'C',false);
$pdf->Cell(20,$ht,convertirc(_("Numéro")),1,0,'C',false);
$pdf->Cell(10,$ht,convertirc(_("Sexe")),1,0,'C',false);
$pdf->Cell(20,$ht,convertirc(_("Naissance")),1,0,'C',false);
$pdf->Cell(20,$ht,convertirc(_("Entrée")),1,0,'C',false);
$pdf->Cell(20,$ht,convertirc(_('P NETTE STAT')),1,0,'C',false);
$pdf->Cell(20,$ht,convertirc(_('Prime TTC')),1,1,'C',false);
*/
//$oldidCollege = "0";
//colleges
foreach ($colleges as $college){
//$pdf->Ln(10);
$pdf->Ln(4);
$pdf->SetFont('Arial','B', 9);
$pdf->SetTextColor(234,67,53);
$pdf->Cell(25,$ht,convertirc(_("Collège")),0,0,'L',false);
$pdf->Cell(25,$ht,convertirc(" : ".$college['codeProduit']),0,0,'L',false);
$pdf->Cell(27);
$pdf->Cell(0,$ht,convertirc($college['libelleCollege']),0,1,'L',false);
$pdf->Ln(2);
$numeroAdherent = "";
$pdf->SetTextColor(0);
foreach ($beneficiaires as $beneficiaire)
{
if($college['idCollege']==$beneficiaire['idCollege']){
if($numeroAdherent!=$beneficiaire['numeroAdherent'])
{
$pdf->SetFont('Arial','B', 9);
$pdf->Cell(190,$ht,convertirc(_("Famille")." : ".$beneficiaire['nomAdherent']),1,0,'C',false);
foreach ($nbFamilles as $nbFamille){
if ($beneficiaire['numeroAdherent'] == $nbFamille['numeroAdherent']){
$pdf->Cell(130);
$pdf->Cell(0,$ht,convertirc(_("Effectif")." : ".$nbFamille['nbfamille']),0,1,'R',false);
}
}
$pdf->SetFillColor(217,237,247);
$pdf->Cell(20,$ht,convertirc(_("Assuré(s)")),1,0,'C',true);
$pdf->SetFillColor(217,237,247);
$pdf->Cell(20,$ht,convertirc(_("Matricule")),1,0,'C',true);
$pdf->SetFillColor(217,237,247);
$pdf->Cell(25,$ht,convertirc(_("Nom")),1,0,'C',true);
$pdf->SetFillColor(217,237,247);
$pdf->Cell(55,$ht,convertirc(_("Prénoms")),1,0,'C',true);
$pdf->SetFillColor(217,237,247);
$pdf->Cell(10,$ht,convertirc(_("Statut")),1,0,'C',true);
$pdf->SetFillColor(217,237,247);
$pdf->Cell(10,$ht,convertirc(_("Sexe")),1,0,'C',true);
$pdf->SetFillColor(217,237,247);
$pdf->Cell(20,$ht,convertirc(_("Naissance")),1,0,'C',true);
$pdf->SetFillColor(217,237,247);
$pdf->Cell(15,$ht,convertirc(_("Entrée")),1,0,'C',true);
$pdf->SetFillColor(217,237,247);
$pdf->Cell(15,$ht,convertirc(_("Avenant")),1,1,'C',true);
}
$pdf->SetFont('Arial','', 7);
$pdf->Cell(20,$ht,convertirc($beneficiaire['numeroAdherent']),1,0,'L',false);
$pdf->Cell(20,$ht,convertirc($beneficiaire['numeroBeneficiaire']),1,0,'L',false);
$pdf->Cell(25,$ht,convertirc(substr($beneficiaire['nomBeneficiaire'], 0, 15)),1,0,'L',false);
$pdf->Cell(55,$ht,convertirc(substr($beneficiaire['prenomsBeneficiaire'], 0, 30)),1,0,'L',false);
$pdf->Cell(10,$ht,convertirc($beneficiaire['codeLienParente']),1,0,'C',false);
$pdf->Cell(10,$ht,convertirc($beneficiaire['sexe']),1,0,'C',false);
$pdf->Cell(20,$ht,convertirc($beneficiaire['dateNaissance']),1,0,'C',false);
$pdf->Cell(15,$ht,convertirc($beneficiaire['dateEntree']),1,0,'C',false);
$pdf->Cell(15,$ht,$beneficiaire['codeTypeAvenant'],1,1,'C',false);
$numeroAdherent = $beneficiaire['numeroAdherent'];
}
}
/*
$pdf->Ln(5);
$pdf->SetFont('Arial','B', 9);
$pdf->SetTextColor(234,67,53);
foreach ($nombreStatuts as $nombreStatut){
if ($college['idCollege'] == $nombreStatut['idCollege']){
$pdf->Cell(0,$ht,convertirc("Effectif Collège : ".$college['codeProduit']." ".$college['libelleCollege']." = ".$nombreStatut['nbcollege']),'TLR',1,'L',false);
$pdf->SetTextColor(0);
$pdf->SetFont('Arial','', 9);
$pdf->Cell(25,$ht,convertirc(_("Assuré")),'L',0,'L',false);
$pdf->SetFont('Arial','B', 9);
$pdf->Cell(25,$ht,convertirc(" 'A' : ".$nombreStatut['nbassure']),0,0,'L',false);
$pdf->SetFont('Arial','', 9);
$pdf->Cell(20);
$pdf->Cell(35,$ht,convertirc(_("Géniteur(Ascendant)")),0,0,'L',false);
$pdf->SetFont('Arial','B', 9);
$pdf->Cell(25,$ht,convertirc(" 'F' : ".$nombreStatut['nbgeniteur']),0,0,'L',false);
$pdf->SetFont('Arial','', 9);
$pdf->Cell(10);
$pdf->Cell(35,$ht,convertirc(_("Autre Parent")),0,0,'L',false);
$pdf->SetFont('Arial','B', 9);
$pdf->Cell(0,$ht,convertirc(" 'O' : ".$nombreStatut['nbautreparent']),'R',0,'L',false);
$pdf->Ln();
$pdf->SetFont('Arial','', 9);
$pdf->Cell(25,$ht,convertirc(_("Conjoint")),'L',0,'L',false);
$pdf->SetFont('Arial','B', 9);
$pdf->Cell(25,$ht,convertirc(" 'C' : ".$nombreStatut['nbconjoint']),0,0,'L',false);
$pdf->SetFont('Arial','', 9);
$pdf->Cell(20);
$pdf->Cell(35,$ht,convertirc(_("Autre Conjoint")),0,0,'L',false);
$pdf->SetFont('Arial','B', 9);
$pdf->Cell(0,$ht,convertirc(" 'D' : ".$nombreStatut['nbautreconjoint']),'R',0,'L',false);
$pdf->Ln();
$pdf->SetFont('Arial','', 9);
$pdf->Cell(25,$ht,convertirc(_("Enfant")),'LB',0,'L',false);
$pdf->SetFont('Arial','B', 9);
$pdf->Cell(45,$ht,convertirc(" 'E' : ".$nombreStatut['nbenfant']),'B',0,'L',false);
$pdf->SetFont('Arial','', 9);
//$pdf->Cell(20);
$pdf->Cell(35,$ht,convertirc(_("Enfant supplémentaire")),'B',0,'L',false);
$pdf->SetFont('Arial','B', 9);
$pdf->Cell(0,$ht,convertirc(" 'X' : ".$nombreStatut['nbenfantsup']),'BR',0,'L',false);
}
}
$pdf->Ln(8);
$pdf->SetFont('Arial','B', 9);
$pdf->SetTextColor(66,133,244);
foreach ($nombreStatutspolices as $nombreStatutspolice){
if ($college['idCollege'] == $nombreStatutspolice['idCollege']){
$pdf->Cell(0,$ht,convertirc("Effectif Police : ".$enetete['numeroPolice']." ".$libellePolice." = ".$nombreStatutspolice['nbpolice']),'TLR',1,'L',false);
$pdf->SetTextColor(0);
$pdf->SetFont('Arial','', 9);
$pdf->Cell(25,$ht,convertirc(_("Assuré")),'L',0,'L',false);
$pdf->SetFont('Arial','B', 9);
$pdf->Cell(25,$ht,convertirc(" 'A' : ".$nombreStatutspolice['nbassure']),0,0,'L',false);
$pdf->SetFont('Arial','', 9);
$pdf->Cell(20);
$pdf->Cell(35,$ht,convertirc(_("Géniteur(Ascendant)")),0,0,'L',false);
$pdf->SetFont('Arial','B', 9);
$pdf->Cell(25,$ht,convertirc(" 'F' : ".$nombreStatutspolice['nbgeniteur']),0,0,'L',false);
$pdf->SetFont('Arial','', 9);
$pdf->Cell(10);
$pdf->Cell(35,$ht,convertirc(_("Autre Parent")),0,0,'L',false);
$pdf->SetFont('Arial','B', 9);
$pdf->Cell(0,$ht,convertirc(" 'O' : ".$nombreStatutspolice['nbautreparent']),'R',0,'L',false);
$pdf->Ln();
$pdf->SetFont('Arial','', 9);
$pdf->Cell(25,$ht,convertirc(_("Conjoint")),'L',0,'L',false);
$pdf->SetFont('Arial','B', 9);
$pdf->Cell(25,$ht,convertirc(" 'C' : ".$nombreStatutspolice['nbconjoint']),0,0,'L',false);
$pdf->SetFont('Arial','', 9);
$pdf->Cell(20);
$pdf->Cell(35,$ht,convertirc(_("Autre Conjoint")),0,0,'L',false);
$pdf->SetFont('Arial','B', 9);
$pdf->Cell(0,$ht,convertirc(" 'D' : ".$nombreStatutspolice['nbautreconjoint']),'R',0,'L',false);
$pdf->Ln();
$pdf->SetFont('Arial','', 9);
$pdf->Cell(25,$ht,convertirc(_("Enfant")),'LB',0,'L',false);
$pdf->SetFont('Arial','B', 9);
$pdf->Cell(45,$ht,convertirc(" 'E' : ".$nombreStatutspolice['nbenfant']),'B',0,'L',false);
$pdf->SetFont('Arial','', 9);
//$pdf->Cell(20);
$pdf->Cell(35,$ht,convertirc(_("Enfant supplémentaire")),'B',0,'L',false);
$pdf->SetFont('Arial','B', 9);
$pdf->Cell(0,$ht,convertirc(" 'X' : ".$nombreStatutspolice['nbenfantsup']),'BR',0,'L',false);
}
}
$pdf->Ln(8);
$pdf->SetFont('Arial','B', 9);
$pdf->SetTextColor(52,168,83);
foreach ($nombrestatutclients as $nombrestatutclient){
if ($college['idCollege'] == $nombrestatutclient['idCollege']){
$pdf->Cell(0,$ht,convertirc("Effectif Souscripteur : ".$enetete['numeroClient']." ".$enetete['nomClient']." = ".$nombrestatutclient['nbfamille']),'TLR',1,'L',false);
$pdf->SetTextColor(0);
$pdf->SetFont('Arial','', 9);
$pdf->Cell(25,$ht,convertirc(_("Assuré")),'L',0,'L',false);
$pdf->SetFont('Arial','B', 9);
$pdf->Cell(25,$ht,convertirc(" 'A' : ".$nombrestatutclient['nbassure']),0,0,'L',false);
$pdf->SetFont('Arial','', 9);
$pdf->Cell(20);
$pdf->Cell(35,$ht,convertirc(_("Géniteur(Ascendant)")),0,0,'L',false);
$pdf->SetFont('Arial','B', 9);
$pdf->Cell(25,$ht,convertirc(" 'F' : ".$nombrestatutclient['nbgeniteur']),0,0,'L',false);
$pdf->SetFont('Arial','', 9);
$pdf->Cell(10);
$pdf->Cell(35,$ht,convertirc(_("Autre Parent")),0,0,'L',false);
$pdf->SetFont('Arial','B', 9);
$pdf->Cell(0,$ht,convertirc(" 'O' : ".$nombrestatutclient['nbautreparent']),'R',0,'L',false);
$pdf->Ln();
$pdf->SetFont('Arial','', 9);
$pdf->Cell(25,$ht,convertirc(_("Conjoint")),'L',0,'L',false);
$pdf->SetFont('Arial','B', 9);
$pdf->Cell(25,$ht,convertirc(" 'C' : ".$nombrestatutclient['nbconjoint']),0,0,'L',false);
$pdf->SetFont('Arial','', 9);
$pdf->Cell(20);
$pdf->Cell(35,$ht,convertirc(_("Autre Conjoint")),0,0,'L',false);
$pdf->SetFont('Arial','B', 9);
$pdf->Cell(0,$ht,convertirc(" 'D' : ".$nombrestatutclient['nbautreconjoint']),'R',0,'L',false);
$pdf->Ln();
$pdf->SetFont('Arial','', 9);
$pdf->Cell(25,$ht,convertirc(_("Enfant")),'LB',0,'L',false);
$pdf->SetFont('Arial','B', 9);
$pdf->Cell(45,$ht,convertirc(" 'E' : ".$nombrestatutclient['nbenfant']),'B',0,'L',false);
$pdf->SetFont('Arial','', 9);
//$pdf->Cell(20);
$pdf->Cell(35,$ht,convertirc(_("Enfant supplémentaire")),'B',0,'L',false);
$pdf->SetFont('Arial','B', 9);
$pdf->Cell(0,$ht,convertirc(" 'X' : ".$nombrestatutclient['nbenfantsup']),'BR',0,'L',false);
}
}
//$pdf->SetY();
//Police
//for ($x = 2; $x < $nbreCollege; $x++) {
*/
if($x < $nbreCollege){
$pdf->AddPage();
if ($infosDuGarant['typeGarant']=="1"){
if (file_exists($_SESSION['dossierSociete'].'/Tarifs/Img/garants/logo_'.strtolower($codeGcAssureur).'.png')){
$pdf->Image($_SESSION['dossierSociete'].'/Tarifs/Img/garants/logo_'.strtolower($codeGcAssureur).'.png',10,5,30);
}else{
$pdf->Image($_SESSION['dossierSociete'].'/Tarifs/Img/logo_vitalis.png',10,6,30);
}
}else{
$pdf->Image($_SESSION['dossierSociete'].'/Tarifs/Img/logo_vitalis.png',10,6,30);
}
$pdf->Cell(90);
//$pdf->Ln(50);
$pdf->SetFont('Arial','I',7);
//Numéro de page
$pdf->Cell(20,$ht,'Page '.$pdf->PageNo().'/{nb}',0,0,'C');
$pdf->SetFont('Arial','', 7);
$pdf->Cell(0,$ht,convertirc(_('Edité le').' : '.heureCouranteLang($_SESSION['lang'])),0,1,'R',false);
// Police Arial gras 15
$pdf->SetFont('Arial','B',13);
$pdf->Ln(12);
// Décalage à droite
$pdf->Cell(30);
$pdf->SetFillColor(217,237,247); // bleu
// Titre
$pdf->Cell(150,10,convertirc("LISTE DES ASSURES ET LEURS DEPENDANTS"),1,0,'C',true);
$pdf->Ln(15);
$pdf->Cell(0,$ht,convertirc(_("Du ").dateLang($debut,$_SESSION['lang'])._(" au ").dateLang($fin,$_SESSION['lang'])),0,0,'C',false);
//$pdf->Cell(130);
$pdf->SetFont('Arial','B', 9);
$pdf->Ln(17);
$pdf->Cell(25,$ht,convertirc(_("Garant")),0,0,'L',false);
$pdf->Cell(25,$ht,convertirc(" : ".$enetete['codeGcAssureur']),0,0,'L',false);
$pdf->Cell(2);
$pdf->Cell(0,$ht,convertirc($enetete['garant']),0,1,'L',false);
$pdf->Cell(25,$ht,convertirc(_("Période du ")),0,0,'L',false);
$pdf->Cell(25,$ht,convertirc(" : ".$enetete['dateEffet']." au "),0,0,'L',false);
$pdf->Cell(2);
$pdf->Cell(40,$ht,convertirc(($enetete['dateEcheance']),0,0,'L',false));
$pdf->Cell(-15);
$pdf->Cell(25,$ht,convertirc(_("Statut(s) conserné(s):")),0,0,'L',false);
$pdf->Cell(25);
$pdf->Cell(50,$ht,convertirc(_("('A','C','D','E','F','O','X')")),0,1,'L',false);
$pdf->Cell(25,$ht,convertirc(_("Souscripteur")),0,0,'L',false);
$pdf->Cell(25,$ht,convertirc(" : ".$enetete['numeroClient']),0,0,'L',false);
$pdf->Cell(2);
$pdf->Cell(0,$ht,convertirc($enetete['nomClient']),0,1,'L',false);
$pdf->Cell(25,$ht,convertirc(_("Police")),0,0,'L',false);
$pdf->Cell(27,$ht,convertirc(" : ".$enetete['numeroPolice']),0,0,'L',false);
if (empty($enetete['libellePolice'])){
$libellePolice = $enetete['nomClient'];
}else{
$libellePolice = $enetete['libellePolice'];
}
$pdf->Cell(0,$ht,convertirc($libellePolice),0,1,'L',false);
$x = $x + 1;
}
}
if ($infosDuGarant['typeGarant']=="1"){
if (file_exists($_SESSION['dossierSociete'].'/Tarifs/Img/garants/pied_'.strtolower($codeGcAssureur).'.png')){
$pdf->Image($_SESSION['dossierSociete'].'/Tarifs/Img/garants/pied_'.strtolower($codeGcAssureur).'.png',10,265,190);
}
}
$fichier="Temp/TMP_liste_assures"."_".uniqid().".pdf";
$pdf->Output($fichier,"F");
$t_html =' <div id ="div_export_a" class="alert alert-info"> ';
$t_html .=' <a style="font-size:15pt;" href="'.$fichier.'" target="_blank" > '._("TELECHARGER").' </a> ';
$t_html .=' </div ';
echo $t_html;
exit();
}
}