radiantassure/Controleur/ControleurAjaximprimerlimite.php
2025-12-07 09:35:13 +00:00

88 lines
3.1 KiB
PHP
Executable File

<?php
require_once 'Framework/Controleurrequete.php';
require_once 'Modele/Adherent.php';
require_once 'Modele/Garantieadherent.php';
class ControleurAjaximprimerlimite extends Controleurrequete
{
private $adherent;
private $garantieadherent;
public function __construct()
{
$this->adherent = new Adherent();
$this->garantieadherent = new Garantieadherent();
}
public function index()
{
$idAdherent = $_SESSION['idAdherent_C'];
$adherent = $this->adherent->getContexteAdherentId($idAdherent);
$garantieadherents = $this->garantieadherent->getGarantieAdherent($idAdherent);
$totalgarantieadherent = $this->garantieadherent->getTotalGarantieAdherent($idAdherent);
$pdf = new FPDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$ht=10;
$pdf->SetMargins(10, 10, 10) ;
$pdf->SetFont('Arial','BI', 9);
$pdf->Cell(0,$ht,convertirc("RADIANT INSURANCE COMPANY : KIGALI"),0,1,'C',false);
$pdf->SetFont('Arial','BIU', 9);
$pdf->Cell(0,$ht,convertirc("LILITES DE LA FAMILLE"),0,1,'C',false);
$pdf->SetFont('Arial','BI', 9);
$pdf->Cell(30,$ht,convertirc("Nom Adhérent"),0,0,'C',false);
$pdf->Cell(50,$ht,convertirc(" : ".$adherent['nom']),0,0,'L',false);
$pdf->Cell(40,$ht,convertirc("Prénoms Adhérent"),0,0,'C',false);
$pdf->Cell(60,$ht,convertirc(" : ".$adherent['prenoms']),0,1,'L',false);
$pdf->SetFont('Arial','', 9);
$pdf->Cell(0,$ht,convertirc('Edité le : '.heureCourante()),0,1,'R',false);
$pdf->SetFont('Arial','BI', 9);
$pdf->Cell(55,$ht,convertirc("Garantie"),1,0,'C',false);
$pdf->Cell(30,$ht,convertirc("Annuelles"),1,0,'C',false);
$pdf->Cell(15,$ht,convertirc("Taux(%)"),1,0,'C',false);
$pdf->Cell(30,$ht,convertirc("En vigeur"),1,0,'C',false);
$pdf->Cell(30,$ht,convertirc("Consommations"),1,0,'C',false);
$pdf->Cell(30,$ht,convertirc("Solde"),1,1,'C',false);
$pdf->SetFont('Arial','', 9);
foreach ($garantieadherents as $garantieadherent)
{
$pdf->Cell(55,$ht,convertirc($garantieadherent['garantie']),1,0,'C',false);
$pdf->Cell(30,$ht,format_N($garantieadherent['plafondAnnuel']),1,0,'C',false);
$pdf->Cell(15,$ht,$garantieadherent['tauxAvenant'],1,0,'C',false);
$pdf->Cell(30,$ht,format_N($garantieadherent['plafond']),1,0,'C',false);
$pdf->Cell(30,$ht,format_N($garantieadherent['consommation']),1,0,'C',false);
$pdf->Cell(30,$ht,format_N($garantieadherent['solde']),1,1,'C',false);
}
$pdf->SetFont('Arial','BI', 9);
$pdf->Cell(55,$ht,convertirc("Totaux : "),1,0,'C',false);
$pdf->Cell(30,$ht,format_N($totalgarantieadherent['plafondAnnuel']),1,0,'C',false);
$pdf->Cell(15,$ht,"",1,0,'C',false);
$pdf->Cell(30,$ht,format_N($totalgarantieadherent['plafond']),1,0,'C',false);
$pdf->Cell(30,$ht,format_N($totalgarantieadherent['consommation']),1,0,'C',false);
$pdf->Cell(30,$ht,format_N($totalgarantieadherent['solde']),1,1,'C',false);
$fichier="Temp/limites_famille"."_".uniqid().".pdf";
$pdf->Output($fichier,"F");
echo 'Télécharger le résultat : <a href="'.$fichier.'" target="_blank" >LIMITES DE LA FAMILLE</a>';
exit();
}
}