radiantproduction/Controleur/ControleurAjaxavenantincorporation.php
2026-03-01 22:52:04 +00:00

147 lines
4.8 KiB
PHP

<?php
require_once 'vendor/autoload.php';
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
require_once 'Framework/Controleurrequete.php'; // OK
require_once 'Modele/Avenant.php';
class ControleurAjaxavenantincorporation extends Controleurrequete
{
private $avenant;
public function __construct()
{
$this->avenant = new Avenant();
}
public function index()
{
$idAvenant = $this->requete->getParametreFormulaire("idAvenant");
$entetecp = $this->avenant->getUnAvenant($idAvenant);
// $listeassures = $this->avenant->getListeassuresAvenant($idAvenant);
$listeadherents = $this->avenant->getListeAdherentsAvenant($idAvenant);
$pdf = new FPDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$ht=10;
$pdf->SetMargins(10, 10, 10) ;
$pdf->SetFont('Arial','B', 15);
$pdf->SetY(30);
$pdf->SetFillColor(135,206,250); // bleu
$pdf->Cell(0,$ht,convertirc("INCORPORATION ENDORSEMENT"),1,1,'C',true);
$pdf->SetFont('');
$pdf->Ln(5);
$pdf->SetFont('Arial','', 9);
$text = convertirc("We refer to your request regarding the inclusion of new member/ beneficiary under your existing Medical Insurance Policy.
We are pleased to confirm that they have been incorporated into the current policy in accordance with the agreed contractual terms and conditions. Below are the related premium and benefits limits calculated on prorated basis in consideration of the period to be covered: ");
// $pdf->MultiCell(0, $ht, $text);
$pdf->MultiCell(0, 6, $text);
$pdf->Ln(5);
$pdf->SetFont('Arial','B', 10);
$pdf->SetFont('Arial','BU', 10);
$pdf->Cell(0,$ht,convertirc("Effective Date :".$entetecp['dateEffetAvenant']),0,0,'L',false);
$pdf->Cell(0,$ht,convertirc("End Date:".$entetecp['dateEcheance']),0,1,'R',false);
$pdf->SetFont('Arial','BU', 15);
$pdf->Cell(50,$ht,convertirc("1. Insured Members and Premium"),0,1,'L',false);
foreach ($listeadherents as $adherent)
{
$idAdherent = $adherent['idAdherent'];
$idEntetecontrat = $adherent['idEntetecontrat'];
$pdf->Cell(50,$ht,convertirc("Family : ".$adherent['nomAdherent']),0,1,'L',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);
$pdf->SetFont('Arial','BI', 10);
$pdf->Cell(0,$ht,convertirc("Done at ".$_SESSION['villeSociete'].", on ".$entetecp['dateJour']),0,1,'C',false);
$pdf->Ln(5);
$pdf->SetFont('Arial','B', 10);
$pdf->SetFont('Arial','BU', 10);
$pdf->Cell(0,$ht,convertirc("The Insurer"),0,0,'L',false);
$pdf->Cell(0,$ht,convertirc("The Subscriber"),0,1,'R',false);
$uniqid = uniqid();
$fichier="Temp/$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();
}
}