production/Controleur/ControleurAjaximprimerlimite.php
2025-12-02 11:29:44 +00:00

97 lines
3.3 KiB
PHP
Executable File

<?php
require_once 'Framework/Controleurrequete.php'; // OK
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'];
// $exercieReference = $this->requete->getParametreFormulaire("exercieReference");
$idEntetecontrat = $this->requete->getParametreFormulaire("idEntetecontrat");
$entetecontrat = $this->adherent->getentetecontrat($idEntetecontrat);
$adherent = $this->adherent->getContexteAdherentId($idAdherent);
$garantieadherents = $this->garantieadherent->getGarantieAdherentEnteteContrat($idAdherent, $idEntetecontrat);
$pdf = new FPDF_Protection();
$pdf->SetAuthor('EBENE SOLUTIONS INFORMATIQUES');
$userPassword = '';
$ownerPassword = null;
$pdf->SetProtection(['print'], $userPassword, $ownerPassword);
$pdf->AliasNbPages();
$pdf->AddPage();
$ht=10;
$pdf->SetMargins(10, 10, 10) ;
$pdf->SetFont('Arial','BI', 9);
$pdf->Cell(0,$ht,convertirc($_SESSION['nomSociete']),0,1,'C',false);
$pdf->SetFont('Arial','BIU', 9);
$pdf->Cell(0,$ht,convertirc(_("PLAFONDS DE LA FAMILLE")),0,1,'C',false);
$pdf->SetFont('Arial','BI', 9);
$pdf->Cell(30,$ht,convertirc(_("Famille")),0,0,'C',false);
$pdf->Cell(50,$ht,convertirc(" : ".$adherent['nomAdherent']),0,0,'L',false);
$pdf->Cell(40,$ht,convertirc(_("Période")),0,0,'C',false);
$pdf->Cell(60,$ht,convertirc(" : ".$entetecontrat['dateEffet']." <=> ".$entetecontrat['dateFin']),0,1,'L',false);
$pdf->SetFont('Arial','', 9);
$pdf->Cell(0,$ht,convertirc(_('Edition'). ' : '.heureCouranteLang($_SESSION['lang'])),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);
$fichier="Temp/TMP_limites_famille"."_".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();
}
}