prestation/Controleur/ControleurAjaxsynthsegcpdf.php
2025-12-05 10:42:46 +00:00

185 lines
5.7 KiB
PHP
Executable File

<?php
require_once 'Framework/Controleurrequete.php'; // OK
require_once 'Modele/Gestionconfiee.php';
class ControleurAjaxsynthsegcpdf extends Controleur
{
private $facture;
public function __construct() {
$this->facture = new Gestionconfiee();
}
public function index()
{
$idGcReglement = $_SESSION['idGcReglement'];
$reglement = $this->facture->getgcreglement($idGcReglement);
$gcs = $this->facture->get_synthese_gc();
$valide0 = $reglement['valide0'];
$valideAs = $reglement['valideAs'];
$valide = $reglement['valide'];
$regle = $reglement['regle'];
$pdf = new FPDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetMargins(15, 15, 15) ;
$pdf->SetFont('Arial','BU',10);
$pdf->SetY(30);
// $pdf->AliasNbPages();
$pdf->Cell(0,6,convertirc(_("Facture") . " " . $reglement['gcassureur'] . " : " . $reglement['observations']),0,1,'C',false);
$hl=10;
$pdf->Ln(5);
// Modif du 26/07/2019
$pdf->SetFont('Arial','BI',8);
$pdf->Cell(10,5,convertirc('Date'),0,0,'L',false);
$pdf->Cell(30,5,convertirc(': '.dateFr($reglement['dateSysteme'])),0,0,'L',false);
$pdf->Cell(15,5,convertirc(_("1ère Valid")),0,0,'L',false);
if($valide0=="1")
{
$pdf->Cell(20,5,convertirc(_(": Oui")),0,0,'L',false);
}else
{
$pdf->Cell(20,5,convertirc(_(": Non")),0,0,'L',false);
}
$pdf->Cell(15,5,convertirc(_("Valid Ass")),0,0,'L',false);
if($valideAs=="1")
{
$pdf->Cell(20,5,convertirc(_(": Oui")),0,0,'L',false);
}else
{
$pdf->Cell(20,5,convertirc(_(": Non")),0,0,'L',false);
}
$pdf->Cell(18,5,convertirc(_("2ème Valid")),0,0,'L',false);
if($valide=="1")
{
$pdf->Cell(20,5,convertirc(_(": Oui")),0,0,'L',false);
}else
{
$pdf->Cell(20,5,convertirc(_(": Non")),0,0,'L',false);
}
$pdf->Cell(15,5,convertirc(_("Encais")),0,0,'L',false);
if($regle=="1")
{
$pdf->Cell(20,5,convertirc(_(": Oui")),0,1,'L',false);
}else
{
$pdf->Cell(20,5,convertirc(_(": Non")),0,1,'L',false);
}
// Fin ajout du 01/06/2019
$pdf->Ln(5);
$pdf->SetFont('Arial','B',8);
$pdf->Cell(12,5,convertirc("1 => "._("Cartes")),0,1,'L',false);
$pdf->Cell(20,$hl,convertirc(_("Exercice")),"1",0,'C');
$pdf->Cell(20,$hl,convertirc(_("Mois")),"1",0,'C');
$pdf->Cell(40,$hl,convertirc(_("Nombre de cartes actives")),"1",0,'C');
$pdf->Cell(30,$hl,convertirc(_("Montant par unité")),"1",0,'C');
$pdf->Cell(25,$hl,convertirc(_("Total")),"1",0,'C');
$pdf->Cell(20,$hl,convertirc(_("TVA")),"1",0,'C');
$pdf->Cell(25,$hl,convertirc(_("Total")),"1",1,'C');
$pdf->SetFont('Arial','I',8);
foreach ($gcs as $gc)
{
$pdf->Cell(20,$hl,convertirc($gc['codeExercice']),"1",0,'C');
$pdf->Cell(20,$hl,convertirc($gc['codeMois']),"1",0,'C');
$pdf->Cell(40,$hl,format_N($gc['nbCarte']),"1",0,'C');
$pdf->Cell(30,$hl,format_N($gc['fraisGestion']),"1",0,'C');
$pdf->Cell(25,$hl,format_N($gc['montantFrais']),"1",0,'C');
$pdf->Cell(20,$hl,format_N($gc['tvaFrais']),"1",0,'C');
$pdf->Cell(25,$hl,format_N($gc['ttcFrais']),"1",1,'C');
}
$pdf->SetFont('Arial','BI',8);
$pdf->Cell(110,$hl,convertirc(_("Total")),"1",0,'C');
$pdf->Cell(25,$hl,format_N($reglement['montantFrais']),"1",0,'C');
$pdf->Cell(20,$hl,format_N($reglement['tvaFrais']),"1",0,'C');
$pdf->Cell(25,$hl,format_N($reglement['ttcFrais']),"1",1,'C');
// FIN Cartes
$pdf->Ln(10);
$pdf->SetFont('Arial','B',8);
$pdf->Cell(12,5,convertirc("2 => "._("Sinistres")),0,1,'L',false);
$pdf->Cell(45,$hl,convertirc(_("Rubrique")),"1",0,'C');
$pdf->Cell(45,$hl,convertirc(_("Montant")),"1",0,'C');
$pdf->Cell(45,$hl,convertirc(_("Frais de getsion")),"1",0,'C');
$pdf->Cell(45,$hl,convertirc(_("Total")),"1",1,'C');
$pdf->SetFont('Arial','I',8);
$pdf->Cell(45,$hl,convertirc(_("Sinistres payés")),"1",0,'C');
$pdf->Cell(45,$hl,format_N($reglement['montantApayer']),"1",0,'C');
$pdf->Cell(45,$hl,format_N($reglement['commissionFacture']),"1",0,'C');
$pdf->Cell(45,$hl,format_N($reglement['montantApayer']+$reglement['commissionFacture']),"1",1,'C');
$pdf->Cell(45,$hl,convertirc(_("Montant rejeté")),"1",0,'C');
$pdf->Cell(45,$hl,format_N($reglement['montantRedresse']),"1",0,'C');
$pdf->Cell(45,$hl,format_N($reglement['commissionRedresse']),"1",0,'C');
$pdf->Cell(45,$hl,format_N($reglement['montantRedresse']+$reglement['commissionRedresse']),"1",1,'C');
// FIN Sinistres
$pdf->Ln(10);
$pdf->SetFont('Arial','B',8);
$pdf->Cell(12,5,convertirc("3 => "._("Montant total")),0,1,'L',false);
$pdf->Cell(90,$hl,convertirc(_("Rubrique")),"1",0,'C');
$pdf->Cell(90,$hl,convertirc(_("Montant")),"1",1,'C');
$pdf->SetFont('Arial','I',8);
$pdf->Cell(90,$hl,convertirc(_("Cartes")),"1",0,'C');
$pdf->Cell(90,$hl,format_N($reglement['ttcFrais']),"1",1,'C');
$pdf->Cell(90,$hl,convertirc(_("Sinistres")),"1",0,'C');
$pdf->Cell(90,$hl,format_N($reglement['montantDu']-$reglement['ttcFrais']),"1",1,'C');
$pdf->SetFont('Arial','BI',8);
$pdf->Cell(90,$hl,convertirc(_("Total")),"1",0,'C');
$pdf->Cell(90,$hl,format_N($reglement['montantDu']),"1",1,'C');
// FIN Total
$pdf->Ln(10);
$pdf->SetFont('Arial','U',10);
$pdf->Cell(0,10,convertirc(_('Fait à')).' '.$_SESSION['villeSociete'].', '._('le').' '.heureCouranteLang($_SESSION['lang']),0,1,'C',false);
$fichier="Temp/TMP_SYNTHESE_GC"."_".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;
}
}