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

203 lines
7.7 KiB
PHP
Executable File

<?php
require_once 'Framework/Controleurrequete.php'; // OK
require_once 'Modele/Statistique.php';
class ControleurAjaxstatsmaladiefichetechniquetroispdf 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);
$statutsfts = $this->detailsp->recapdepensesstatutbenef($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin);
//$primeSinistre = $this->detailsp->getprimesinistre($idPolice,$debutStat,$finStat);
//highlight_string("<?php\n\$datas =\n" . var_export($statutsfts, true) . ";\n>");
$p_factures = $this->detailsp->recapdepensesstatutbenefdeux($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 3',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(_("RECAPITULATIF DES DEPENSES PAR STATUT DE BENEFICIAIRES")),1,0,'C',true);
$pdf->Ln(10);
$pdf->SetFont('Arial','B',11);
$pdf->SetTextColor(0);
$pdf->Cell(0,8,convertirc($entete['garant']),0,1,'C',false);
$pdf->Ln(2);
$pdf->Cell(0,5,$entete['souscripteur'],0,1,'C',false);
$pdf->Ln(2);
$pdf->SetFont('Arial','BI',11);
$pdf->Cell(45);
$pdf->Cell(150,8,convertirc(_('POLICE: ').$entete['libellePolice']),0,1,'L',false);
$pdf->Ln(2);
$pdf->Cell(30);
$pdf->Cell(150,5,convertirc(_('PERIODE COMPTABLE CONSIDEREE').' : '.dateLang($debutStat, $_SESSION['lang']).' '._('AU').' '.dateLang($finStat, $_SESSION['lang'])),0,1,'C',false);
$pdf->Ln(2);
$hl=6;
$pdf->SetFont('Arial','B',10);
$pdf->Cell(190,6,convertirc(_('Dépenses par statut de bénéficiaires')),1,1,'C',false);
$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(25,$hl,convertirc(_("Nombre")),1,0,'C',true);
$pdf->SetFillColor(143,206,143);
$pdf->Cell(25,$hl,convertirc(_("Taux")),1,0,'C',true);
$pdf->SetFillColor(143,206,143);
$pdf->Cell(25,$hl,convertirc(_("Age moyen")),1,0,'C',true);
$pdf->SetFillColor(143,206,143);
$pdf->Cell(27,$hl,convertirc(_("Montant")),1,0,'C',true);
$pdf->SetFillColor(143,206,143);
$pdf->Cell(25,$hl,convertirc(_("Taux")),1,0,'C',true);
$pdf->SetFillColor(143,206,143);
$pdf->Cell(26,$hl,convertirc(_("Coût moyen")),1,1,'C',true);
$pdf->SetFont('Arial','',9);
$total_tauxStatutAssure = 0;
$total_tauxMontantTraite = 0;
$total_coutMoyenTraite = 0;
foreach ($statuts as $statut)
{
$pdf->Cell(37,$hl,convertirc($statut['libelle']),1,0,'L',false);
$pdf->Cell(25,$hl,convertirc(format_N($statut['nbreAssure'])),1,0,'C',false);
$pdf->Cell(25,$hl,convertirc($statut['tauxStatutAssure']."%"),1,0,'C',false);
$pdf->Cell(25,$hl,convertirc($statut['ageMoyenAssure']),1,0,'C',false);
$pdf->Cell(27,$hl,convertirc(format_N($statut['montantTraite'])),1,0,'C',false);
$pdf->Cell(25,$hl,convertirc($statut['tauxMontantTraite']."%"),1,0,'C',false);
$pdf->Cell(26,$hl,convertirc(format_N($statut['coutMoyenTraite'])),1,1,'C',false);
$total_tauxStatutAssure = $total_tauxStatutAssure + $statut['tauxStatutAssure'];
$total_tauxMontantTraite = $total_tauxMontantTraite + $statut['tauxMontantTraite'];
$total_coutMoyenTraite = $total_coutMoyenTraite + $statut['coutMoyenTraite'];
}
$pdf->SetFont('Arial','B',9);
$pdf->Cell(37,$hl,convertirc("TOTAL"),"1",0,'C',false);
$pdf->Cell(25,$hl,format_N($statut['nbTotalAssure']),1,0,'C',false);
$pdf->Cell(25,$hl,$total_tauxStatutAssure."%",1,0,'C',false);
$pdf->Cell(25,$hl,format_N($statut['ageMoyenTotal']),1,0,'C',false);
$pdf->Cell(27,$hl,format_N($statut['mttTotalTraite']),1,0,'C',false);
$pdf->Cell(25,$hl,$total_tauxMontantTraite."%",1,0,'C',false);
$pdf->Cell(26,$hl,format_N($total_coutMoyenTraite),1,0,'C',false);
$pdf->Ln(10);
$pdf->Ln(90);
$hl=6;
$pdf->SetFont('Arial','B',10);
$pdf->Cell(190,6,convertirc(_('Dépenses des bénéficiaires traités par statut')),1,1,'C',false);
$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(_("Bénéficiaires traités sur la période")),1,0,'C',true);
$pdf->SetFillColor(143,206,143);
$pdf->Cell(25,$hl,convertirc(_("Taux")),1,0,'C',true);
$pdf->SetFillColor(143,206,143);
$pdf->Cell(27,$hl,convertirc(_("Dépenses")),1,0,'C',true);
$pdf->SetFillColor(143,206,143);
$pdf->Cell(25,$hl,convertirc(_("Taux")),1,0,'C',true);
$pdf->SetFillColor(143,206,143);
$pdf->Cell(25,$hl,convertirc(_("Coût moyen")),1,1,'C',true);
$pdf->SetFont('Arial','',9);
$total_tauxMontantTraite = 0;
$total_coutMoyenTraite = 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['nbreAssureTraite'])),1,0,'C',false);
$pdf->Cell(25,$hl,convertirc($statut['tauxAssureTraite']."%"),1,0,'C',false);
$pdf->Cell(27,$hl,convertirc(format_N($statut['montantTraite'])),1,0,'C',false);
$pdf->Cell(25,$hl,convertirc($statut['tauxMontantTraite']."%"),1,0,'C',false);
$pdf->Cell(25,$hl,convertirc(format_N($statut['coutMoyenTraite'])),1,1,'C',false);
$total_tauxMontantTraite = $total_tauxMontantTraite + $statut['tauxMontantTraite'];
$total_coutMoyenTraite = $total_coutMoyenTraite + $statut['coutMoyenTraite'];
$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_traite),1,0,'C',false);
$pdf->Cell(25,$hl,$total_taux."%",1,0,'C',false);
$pdf->Cell(27,$hl,format_N($statut['mttTotalTraite']),1,0,'C',false);
$pdf->Cell(25,$hl,$total_tauxMontantTraite."%",1,0,'C',false);
$pdf->Cell(25,$hl,format_N($total_coutMoyenTraite),1,0,'C',false);
$tp = 13;
$ht = 7;
$pdf->SetFont('Arial','BU', $tp);
$fichier="Temp/TMP_CUMUL_SP_FICHE3"."_".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;
}
}