production/Controleur/ControleurAjaxstatsmaladiefichetechniquedixpdf.php
2025-12-02 11:29:44 +00:00

194 lines
8.3 KiB
PHP
Executable File

<?php
require_once 'Framework/Controleurrequete.php'; // OK
require_once 'Modele/Statistique.php';
//require 'Fpdf/diag.php';
class ControleurAjaxstatsmaladiefichetechniquedixpdf extends Controleur
{
private $detailsp;
public function __construct() {
$this->detailsp = new Statistique();
}
public function index()
{
$idPolice = $this->requete->getParametreFormulaire("idPolice");
$debutStat = $this->requete->getParametreDate("debutStat");
$finStat = $this->requete->getParametreDate("finStat");
$codeGcAssureur = $this->requete->getParametreFormulaire("codeGcAssureur");
if($idPolice== ''){
$idPolice = null;
}
$depenses = $this->requete->getParametreFormulaire("depenses","numerique");
$_SESSION['debutStat'] = $debutStat;
$_SESSION['finStat'] = $finStat;
$_SESSION['depenses'] = $depenses;
$entete = $this->detailsp->detailrapportspperiodepdfentete($idPolice);
$p_datedebut = $_SESSION['debutStat'];
$p_datefin =$_SESSION['finStat'];
$p_garant = $codeGcAssureur;
$p_limite = $_SESSION['depenses'];
$p_id_client =null;
$p_id_college =null;
$p_id = $idPolice;
$p_factures = $this->detailsp->evolutiondepfamilleAct($p_garant, $p_id_client, $p_id, $p_id_college, $p_datedebut, $p_datefin,$p_limite );
$pdf = new FPDF_Protection();
$pdf->SetAuthor('EBENE SOLUTIONS INFORMATIQUES');
$userPassword = '';
$ownerPassword = null;
$pdf->SetProtection(['print'], $userPassword, $ownerPassword);
$pdf->AliasNbPages();
$pdf->AddPage('L');
$pdf->SetMargins(10, 10, 10) ;
$pdf->Image($_SESSION['lienLogo'],140,3,15);
$pdf->SetFont('Arial','B',7);
$pdf->Cell(0,5,convertirc(_('FICHE TECHNIQUE No 10')),0,1,'L',false);
$pdf->SetY(10);
$pdf->SetFont('Arial','',7);
$pdf->Cell(0,5,convertirc(_('Edition du').': '.heureCouranteLang($_SESSION['lang'])),0,1,'R',false);
$pdf->Ln(2);
$pdf->SetFont('Arial','B',13);
$pdf->SetFillColor(182,216,242);
$pdf->Cell(0,8,convertirc(_("EVOLUTION MENSUELLE DES DEPENSES PAR FAMILLE D'ACTES")),1,0,'C',true);
$pdf->Ln(8);
$pdf->SetFont('Arial', 'B', 11);
$pdf->SetTextColor(0);
$pdf->Ln(8);
$pdf->Cell(0, 6, convertirc(_('PERIODE COMPTABLE CONSIDEREE').': '.dateLang($debutStat, $_SESSION['lang']).' '._('AU').' '.dateLang($finStat, $_SESSION['lang'])), 0, 1, 'C', false);
if ($p_id!=null){
$pdf->Ln(10);
$pdf->SetFont('Arial', 'BUI', 11);
$pdf->Cell(35, 8, convertirc(_('GARANT').': '), 0, 0, 'L', false);
$pdf->SetFont('Arial', 'BI', 11);
$pdf->Cell(0, 8, convertirc($entete['garant']), 0, 1, 'L', false);
$pdf->SetFont('Arial', 'BUI', 11);
$pdf->Cell(35, 8, convertirc(_('SOUSCRIPTEUR').': '), 0, 0, 'L', false);
$pdf->SetFont('Arial', 'BI', 11);
$pdf->Cell(0, 8, convertirc($entete['souscripteur']), 0, 1, 'L', false);
//$pdf->Cell(0, 8, convertirc(_('SOUSCRIPTEUR').' : '.$entete['souscripteur']), 0, 1, 'L', false);
$pdf->SetFont('Arial', 'BUI', 11);
$pdf->Cell(35, 8, convertirc(_('POLICE No').': '), 0, 0, 'L', false);
$pdf->SetFont('Arial', 'BI', 11);
$pdf->Cell(0, 8, convertirc($entete['numeroPolice'].' / '.$entete['libellePolice']), 0, 1, 'L', false);
$pdf->SetFont('Arial', 'BUI', 11);
$pdf->Cell(35, 8, convertirc(_('COURTIER').': '), 0, 0, 'L', false);
$pdf->SetFont('Arial', 'BI', 11);
$pdf->Cell(0, 8, convertirc($entete['courtier']), 0, 1, 'L', false);
}else{
$pdf->Ln(10);
$pdf->SetFont('Arial', 'BUI', 11);
$pdf->Cell(35, 8, convertirc(_('GARANT').': '), 0, 0, 'L', false);
$pdf->SetFont('Arial', 'BI', 11);
$pdf->Cell(0, 8, convertirc($p_garant), 0, 1, 'L', false);
}
$pdf->Ln(8);
$hl=7;
$pdf->SetFont('Arial','B',7);
$pdf->SetFillColor(182,216,242);
$pdf->Cell(15,$hl,convertirc(_('Code')),1,0,'C',true);
$pdf->Cell(60,$hl,convertirc(_("Garantie")),1,0,'C',true);
$pdf->Cell(16,$hl,convertirc(_("Janvier")),1,0,'C',true);
$pdf->Cell(16,$hl,convertirc(_("Février")),1,0,'C',true);
$pdf->Cell(15,$hl,convertirc(_("Mars")),1,0,'C',true);
$pdf->Cell(15,$hl,convertirc(_("Avril")),1,0,'C',true);
$pdf->Cell(15,$hl,convertirc(_("Mai")),1,0,'C',true);
$pdf->Cell(15,$hl,convertirc(_("Juin")),1,0,'C',true);
$pdf->Cell(16,$hl,convertirc(_("Juillet")),1,0,'C',true);
$pdf->Cell(15,$hl,convertirc(_("Août")),1,0,'C',true);
$pdf->Cell(16,$hl,convertirc(_("Septembre")),1,0,'C',true);
$pdf->Cell(16,$hl,convertirc(_("Octobre")),1,0,'C',true);
$pdf->Cell(16,$hl,convertirc(_("Novembre")),1,0,'C',true);
$pdf->Cell(16,$hl,convertirc(_("Décembre")),1,0,'C',true);
$pdf->Cell(16,$hl,convertirc(_("Totaux")),1,1,'C',true);
$total_JANVIER = 0;
$total_FEVRIER = 0;
$total_MARS = 0;
$total_AVRIL = 0;
$total_MAI = 0;
$total_JUIN = 0;
$total_JUILLET = 0;
$total_AOUT = 0;
$total_SEPTEMBRE = 0;
$total_OCTOBRE = 0;
$total_NOVEMBRE = 0;
$total_DECEMBRE = 0;
$total_TOTAUX = 0;
$pdf->SetFont('Arial','',7);
foreach ($p_factures as $dep)
{
$pdf->Cell(15,$hl,convertirc($dep['codeGarantie']),1,0,'C',false);
$pdf->Cell(60,$hl,convertirc($dep['libelle']),1,0,'L',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['JANVIER'])),1,0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['FEVRIER'])),1,0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($dep['MARS'])),1,0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($dep['AVRIL'])),1,0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($dep['MAI'])),1,0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($dep['JUIN'])),1,0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['JUILLET'])),1,0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($dep['AOUT'])),1,0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['SEPTEMBRE'])),1,0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['OCTOBRE'])),1,0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['NOVEMBRE'])),1,0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['DECEMBRE'])),1,0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['TOTAUX'])),1,1,'C',false);
$total_JANVIER = $total_JANVIER + $dep['JANVIER'];
$total_FEVRIER = $total_FEVRIER + $dep['FEVRIER'];
$total_MARS = $total_MARS + $dep['MARS'];
$total_AVRIL = $total_AVRIL + $dep['AVRIL'];
$total_MAI = $total_MAI + $dep['MAI'];
$total_JUIN = $total_JUIN + $dep['JUIN'];
$total_JUILLET = $total_JUILLET + $dep['JUILLET'];
$total_AOUT = $total_AOUT + $dep['AOUT'];
$total_SEPTEMBRE = $total_SEPTEMBRE + $dep['SEPTEMBRE'];
$total_OCTOBRE = $total_OCTOBRE + $dep['OCTOBRE'];
$total_NOVEMBRE = $total_NOVEMBRE + $dep['NOVEMBRE'];
$total_DECEMBRE = $total_DECEMBRE + $dep['DECEMBRE'];
$total_TOTAUX = $total_TOTAUX + $dep['TOTAUX'];
}
$pdf->SetFont('Arial','B',8);
$pdf->SetFillColor(182,216,242);
$pdf->Cell(75,$hl,convertirc("TOTAL GENERAL"),"1",0,'C',true);
$pdf->Cell(16,$hl,format_N($total_JANVIER),1,0,'C',true);
$pdf->Cell(16,$hl,format_N($total_FEVRIER),1,0,'C',true);
$pdf->Cell(15,$hl,format_N($total_MARS),1,0,'C',true);
$pdf->Cell(15,$hl,format_N($total_AVRIL),1,0,'C',true);
$pdf->Cell(15,$hl,format_N($total_MAI),1,0,'C',true);
$pdf->Cell(15,$hl,format_N($total_JUIN),1,0,'C',true);
$pdf->Cell(16,$hl,format_N($total_JUILLET),1,0,'C',true);
$pdf->Cell(15,$hl,format_N($total_AOUT),1,0,'C',true);
$pdf->Cell(16,$hl,format_N($total_SEPTEMBRE),1,0,'C',true);
$pdf->Cell(16,$hl,format_N($total_OCTOBRE),1,0,'C',true);
$pdf->Cell(16,$hl,format_N($total_NOVEMBRE),1,0,'C',true);
$pdf->Cell(16,$hl,format_N($total_DECEMBRE),1,0,'C',true);
$pdf->Cell(16,$hl,format_N($total_TOTAUX),1,1,'C',true);
$fichier="Temp/TMP_CUMUL_SP_FICHE10"."_".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;
}
}