garant/Controleur/ControleurAjaxfraisgestiongcdetailpdf.php
2025-12-05 10:57:03 +00:00

125 lines
3.8 KiB
PHP
Executable File

<?php
require_once 'Framework/Controleurrequete.php';
require_once 'Modele/Gestionconfiee.php';
class ControleurAjaxfraisgestiongcdetailpdf 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_frais_gestion_gc_detail();
$valide0 = $reglement['valide0'];
$valideAs = $reglement['valideAs'];
$valide = $reglement['valide'];
$regle = $reglement['regle'];
$pdf = new FPDF("L");
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetMargins(15, 15, 15) ;
$pdf->SetFont('Arial','BU',10);
// $pdf->AliasNbPages();
$pdf->Cell(0,6,convertirc(_("FRAIS DE GESTION DE LA FACTURATION : DETAIL")),0,1,'C',false);
$pdf->Ln(2);
$pdf->SetFont('Arial','B',6);
$pdf->Cell(12,5,convertirc(_("Assureur")),0,0,'L',false);
$pdf->Cell(18,5,convertirc(': '.$reglement['gcassureur']),0,0,'L',false);
$pdf->Cell(8,5,convertirc('Date'),0,0,'L',false);
$pdf->Cell(25,5,convertirc(': '.dateFr($reglement['dateSysteme'])),0,0,'L',false);
$pdf->Cell(14,5,convertirc(_("1ère Valid.")),0,0,'L',false);
if($valide0=="1")
{
$pdf->Cell(18,5,convertirc(_(": Oui")),0,0,'L',false);
}else
{
$pdf->Cell(18,5,convertirc(_(": Non")),0,0,'L',false);
}
$pdf->Cell(14,5,convertirc(_("Valid. Ass.")),0,0,'L',false);
if($valideAs=="1")
{
$pdf->Cell(18,5,convertirc(_(": Oui")),0,0,'L',false);
}else
{
$pdf->Cell(18,5,convertirc(_(": Non")),0,0,'L',false);
}
$pdf->Cell(14,5,convertirc(_("2ème Valid.")),0,0,'L',false);
if($valide=="1")
{
$pdf->Cell(18,5,convertirc(_(": Oui")),0,0,'L',false);
}else
{
$pdf->Cell(18,5,convertirc(_(": Non")),0,0,'L',false);
}
$pdf->Cell(10,5,convertirc(_("Encais")),0,0,'L',false);
if($regle=="1")
{
$pdf->Cell(18,5,convertirc(_(": Oui")),0,1,'L',false);
}else
{
$pdf->Cell(18,5,convertirc(_(": Non")),0,1,'L',false);
}
$pdf->Cell(12,5,convertirc('Observ.'),0,0,'L',false);
$pdf->Cell(25,5,convertirc(': '.$reglement['observations']),0,0,'L',false);
$pdf->Cell(0,5,'Edition : '.heureCourante(),0,1,'R',false);
$pdf->Ln(2);
$hl=5;
$pdf->SetFont('Arial','B',6);
$pdf->Cell(15,$hl,convertirc(_("Exercice")),"1",0,'C');
$pdf->Cell(10,$hl,convertirc(_("Mois")),"1",0,'C');
$pdf->Cell(70,$hl,convertirc(_("Souscripteur")),"1",0,'C');
$pdf->Cell(65,$hl,convertirc(_("Adhérent")),"1",0,'C');
$pdf->Cell(20,$hl,convertirc(_("No benef")),"1",0,'C');
$pdf->Cell(65,$hl,convertirc(_("Bénéficiaire")),"1",0,'C');
$pdf->Cell(15,$hl,convertirc(_("Montant")),"1",1,'C');
$pdf->SetFont('Arial','I',6);
foreach ($gcs as $gc)
{
$pdf->Cell(15,$hl,convertirc($gc['codeExercice']),"1",0,'C');
$pdf->Cell(10,$hl,convertirc($gc['codeMois']),"1",0,'C');
$pdf->Cell(70,$hl,convertirc($gc['souscripteur']),"1",0,'L');
$pdf->Cell(65,$hl,convertirc($gc['adherent']),"1",0,'L');
$pdf->Cell(20,$hl,convertirc($gc['numeroBeneficiaire']),"1",0,'C');
$pdf->Cell(65,$hl,convertirc($gc['beneficiaire']),"1",0,'L');
$pdf->Cell(15,$hl,format_N($gc['montantFrais']),"1",1,'C');
}
$pdf->SetFont('Arial','BI',6);
$pdf->Cell(245,$hl,convertirc("TOTAUX"),"1",0,'C');
$pdf->Cell(15,$hl,format_N($reglement['montantFrais']),1,1,'C');
$fichier="Temp/TMP_DETAIL_FG_DETAIL_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;
}
}