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

166 lines
5.9 KiB
PHP
Executable File

<?php
require_once 'Framework/Controleurrequete.php'; // OK
require_once 'Modele/Statistique.php';
class ControleurAjaxstatsmaladiefichetechniqueunpdf 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");
$_SESSION['debutStat'] = $debutStat;
$_SESSION['finStat'] = $finStat;
$entete = $this->detailsp->detailrapportspperiodepdfentete($idPolice);
//$detailsps = $this->detailsp->detailrapportspperiodepdf($idPolice);
$statuts = $this->detailsp->listestatutbeneficiaire($idPolice,$debutStat,$finStat);
$primeSinistre = $this->detailsp->getprimesinistre($idPolice,$debutStat,$finStat);
$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 1',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(_("DONNEES ELEMENTAIRES")),1,0,'C',true);
$pdf->Ln(15);
$pdf->SetFont('Arial','B',11);
$pdf->SetTextColor(0);
$pdf->Cell(0,5,$entete['souscripteur'],0,1,'C',false);
$pdf->Ln(5);
$pdf->Cell(0,5,convertirc(_('PERIODE COMPTABLE CONSIDEREE').' : '.dateLang($debutStat, $_SESSION['lang']).' '._('AU').' '.dateLang($finStat, $_SESSION['lang'])),0,1,'C',false);
$pdf->Ln(10);
$pdf->SetFont('Arial','BI',11);
$pdf->Cell(0,8,convertirc(_('GARANT').' : '.$entete['garant']),0,1,'L',false);
$pdf->Cell(0,8,convertirc(_('POLICE').' No : '.$entete['numeroPolice'].' / '.$entete['libellePolice']),0,1,'L',false);
$pdf->Cell(0,8,convertirc(_('COURTIER').' : '.$entete['courtier']),0,1,'L',false);
$pdf->Cell(0,8,convertirc(_("DATE D'EFFET").' : '.dateLang($entete['dateEffetPolice'], $_SESSION['lang'])),0,1,'L',false);
$pdf->Cell(0,8,convertirc(_("POPULATION").' : cf Tableau ci-dessous : '),0,1,'L',false);
$pdf->Ln(2);
$hl=8;
$pdf->SetFont('Arial','B',8);
$pdf->SetFillColor(143,206,143);
$pdf->Cell(37,$hl,convertirc(_('Statut bénéficiaire')),1,0,'C',true);
$pdf->SetFillColor(143,206,143);
$pdf->Cell(51,$hl,convertirc(_("Nbre d'assurés Moyen sur la période")),1,0,'C',true);
$pdf->SetFillColor(143,206,143);
$pdf->Cell(51,$hl,convertirc(_("Bénéficiaires traités sur la période")),1,0,'C',true);
$pdf->SetFillColor(143,206,143);
$pdf->Cell(51,$hl,convertirc(_("% Bénéficiaires traités sur la période")),1,1,'C',true);
$pdf->SetFont('Arial','',9);
$total_assure = 0;
$total_traite = 0;
$total_taux = 0;
foreach ($statuts as $statut)
{
$pdf->Cell(37,$hl,convertirc($statut['libelle']),1,0,'L',false);
$pdf->Cell(51,$hl,convertirc(format_N($statut['nbreAssure'])),1,0,'C',false);
$pdf->Cell(51,$hl,convertirc(format_N($statut['nbreAssureTraite'])),1,0,'C',false);
$pdf->Cell(51,$hl,convertirc($statut['tauxAssureTraite']."%"),1,1,'C',false);
$total_assure = $total_assure + $statut['nbreAssure'];
$total_traite = $total_traite + $statut['nbreAssureTraite'];
$total_taux = $total_taux + $statut['tauxAssureTraite'];
}
$pdf->SetFont('Arial','B',9);
$pdf->Cell(37,$hl,convertirc("TOTAL"),"1",0,'C',false);
$pdf->Cell(51,$hl,format_N($total_assure),1,0,'C',false);
$pdf->Cell(51,$hl,format_N($total_traite),1,0,'C',false);
$pdf->Cell(51,$hl,$total_taux."%",1,0,'C',false);
$pdf->Ln(15);
$tp = 13;
$ht = 7;
$pdf->SetFont('Arial','BU', $tp);
$pdf->Cell(0,$ht,convertirc("PRIMES ET SINISTRALITE "),0,1,'C',false);
$pdf->SetFont('Arial','B', 10);
$pdf->Ln(5);
$pdf->Cell(100,$ht,convertirc(_("RAPPEL PRIME NETTE TOTALE :")),0,0,'L',false);
$pdf->Cell(40,$ht,format_N($primeSinistre['primeNetteTotal']),0,1,'L',false);
$pdf->SetFont('Arial','', 10);
$pdf->Cell(100,$ht,convertirc(_("PRIME NETTE DE LA PERIODE :")),0,0,'L',false);
$pdf->Cell(40,$ht,format_N($primeSinistre['primeNettePeriode']),0,1,'L',false);
$pdf->Ln(5);
$pdf->Cell(100,$ht,convertirc(_("PROVISION POUR SINISTRE DE LA PERIODE :")),0,0,'L',false);
$pdf->Cell(40,$ht,format_N($primeSinistre['provisionPeriode']),0,1,'L',false);
$pdf->Cell(100,$ht,convertirc(_("SINISTRE DE LA PERIODE :")),0,0,'L',false);
$pdf->Cell(40,$ht,format_N($primeSinistre['sinistrePeriode']),0,1,'L',false);
$pdf->Ln(10);
$pdf->SetFont('Arial','B', 10);
$pdf->Cell(100,$ht,convertirc(_("RESULTATS TECHNIQUES DE LA PERIODE (Rapport Sinistres/Primes) :")),0,1,'L',false);
$pdf->SetFont('Arial','', 10);
$pdf->Cell(100,$ht,convertirc(_("RAPPORT (SINISTRES/PROVISION) NET :")),0,0,'L',false);
$pdf->Cell(40,$ht,number_format($primeSinistre['rapport'], 2, '.', ','),0,1,'L',false);
$pdf->Cell(100,$ht,convertirc(_("EXCEDENT (ou DEFICIT (-)) :")),0,0,'L',false);
$pdf->Cell(40,$ht,format_N($primeSinistre['excedent']),0,1,'L',false);
$fichier="Temp/TMP_CUMUL_SP_FICHE1"."_".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;
}
}