196 lines
6.8 KiB
PHP
Executable File
196 lines
6.8 KiB
PHP
Executable File
<?php
|
|
require_once 'Framework/Controleurrequete.php';
|
|
require_once 'Modele/Demandedecompte.php';
|
|
|
|
class ControleurAjaximprimerdemandedecompte extends Controleurrequete
|
|
{
|
|
private $reglement;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->reglement = new Demandedecompte();
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
$this->genererVueAjax();
|
|
}
|
|
|
|
public function imprimerdemandecompte()
|
|
{
|
|
$idDemandeDecompte = $_SESSION['p_idDemandeDecompte_C'];
|
|
$numeroDemandeDecompte = $_SESSION['p_numeroDemandeDecompte_C'];
|
|
$villeSignature = $_SESSION['p_villeSignature_C'];
|
|
|
|
$reglement = $this->reglement->getdemandedecompte($idDemandeDecompte);
|
|
|
|
$codeTypePrestataire = $reglement['codeTypePrestataire'];
|
|
|
|
if($codeTypePrestataire=="CSO")
|
|
{
|
|
$factures = $this->reglement->getdetaildemandedecompteexportcso($numeroDemandeDecompte);
|
|
}
|
|
elseif($codeTypePrestataire=="PHA")
|
|
{
|
|
$factures = $this->reglement->getdetaildemandedecompteexportpha($numeroDemandeDecompte);
|
|
}
|
|
elseif($codeTypePrestataire=="OPT")
|
|
{
|
|
$factures = $this->reglement->getdetaildemandedecompteexportopt($numeroDemandeDecompte);
|
|
}
|
|
elseif($codeTypePrestataire=="LAB")
|
|
{
|
|
$factures = $this->reglement->getdetaildemandedecompteexportlab($numeroDemandeDecompte);
|
|
}
|
|
elseif($codeTypePrestataire=="SEA")
|
|
{
|
|
$factures = $this->reglement->getdetaildemandedecompteexportsea($numeroDemandeDecompte);
|
|
}
|
|
|
|
// $nb = count($factures);
|
|
|
|
$pdf = new FPDF_Protection("L");
|
|
$pdf->SetAuthor('EBENE SOLUTIONS INFORMATIQUES');
|
|
$userPassword = '';
|
|
$ownerPassword = null;
|
|
$pdf->SetProtection(['print'], $userPassword, $ownerPassword);
|
|
|
|
$pdf->AliasNbPages();
|
|
$pdf->AddPage();
|
|
|
|
$ht=4;
|
|
|
|
$pdf->SetMargins(10, 10, 10) ;
|
|
|
|
$pdf->Image($_SESSION['p_lienLogo'],10,6,30);
|
|
|
|
|
|
//$pdf->Ln(50);
|
|
$pdf->SetFont('Arial','I',7);
|
|
//Numéro de page
|
|
$pdf->Cell(0,$ht,'Page '.$pdf->PageNo().'/{nb}',0,0,'C');
|
|
$pdf->SetFont('Arial','', 7);
|
|
$pdf->Cell(0,$ht,convertirc(_('Edité le').' : '.heureCouranteLang($_SESSION['p_lang'])),0,1,'R',false);
|
|
$pdf->Ln(5);
|
|
|
|
// Police Arial gras 15
|
|
$pdf->SetFont('Arial','B',15);
|
|
|
|
// Décalage à droite
|
|
$pdf->Cell(90);
|
|
|
|
$pdf->SetFillColor(217,237,247); // bleu
|
|
// Titre
|
|
$pdf->Cell(120,10,convertirc(_("BORDERAU DEMANDE DE DECOMPTE") . " No ".$reglement['numeroDemandeDecompte']),1,0,'C',true);
|
|
|
|
$pdf->Ln(15);
|
|
$pdf->Cell(20);
|
|
$pdf->SetFont('Arial','BU',13);
|
|
$pdf->Cell(0,$ht,convertirc($reglement['prestataire']),0,0,'C',false);
|
|
// Saut de ligne
|
|
$pdf->Ln(10);
|
|
|
|
|
|
//$pdf->Cell(0,$ht,convertirc($_SESSION['p_nomSociete']),0,0,'L',false);
|
|
//$pdf->Cell(0,$ht,convertirc(_("BORDERAU DEMANDE DECOMPTE") . " No ".$reglement['numeroDemandeDecompte']." => " . _("PRESTATAIRE") . " => " . $reglement['prestataire']),0,1,'R',false);
|
|
$pdf->Cell(20);
|
|
$pdf->SetFont('Arial','B', 11);
|
|
|
|
$pdf->Cell(0,$ht,convertirc(_("PERIODE DE ") . " : " . $reglement['periode']),0,1,'C',false);
|
|
$pdf->Ln(5);
|
|
$pdf->SetFont('Arial','B', 8);
|
|
$pdf->SetFillColor(217,237,247);
|
|
$pdf->Cell(10,$ht,convertirc("No"),1,0,'C',true);
|
|
$pdf->SetFillColor(217,237,247);
|
|
$pdf->Cell(10,$ht,convertirc("Jour"),1,0,'C',true);
|
|
$pdf->SetFillColor(217,237,247);
|
|
$pdf->Cell(20,$ht,convertirc(_("Police")),1,0,'C',true);
|
|
$pdf->SetFillColor(217,237,247);
|
|
$pdf->Cell(50,$ht,convertirc(_("Souscripteur")),1,0,'L',true);
|
|
$pdf->SetFillColor(217,237,247);
|
|
$pdf->Cell(50,$ht,convertirc(_("Adhérent")),1,0,'L',true);
|
|
$pdf->SetFillColor(217,237,247);
|
|
$pdf->Cell(15,$ht,convertirc(_("No Benef")),1,0,'C',true);
|
|
$pdf->SetFillColor(217,237,247);
|
|
$pdf->Cell(50,$ht,convertirc(_("Bénéficiaire")),1,0,'L',true);
|
|
$pdf->SetFillColor(217,237,247);
|
|
$pdf->Cell(15,$ht,convertirc(_("Bon No")),1,0,'C',true);
|
|
$pdf->SetFillColor(217,237,247);
|
|
$pdf->Cell(20,$ht,convertirc(_("Coût")),1,0,'R',true);
|
|
$pdf->SetFillColor(217,237,247);
|
|
$pdf->Cell(15,$ht,convertirc(_("T M")),1,0,'R',true);
|
|
$pdf->SetFillColor(217,237,247);
|
|
$pdf->Cell(20,$ht,convertirc(_("Retenu")),1,1,'R',true);
|
|
|
|
$ordre = "0";
|
|
$fraisReel = "0";
|
|
$montantTm = "0";
|
|
$montantArembourser = "0";
|
|
$fraisRetenu = "0";
|
|
|
|
$pdf->SetFont('Arial','', 7);
|
|
|
|
foreach ($factures as $facture)
|
|
{
|
|
$ordre++;
|
|
$pdf->Cell(10,$ht,$ordre,1,0,'C',false);
|
|
$pdf->Cell(10,$ht,$facture['jourFacture'],1,0,'C',false);
|
|
$pdf->Cell(20,$ht,convertirc($facture['numeroPolice']),1,0,'C',false);
|
|
$pdf->Cell(50,$ht,convertirc(substr($facture['souscripteur'], 0, 25)),1,0,'L',false);
|
|
$pdf->Cell(50,$ht,substr($facture['adherent'], 0, 30),1,0,'L',false);
|
|
$pdf->Cell(15,$ht,convertirc($facture['numeroBeneficiaire']),1,0,'C',false);
|
|
$pdf->Cell(50,$ht,substr($facture['beneficiaire'], 0, 30),1,0,'L',false);
|
|
$pdf->Cell(15,$ht,convertirc($facture['numeroBon']),1,0,'C',false);
|
|
$pdf->Cell(20,$ht,format_N($facture['fraisReel']),1,0,'R',false);
|
|
$pdf->Cell(15,$ht,format_N($facture['montantTm']),1,0,'R',false);
|
|
$pdf->Cell(20,$ht,format_N($facture['fraisRetenu']),1,1,'R',false);
|
|
|
|
$fraisReel += $facture['fraisReel'];
|
|
$montantTm += $facture['montantTm'];
|
|
$montantArembourser += $facture['montantArembourser'];
|
|
$fraisRetenu += $facture['fraisRetenu'];
|
|
}
|
|
|
|
$pdf->SetFont('Arial','B', 8);
|
|
|
|
$pdf->Cell(220,$ht,convertirc("TOTAUX : "),1,0,'C',false);
|
|
|
|
$pdf->Cell(20,$ht,format_N($fraisReel),1,0,'R',false);
|
|
$pdf->Cell(15,$ht,format_N($montantTm),1,0,'R',false);
|
|
$pdf->Cell(20,$ht,format_N($fraisRetenu),1,1,'R',false);
|
|
|
|
$pdf->SetFontSize(8);
|
|
$pdf->Cell(0,6,convertirc(_('Arrêté la présente demande de décompte à la somme de') . ' :'),0,1,'C',false);
|
|
$pdf->SetFont('','I');
|
|
$pdf->SetFillColor(135,206,250); // bleu
|
|
|
|
// $pdf->Cell(0,6,asLetters($fraisRetenu)." ".$_SESSION['p_devise_C'],0,1,'C',true);
|
|
$pdf->Cell(0,6, convetirEnLettre($fraisRetenu, $_SESSION['p_lang'])." ".$_SESSION['p_devise_C'],0,1,'C',true);
|
|
|
|
$pdf->SetFont('');
|
|
|
|
// $pdf->SetY(-70);
|
|
|
|
$pdf->Cell(0,6,convertirc(_('Fait à') . ' ' . $villeSignature.', ' . _('le') . ' ') . dateCouranteLang($_SESSION['p_lang']),0,1,'C',false);
|
|
|
|
$pdf->Ln(10);
|
|
$pdf->SetFont('','U');
|
|
$pdf->Cell(0,6,convertirc(_('Pour') . ' : '.$reglement['prestataire']),0,0,'C',false);
|
|
|
|
/*
|
|
$pagenumber = '{nb}';
|
|
if($this->PageNo() == $pagenumber){
|
|
$this->Cell(173,10, ' FOOTER TEST - '.$pagenumber, 0, 0);
|
|
}
|
|
*/
|
|
$fichier="Temp/borderau_decompte"."_".uniqid().".pdf";
|
|
$pdf->Output($fichier,"F");
|
|
|
|
$t_html =' <div id ="div_wait" class="alert alert-info"> ';
|
|
$t_html .=' <a style="font-size:15pt;" href="'.$fichier.'" target="_blank" > '._("TELECHARGER").' </a> ';
|
|
|
|
$t_html .=' </div ';
|
|
echo $t_html;
|
|
}
|
|
|
|
} |