radiantproduction/Controleur/ControleurAjaxdetailrapportspgarantiepdf.php

88 lines
3.2 KiB
PHP

<?php
require_once 'Framework/Controleurrequete.php'; // OK
require_once 'Modele/Statistique.php';
class ControleurAjaxdetailrapportspgarantiepdf extends Controleur
{
private $detailsp;
public function __construct() {
$this->detailsp = new Statistique();
}
public function index()
{
$idPolice = $this->requete->getParametreFormulaire("idPolice");
$entete = $this->detailsp->detailrapportsppdfentete($idPolice);
$detailsps = $this->detailsp->detailrapportspgarantiepdf($idPolice);
$pdf = new FPDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetMargins(10, 10, 10) ;
$pdf->SetFont('Arial','BU',10);
// $pdf->AliasNbPages();
$pdf->Cell(0,6,convertirc($entete['nomAssureur']." : "._('DETAIL DES GARANTIES')),0,1,'C',false);
$pdf->Ln(2);
$pdf->SetFont('Arial','B',7);
$pdf->Cell(0,5,convertirc(_('Souscripteur').' : '.$entete['souscripteur']),0,1,'L',false);
$pdf->Cell(0,5,convertirc(_('No Police').' : '.$entete['numeroPolice']),0,1,'L',false);
$pdf->Cell(0,5,convertirc(_('Couverture').' : '.$entete['dateEffetPolice'].' '._('au').' '.$entete['dateFinPolice']),0,1,'L',false);
$pdf->Cell(0,5,convertirc(_('Date Analyse').' : '.$entete['dateAnalyse']),0,0,'L',false);
$pdf->Cell(0,5,'Edition : '.heureCouranteLang($_SESSION['lang']),0,1,'R',false);
$pdf->Ln(2);
$hl=5;
$pdf->Cell(40,$hl,convertirc(_('Adhérent')),"1",0,'C');
$pdf->Cell(40,$hl,convertirc(_('Bénéficiaire')),"1",0,'C');
$pdf->Cell(35,$hl,convertirc(_('College')),"1",0,'C');
$pdf->Cell(13,$hl,convertirc("Date"),"1",0,'C');
$pdf->Cell(35,$hl,convertirc(_('Prestataire')),"1",0,'C');
$pdf->Cell(5,$hl,convertirc(_('Gar')),"1",0,'C');
$pdf->Cell(13,$hl,convertirc(_('Montant')),"1",0,'C');
$pdf->Cell(9,$hl,convertirc(_('Fact')),"1",1,'C');
$pdf->SetFont('Arial','I',6);
$montantTotal = 0;
foreach ($detailsps as $detailsp)
{
$pdf->Cell(40,$hl,convertirc($detailsp['adherent']),"1",0,'L');
$pdf->Cell(40,$hl,convertirc($detailsp['beneficiaire']),"1",0,'L');
$pdf->Cell(35,$hl,convertirc($detailsp['college']),"1",0,'L');
$pdf->Cell(13,$hl,convertirc($detailsp['dateFacture']),"1",0,'C');
// $pdf->Cell(40,$hl,convertirc($detailsp['prestataire']),"1",0,'L');
$pdf->Cell(35,$hl,convertirc(substr($detailsp['prestataire'], 0, 30)),"1",0,'L');
$pdf->Cell(5,$hl,convertirc($detailsp['gar']),"1",0,'C');
$pdf->Cell(13,$hl,format_N($detailsp['montant']),"1",0,'C');
$pdf->Cell(9,$hl,convertirc($detailsp['facture']),"1",1,'C');
$montantTotal = $detailsp['montantTotal'];
}
/* mis en commentaire le 01/08/2018 => proposition de MUGABO*/
$pdf->SetFont('Arial','BI',6);
$pdf->Cell(168,$hl,convertirc("TOTAL"),"1",0,'C');
// $pdf->Cell(13,$hl,format_N($detailsp['montantTotal']),"1",0,'C');
$pdf->Cell(13,$hl,format_N($montantTotal),"1",0,'C');
$pdf->Cell(9,$hl,"","1",1,'C');
$fichier="Temp/TMP_DETAIL_GARANTIES_SP"."_".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;
}
}