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

119 lines
4.4 KiB
PHP
Executable File

<?php
require_once 'Framework/Controleurrequete.php'; // OK
require_once 'Modele/Statistique.php';
class ControleurAjaxdetailrapportspperiodepdf extends Controleur
{
private $detailsp;
public function __construct() {
$this->detailsp = new Statistique();
}
public function index()
{
$idPolice = $this->requete->getParametreFormulaire("idPolice");
$entete = $this->detailsp->detailrapportspperiodepdfentete($idPolice);
$detailsps = $this->detailsp->detailrapportspperiodepdf($idPolice);
$pdf = new FPDF_Protection();
$pdf->SetAuthor('EBENE SOLUTIONS INFORMATIQUES');
$userPassword = '';
$ownerPassword = null;
$pdf->SetProtection(['print'], $userPassword, $ownerPassword);
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetMargins(15, 15, 15) ;
$pdf->Image($_SESSION['lienLogo'],94,3,18);
$pdf->Ln(10);
$pdf->SetFont('Arial','BU',10);
// $pdf->AliasNbPages();
$pdf->Cell(0,6,convertirc(_("RAPPORT SINISTRE A PRIME DETAIL PAR FAMILLE")),0,1,'C',false);
$pdf->Ln(2);
$pdf->SetFont('Arial','B',7);
$pdf->Cell(0,5,convertirc(_('Garant').' : '.$entete['garant']),0,1,'L',false);
$pdf->Cell(0,5,convertirc(_('Souscripteur').' : '.$entete['souscripteur']),0,1,'L',false);
$pdf->Cell(0,5,convertirc(_('Police').' No : '.$entete['numeroPolice'].' / '.$entete['libellePolice']),0,1,'L',false);
$pdf->Cell(0,5,convertirc(_('Période couverte').' : '.dateLang($entete['dateEffetPolice'], $_SESSION['lang']).' '._('au').' '.dateLang($entete['dateFinPolice'], $_SESSION['lang'])),0,1,'L',false);
$pdf->Cell(0,5,convertirc(_('Periode Analyse').' : '.dateLang($entete['debutAnalyse'], $_SESSION['lang']).' '._('au').' '.dateLang($entete['finAnalyse'], $_SESSION['lang'])),0,0,'L',false);
$pdf->Cell(0,5,'Edition : '.heureCouranteLang($_SESSION['lang']),0,1,'R',false);
$pdf->Ln(2);
$hl=5;
$pdf->Cell(15,$hl,convertirc(_('Matricule')),"1",0,'C');
$pdf->Cell(60,$hl,convertirc(_('Adhérent')),"1",0,'C');
$pdf->Cell(15,$hl,convertirc(_('Date Effet')),"1",0,'C');
$pdf->Cell(10,$hl,convertirc(_('Jours')),"1",0,'C');
$pdf->Cell(20,$hl,convertirc(_('Prime An')),"1",0,'C');
$pdf->Cell(20,$hl,convertirc(_('Prime Acquise')),"1",0,'C');
$pdf->Cell(20,$hl,convertirc(_('Sinistres')),"1",0,'C');
$pdf->Cell(20,$hl,convertirc("Ratio"),"1",1,'C');
$pdf->SetFont('Arial','I',7);
foreach ($detailsps as $detailsp)
{
$pdf->Cell(15,$hl,convertirc($detailsp['numeroAdherent']),"1",0,'C');
$pdf->Cell(60,$hl,convertirc(substr($detailsp['adherent'],0,38)),"1",0,'L');
$pdf->Cell(15,$hl,convertirc($detailsp['dateEffetAdherent']),"1",0,'C');
$pdf->Cell(10,$hl,convertirc($detailsp['duree_acq']),"1",0,'C');
$pdf->Cell(20,$hl,format_N($detailsp['primeAnnuelle']),"1",0,'C');
$pdf->Cell(20,$hl,format_N($detailsp['primeAcquise']),"1",0,'C');
$pdf->Cell(20,$hl,format_N($detailsp['sinistres']),"1",0,'C');
$pdf->Cell(10,$hl,convertirc($detailsp['rapportSp']),"1",0,'C');
$pdf->Cell(10,$hl,convertirc($detailsp['rapportSpAn']),"1",1,'C');
}
$pdf->SetFont('Arial','BI',7);
$pdf->Cell(100,$hl,convertirc("TOTAL"),"1",0,'C');
$pdf->Cell(20,$hl,format_N($detailsp['primeAnnuelleTotal']),"1",0,'C');
$pdf->Cell(20,$hl,format_N($detailsp['primeAcquiseTotal']),"1",0,'C');
$pdf->Cell(20,$hl,format_N($detailsp['sinistresTotal']),"1",0,'C');
$pdf->Cell(10,$hl,convertirc($detailsp['rapportSpTotal']),"1",0,'C');
$pdf->Cell(10,$hl,convertirc($detailsp['rapportSpTotalAn']),"1",1,'C');
$pdf->Ln(20);
$tp = 10;
$ht = 7;
$pdf->SetFont('Arial','BI', $tp);
if (est_anglophone())
{
$pdf->Cell(0,$ht,convertirc("Done at " . $_SESSION['villeSociete'].", on ".dateCouranteLang($_SESSION['lang'])),0,1,'C',false);
}
else
{
$pdf->Cell(0,$ht,convertirc("Fait à " . $_SESSION['villeSociete'].", le ".dateCouranteLang($_SESSION['lang'])),0,1,'C',false);
}
$pdf->Ln(10);
$pdf->SetFont('Arial','BU', $tp);
$pdf->Cell(0,$ht,convertirc(_("Le Souscripteur")),0,0,'L',false);
$pdf->Cell(0,$ht,convertirc(_("Le Gestionnaire")),0,0,'R',false);
$fichier="Temp/TMP_CUMUL_SP_FAMILLE"."_".uniqid().".pdf";
$pdf->Output($fichier,"F");
$t_html =' <div id ="div_export_b" class="alert alert-info"> ';
$t_html .=' <a style="font-size:15pt;" href="'.$fichier.'" target="_blank" > '._("TELECHARGER").' </a> ';
$t_html .=' </div ';
echo $t_html;
}
}