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

318 lines
13 KiB
PHP
Executable File

<?php
require_once 'Framework/Controleurrequete.php'; // OK
require_once 'Modele/Statistique.php';
class ControleurAjaxstatsmaladiefichetechniquedixneufpdf extends Controleur
{
private $detailsp;
public function __construct() {
$this->detailsp = new Statistique();
}
public function index()
{
$codeGcAssureur = $this->requete->getParametreFormulaire("codeGcAssureur");
$idPolice = $this->requete->getParametreFormulaire("idPolice");
$debutStat = $this->requete->getParametreDate("debutStat");
$finStat = $this->requete->getParametreDate("finStat");
$Chargement = $this->requete->getParametreFormulaire("Chargement");
$_SESSION['debutStat'] = $debutStat;
$_SESSION['finStat'] = $finStat;
if ($codeGcAssureur == "" ||$codeGcAssureur == "AUC" ){
$codeGcAssureur = null;
}
if ($idPolice == ""){
$idPolice = null;
}
$p_datedebut = $_SESSION['debutStat'];
$p_datefin = $_SESSION['finStat'];
$p_garant = $codeGcAssureur;
$p_id = $idPolice ;
$idCollege= "";
$p_id_clients="";
$p_id_clients=null;
$p_id_college=null;
$p_code="";
$p_code="QTM";
if ($p_garant != null && $p_id != null ){
$entete = $this->detailsp->detailrapportspperiodepdfentete($idPolice);
}
$resultattechniques = $this->detailsp->getresultattechniques($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin,$p_code,$Chargement);
$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['lienLogo'],94,3,15);
$pdf->SetFont('Arial','B',7);
$pdf->Cell(0,5,'',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);
$resultattechnique= "";
foreach ($resultattechniques as $resultattechnique){
$pdf->SetFillColor(182,216,242); // bleu
$pdf->Cell(0,8,convertirc(_("RESULTATS TECHNIQUES DE L'EXERCICE")." ".$resultattechnique['exercice']),1,0,'C',true);
}
$pdf->Ln(10);
$pdf->SetFont('Arial', 'B', 11);
$pdf->SetTextColor(0);
$pdf->Ln(8);
$pdf->Cell(0, 5, convertirc(_('PERIODE COMPTABLE CONSIDEREE').': '.dateLang($debutStat, $_SESSION['lang']).' '._('AU').' '.dateLang($finStat, $_SESSION['lang'])), 0, 1, 'C', false);
if ($p_garant == null && $p_id == null ){
}
if($p_garant != null && $p_id == null ){
$pdf->Ln(8);
$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);
}else{
$pdf->Ln(8);
$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->SetFont('Arial', 'BUI', 11);
$pdf->Cell(35, 8, convertirc(_('POLICE').': '), 0, 0, 'L', false);
$pdf->SetFont('Arial', 'BI', 11);
$pdf->Cell(0, 8, convertirc($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->Ln(2);
$pdf->Cell(0, 8, convertirc(_('CHARGEMENT').': '.$Chargement.' %'), 0, 1, 'L', false);
$pdf->Ln(5);
$hl=7;
$pdf->SetFont('Arial','B',8);
$pdf->SetFillColor(182,216,242);
$pdf->Cell(54,$hl,convertirc(_('Souscripteur')),1,0,'C',true);
$pdf->SetFillColor(182,216,242);
$pdf->Cell(16,$hl,convertirc(_("No Police")),1,0,'C',true);
$pdf->Cell(8,$hl,convertirc(_("ID")),1,0,'C',true);
$pdf->SetFillColor(182,216,242);
$pdf->Cell(50,$hl,convertirc(_("Sinistres")),1,0,'C',true);
$pdf->SetFillColor(182,216,242);
$pdf->Cell(40,$hl,convertirc(_("Primes totales annuelles")),1,0,'C',true);
$pdf->SetFillColor(182,216,242);
$pdf->Cell(12,$hl,convertirc(_("R/SP (%)")),1,0,'C',true);
$pdf->SetFillColor(182,216,242);
$pdf->Cell(12,$hl,convertirc(_("(%) Ajus")),1,1,'C',true);
$hl=5;
$pdf->SetFont('Arial','B',8);
$pdf->Cell(78,$hl,convertirc(_('-')),1,0,'C',false);
$pdf->Cell(16,$hl,convertirc(_("Tardifs")),1,0,'C',false);
$pdf->Cell(16,$hl,convertirc(_("Courant")),1,0,'C',false);
$pdf->Cell(18,$hl,convertirc(_("Total")),1,0,'C',false);
$pdf->Cell(20,$hl,convertirc(_("Période")),1,0,'C',false);
$pdf->Cell(20,$hl,convertirc(_("Totales")),1,0,'C',false);
$pdf->Cell(24,$hl,convertirc(_("-")),1,1,'C',false);
$pdf->SetFont('Arial','',8);
$TOTALmontantApayerTotal=
$TOTALprimeAnalyseTotal=
$TOTALprimeAnnuelleTotal=0;
$TOTALrapportSpTotal = 0.00;
$TOTALajustementSp=0.00;
//highlight_string("<?php\n\$datas =\n" . var_export($TOTALajustementSp, true) . ";\n>");
foreach ($resultattechniques as $resultattechnique){
$hl=7;
$pdf->SetFont('Arial','B',7);
$taillelibellePolice= strlen($resultattechnique['libellePolice']);
if($taillelibellePolice>32) {
$pdf->SetFont('Arial','B', 6);
$text = wordwrap($resultattechnique['libellePolice'], 40, "***", false); // insertion de marqueurs ***
$tcut = explode("***", $text); // on créé un tableau à partir des marqueurs ***
$part1 = $tcut[0]; // la partie à mettre en exergue
$part2 = '';
for($i=1; $i<count($tcut); $i++) {
$part2 .= $tcut[$i].' ';
}
$part2 = trim($part2); //suppression du dernier espace dans la partie de texte restante
$pdf->Cell(54,$hl,convertirc(_($part1)),1,0,'L',false);
}else{
$pdf->Cell(54,$hl,convertirc(_($resultattechnique['libellePolice'])),1,0,'L',false);
}
$pdf->Cell(16,$hl,convertirc(_($resultattechnique['numeroPolice'])),1,0,'C',false);
$pdf->Cell(8,$hl,convertirc(_($resultattechnique['idPolice'])),1,0,'C',false);
$pdf->Cell(16,$hl,convertirc(_($resultattechnique[''])),1,0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($resultattechnique['sinistre'])),1,0,'C',false);
$pdf->Cell(18,$hl,convertirc(format_N($resultattechnique['sinistre'])),1,0,'C',false);
$pdf->Cell(20,$hl,convertirc(format_N($resultattechnique['primeAnalyse'])),1,0,'C',false);
$pdf->Cell(20,$hl,convertirc(format_N($resultattechnique['primeAnnuelle'])),1,0,'C',false);
$pdf->Cell(12,$hl,convertirc(_($resultattechnique['rapportSp'])),1,0,'C',false);
if ($resultattechnique['ajustAnalyse']==1){
$pdf->SetTextColor(220,20,60);
$pdf->Cell(12,$hl,convertirc(_("# Résil.")),1,1,'C',false);
$pdf->SetTextColor(0,0,0);
}else{
$pdf->Cell(12,$hl,convertirc(_($resultattechnique['ajustAnalyse'])),1,1,'C',false);
}
$TOTALmontantApayerTotal= $TOTALmontantApayerTotal + $resultattechnique['sinistre'];
$TOTALprimeAnalyseTotal= $TOTALprimeAnalyseTotal + $resultattechnique['primeAnalyse'];
$TOTALprimeAnnuelleTotal= $TOTALprimeAnnuelleTotal + $resultattechnique['primeAnnuelle'];
$TOTALrapportSpTotal = $resultattechnique['rspGarant'];
$TOTALajustementSp = $resultattechnique['tauxAjustementGarant'];
}
$hl=5;
$pdf->SetFont('Arial','B',7);
$pdf->SetTextColor(220,20,60);
$pdf->Cell(78,$hl,convertirc(_('TOTAL CATEGORIE '.$entete['libellePolice'])),1,0,'L',false);
$pdf->Cell(16,$hl,convertirc(''),1,0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($TOTALmontantApayerTotal)),1,0,'C',false);
$pdf->Cell(18,$hl,convertirc(format_N($TOTALmontantApayerTotal)),1,0,'C',false);
$pdf->Cell(20,$hl,convertirc(format_N($TOTALprimeAnalyseTotal)),1,0,'C',false);
$pdf->Cell(20,$hl,convertirc(format_N($TOTALprimeAnnuelleTotal)),1,0,'C',false);
$pdf->Cell(12,$hl,convertirc(($TOTALrapportSpTotal)),1,0,'C',false);
$pdf->Cell(12,$hl,convertirc("-"),1,1,'C',false);
$pdf->SetFont('Arial','',8);
$pdf->Ln(5);
$pdf->SetFont('Arial','B',8);
$pdf->SetTextColor(65,105,225);
$pdf->Cell(192,$hl,convertirc(_('LEGENDE (AJUSTEMENT %)')),1,1,'L',false);
$pdf->Cell(30,$hl,convertirc(''),1,0,'C',false);
$pdf->Cell(162,$hl,convertirc('*'),1,1,'L',false);
$pdf->SetFont('Arial','B',8);
$hl=5;
$pdf->SetFont('Arial','B',7);
$pdf->SetTextColor(0,128,0);
$pdf->Cell(78,$hl,convertirc(_('TOTAL COURTIER').' '.$entete['courtier']),1,0,'L',false);
$pdf->Cell(16,$hl,convertirc(''),1,0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($TOTALmontantApayerTotal)),1,0,'C',false);
$pdf->Cell(18,$hl,convertirc(format_N($TOTALmontantApayerTotal)),1,0,'C',false);
$pdf->Cell(20,$hl,convertirc(format_N($TOTALprimeAnalyseTotal)),1,0,'C',false);
$pdf->Cell(20,$hl,convertirc(format_N($TOTALprimeAnnuelleTotal)),1,0,'C',false);
$pdf->Cell(12,$hl,convertirc(_($TOTALrapportSpTotal)),1,0,'C',false);
$pdf->Cell(12,$hl,convertirc("-"),1,1,'C',false);
$pdf->Ln(1);
$hl=5;
$pdf->SetFont('Arial','B',8);
$pdf->SetTextColor(75,0,130);
$pdf->Cell(78,$hl,convertirc(_('TOTAL').' '.$entete['garant']),1,0,'L',false);
$pdf->Cell(16,$hl,convertirc(''),1,0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($TOTALmontantApayerTotal)),1,0,'C',false);
$pdf->Cell(18,$hl,convertirc(format_N($TOTALmontantApayerTotal)),1,0,'C',false);
$pdf->Cell(20,$hl,convertirc(format_N($TOTALprimeAnalyseTotal)),1,0,'C',false);
$pdf->Cell(20,$hl,convertirc(format_N($TOTALprimeAnnuelleTotal)),1,0,'C',false);
$pdf->Cell(12,$hl,convertirc($TOTALrapportSpTotal),1,0,'C',false);
$pdf->Cell(12,$hl,convertirc($TOTALajustementSp),1,1,'C',false);
$pdf->SetFont('Arial','',8);
$pdf->SetTextColor(0,0,0);
$pdf->Ln(8);
$pdf->Cell(45,$hl,convertirc(_("# R/SP (%). = Rapport Sinitre Total / Prime Totale période")),0,0,'L',false);
$pdf->Ln(5);
$pdf->Cell(45,$hl,convertirc(_("# Ajus. = Ajustement")),0,0,'L',false);
$pdf->Ln(5);
$pdf->Cell(45,$hl,convertirc(_("# Résil. = R/SP (%) supérieur à 115 (%) entrainant une résiliation pour ordre de la police")),0,0,'L',false);
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetMargins(10, 10, 10) ;
$pdf->Image($_SESSION['lienLogo'],94,3,15);
$pdf->SetFont('Arial','B',7);
$pdf->Cell(0,5,'',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);
$resultattechnique= "";
// $pdf->AliasNbPages();
foreach ($resultattechniques as $resultattechnique){
$pdf->SetFillColor(182,216,242); // bleu
$pdf->Cell(0,8,convertirc(_("RESULTATS TECHNIQUES DE L'EXERCICE")." ".$resultattechnique['exercice']),1,0,'C',true);
}
$pdf->Ln(10);
$pdf->SetFont('Arial', 'B', 11);
$pdf->SetTextColor(0);
$pdf->Ln(8);
$pdf->Cell(0, 5, convertirc(_('PERIODE COMPTABLE CONSIDEREE').': '.dateLang($debutStat, $_SESSION['lang']).' '._('AU').' '.dateLang($finStat, $_SESSION['lang'])), 0, 1, 'C', false);
$pdf->Ln(8);
$hl=5;
$pdf->SetFont('Arial','B',6);
$pdf->SetFillColor(182,216,242);
$pdf->Cell(78,$hl,convertirc(_('TOTAL GENERAL').' '),1,0,'L',true);
$pdf->Cell(16,$hl,convertirc(''),1,0,'C',true);
$pdf->Cell(16,$hl,convertirc(format_N($TOTALmontantApayerTotal)),1,0,'C',true);
$pdf->Cell(18,$hl,convertirc(format_N($TOTALmontantApayerTotal)),1,0,'C',true);
$pdf->Cell(20,$hl,convertirc(format_N($TOTALprimeAnalyseTotal)),1,0,'C',true);
$pdf->Cell(20,$hl,convertirc(format_N($TOTALprimeAnnuelleTotal)),1,0,'C',true);
$pdf->Cell(12,$hl,convertirc($TOTALrapportSpTotal),1,0,'C',true);
$pdf->Cell(12,$hl,convertirc($TOTALajustementSp),1,1,'C',true);
$pdf->SetFont('Arial','',8);
$fichier="Temp/TMP_CUMUL_FT19_RESULTAT_TECHNIQUE"."_".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;
}
}