162 lines
6.1 KiB
PHP
Executable File
162 lines
6.1 KiB
PHP
Executable File
<?php
|
|
require_once 'Framework/Controleurrequete.php'; // OK
|
|
require_once 'Modele/Statistique.php';
|
|
//require 'Fpdf/diag.php';
|
|
|
|
class ControleurAjaxstatsmaladiefichetechniquedixseptpdf 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;
|
|
}
|
|
|
|
$_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_id = $idPolice;
|
|
$p_id_college = null;
|
|
$p_id_clients = null;
|
|
$p_factures = $this->detailsp->etatdepenseparaffection($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin);
|
|
|
|
$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->Image($_SESSION['dossierSociete'].'/Tarifs/Img/logo_vitalis.png',94,3,15);
|
|
$pdf->SetFont('Arial','B',7);
|
|
|
|
$pdf->Cell(0,5,'FICHE TECHNIQUE No 16',0,1,'L',false);
|
|
$pdf->SetY(10);
|
|
$pdf->SetFont('Arial','',7);
|
|
$pdf->Cell(0,5,'Edition du : '.heureCouranteLang($_SESSION['lang']),0,1,'R',false);
|
|
|
|
$pdf->Ln(2);
|
|
|
|
$pdf->SetFont('Arial','B',13);
|
|
|
|
// $pdf->AliasNbPages();
|
|
|
|
//$pdf->SetTextColor(81,163,226);
|
|
$pdf->SetFillColor(143,206,143); // bleu
|
|
$pdf->Cell(0,8,convertirc(_("ETAT DES DEPENSES PAR AFFECTION")),1,0,'C',true);
|
|
|
|
$pdf->Ln(10);
|
|
$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);
|
|
// $pdf->Cell(0, 6, convertirc(_('COURTIER').' : '.$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',10);
|
|
$pdf->SetFillColor(143,206,143);
|
|
$pdf->Cell(67,$hl,convertirc(_('Affection')),1,0,'C',true);
|
|
$pdf->SetFillColor(143,206,143);
|
|
$pdf->Cell(34,$hl,convertirc(_("Montant Facture")),1,0,'C',true);
|
|
$pdf->SetFillColor(143,206,143);
|
|
$pdf->Cell(34,$hl,convertirc(_("Apres Décompte")),1,0,'C',true);
|
|
$pdf->SetFillColor(143,206,143);
|
|
$pdf->Cell(30,$hl,convertirc(_("Coût Moyen")),1,0,'C',true);
|
|
$pdf->SetFillColor(143,206,143);
|
|
$pdf->Cell(25,$hl,convertirc(_("Taux (%)")),1,1,'C',true);
|
|
|
|
$pdf->SetFont('Arial','',10);
|
|
|
|
$total_montantFacture =
|
|
$total_apresDecompte =
|
|
$total_Coutmoyen =
|
|
$total_Taux = 0;
|
|
|
|
foreach ($p_factures as $dep)
|
|
{
|
|
$pdf->Cell(67,$hl,convertirc($dep['Affection']),1,0,'L',false);
|
|
$pdf->Cell(34,$hl,convertirc(format_N($dep['montantFacture'])),1,0,'R',false);
|
|
$pdf->Cell(34,$hl,convertirc(format_N($dep['apresDecompte'])),1,0,'R',false);
|
|
$pdf->Cell(30,$hl,convertirc(format_N($dep['Coutmoyen'])),1,0,'R',false);
|
|
$pdf->Cell(25,$hl,convertirc($dep['Taux']),1,1,'C',false);
|
|
|
|
$total_montantFacture = $total_montantFacture +$dep['montantFacture'];
|
|
$total_apresDecompte = $total_apresDecompte +$dep['apresDecompte'];
|
|
$total_Coutmoyen = $total_Coutmoyen +$dep['Coutmoyen'];
|
|
$total_Taux = $total_Taux +$dep['Taux'];
|
|
}
|
|
// $total_Quantite=count($p_factures)
|
|
// $total_Coutmoyen = $total_Coutmoyen/$total_Quantite ;
|
|
$pdf->SetFont('Arial','B',10);
|
|
$pdf->SetFillColor(143,206,143);
|
|
$pdf->Cell(67,$hl,convertirc("TOTAL GENERAL"),"1",0,'C',true);
|
|
$pdf->Cell(34,$hl,format_N($total_montantFacture),1,0,'C',true);
|
|
$pdf->Cell(34,$hl,format_N($total_apresDecompte),1,0,'C',true);
|
|
$pdf->Cell(30,$hl,format_N($total_Coutmoyen),1,0,'C',true);
|
|
$pdf->Cell(25,$hl,format_N($total_Taux),1,1,'C',true);
|
|
|
|
|
|
|
|
|
|
|
|
//Numéro de page
|
|
/* $pdf->SetY(265);
|
|
$pdf->Cell(0,$hl,'Page '.$pdf->PageNo().'/{nb}',0,0,'C'); */
|
|
|
|
$fichier="Temp/TMP_CUMUL_SP_FICHE16"."_".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;
|
|
}
|
|
} |