prestation/Controleur/ControleurAjaxdetailpaiementdecomptepdf.php
2025-12-01 18:54:33 +00:00

137 lines
4.6 KiB
PHP

<?php
require_once 'Framework/Controleurrequete.php'; // OK
require_once 'Modele/Reglement.php';
class ControleurAjaxdetailpaiementdecomptepdf extends Controleur
{
private $reglement;
public function __construct() {
$this->reglement = new Reglement();
}
public function index()
{
$idPaiementDecompte = $_SESSION['idPaiementDecompte_C'];
$reglement = $this->reglement->getpaiementdecompte($idPaiementDecompte);
$decomptes = $this->reglement->get_paiementdecompte_cons();
$pdf = new FPDF_Protection();
$pdf->SetAuthor('EBENE SOLUTIONS INFORMATIQUES');
$userPassword = '';
$ownerPassword = null;
$pdf->SetProtection(['print'], $userPassword, $ownerPassword);
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetMargins(10, 10, 10) ;
// $pdf->AliasNbPages();
$pdf->SetFont('Arial','B', 15);
$pdf->Cell(0,10,convertirc($_SESSION['nomSociete'] ),1,1,'C',false);
$pdf->SetFont('Arial','BU',10);
$pdf->Ln(5);
$pdf->Cell(0,6,convertirc(_("DETAIL PAIEMENT DECOMPTES")),0,1,'C',false);
$pdf->Ln(2);
$pdf->SetFont('Arial','B',6);
$pdf->Cell(10,5,convertirc(_("No Règlt")),0,0,'L',false);
$pdf->Cell(15,5,convertirc(': '.$reglement['numeroReglement']),0,0,'L',false);
$pdf->Cell(6,5,convertirc('Init'),0,0,'L',false);
$pdf->Cell(25,5,convertirc(': '.dateheureFr($reglement['dateSysteme'])),0,0,'L',false);
$pdf->Cell(4,5,convertirc('Init'),0,0,'L',false);
$pdf->Cell(20,5,convertirc(': '.$reglement['codeUtilisateur']),0,0,'L',false);
$pdf->Cell(10,5,convertirc(_("Décptes")),0,0,'L',false);
$pdf->Cell(8,5,convertirc(': '.$reglement['nbDecomptes']),0,0,'L',false);
$pdf->Cell(10,5,convertirc(_("Montant")),0,0,'L',false);
$pdf->Cell(20,5,convertirc(': '.format_N($reglement['montantApayer'])),0,0,'L',false);
if($reglement['valide']=="1")
{
$pdf->Cell(6,5,convertirc('Valid'),0,0,'L',false);
$pdf->Cell(20,5,convertirc(': '.$reglement['userPaiement']),0,0,'L',false);
$pdf->Cell(7,5,convertirc(_("Heure Valid")),0,0,'L',false);
$pdf->Cell(0,5,convertirc(': '.dateheureFr($reglement['heureReglement'])),0,1,'R',false);
}
else
{
$pdf->Cell(0,5,convertirc(_("ATTENTE VALIDATION")),0,1,'R',false);
}
// 2ème ligne
$pdf->Cell(10,5,convertirc(_("Mod P")),0,0,'L',false);
$pdf->Cell(15,5,convertirc(': '.$reglement['modepaiement']),0,0,'L',false);
$pdf->Cell(6,5,convertirc(_("Banque")),0,0,'L',false);
$pdf->Cell(25,5,convertirc(': '.$reglement['banquePayeur']),0,0,'L',false);
$pdf->Cell(4,5,convertirc(_("Réf")),0,0,'L',false);
$pdf->Cell(20,5,convertirc(': '.$reglement['referencePaiement']),0,0,'L',false);
$pdf->Cell(10,5,convertirc(_("Date Cpt")),0,0,'L',false);
$pdf->Cell(8,5,convertirc(': '.dateFr($reglement['dateComptable'])),0,0,'L',false);
// FIN ENTETE
$pdf->Cell(0,5,'Edition : '.heureCouranteLang($_SESSION['lang']),0,1,'R',false);
$pdf->Ln(2);
$hl=5;
$pdf->SetFont('Arial','B',6);
$pdf->Cell(20,$hl,convertirc(_("Exercice")),"1",0,'C');
$pdf->Cell(10,$hl,convertirc(_("Mois")),"1",0,'C');
$pdf->Cell(20,$hl,convertirc(_("No Demande")),"1",0,'C');
$pdf->Cell(50,$hl,convertirc(_("Prestataire")),"1",0,'C');
$pdf->Cell(25,$hl,convertirc(_("Montant")),"1",0,'C');
$pdf->Cell(30,$hl,convertirc(_("Date Demande")),"1",0,'C');
$pdf->Cell(35,$hl,convertirc(_("No Lot")),"1",1,'C');
// détail des demandes de règlements
$pdf->SetFont('Arial','I',6);
foreach ($decomptes as $decompte)
{
$pdf->Cell(20,$hl,convertirc($decompte['codeExercice']),"1",0,'C');
$pdf->Cell(10,$hl,convertirc($decompte['codeMois']),"1",0,'C');
$pdf->Cell(20,$hl,convertirc($decompte['numeroDemandeReglement']),"1",0,'C');
$pdf->Cell(50,$hl,convertirc($decompte['prestataire']),"1",0,'L');
$pdf->Cell(25,$hl,format_N($decompte['montantApayer']),"1",0,'C');
$pdf->Cell(30,$hl,dateheureFr($decompte['dateDemandeReglement']),"1",0,'C');
$pdf->Cell(35,$hl,$decompte['numeroLotDecompte'],"1",1,'C');
}
$pdf->SetFont('Arial','BI',6);
$pdf->Cell(100,$hl,convertirc("TOTAL"),"1",0,'C');
$pdf->Cell(25,$hl,format_N($reglement['montantApayer']),"1",0,'C');
$pdf->Cell(65,$hl,"",1,1,'C');
$fichier="Temp/TMP_DETAIL_PAIEMENT_DCPTE"."_".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;
}
}