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

115 lines
3.8 KiB
PHP

<?php
require_once 'Framework/Controleurrequete.php'; // OK
require_once 'Modele/Gestionconfiee.php';
require_once 'Modele/Societeuser.php';
class ControleurAjaxrecugc extends Controleur
{
private $facture;
private $societeuser;
public function __construct() {
$this->facture = new Gestionconfiee();
$this->societeuser = new Societeuser();
}
public function index()
{
$idGcReglement = $_SESSION['idGcReglement'];
$reglement = $this->facture->getgcreglement($idGcReglement);
$societeuser = $this->societeuser->getSocieteuser($_SESSION['codeSociete']);
$pdf = new FPDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetMargins(25, 25, 25) ;
$pdf->SetFont('Arial','BU',10);
$pdf->Sety(40);
$pdf->Cell(0,12,convertirc($societeuser['nomSociete']),1,1,'C',false);
$pdf->Ln(2);
$pdf->SetFont('Arial','I',7);
$pdf->Cell(0,5,'Edition : '.heureCouranteLang($_SESSION['lang']),0,1,'C',false);
$pdf->Cell(0,5,convertirc( _("Tél") . " : ".$societeuser['telephoneSociete']),0,1,'C',false);
$pdf->Cell(0,5,convertirc(_("Adresse Post") . " : " . $societeuser['adressePostSociete']),0,1,'C',false);
$pdf->Cell(0,5,convertirc(_("Registre Commerce") . " : " . $societeuser['registreCommerce']),0,1,'C',false);
$pdf->Ln(5);
$pdf->SetFont('Arial','BU',10);
$pdf->Cell(0,12,convertirc(_('RECU ENCAISSEMENT').' No '.$reglement['gcNumeroDecompte']),1,1,'C',false);
$pdf->Ln(5);
$pdf->SetFont('Arial','',10);
$pdf->Cell(40,10,convertirc(_("Assureur")),0,0,'L',false);
$pdf->SetFont('Arial','BI',10);
$pdf->Cell(0,10,convertirc(': '.$reglement['gcassureur']),0,1,'L',false);
$pdf->SetFont('Arial','',10);
$pdf->Cell(40,10,convertirc(_('Date Fact')),0,0,'L',false);
$pdf->SetFont('Arial','BI',10);
$pdf->Cell(0,10,convertirc(': '.dateFr($reglement['dateSysteme'])),0,1,'L',false);
$pdf->SetFont('Arial','',10);
$pdf->Cell(40,10,convertirc(_('Reçu de')),0,0,'L',false);
$pdf->SetFont('Arial','BI',10);
$pdf->Cell(0,10,convertirc(': '.$reglement['nomTireur']),0,1,'L');
$pdf->SetFont('Arial','',10);
$pdf->Cell(40,5,convertirc(_('La somme de')),0,0,'L',false);
$pdf->SetFont('Arial','BI',10);
$pdf->Cell(0,5,convertirc(': '.format_N($reglement['montantDu'])." ".$_SESSION['devise_C']),0,1,'L');
$pdf->SetFont('Arial','BI',9);
$pdf->Cell(0,10, convetirEnLettre($reglement['montantDu'], $_SESSION['lang'])." ".$_SESSION['devise_C'],1,1,'C');
$pdf->SetFont('Arial','',10);
$pdf->Cell(40,10,convertirc(_('Mode Paiement')),0,0,'L',false);
$pdf->SetFont('Arial','BI',10);
$pdf->Cell(0,10,convertirc(': '.$reglement['modepaiement']),0,1,'L');
$pdf->SetFont('Arial','',10);
$pdf->Cell(40,10,convertirc(_('Références paiement')),0,0,'L',false);
$pdf->SetFont('Arial','BI',10);
$pdf->Cell(0,10,convertirc(': '.$reglement['referencePaiement']),0,1,'L');
$pdf->SetFont('Arial','',10);
$pdf->Cell(40,10,convertirc(_('Banque')),0,0,'L',false);
$pdf->SetFont('Arial','BI',10);
$pdf->Cell(0,10,convertirc(': '.$reglement['banquePayeur']),0,1,'L');
$pdf->Ln(10);
$pdf->SetFont('Arial','U',10);
$pdf->Cell(0,10,convertirc(_('Fait à')).' '.$_SESSION['villeSociete'].', '._('le').' '.dateFr($reglement['dateComptable']),0,1,'C',false);
$pdf->Ln(10);
$pdf->Cell(0,10,convertirc(_('La Comptabilité de').' '.$societeuser['nomSociete'].' : '.$reglement['userPaiement']),0,0,'C',false);
$fichier="Temp/TMP_RECU_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;
}
}