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

4693 lines
171 KiB
PHP
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
require_once 'Framework/Controleurrequete.php'; // OK
require_once 'Modele/Statistique.php';
require_once 'Modele/Police.php';
require_once 'Modele/Collegepolice.php';
require_once $_SESSION['dossierSociete'].'/Tarifs/Modele/Police_sodciete.php';
class ControleurAjaxstatsmaladiefichetechniqueadherentpdf extends Controleur
{
private $detailsp;
private $college;
private $police;
private $police_societe;
public function __construct() {
$this->detailsp = new Statistique();
$this->college = new Collegepolice();
$this->police = new Police();
$this->police_societe = new Police_sodciete();
}
public function index()
{
}
function statsadherent($idPolice,$idCollege,$codeGcAssureur,$Chargement,$p_datedebut,$p_datefin,$depenses,$chargeravantapres,$famille,$numeroAdherent ){
$p_datedebut = $p_datedebut;
$p_datefin =$_SESSION['p_datefin'];
$p_garant = $codeGcAssureur;
$p_id = $entete['idPolice'] ;
$p_limite = $_SESSION['depenses'];
$p_id_college = $idCollege;
$p_id_clients = null;
$p_apporteur = null;
$infocollege = $this->college->getCollegepoliceId($idCollege);
$tableaudajustements = $this->detailsp->gettableauAjustementGarant($codeGcAssureur);
$infosDuGarant = $this->police_societe->getInfosGarant($codeGcAssureur);
$pdf = new FPDF_Protection();
$pdf->SetAuthor('EBENE SOLUTIONS INFORMATIQUES');
$userPassword = '';
$ownerPassword = null;
$pdf->SetProtection(['print'], $userPassword, $ownerPassword);
$pdf->AliasNbPages();
$pdf->AddPage(); // debut page de garde
$pdf->SetMargins(10, 10, 10) ;
$pdf->Image($_SESSION['dossierSociete'].'/Tarifs/Img/newkit1.jpg', 0, 0, 210);
$pdf->SetY(75);
$pdf->SetFont('Helvetica', 'B', 36);
$pdf->SetTextColor( 37, 36, 97 );
$pdf->Cell(0, 6, convertirc(_('STATISTIQUES MALADIE')), 0, 1, 'C', false);
$pdf->SetY(240);
$pdf->SetFont('Times', 'BI', 13);
$pdf->SetTextColor( 0, 0, 0 );
$pdf->Cell(0, 6, convertirc(_('PÉRIODE CONSIDÉRÉE').': '.dateLang($p_datedebut, $_SESSION['lang']).' '._('AU').' '.dateLang($p_datefin, $_SESSION['lang'])), 0, 1, 'C', false);
$pdf->Ln(10);
$pdf->SetTextColor( 37, 36, 97 );
if ($p_id!=null){
$pdf->SetFont('Helvetica', 'BI', 12);
$pdf->Cell(75, 5, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(22, 5, convertirc(_('GARANT').':')), 0, 0, 'L', false);
$pdf->MultiCell(115, 5, convertirc(_($entete['garant'])), 0, 'L');
$pdf->Ln(2);
$pdf->Cell(75, 5, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(38, 5, convertirc(_('SOUSCRIPTEUR').':'), 0, 0, 'L', false);
$pdf->MultiCell(115, 5, convertirc(_($entete['souscripteur'])), 0, 'L');
$pdf->Ln(2);
$pdf->Cell(75, 5, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(21, 5, convertirc(_('POLICE').':'), 0, 0, 'L', false);
$pdf->MultiCell(115, 5, convertirc(_($entete['libellePolice'])), 0, 'L');
}else{
$pdf->SetFont('Times', 'BI', 16);
$pdf->Cell(100, 5, convertirc(_('GARANT').':'), 0, 0, 'L', false);
$pdf->SetFont('Times', 'BI', 14);
$pdf->MultiCell(115, 5, convertirc(_($infosDuGarant['libelle'])), 0, 'L' );
$pdf->Ln(40);
}
$pdf->AddPage(); // SOMMAIRE
$pdf->SetMargins(10, 10, 10) ;
$pdf->Image($_SESSION['dossierSociete'].'/Tarifs/Img/newkit2.jpg', 0, 0, 210);
$pdf->Ln(10);
$pdf->SetTextColor(255, 255, 255);
$pdf->SetFont('Arial', 'B', 24);
$pdf->Cell(34,12,convertirc(''),0,0,'C',false);
$pdf->Cell(100,12,convertirc(_("SOMMAIRE")),0,0,'C',false);
$pdf->Ln(20);
$pdf->SetFont('Helvetica', 'B', 9);
$pdf->Cell(10,0,convertirc(''),0,0,'C',false);
$pdf->Cell(34,0,convertirc(_("DONNÉES ÉLEMENTAIRES")),0,0,'L',false);
$pdf->Cell(140,0,convertirc(''),0,0,'L',false);
$pdf->Ln(8);
$pdf->Cell(10,0,convertirc(''),0,0,'C',false);
$pdf->Cell(34,0,convertirc(_("MOUVEMENTS D'EFFECTIFS PAR COLLEGE")),0,0,'L',false);
$pdf->Cell(140,0,convertirc(''),0,0,'L',false);
$pdf->Ln(8);
$pdf->Cell(10,0,convertirc(''),0,0,'C',false);
$pdf->Cell(34,0,convertirc(_("DÉPENSES PAR FAMILLES ET PAR COLLEGE")),0,0,'L',false);
$pdf->Cell(140,0,convertirc(''),0,0,'L',false);
$pdf->Ln(8);
$pdf->Cell(10,0,convertirc(''),0,0,'C',false);
$pdf->Cell(34,0,convertirc(_("RÉCAPITULATIF DES DÉPENSES PAR STATUT DE BÉNÉFICIAIRES")),0,0,'L',false);
$pdf->Cell(140,0,convertirc(''),0,0,'L',false);
$pdf->Ln(8);
$pdf->Cell(10,0,convertirc(''),0,0,'C',false);
$pdf->Cell(34,0,convertirc(_("ÉVOLUTION MENSUELLE DES DÉPENSES")),0,0,'L',false);
$pdf->Cell(140,0,convertirc(''),0,0,'L',false);
$pdf->Ln(8);
$pdf->Cell(10,0,convertirc(''),0,0,'C',false);
$pdf->Cell(34,0,convertirc(_("RÉCAPITULATIF DES DÉPENSES PAR FAMILLE DACTES MÉDICAUX")),0,0,'L',false);
$pdf->Cell(140,0,convertirc(''),0,1,'L',false);
$pdf->Ln(8);
$pdf->Cell(10,0,convertirc(''),0,0,'C',false);
$pdf->Cell(36,0,convertirc(_("COMPARATIF DES DÉPENSES DES ANNÉES N-1 ET N")),0,0,'L',false);
$pdf->Cell(140,0,convertirc(''),0,1,'L',false);
$pdf->Ln(8);
$pdf->Cell(10,0,convertirc(''),0,0,'C',false);
$pdf->Cell(36,0,convertirc(_("DÉPENSES PAR FAMILLE DACTES ET PAR PRESTATAIRES")),0,0,'L',false);
$pdf->Cell(140,0,convertirc(''),0,0,'L',false);
$pdf->AddPage(); //
$pdf->Cell(0,8,convertirc(_("FICHE DE SUIVI")),0,1,'C',TRUE);
$pdf->Ln(8);
$h=5;
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('Times', 'BI', 9);
$pdf->Cell(75,$h,convertirc(_("PERIODE")),1,0,'L',false);
$pdf->Cell(115,$h,convertirc(dateLang($p_datedebut, $_SESSION['lang']).' '._('AU').' '.dateLang($p_datefin, $_SESSION['lang'])),1,1,'L',false);
$beneficiaires = $this->detailsp->getficheSuivie1($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin);
$agemoyens = $this->detailsp->getficheSuivie2($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin);
$tranchesages = $this->detailsp->getficheSuivie3($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin);
$topactes = $this->detailsp->getficheSuivie4($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin);
$topprestataires = $this->detailsp->getficheSuivie5($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin);
$topaffections = $this->detailsp->getficheSuivie6($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin);
$sinistrialites = $this->detailsp->getficheSuivie7($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin,$Chargement,$chargeravantapres);
$nombreBeneficiaire = 0;
foreach($beneficiaires as $key=>$beneficiaire){
if($key == 0){
$nombreTraiteA= $beneficiaire['Nombretraite'];
$DepensesA= $beneficiaire['Depenses'];
$taux_DepenseA= $beneficiaire['Taux_Depense'];
$coutMoyenA= $beneficiaire['CoutMoyen'];
}elseif($key == 1){
$nombreTraiteC= $beneficiaire['Nombretraite'];
$DepensesC= $beneficiaire['Depenses'];
$taux_DepenseC= $beneficiaire['Taux_Depense'];
$coutMoyenC=30;
//$beneficiaire['CoutMoyen'];
}
elseif($key == 2){
$nombreTraiteE= $beneficiaire['Nombretraite'];
$DepensesE= $beneficiaire['Depenses'];
$taux_DepenseE= $beneficiaire['Taux_Depense'];
$coutMoyenE= $beneficiaire['CoutMoyen'];
}
$nombreBeneficiaire = $nombreBeneficiaire+ $beneficiaire['Nombre'];
}
$coutMoyens = max(array($coutMoyenA,$coutMoyenC,$coutMoyenE));
if( $coutMoyens=$coutMoyenA){
$libelle = _("Adhérent(e)s");
}elseif( $coutMoyens== $coutMoyenC){
$libelle = _("Conjoint(e)s");
}
elseif( $coutMoyens == $coutMoyenE){
$libelle = _("Enfants");
}
foreach($agemoyens as $key=>$agemoyen){
if($key == 0){
$Age_MoyenA= $agemoyen['Age_Moyen'];
}elseif($key == 1){
$Age_MoyenC= $agemoyen['Age_Moyen'];
}
elseif($key == 2){
$Age_MoyenE= $agemoyen['Age_Moyen'];
}
}
foreach($tranchesages as $key=>$tranchesage){
if($key == 0){
$Depenses1= $tranchesage['Depense_Tranche'];
$taux_Depense1= $tranchesage['Taux_Depense'];
$coutMoyen1= $beneficiaire['CoutMoyen'];
}elseif($key == 1){
$Depenses2= $tranchesage['Depense_Tranche'];
$taux_Depense2= $tranchesage['Taux_Depense'];
$coutMoyen2= $beneficiaire['CoutMoyen'];
}
elseif($key == 2){
$Depenses3= $tranchesage['Depense_Tranche'];
$taux_Depense3= $tranchesage['Taux_Depense'];
$coutMoyen3= $beneficiaire['CoutMoyen'];
}
elseif($key == 3){
$Depenses4= $tranchesage['Depense_Tranche'];
$taux_Depense4= $tranchesage['Taux_Depense'];
$coutMoyen4= $beneficiaire['CoutMoyen'];
}
elseif($key == 4){
$Depenses4= $tranchesage['Depense_Tranche'];
$taux_Depense4= $tranchesage['Taux_Depense'];
$coutMoyen4= $beneficiaire['CoutMoyen'];
}
}
$pdf->Cell(75,$h,convertirc(_("BENEFICIAIRES")),1,0,'L',false);
$pdf->Cell(115,$h,convertirc(format_N($nombreBeneficiaire)),1,1,'L',false);
$pdf->Cell(75,$h,convertirc(''),"LTR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_("Adhérent(e)s")." : ".format_N($nombreTraiteA)),"LTR",1,'L',false);
$pdf->Cell(75,$h,convertirc(_("BENEFICIAIRES TRAITES")),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_("Conjoint(e)s")." : ".format_N($nombreTraiteC)),"LR",1,'L',false);
$pdf->Cell(75,$h,convertirc(''),"LBR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_("Enfants")." : ".format_N($nombreTraiteE)),"LBR",1,'L',false);
$pdf->Cell(75,$h,convertirc(''),"LTR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_("Adhérent(e)s")." : ".format_N($Age_MoyenA)." "._("ans")),"LTR",1,'L',false);
$pdf->Cell(75,$h,convertirc(_("AGE MOYEN DE LA POPULATION")),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_("Conjoint(e)s")." : ".format_N($Age_MoyenC)." "._("ans")),"LR",1,'L',false);
$pdf->Cell(75,$h,convertirc(''),"LBR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_("Enfants")." : ".format_N($Age_MoyenE)." "._("ans")),"LBR",1,'L',false);
$pdf->Cell(75,$h,convertirc(''),"LTR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_("Adhérent(e)s")." : ".format_N($DepensesA)." ".$_SESSION['devise_C']." "._("soit")." ".$taux_DepenseA." %")),"LTR",1,'L',false);
$pdf->Cell(75,$h,convertirc(_("SINISTRIALITE PAR STATUT DE BENEFICIAIRE")),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_("Conjoint(e)s")." : ".format_N($DepensesC)." ".$_SESSION['devise_C']." "._("soit")." ".$taux_DepenseC." %")),"LR",1,'L',false);
$pdf->Cell(75,$h,convertirc(''),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_("Enfants")." : ".format_N($DepensesE)." ".$_SESSION['devise_C']." "._("soit")." ".$taux_DepenseE." %")),"LR",1,'L',false);
$pdf->Cell(75,$h,convertirc(''),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_("On observe un coût moyen plus élevé chez les")." ".$libelle." ".format_N($coutMoyens)." ".$_SESSION['devise_C'])),"LR",1,'L',false);
$pdf->Cell(75,$h,convertirc(''),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc(''),"LR",1,'L',false);
$key=0;
foreach($topactes as $key=>$topacte){
if($key == 0){
$pdf->Cell(75,$h,convertirc(_("TOP DES ACTES")),"LTR",0,'L',false);
$pdf->Cell(115,$h,convertirc($topacte['libelle']." : "." ".format_N($topacte['MontantRembourse'])." ".$_SESSION['devise_C']." "._("soit")." ".$topacte['Taux']." %"),"LTR",1,'L',false);
}else{
$pdf->Cell(75,$h,convertirc(''),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc($topacte['libelle']." : "." ".format_N($topacte['MontantRembourse'])." ".$_SESSION['devise_C']." "._("soit")." ".$topacte['Taux']." %"),"LR",1,'L',false);
}
}
$pdf->Cell(75,$h,convertirc(''),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc(''),"LR",1,'L',false);
foreach($topprestataires as $key=>$topprestataire){
if($key == 0){
$pdf->Cell(75,$h,convertirc(_("TOP DES PRESTATAIRES")),"LTR",0,'L',false);
$pdf->Cell(115,$h,convertirc($topprestataire['Prestataire']." :"." ".format_N($topprestataire['montantApayer'])." ".$_SESSION['devise_C']),"LTR",1,'L',false);
}else{
$pdf->Cell(75,$h,convertirc(''),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc($topprestataire['Prestataire'].": "." ".format_N($topprestataire['montantApayer'])." ".$_SESSION['devise_C']),"LR",1,'L',false);
}
}
$pdf->Cell(75,$h,convertirc(''),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc(''),"LR",1,'L',false);
foreach($topaffections as $key=>$topaffection){
if($key == 0){
$pdf->Cell(75,$h,convertirc(_("TOP DES AFFECTIONS")),"LTR",0,'L',false);
$pdf->Cell(115,$h,convertirc($topaffection['affection']." : "." ".format_N($topaffection['apresDecompte'])." ".$_SESSION['devise_C']." "._("soit")." ".$topaffection['Taux']." %"),"LTR",1,'L',false);
}else{
$pdf->Cell(75,$h,convertirc(''),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc($topaffection['affection']." : "." ".format_N($topaffection['apresDecompte'])." ".$_SESSION['devise_C']." "._("soit")." ".$topaffection['Taux']." %"),"LR",1,'L',false);
}
}
$pdf->Cell(75,$h,convertirc(''),"LTR",0,'L',false);
$pdf->Cell(115,$h,convertirc(''),"LTR",1,'L',false);
$pdf->Cell(75,$h,convertirc(_("SINISTRIALITÉ")),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_("PROVISION MOYENNE")." : ".format_N($sinistrialites['PROVISION'])." ".$_SESSION['devise_C']),"LR",1,'L',false);
$pdf->Cell(75,$h,convertirc(''),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_("SINISTRIALITÉ MOYENNE")." : ".format_N($sinistrialites['SINISTRES'])." ".$_SESSION['devise_C']),"LR",1,'L',false);
$pdf->Cell(75,$h,convertirc(''),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_("ÉCART")." : ".format_N($sinistrialites['ECART'])." ".$_SESSION['devise_C']),"LR",1,'L',false);
// tableau d'ajustement
$pdf->Cell(75,$h,convertirc(''),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc(''),"LR",1,'L',false);
foreach($tableaudajustements as $key=>$tableaudajustement){
if($tableaudajustement['codeGcAssureur'] ==$entete['codeGcAssureur'] ){
$ajustement = $tableaudajustement['tauxAjustement']>=0.00 ? 'majoration' : 'minoration';
if($tableaudajustement['spMin']<= $sinistrialites['RAPPRSP'] && $tableaudajustement['spMax']>= $sinistrialites['RAPPRSP'] ){
$pdf->SetFont('Times', 'BI', 11);
$pdf->SetTextColor(255, 0, 0);
$conclusion = $ajustement=="majoration" ? _("La tendance est ascendante par conséquent la police sera majorée au renouvelement.") : _("La tendance est constante par conséquent la police ne sera pas majorée au renouvelement.") ;
}else{
$pdf->SetFont('Times', 'BI', 9);
$pdf->SetTextColor(0, 0, 0);
}
if($key == 0){
$pdf->Cell(75,$h,convertirc(_("Tableau d'ajustement")),"LTR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_("de")." ".$tableaudajustement['spMin']." "._("à")." ".$tableaudajustement['spMax'].$ajustement.$tableaudajustement['tauxAjustement'] )),"LTR",1,'L',false);
}else{
$pdf->Cell(75,$h,convertirc(''),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_("de")." ".$tableaudajustement['spMin']." "._("à")." ".$tableaudajustement['spMax'].$ajustement.$tableaudajustement['tauxAjustement'] )),"LR",1,'L',false);
}
}
}
$pdf->Cell(75,$h,convertirc(''),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc(''),"LR",1,'L',false);
$pdf->Cell(190,$h,convertirc(_($conclusion)),"LBR",1,'L',false);
$pdf->AddPage(); // DEBUT FT1
$statutsfts = $this->detailsp->donneelementaire_rp($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin);
$primeSinistrefts = $this->detailsp->donneelementaire_rp2_1($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin,$Chargement,$chargeravantapres );
$pdf->SetMargins(10, 10, 10) ;
$pdf->Image($_SESSION['dossierSociete'].'/Tarifs/Img/newkit3.jpg', 0, 0, 210);
$pdf->SetY(40);
$pdf->SetFont('Helvetica', 'B', 18);
$pdf->SetTextColor( 65, 185, 80 );
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(50, 6, convertirc(_('DONNÉES ÉLÉMENTAIRES')), 0, 1, 'L', false);
$pdf->Ln(8);
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->SetTextColor(0);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(50, 6, convertirc(_('PÉRIODE COMPTABLE CONSIDÉRÉE').' : '.dateLang($p_datedebut, $_SESSION['lang']).' '._('AU').' '.dateLang($p_datefin, $_SESSION['lang'])), 0, 1, 'L', false);
$pdf->Ln(8);
if ($p_id!=null){
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->Cell(10, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('GARANT')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['garant'])), 0, 1, 'L', false);
$pdf->Cell(10, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('SOUSCRIPTEUR')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['souscripteur'])), 0, 1, 'L', false);
//$pdf->Cell(0, 8, convertirc(_('SOUSCRIPTEUR').' : '.$entete['souscripteur']), 0, 1, 'L', false);
$pdf->Cell(10, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('POLICE No')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['numeroPolice'].' / '.$entete['libellePolice'])), 0, 1, 'L', false);
$pdf->Cell(10, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('COURTIER')), 0, 0, 'L', false);
$pdf->Cell(0, 6, 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('Helvetica', 'BUI', 11);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('GARANT')), 0, 0, 'L', false);
$pdf->SetFont('Helvetica', 'BI', 11);
$pdf->Cell(0, 6, convertirc(_(' : '.$p_garant)), 0, 1, 'L', false);
}
$pdf->SetX(15);
$pdf->SetFont('Helvetica', 'BI', 11);
$pdf->Cell(35, 6, convertirc(_('POPULATION')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : cf Tableau ci-dessous : ' )), 0, 1, 'L', false);
// $pdf->Cell(0, 6, convertirc(_("POPULATION").' : cf Tableau ci-dessous : '), 0, 1, 'L', false);
$pdf->Ln(10);
$hl=6;
$pdf->SetX(12);
$pdf->SetFont('Arial', 'B', 8);
$pdf->SetFillColor(143, 206, 143);
$pdf->Cell(35, $hl, convertirc(_('Statut bénéficiaire')), 1, 0, 'C', true);
$pdf->Cell(50, $hl, convertirc(_("Nombre d'assurés sur la période")), 1, 0, 'C', true);
$pdf->Cell(50, $hl, convertirc(_("Bénéficiaires traités sur la période")), 1, 0, 'C', true);
$pdf->Cell(50, $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 ($statutsfts as $statutsf) {
$pdf->SetX(12);
$pdf->Cell(35, $hl, convertirc($statutsf['libelle']), 1, 0, 'L', false);
$pdf->Cell(50, $hl, convertirc(format_N($statutsf['Nombre'])), 1, 0, 'C', false);
$pdf->Cell(50, $hl, convertirc(format_N($statutsf['Nombretraite'])), 1, 0, 'C', false);
$pdf->Cell(50, $hl, convertirc($statutsf['Taux_EffTraite']." %"), 1, 1, 'C', false);
$total_assure = $total_assure + $statutsf['Nombre'];
$total_traite = $total_traite + $statutsf['Nombretraite'];
$total_taux = $total_taux + $statutsf['Taux_EffTraite'];
}
$hl=8;
$pdf->SetFont('Arial', 'B', 9);
$pdf->SetFillColor(143, 206, 143);
$pdf->SetX(12);
$pdf->Cell(35, $hl, convertirc(_('TOTAL')), 1, 0, 'C', true);
$pdf->Cell(50, $hl, convertirc(_(format_N($total_assure))), 1, 0, 'C', true);
$pdf->Cell(50, $hl, convertirc(_(format_N($total_traite))), 1, 0, 'C', true);
$pdf->Cell(50, $hl, convertirc(_(format_N($total_taux)." %")), 1, 1, 'C', true);
$pdf->Ln(15);
$tp = 11;
$ht = 6;
$pdf->SetFont('Arial', 'BI', $tp);
$pdf->SetTextColor( 65, 185, 80 );
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(190, $ht, convertirc("PRIMES ET SINISTRALITÉ DE LA POLICE "), 0, 1, 'C', false);
$pdf->SetTextColor( 0, 0, 0 );
foreach ($primeSinistrefts as $primeSinistreft) {
}
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->Ln(5);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(100, $ht, convertirc(_("RAPPEL PRIME NETTE TOTALE :")), 0, 0, 'L', false);
$pdf->Cell(40, $ht, format_N($primeSinistreft['PRIMETOTALE']), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(100, $ht, convertirc(_("PRIME NETTE DE LA PÉRIODE :")), 0, 0, 'L', false);
$pdf->Cell(40, $ht, format_N($primeSinistreft['PRIMENETTE']), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(100, $ht, convertirc(_("CHARGEMENT DE LA PÉRIODE :")), 0, 0, 'L', false);
$pdf->Cell(40, $ht, format_N($primeSinistreft['CHARGEMENT']), 0, 1, 'L', false);
$pdf->Ln(5);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(100, $ht, convertirc(_("PROVISION POUR SINISTRE DE LA PÉRIODE :")), 0, 0, 'L', false);
$pdf->Cell(40, $ht, format_N($primeSinistreft['PROVISION']), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(100, $ht, convertirc(_("SINISTRE DE LA PÉRIODE :")), 0, 0, 'L', false);
$pdf->Cell(40, $ht, format_N($primeSinistreft['SINISTRES']), 0, 1, 'L', false);
$pdf->Ln(10);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(120, $ht, convertirc(_("RÉSULTATS TECHNIQUES DE LA PÉRIODE (Rapport Sinistres/Primes) :")), 0, 1, 'L', false);
if($chargeravantapres =="AVANT"){
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(125, $ht, convertirc(_("RAPPORT (SINISTRES/PRIME NETTE DE LA PÉRIODE) NET :")), 0, 0, 'L', false);
$pdf->Cell(40, $ht, number_format($primeSinistreft['RAPPRSP'], 2, '.', ','), 0, 1, 'L', false);
}else{
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(110, $ht, convertirc(_("RAPPORT (SINISTRES/PROVISION) NET :")), 0, 0, 'L', false);
$pdf->Cell(40, $ht, number_format($primeSinistreft['RAPPRSP'], 2, '.', ','), 0, 1, 'L', false);
}
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(125, $ht, convertirc(_("EXCEDENT (ou DEFICIT (-)) :")), 0, 0, 'L', false);
$pdf->Cell(40, $ht, format_N($primeSinistreft['ECART']), 0, 1, 'L', false);
$pdf->AddPage('L'); // debut MOUVEMENTS D'EFFECTIFS PAR COLLEGE
$p_factures = $this->detailsp->mouvementeffectifcollege($p_garant, $p_id_clients, $p_id, $p_id_college,$p_apporteur, $p_datedebut, $p_datefin,$p_limite );
$pdf->SetMargins(10, 10, 10) ;
$pdf->Image($_SESSION['dossierSociete'].'/Tarifs/Img/newkit7.jpg', 0, 0, 297);
$pdf->SetY(15);
$pdf->SetFont('Helvetica', 'B', 18);
$pdf->SetTextColor( 65, 185, 80 );
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->MultiCell(150, 8, convertirc(_("MOUVEMENTS D'EFFECTIFS PAR COLLEGE")), 0, 'L' );
$pdf->Ln(8);
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->SetTextColor(0);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(50, 6, convertirc(_('PÉRIODE COMPTABLE CONSIDÉRÉE').' : '.dateLang($p_datedebut, $_SESSION['lang']).' '._('AU').' '.dateLang($p_datefin, $_SESSION['lang'])), 0, 1, 'L', false);
$pdf->Ln(10);
if ($p_id!=null){
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('GARANT')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['garant'])), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('SOUSCRIPTEUR')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['souscripteur'])), 0, 1, 'L', false);
//$pdf->Cell(0, 8, convertirc(_('SOUSCRIPTEUR').' : '.$entete['souscripteur']), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('POLICE No')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['numeroPolice'].' / '.$entete['libellePolice'])), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('COURTIER')), 0, 0, 'L', false);
$pdf->Cell(0, 6, 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('Helvetica', 'BUI', 11);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('GARANT')), 0, 0, 'L', false);
$pdf->SetFont('Helvetica', 'BI', 11);
$pdf->Cell(0, 6, convertirc(_(' : '.$p_garant)), 0, 1, 'L', false);
}
$pdf->Ln(10);
$hl=7;
$pdf->SetFont('Arial','',7);
$pdf->SetFillColor(143,206,143);
$pdf->Cell(15,$hl,convertirc(_('idCollege')),1,0,'C',true);
$pdf->Cell(60,$hl,convertirc(_("College")),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;
foreach ($p_factures as $dep)
{
$taillelibelleCollege = strlen($dep['libelleCollege']); // compter le nombre de caractere de la chaine
if($taillelibelleCollege>43) {
$hl= 4;
$text = wordwrap($dep['libelleCollege'], 45, "***", 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(15,$hl,convertirc($dep['idCollege']),"LTR",0,'C',false);
$pdf->Cell(60,$hl,convertirc($part1),"LTR",0,'L',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['JANVIER'])),"LTR",0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['FEVRIER'])),"LTR",0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($dep['MARS'])),"LTR",0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($dep['AVRIL'])),"LTR",0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($dep['MAI'])),"LTR",0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($dep['JUIN'])),"LTR",0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['JUILLET'])),"LTR",0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($dep['AOUT'])),"LTR",0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['SEPTEMBRE'])),"LTR",0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['OCTOBRE'])),"LTR",0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['NOVEMBRE'])),"LTR",0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['DECEMBRE'])),"LTR",0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['TOTAUX'])),"LTR",1,'C',false);
$pdf->Cell(15,$hl,convertirc(""),"LBR",0,'C',false);
$pdf->Cell(60,$hl,convertirc($part2),"LBR",0,'L',false);
$pdf->Cell(16,$hl,convertirc(""),"LBR",0,'C',false);
$pdf->Cell(16,$hl,convertirc(""),"LBR",0,'C',false);
$pdf->Cell(15,$hl,convertirc(""),"LBR",0,'C',false);
$pdf->Cell(15,$hl,convertirc(""),"LBR",0,'C',false);
$pdf->Cell(15,$hl,convertirc(""),"LBR",0,'C',false);
$pdf->Cell(15,$hl,convertirc(""),"LBR",0,'C',false);
$pdf->Cell(16,$hl,convertirc(""),"LBR",0,'C',false);
$pdf->Cell(15,$hl,convertirc(""),"LBR",0,'C',false);
$pdf->Cell(16,$hl,convertirc(""),"LBR",0,'C',false);
$pdf->Cell(16,$hl,convertirc(""),"LBR",0,'C',false);
$pdf->Cell(16,$hl,convertirc(""),"LBR",0,'C',false);
$pdf->Cell(16,$hl,convertirc(""),"LBR",0,'C',false);
$pdf->Cell(16,$hl,convertirc(""),"LBR",1,'C',false);
}
else{
$pdf->Cell(15,$hl,convertirc($dep['idCollege']),1,0,'C',false);
$pdf->Cell(60,$hl,convertirc($dep['libelleCollege']),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(143,206,143);
$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);
$pdf->Ln(5);
$pdf->Cell(45,$hl,convertirc(_("Nombre de lignes: ").count($p_factures)),0,0,'L',false);
$pdf->AddPage(); // debut etat des depenses par college
$p_factures = $this->detailsp->get_depense_contrat_college_rp($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin);
$pdf->SetMargins(10, 10, 10) ;
$pdf->Image($_SESSION['dossierSociete'].'/Tarifs/Img/newkit5.jpg', 0, 0, 210);
$pdf->SetFont('Arial','B',13);
$pdf->SetY(40);
$pdf->SetFont('Helvetica', 'B', 18);
$pdf->SetTextColor( 65, 185, 80 );
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->MultiCell(145, 8, convertirc(_("DÉPENSES PAR FAMILLES ET PAR COLLEGE")), 0, 'L' );
$pdf->Ln(8);
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->SetTextColor(0);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(50, 6, convertirc(_('PÉRIODE COMPTABLE CONSIDÉRÉE').' : '.dateLang($p_datedebut, $_SESSION['lang']).' '._('AU').' '.dateLang($p_datefin, $_SESSION['lang'])), 0, 1, 'L', false);
$pdf->Ln(10);
if ($p_id!=null){
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('GARANT')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['garant'])), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('SOUSCRIPTEUR')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['souscripteur'])), 0, 1, 'L', false);
//$pdf->Cell(0, 8, convertirc(_('SOUSCRIPTEUR').' : '.$entete['souscripteur']), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('POLICE No')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['numeroPolice'].' / '.$entete['libellePolice'])), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('COURTIER')), 0, 0, 'L', false);
$pdf->Cell(0, 6, 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('Helvetica', 'BUI', 11);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('GARANT')), 0, 0, 'L', false);
$pdf->SetFont('Helvetica', 'BI', 11);
$pdf->Cell(0, 6, convertirc(_(' : '.$p_garant)), 0, 1, 'L', false);
}
$pdf->Ln(5);
$hl=7;
$pdf->SetFont('Arial','B',8);
$pdf->SetFillColor(143,206,143);
$pdf->Cell(16,$hl,convertirc(_("Id")),1,0,'C',true);
$pdf->Cell(94,$hl,convertirc(_("College")),1,0,'C',true);
$pdf->Cell(30,$hl,convertirc(_("Mt Recl.")),1,0,'C',true);
$pdf->Cell(30,$hl,convertirc(_("Mt Remb.")),1,0,'C',true);
$pdf->Cell(20,$hl,convertirc(_("Taux (%)")),1,1,'C',true);
$pdf->SetFont('Arial','',8);
$total_montantFacture = 0;
$total_apresDecompte = 0;
$total_taux = 0;
foreach ($p_factures as $p_facture){
$total_montantFacture = $total_montantFacture + $p_facture['montantFacture'];
$total_apresDecompte = $total_apresDecompte + $p_facture['apresDecompte'];
$total_taux = $total_taux + $p_facture['Taux'];
$pdf->Cell(16,$hl,convertirc($p_facture['id']),1,0,'C',false);
$pdf->Cell(94,$hl,convertirc($p_facture['libelleCollege']),1,0,'L',false);
$pdf->Cell(30,$hl,convertirc(format_N($p_facture['montantFacture'])),1,0,'C',false);
$pdf->Cell(30,$hl,convertirc(format_N($p_facture['apresDecompte'])),1,0,'C',false);
$pdf->Cell(20,$hl,convertirc($p_facture['Taux']),1,1,'C',false);
}
$pdf->Cell(110,$hl,convertirc("TOTAL GENERAL"),1,0,'L',true);
$pdf->Cell(30,$hl,convertirc(format_N($total_montantFacture)),1,0,'C',true);
$pdf->Cell(30,$hl,convertirc(format_N($total_apresDecompte)),1,0,'C',true);
$pdf->Cell(20,$hl,convertirc(format_N($total_taux)),1,1,'C',true);
$pdf->SetFont('Helvetica','B',10);
$pdf->Cell(45,$hl,convertirc(_(" * Légende :")),0,0,'L',false);
$pdf->Ln(5);
$pdf->SetX(16);
$pdf->Cell(45,$hl,convertirc(_("Mt Recl. = Montant reclamé ")),0,0,'L',false);
$pdf->Ln(5);
$pdf->SetX(16);
$pdf->Cell(45,$hl,convertirc(_("Mt Remb. = Montant rembousé")),0,0,'L',false);
$pdf->AddPage(); // debut ft3
$p_factures = $this->detailsp->recapdepensesstatutbenef($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin);
$statutsfts = $this->detailsp->recapdepensesstatutbenefdeux($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin);
$statuts = $this->detailsp->listestatutbeneficiaire($idPolice,$p_datedebut,$p_datefin);
$pdf->SetMargins(10, 10, 10) ;
$pdf->Image($_SESSION['dossierSociete'].'/Tarifs/Img/newkit3.jpg', 0, 0, 210);
$pdf->SetY(30);
$pdf->SetFont('Helvetica', 'B', 18);
$pdf->SetTextColor( 65, 185, 80 );
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->MultiCell(145, 8, convertirc(_("RÉCAPITULATIF DES DÉPENSES PAR STATUT DE BÉNEFICIAIRES")), 0, 'L' );
$pdf->Ln(8);
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->SetTextColor(0);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(50, 6, convertirc(_('PÉRIODE COMPTABLE CONSIDÉRÉE').' : '.dateLang($p_datedebut, $_SESSION['lang']).' '._('AU').' '.dateLang($p_datefin, $_SESSION['lang'])), 0, 1, 'L', false);
$pdf->Ln(10);
if ($p_id!=null){
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('GARANT')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['garant'])), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('SOUSCRIPTEUR')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['souscripteur'])), 0, 1, 'L', false);
//$pdf->Cell(0, 8, convertirc(_('SOUSCRIPTEUR').' : '.$entete['souscripteur']), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('POLICE No')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['numeroPolice'].' / '.$entete['libellePolice'])), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('COURTIER')), 0, 0, 'L', false);
$pdf->Cell(0, 6, 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('Helvetica', 'BUI', 11);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('GARANT')), 0, 0, 'L', false);
$pdf->SetFont('Helvetica', 'BI', 11);
$pdf->Cell(0, 6, convertirc(_(' : '.$p_garant)), 0, 1, 'L', false);
}
$pdf->Ln(5);
$hl=6;
$pdf->SetX(13);
$pdf->SetFont('Arial','B',9);
$pdf->Cell(184,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->SetX(13);
$pdf->Cell(34,$hl,convertirc(_('Statut bénéficiaire')),1,0,'C',true);
$pdf->Cell(25,$hl,convertirc(_("Nombre")),1,0,'C',true);
$pdf->Cell(25,$hl,convertirc(_("Taux effectif")),1,0,'C',true);
$pdf->Cell(25,$hl,convertirc(_("Age moyen")),1,0,'C',true);
$pdf->Cell(27,$hl,convertirc(_("Montant")),1,0,'C',true);
$pdf->Cell(24,$hl,convertirc(_("Taux")),1,0,'C',true);
$pdf->Cell(24,$hl,convertirc(_("Coût moyen")),1,1,'C',true);
$pdf->SetFont('Arial','',9);
$total_Nombre = 0;
$total_Taux_Eff = 0;
$total_Age_Moyen = 0;
$total_Montant = 0;
$total_tauxMontantTraite = 0;
$total_coutMoyenTraite = 0;
foreach ($p_factures as $p_facture)
{
$pdf->SetX(13);
$pdf->Cell(34,$hl,convertirc($p_facture['libelle']),1,0,'L',false);
$pdf->Cell(25,$hl,convertirc(format_N($p_facture['Nombre'])),1,0,'C',false);
$pdf->Cell(25,$hl,convertirc($p_facture['Taux_Eff']."%"),1,0,'C',false);
$pdf->Cell(25,$hl,convertirc($p_facture['Age_Moyen']),1,0,'C',false);
$pdf->Cell(27,$hl,convertirc(format_N($p_facture['Montant'])),1,0,'C',false);
$pdf->Cell(24,$hl,convertirc($p_facture['Taux_Depense']."%"),1,0,'C',false);
$pdf->Cell(24,$hl,convertirc(format_N($p_facture['CoutMoyen'])),1,1,'C',false);
$total_Nombre = $total_Nombre + $p_facture['Nombre'];
$total_Taux_Eff = $total_Taux_Eff + $p_facture['Taux_Eff'];
$total_Age_Moyen = $total_Age_Moyen + $p_facture['Age_Moyen'];
$total_Montant = $total_Montant + $p_facture['Montant'];
$total_tauxMontantTraite = $total_tauxMontantTraite + $p_facture['Taux_Depense'];
$total_coutMoyenTraite = $total_coutMoyenTraite + $p_facture['CoutMoyen'];
}
$pdf->SetFont('Arial','B',9);
$pdf->SetX(13);
$total_Age_Moyen =$total_Age_Moyen /6;
$pdf->Cell(34,$hl,convertirc("TOTAL GENERAL"),"1",0,'C',true);
$pdf->Cell(25,$hl,format_N($total_Nombre),1,0,'C',true);
$pdf->Cell(25,$hl,format_N($total_Taux_Eff)."%",1,0,'C',true);
$pdf->Cell(25,$hl,format_N($total_Age_Moyen),1,0,'C',true);
$pdf->Cell(27,$hl,format_N($total_Montant),1,0,'C',true);
$pdf->Cell(24,$hl,format_N($total_tauxMontantTraite)."%",1,0,'C',true);
$pdf->Cell(24,$hl,format_N($total_coutMoyenTraite),1,0,'C',true);
$pdf->SetFont('Arial','B',8);
$pdf->SetY(160);
$pdf->Cell(10,8,(''),0,0);
$pdf->Cell(80,8,convertirc(_('Récapitulatif dépenses par statut bénéficiaire (%)')),1,0,'C',false);
$pdf->Cell(10,8,(''),0,0);
$pdf->Cell(80,8,convertirc(_('Récapitulatif des bénéficiaires traités par statut (%)')),1,1,'C',false);
$pdf->Ln(5);
$pdf->Rect(20,168, 80, 52, 'D');
$pdf->Rect(110, 168, 80, 52, 'D');
// DEBUT GRAPH
$valeur0=0;
$valeur1=0;
$valeur2=0;
$valeur3=0;
$valeur4=0;
$valeur5=0;
$value=0;
$v=0;
$valeurs=array();
foreach($p_factures as $key => $value){
array_push($valeurs,$value['Taux_Depense']);
}
foreach($valeurs as $key =>$valeur){
if ($key == 0) {
$valeur0 = $valeur;
}
if ($key == 1) {
$valeur1 = $valeur;
}
if ($key == 2) {
$valeur2 = $valeur;
}
if ($key == 3) {
$valeur3 = $valeur;
}
if ($key == 4) {
$valeur4 = $valeur;
}
if ($key == 5) {
$valeur5 = $valeur;
}
$data=Array(
'A'=>[
'color'=>[255,0,0],
'value'=>$valeur0],
'C'=>[
'color'=>[255,255,0],
'value'=>$valeur1],
'E'=>[
'color'=>[50,0,255],
'value'=>$valeur2],
'O'=>[
'color'=>[255,0,255],
'value'=>$valeur3],
'F'=>[
'color'=>[0,255,0],
'value'=>$valeur4],
'D'=>[
'color'=>[0,0,0],
'value'=>$valeur5]
);
}
//pie and legend properties
$pieX=40;
$pieY=195;
$r=14;//radius
$legendX=65;
$legendY=185;
//get total data summary
$dataSum=0;
foreach($data as $item){
$dataSum+=$item['value'];
}
//get scale unit for each degree
$degUnit=360/$dataSum;
//variable to store current angle
$currentAngle=0;
//store current legend Y position
$currentLegendY=$legendY;
$pdf->SetFont('Arial','',8);
//simplify the code by drawing both pie and legend in one loop
foreach($data as $index=>$item){
//draw the pie
//slice size
$deg=$degUnit*$item['value'];
//set color
$pdf->SetFillColor($item['color'][0],$item['color'][1],$item['color'][2]);
//remove border
$pdf->SetDrawColor($item['color'][0],$item['color'][1],$item['color'][2]);
//draw the slice
$pdf->Sector($pieX,$pieY,$r,$currentAngle,$currentAngle+$deg);
//add slice angle to currentAngle var
$currentAngle+=$deg;
//draw the legend
$pdf->SetFont('Arial','',8);
// $pdf->SetXY($chartX,$chartY);
$pdf->Rect($legendX,$currentLegendY,4,4,'DF');
$pdf->SetXY($legendX + 6,$currentLegendY);
foreach($valeurs as $key =>$valeur){
if ($key == 0) {
$v0 = $valeur;
}
if ($key == 1) {
$v1 = $valeur;
}
if ($key == 2) {
$v2 = $valeur;
}
if ($key == 3) {
$v3 = $valeur;
}
if ($key == 4) {
$v4 = $valeur;
}
if ($key == 5) {
$v5 = $valeur;
}
}
$pdf->Cell(20,5,convertirc(_($index)),0,0);
if ($index == 'A') {
$pdf->Cell(10,5,convertirc(_($v0)),0,0);
}
if ($index == 'C') {
$pdf->Cell(10,5,convertirc(_($v1)),0,0);
}
if ($index == 'E') {
$pdf->Cell(10,5,convertirc(_($v2)),0,0);
}
if ($index == 'O') {
$pdf->Cell(10,5,convertirc(_('0')),0,0);
}
if ($index == 'F') {
$pdf->Cell(10,5,convertirc(_($v4)),0,0);
}
if ($index == 'D') {
$pdf->Cell(10,5,convertirc(_($v5)),0,0);
}
$currentLegendY+=5;
}
$valeur0=0;
$valeur1=0;
$valeur2=0;
$valeur3=0;
$valeur4=0;
$valeur5=0;
$value=0;
$v=0;
$valeurs=array();
foreach($statutsfts as $key => $value){
array_push($valeurs,$value['Taux_Eff']);
}
foreach($valeurs as $key =>$valeur){
if ($key == 0) {
$valeur0 = $valeur;
}
if ($key == 1) {
$valeur1 = $valeur;
}
if ($key == 2) {
$valeur2 = $valeur;
}
if ($key == 3) {
$valeur3 = $valeur;
}
if ($key == 4) {
$valeur4 = $valeur;
}
if ($key == 5) {
$valeur5 = $valeur;
}
$data=Array(
'A'=>[
'color'=>[255,0,0],
'value'=>$valeur0],
'C'=>[
'color'=>[255,255,0],
'value'=>$valeur1],
'E'=>[
'color'=>[50,0,255],
'value'=>$valeur2],
'O'=>[
'color'=>[255,0,255],
'value'=>$valeur3],
'F'=>[
'color'=>[0,255,0],
'value'=>$valeur4],
'D'=>[
'color'=>[0,0,0],
'value'=>$valeur5]
);
}
//pie and legend properties
$pieX=130;
$pieY=195;
$r=14;//radius
$legendX=155;
$legendY=185;
//get total data summary
$dataSum=0;
foreach($data as $item){
$dataSum+=$item['value'];
}
//get scale unit for each degree
$degUnit=360/$dataSum;
//variable to store current angle
$currentAngle=0;
//store current legend Y position
$currentLegendY=$legendY;
$pdf->SetFont('Arial','',8);
//simplify the code by drawing both pie and legend in one loop
foreach($data as $index=>$item){
//draw the pie
//slice size
$deg=$degUnit*$item['value'];
//set color
$pdf->SetFillColor($item['color'][0],$item['color'][1],$item['color'][2]);
//remove border
$pdf->SetDrawColor($item['color'][0],$item['color'][1],$item['color'][2]);
//draw the slice
$pdf->Sector($pieX,$pieY,$r,$currentAngle,$currentAngle+$deg);
//add slice angle to currentAngle var
$currentAngle+=$deg;
//draw the legend
$pdf->SetFont('Arial','',8);
// $pdf->SetXY($chartX,$chartY);
$pdf->Rect($legendX,$currentLegendY,4,4,'DF');
$pdf->SetXY($legendX + 6,$currentLegendY);
foreach($valeurs as $key =>$valeur){
if ($key == 0) {
$v0 = $valeur;
}
if ($key == 1) {
$v1 = $valeur;
}
if ($key == 2) {
$v2 = $valeur;
}
if ($key == 3) {
$v3 = $valeur;
}
if ($key == 4) {
$v4 = $valeur;
}
if ($key == 5) {
$v5 = $valeur;
}
}
$pdf->Cell(20,5,convertirc(_($index)),0,0);
if ($index == 'A') {
$pdf->Cell(10,5,convertirc(_($v0)),0,0);
}
if ($index == 'C') {
$pdf->Cell(10,5,convertirc(_($v1)),0,0);
}
if ($index == 'E') {
$pdf->Cell(10,5,convertirc(_($v2)),0,0);
}
if ($index == 'O') {
$pdf->Cell(10,5,convertirc(_($v3)),0,0);
}
if ($index == 'F') {
$pdf->Cell(10,5,convertirc(_($v4)),0,0);
}
if ($index == 'D') {
$pdf->Cell(10,5,convertirc(_($v5)),0,0);
}
$currentLegendY+=5;
}
$pdf->Ln(18);
$hl=5;
$pdf->SetX(13);
$pdf->SetFont('Arial','B',9);
$pdf->Cell(184,6,convertirc(_('Dépenses des bénéficiaires traités par statut')),1,1,'C',false);
$pdf->SetFont('Arial','B',8);
$pdf->SetX(13);
$pdf->SetFillColor(143,206,143);
$pdf->Cell(34,$hl,convertirc(_('Statut bénéficiaire')),1,0,'C',true);
$pdf->Cell(51,$hl,convertirc(_("Nombre de fois traités sur la période")),1,0,'C',true);
$pdf->Cell(24,$hl,convertirc(_("Taux traités")),1,0,'C',true);
$pdf->Cell(27,$hl,convertirc(_("Dépenses")),1,0,'C',true);
$pdf->Cell(24,$hl,convertirc(_("Taux")),1,0,'C',true);
$pdf->Cell(24,$hl,convertirc(_("Coût moyen")),1,1,'C',true);
$pdf->SetFont('Arial','',9);
$total_BenefTraite = 0;
$total_Taux_EffTraite = 0;
$total_Depensestraite = 0;
$total_Taux_Depense =0;
$total_coutMoyenTraite = 0;
foreach ($statutsfts as $statutsft)
{
$pdf->SetX(13);
$pdf->Cell(34,$hl,convertirc($statutsft['libelle']),1,0,'L',false);
$pdf->Cell(51,$hl,convertirc(format_N($statutsft['BenefTraite'])),1,0,'C',false);
$pdf->Cell(24,$hl,convertirc($statutsft['Taux_Eff']."%"),1,0,'C',false);
$pdf->Cell(27,$hl,convertirc(format_N($statutsft['Depenses'])),1,0,'C',false);
$pdf->Cell(24,$hl,convertirc($statutsft['Taux_Depense']."%"),1,0,'C',false);
$pdf->Cell(24,$hl,convertirc(format_N($statutsft['CoutMoyen'])),1,1,'C',false);
$total_BenefTraite = $total_BenefTraite + $statutsft['BenefTraite'];
$total_Taux_EffTraite = $total_Taux_EffTraite + $statutsft['Taux_Eff'];
$total_Depensestraite = $total_Depensestraite + $statutsft['Depenses'];
$total_Taux_Depense = $total_Taux_Depense+ $statutsft['Taux_Depense'];
$total_coutMoyenTraite = $total_coutMoyenTraite + $statutsft['CoutMoyen'];
}
$pdf->SetFont('Arial','B',9);
$pdf->SetX(13);
$pdf->Cell(34,$hl,convertirc("TOTAL GÉNERAL"),"1",0,'C',true);
$pdf->Cell(51,$hl,format_N($total_BenefTraite),1,0,'C',true);
$pdf->Cell(24,$hl,$total_Taux_EffTraite."%",1,0,'C',true);
$pdf->Cell(27,$hl,format_N($total_Depensestraite),1,0,'C',true);
$pdf->Cell(24,$hl,format_N($total_tauxMontantTraite)."%",1,0,'C',true);
$pdf->Cell(24,$hl,format_N($total_coutMoyenTraite),1,0,'C',true);
$pdf->AddPage();// debut ft 8
$p_factures = $this->detailsp->etatrecapdepensesparfamilledactesmedicaux($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin);
$pdf->SetMargins(10, 10, 10) ;
$pdf->Image($_SESSION['dossierSociete'].'/Tarifs/Img/newkit5.jpg', 0, 0, 210);
$pdf->SetY(15);
$pdf->SetFont('Helvetica', 'B', 18);
$pdf->SetTextColor( 65, 185, 80 );
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->MultiCell(150, 8, convertirc(_("RÉCAPITULATIF DES DÉPENSES PAR FAMILLE D'ACTES")), 0, 'L' );
$pdf->Ln(8);
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->SetTextColor(0);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(50, 6, convertirc(_('PÉRIODE COMPTABLE CONSIDÉRÉE').' : '.dateLang($p_datedebut, $_SESSION['lang']).' '._('AU').' '.dateLang($p_datefin, $_SESSION['lang'])), 0, 1, 'L', false);
$pdf->Ln(10);
if ($p_id!=null){
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('GARANT')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['garant'])), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('SOUSCRIPTEUR')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['souscripteur'])), 0, 1, 'L', false);
//$pdf->Cell(0, 8, convertirc(_('SOUSCRIPTEUR').' : '.$entete['souscripteur']), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('POLICE No')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['numeroPolice'].' / '.$entete['libellePolice'])), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('COURTIER')), 0, 0, 'L', false);
$pdf->Cell(0, 6, 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('Helvetica', 'BUI', 11);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('GARANT')), 0, 0, 'L', false);
$pdf->SetFont('Helvetica', 'BI', 11);
$pdf->Cell(0, 6, convertirc(_(' : '.$p_garant)), 0, 1, 'L', false);
}
$pdf->Ln(10);
$hl=6;
$pdf->SetFont('Arial', 'B', 8);
$pdf->SetFillColor(143, 206, 143);
$pdf->Cell(15, $hl, convertirc(_('Code')), 1, 0, 'C', true);
$pdf->SetFillColor(143, 206, 143);
$pdf->Cell(80, $hl, convertirc(_("Libellé")), 1, 0, 'C', true);
$pdf->SetFillColor(143, 206, 143);
$pdf->Cell(20, $hl, convertirc(_("Quantité")), 1, 0, 'C', true);
$pdf->SetFillColor(143, 206, 143);
$pdf->Cell(30, $hl, convertirc(_("Montant Remboursé")), 1, 0, 'C', true);
$pdf->SetFillColor(143, 206, 143);
$pdf->Cell(25, $hl, convertirc(_("Coût Moyen")), 1, 0, 'C', true);
$pdf->SetFillColor(143, 206, 143);
$pdf->Cell(20, $hl, convertirc(_("Taux")), 1, 1, 'C', true);
$pdf->SetFont('Arial', '', 9);
$total_assure = 0;
$total_coutmoyen =0;
$total_quantite =0;
$total_montantrembourse =0;
$total_traite = 0;
$total_taux = 0;
foreach ($p_factures as $p_facture) {
$pdf->Cell(15, $hl, convertirc($p_facture['codeGarantie']), 1, 0, 'L', false);
$pdf->Cell(80, $hl, convertirc($p_facture['libelle']), 1, 0, 'L', false);
$pdf->Cell(20, $hl, convertirc(format_N($p_facture['Quantite'])), 1, 0, 'C', false);
$pdf->Cell(30, $hl, convertirc(format_N($p_facture['MontantRembourse'])), 1, 0, 'R', false);
$pdf->Cell(25, $hl, convertirc(format_N($p_facture['Coutmoyen'])), 1, 0, 'R', false);
$pdf->Cell(20, $hl, convertirc($p_facture['Taux']), 1, 1, 'C', false);
$total_coutmoyen = $total_coutmoyen + $p_facture['Coutmoyen'];
$total_quantite = $total_quantite + $p_facture['Quantite'];
$total_montantrembourse = $total_montantrembourse + $p_facture['MontantRembourse'];
$total_taux = $total_taux + $p_facture['Taux'];
}
$hl=8;
$pdf->SetFont('Arial', 'B', 9);
$pdf->SetFillColor(143, 206, 143);
$pdf->Cell(95, $hl, convertirc(_('TOTAL')), 1, 0, 'C', true);
$pdf->SetFillColor(143, 206, 143);
$pdf->Cell(20, $hl, convertirc(_(format_N($total_quantite))), 1, 0, 'C', true);
$pdf->SetFillColor(143, 206, 143);
$pdf->Cell(30, $hl, convertirc(_(format_N($total_montantrembourse))), 1, 0, 'C', true);
$pdf->SetFillColor(143, 206, 143);
$pdf->Cell(25, $hl, convertirc(_(format_N($total_coutmoyen))), 1, 0, 'C', true);
$pdf->SetFillColor(143, 206, 143);
$pdf->Cell(20, $hl, convertirc(_(convertirc('100 %'))), 1, 1, 'C', true);
$chartX=15;
$chartY=175;
//dimension
$chartWidth=180;
$chartHeight=100;
//padding
$chartTopPadding=12;
$chartLeftPadding=20;
$chartBottomPadding=10;
$chartRightPadding=5;
//chart box
$chartBoxX=$chartX+$chartLeftPadding;
$chartBoxY=$chartY+$chartTopPadding;
$chartBoxWidth=$chartWidth-$chartLeftPadding-$chartRightPadding;
$chartBoxHeight=$chartHeight-$chartBottomPadding-$chartTopPadding;
//bar width
$barWidth=8;
$valeur0=0;
$valeur1=0;
$valeur2=0;
$valeur3=0;
$valeur4=0;
$valeur5=0;
$valeur6=0;
$valeur7=0;
$valeur8=0;
$valeur9=0;
$valeur10=0;
$value=0;
$v=0;
$valeurs=array();
foreach($p_factures as $p_factures['codeGarantie'] => $value)
{
array_push($valeurs,$value['Taux']);
foreach($valeurs as $key =>$valeur)
{
if ($value['codeGarantie'] == 'AUX') {
$valeur1 = $value['Taux'];
}
if ($value['codeGarantie'] == 'BIO') {
$valeur2 = $value['Taux'];
}
if ($value['codeGarantie'] == 'CON') {
$valeur3 = $value['Taux'];
}
if ($value['codeGarantie'] == 'DEN') {
$valeur4 = $value['Taux'];
}
if ($value['codeGarantie'] == 'EXA') {
$valeur5 = $value['Taux'];
}
if ($value['codeGarantie'] == 'HOS') {
$valeur6 = $value['Taux'];
}
if ($value['codeGarantie'] == 'IMA') {
$valeur7 = $value['Taux'];
}
if ($value['codeGarantie'] == 'MAT') {
$valeur8 = $value['Taux'];
}
if ($value['codeGarantie'] == 'OPT') {
$valeur9 = $value['Taux'];
}
if ($value['codeGarantie'] == 'PHA') {
$valeur10 = $value['Taux'];
}
$data=Array(
'AUX'=>[
'color'=>[255,0,0],
'value'=>$valeur1],
'BIO'=>[
'color'=>[255,255,0],
'value'=>$valeur2],
'CON'=>[
'color'=>[50,0,255],
'value'=>$valeur3],
'DEN'=>[
'color'=>[255,0,255],
'value'=>$valeur4],
'EXA'=>[
'color'=>[0,255,0],
'value'=>$valeur5],
'HOS'=>[
'color'=>[200,255,100],
'value'=>$valeur6],
'IMA'=>[
'color'=>[121,248,248],
'value'=>$valeur7],
'MAT'=>[
'color'=>[121,210,180],
'value'=>$valeur8],
'OPT'=>[
'color'=>[221,248,248],
'value'=>$valeur9],
'PHA'=>[
'color'=>[0,100,108],
'value'=>$valeur10]
);
}
}
$dataMax=0;
foreach($data as $item){
if($item['value']>$dataMax)
$dataMax=$item['value'];
}
//data step
if($dataMax>200 and $dataMax<600){
$dataStep=20;
}
if($dataMax<200){
$dataStep=10;
}
if($dataMax>1000){
$dataStep=100;
}
//set font, line width and color
$pdf->SetFont('Arial','',8);
$pdf->SetLineWidth(0.1);
$pdf->SetDrawColor(0);
//chart boundary
$pdf->Rect($chartX,$chartY,$chartWidth,$chartHeight);
//vertical axis line
$pdf->Line(
$chartBoxX ,
$chartBoxY ,
$chartBoxX ,
($chartBoxY+$chartBoxHeight)
);
//horizontal axis line
$pdf->Line(
$chartBoxX-2 ,
($chartBoxY+$chartBoxHeight) ,
$chartBoxX+($chartBoxWidth) ,
($chartBoxY+$chartBoxHeight)
);
///vertical axis
//calculate chart's y axis scale unit
$yAxisUnits=$chartBoxHeight/$dataMax;
//draw the vertical (y) axis labels
for($i=0 ; $i<=$dataMax ; $i+=$dataStep){
//y position
$yAxisPos=$chartBoxY+($yAxisUnits*$i);
//draw y axis line
$pdf->Line(
$chartBoxX-2 ,
$yAxisPos ,
$chartBoxX ,
$yAxisPos
);
//set cell position for y axis labels
$pdf->SetXY($chartBoxX-$chartLeftPadding , $yAxisPos-2);
//$pdf->Cell($chartLeftPadding-4 , 5 , $dataMax-$i , 1);---------------
$pdf->Cell($chartLeftPadding-4 , 5 , $dataMax-$i, 0 , 0 , 'R');
}
///horizontal axis
//set cells position
$pdf->SetXY($chartBoxX , $chartBoxY+$chartBoxHeight);
//cell's width
$xLabelWidth=$chartBoxWidth / count($data);
//$pdf->Cell($xLabelWidth , 5 , $itemName , 1 , 0 , 'C');-------------
//loop horizontal axis and draw the bar
$barXPos=0;
foreach($data as $itemName=>$item){
//print the label
//$pdf->Cell($xLabelWidth , 5 , $itemName , 1 , 0 , 'C');--------------
$pdf->Cell($xLabelWidth , 5 , $itemName , 0 , 0 , 'C');
///drawing the bar
//bar color
$pdf->SetFillColor($item['color'][0],$item['color'][1],$item['color'][2]);
//bar height
$barHeight=$yAxisUnits*$item['value'];
//bar x position
$barX=($xLabelWidth/2)+($xLabelWidth*$barXPos);
$barX=$barX-($barWidth/2);
$barX=$barX+$chartBoxX;
//bar y position
$barY=$chartBoxHeight-$barHeight;
$barY=$barY+$chartBoxY;
//draw the bar
$pdf->Rect($barX,$barY,$barWidth,$barHeight,'DF');
//increase x position (next series)
$barXPos++;
}
//axis labels
$pdf->SetFont('Arial','B',9);
$pdf->SetXY($chartX,$chartY);
$pdf->Cell(30,10,"Taux",0);
$pdf->SetXY(($chartWidth/2)-50+$chartX,$chartY+$chartHeight-($chartBottomPadding/2));
$pdf->Cell(100,5,convertirc(_("Récapitulatif des dépenses par famille d'acte")),0,0,'C');
$pdf->AddPage();// debut fiche 11
$depensesFamillesA = $this->detailsp->etatcomparatifdesdepensesA($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin, $p_limite);
$depensesFamillesB = $this->detailsp->etatcomparatifdesdepensesB($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin, $p_limite);
$pdf->SetMargins(10, 10, 10) ;
$pdf->Image($_SESSION['dossierSociete'].'/Tarifs/Img/newkit5.jpg', 0, 0, 210);
$pdf->SetY(10);
$pdf->SetFont('Helvetica', 'B', 18);
$pdf->SetTextColor( 65, 185, 80 );
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->MultiCell(150, 8, convertirc(_("COMPARATIF DES DÉPENSES DES ANNÉE N-1 ET N")), 0, 'L' );
$pdf->Ln(8);
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->SetTextColor(0);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(50, 6, convertirc(_('PÉRIODE COMPTABLE CONSIDÉRÉE').' : '.dateLang($p_datedebut, $_SESSION['lang']).' '._('AU').' '.dateLang($p_datefin, $_SESSION['lang'])), 0, 1, 'L', false);
$pdf->Ln(9);
if ($p_id!=null){
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('GARANT')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['garant'])), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('SOUSCRIPTEUR')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['souscripteur'])), 0, 1, 'L', false);
//$pdf->Cell(0, 8, convertirc(_('SOUSCRIPTEUR').' : '.$entete['souscripteur']), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('POLICE No')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['numeroPolice'].' / '.$entete['libellePolice'])), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('COURTIER')), 0, 0, 'L', false);
$pdf->Cell(0, 6, 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('Helvetica', 'BUI', 11);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('GARANT')), 0, 0, 'L', false);
$pdf->SetFont('Helvetica', 'BI', 11);
$pdf->Cell(0, 6, convertirc(_(' : '.$p_garant)), 0, 1, 'L', false);
}
$pdf->Ln(2);
$hl=7;
$pdf->SetFont('Arial','BU',10);
$annee = date("Y", strtotime($p_datefin));
$precannee = $annee -1;
$pdf->Cell(95,$hl,convertirc(_('Etat des dépenses de l\'année n-1')),1,0,'C',FALSE);
$pdf->Cell(95,$hl,convertirc(_('Etat des dépenses de l\'année n')),1,1,'C',FALSE);
$pdf->SetFillColor(255,250,205);
$pdf->SetFont('Arial','B',6);
$pdf->Cell(44,$hl,convertirc(_('Famille d\'actes')),1,0,'C',true);
$pdf->Cell(13,$hl,convertirc(_("Nombre")),1,0,'C',true);
$pdf->Cell(14,$hl,convertirc(_("Montant net ")),1,0,'C',true);
$pdf->Cell(13,$hl,convertirc(_("Coût moyen")),1,0,'C',true);
$pdf->Cell(10,$hl,convertirc(_("Taux %")),1,0,'C',true);
$pdf->SetX(106);
$pdf->SetFillColor(0,100,108);
$pdf->SetTextColor(255,255,255);
$pdf->Cell(44,$hl,convertirc(_('Famille d\'actes')),1,0,'C',true);
$pdf->Cell(13,$hl,convertirc(_("Nombre")),1,0,'C',true);
$pdf->Cell(14,$hl,convertirc(_("Montant net ")),1,0,'C',true);
$pdf->Cell(13,$hl,convertirc(_("Coût moyen")),1,0,'C',true);
$pdf->Cell(10,$hl,convertirc(_("Taux %")),1,1,'C',true);
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','',6);
$total_popActive = 0;
$total_popTraite = 0;
$total_quantite = 0;
$total_taux =0;
$total_montantReclame = 0;
$total_montantNonRembourse = 0;
$total_montantRembourse = 0;
$total_coutMoyen = 0;
$total_popActiveA = 0;
$total_popTraiteA = 0;
$total_montantReclameA = 0;
$total_montantNonRembourseA = 0;
$total_montantRembourseA = 0;
$total_coutMoyenA = 0;
$total_tauxA =0;
$total_quantiteA = 0;
foreach ($depensesFamillesA as $depA)
{
$pdf->Cell(44,$hl,convertirc($depA['libelle']),1,0,'L',false);
$pdf->Cell(13,$hl,convertirc($depA['Quantite']),1,0,'C',false);
$pdf->Cell(14,$hl,convertirc(format_N($depA['MontantRembourse'])),1,0,'C',false);
$pdf->Cell(13,$hl,convertirc(format_N($depA['Coutmoyen'])),1,0,'C',false);
$pdf->Cell(10,$hl,convertirc(($depA['Taux'])),1,1,'C',false);
$total_quantiteA = $total_quantiteA + $depA['Quantite'];
$total_montantRembourseA = $total_montantRembourseA + $depA['MontantRembourse'];
$total_coutMoyenA = $total_montantRembourseA / $total_quantiteA;
$total_tauxA = $total_tauxA + $depA['Taux'];
}
$pdf->SetFont('Arial','B',6);
$pdf->SetFillColor(255,250,205);
$pdf->Cell(44,$hl,convertirc("TOTAL GENERAL"),"1",0,'C',true);
$pdf->Cell(13,$hl,format_N($total_quantiteA),1,0,'C',true);
$pdf->Cell(14,$hl,format_N($total_montantRembourseA),1,0,'C',true);
$pdf->Cell(13,$hl,format_N($total_coutMoyenA),1,0,'C',true);
$pdf->Cell(10,$hl,format_N(100),1,0,'C',true);
$pdf->SetY(89);
if ($p_id!=null){
$pdf->SetY(89);
}else{
$pdf->SetY(65);
}
foreach ($depensesFamillesB as $dep)
{
$pdf->SetX(106);
$pdf->Cell(44,$hl,convertirc($dep['libelle']),1,0,'L',false);
$pdf->Cell(13,$hl,convertirc($dep['Quantite']),1,0,'C',false);
$pdf->Cell(14,$hl,convertirc(format_N($dep['MontantRembourse'])),1,0,'C',false);
$pdf->Cell(13,$hl,convertirc(format_N($dep['Coutmoyen'])),1,0,'C',false);
$pdf->Cell(10,$hl,convertirc($dep['Taux']),1,1,'C',false);
$total_quantite = $total_quantite + $dep['Quantite'];
$total_montantRembourse = $total_montantRembourse + $dep['MontantRembourse'];
$total_coutMoyen = $total_montantRembourse / $total_quantite;
$total_taux = $total_taux + $dep['Taux'];
}
$pdf->SetX(106);
$pdf->SetFont('Arial','B',6);
$pdf->SetFillColor(0,100,108);
$pdf->SetTextColor(255,255,255);
$pdf->Cell(44,$hl,convertirc("TOTAL GENERAL"),"1",0,'C',true);
$pdf->Cell(13,$hl,format_N($total_quantite),1,0,'C',true);
$pdf->Cell(14,$hl,format_N($total_montantRembourse),1,0,'C',true);
$pdf->Cell(13,$hl,format_N($total_coutMoyen),1,0,'C',true);
$pdf->Cell(10,$hl,format_N(100),1,1,'C',true);
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','BU',10);
$pdf->SetY(175);
$pdf->SetX(50);
$pdf->Cell(120,8,convertirc(_('Comparaison des dépenses de l\'année n-1 et l\'année n ')),1,1,'C',false);
$chartX=15;
$chartY=175;
//dimension
$chartWidth=180;
$chartHeight=100;
//padding
$chartTopPadding=12;
$chartLeftPadding=20;
$chartBottomPadding=10;
$chartRightPadding=5;
//chart box
$chartBoxX=$chartX+$chartLeftPadding;
$chartBoxY=$chartY+$chartTopPadding;
$chartBoxWidth=$chartWidth-$chartLeftPadding-$chartRightPadding;
$chartBoxHeight=$chartHeight-$chartBottomPadding-$chartTopPadding;
//bar width
$barWidth=5;
$barWidth1=5;
$valeur0=0;
$valeur1=0;
$valeur2=0;
$valeur3=0;
$valeur4=0;
$valeur5=0;
$valeur6=0;
$valeur7=0;
$valeur8=0;
$valeur9=0;
$value=0;
$v=0;
$valeur0A=0;
$valeur1A=0;
$valeur2A=0;
$valeur3A=0;
$valeur4A=0;
$valeur5A=0;
$valeur6A=0;
$valeur7A=0;
$valeur8A=0;
$valeur9A=0;
$value1=0;
$v=0;
$valeurs=array();
$valeurs1=array();
foreach($depensesFamillesA as $depensesFamillesA['codeGarantie'] => $value1)
{
array_push($valeurs1,$value1['Taux']);
foreach($valeurs1 as $key =>$valeurA)
{
if ($value1['codeGarantie'] == 'AUX') {
$valeur1A = $value1['Taux'];
}
if ($value1['codeGarantie'] == 'BIO') {
$valeur2A = $value1['Taux'];
}
if ($value1['codeGarantie'] == 'CON') {
$valeur3A = $value1['Taux'];
}
if ($value1['codeGarantie'] == 'DEN') {
$valeur4A = $value1['Taux'];
}
if ($value1['codeGarantie'] == 'EXA') {
$valeur5A = $value1['Taux'];
}
if ($value1['codeGarantie'] == 'HOS') {
$valeur6A = $value1['Taux'];
}
if ($value1['codeGarantie'] == 'IMA') {
$valeur7A = $value1['Taux'];
}
if ($value1['codeGarantie'] == 'MAT') {
$valeur8A = $value1['Taux'];
}
if ($value1['codeGarantie'] == 'OPT') {
$valeur9A = $value1['Taux'];
}
if ($value1['codeGarantie'] == 'PHA') {
$valeur10A = $value1['Taux'];
}
$data1=Array(
'AUX'=>[
'color'=>[255,250,205],
'value'=>$valeur1A],
'BIO'=>[
'color'=>[255,250,205],
'value'=>$valeur2A],
'CON'=>[
'color'=>[255,250,205],
'value'=>$valeur3A],
'DEN'=>[
'color'=>[255,250,205],
'value'=>$valeur4A],
'EXA'=>[
'color'=>[255,250,205],
'value'=>$valeur5A],
'HOS'=>[
'color'=>[255,250,205],
'value'=>$valeur6A],
'IMA'=>[
'color'=>[255,250,205],
'value'=>$valeur7A],
'MAT'=>[
'color'=>[255,250,205],
'value'=>$valeur8A],
'OPT'=>[
'color'=>[255,250,205],
'value'=>$valeur9A],
'PHA'=>[
'color'=>[255,250,205],
'value'=>$valeur10A]
);
}
}
foreach($depensesFamillesB as $depensesFamillesB['codeGarantie'] => $value)
{
array_push($valeurs,$value['Taux']);
foreach($valeurs as $key =>$valeur)
{
if ($value['codeGarantie'] == 'AUX') {
$valeur1 = $value['Taux'];
}
if ($value['codeGarantie'] == 'BIO') {
$valeur2 = $value['Taux'];
}
if ($value['codeGarantie'] == 'CON') {
$valeur3 = $value['Taux'];
}
if ($value['codeGarantie'] == 'DEN') {
$valeur4 = $value['Taux'];
}
if ($value['codeGarantie'] == 'EXA') {
$valeur5 = $value['Taux'];
}
if ($value['codeGarantie'] == 'HOS') {
$valeur6 = $value['Taux'];
}
if ($value['codeGarantie'] == 'IMA') {
$valeur7 = $value['Taux'];
}
if ($value['codeGarantie'] == 'MAT') {
$valeur8 = $value['Taux'];
}
if ($value['codeGarantie'] == 'OPT') {
$valeur9 = $value['Taux'];
}
if ($value['codeGarantie'] == 'PHA') {
$valeur10 = $value['Taux'];
}
$data=Array(
'AUX'=>[
'color'=>[0,100,108],
'value'=>$valeur1],
'BIO'=>[
'color'=>[0,100,108],
'value'=>$valeur2],
'CON'=>[
'color'=>[0,100,108],
'value'=>$valeur3],
'DEN'=>[
'color'=>[0,100,108],
'value'=>$valeur4],
'EXA'=>[
'color'=>[0,100,108],
'value'=>$valeur5],
'HOS'=>[
'color'=>[0,100,108],
'value'=>$valeur6],
'IMA'=>[
'color'=>[0,100,108],
'value'=>$valeur7],
'MAT'=>[
'color'=>[0,100,108],
'value'=>$valeur8],
'OPT'=>[
'color'=>[0,100,108],
'value'=>$valeur9],
'PHA'=>[
'color'=>[0,100,108],
'value'=>$valeur10]
);
}
}
//$dataMax
$dataMax1=0;
foreach($data1 as $item1)
{
if($item1['value']>$dataMax1)
$dataMax1=$item1['value'];
}
//data step
if($dataMax1>200 and $dataMax1<600)
{
$dataStep1=20;
}
if($dataMax1<200){
$dataStep1=10;
}
if($dataMax1>1000){
$dataStep1=100;
}
$dataMax=0;
foreach($data as $item)
{
if($item['value']>$dataMax)
$dataMax=$item['value'];
}
//data step
if($dataMax>200 and $dataMax<600)
{
$dataStep=20;
}
if($dataMax<200){
$dataStep=10;
}
if($dataMax>1000){
$dataStep=100;
}
//set font, line width and color
$pdf->SetFont('Arial','',8);
$pdf->SetLineWidth(0.1);
$pdf->SetDrawColor(0);
//chart boundary
$pdf->Rect($chartX,$chartY,$chartWidth,$chartHeight);
//vertical axis line
$pdf->Line(
$chartBoxX ,
$chartBoxY ,
$chartBoxX ,
($chartBoxY+$chartBoxHeight)
);
//horizontal axis line
$pdf->Line(
$chartBoxX-2 ,
($chartBoxY+$chartBoxHeight) ,
$chartBoxX+($chartBoxWidth) ,
($chartBoxY+$chartBoxHeight)
);
///vertical axis
//calculate chart's y axis scale unit
$yAxisUnits=$chartBoxHeight/$dataMax;
$yAxisUnits1=$chartBoxHeight/$dataMax1;
//draw the vertical (y) axis labels
for($i=0 ; $i<=$dataMax1 ; $i+=$dataStep1)
{
//y position
$yAxisPos1=$chartBoxY+($yAxisUnits1*$i);
//draw y axis line
$pdf->Line(
$chartBoxX-2 ,
$yAxisPos1 ,
$chartBoxX ,
$yAxisPos1
);
//set cell position for y axis labels
$pdf->SetTextColor(255,250,205);
$pdf->SetXY($chartBoxX-$chartLeftPadding , $yAxisPos1-2);
//$pdf->Cell($chartLeftPadding-4 , 5 , $dataMax-$i , 1);---------------
$pdf->Cell($chartLeftPadding-4 , 5 , $dataMax1-$i, 0 , 0 , 'L');
}
for($i=0 ; $i<=$dataMax ; $i+=$dataStep)
{
//y position
$yAxisPos=$chartBoxY+($yAxisUnits*$i);
//draw y axis line
$pdf->Line(
$chartBoxX-2 ,
$yAxisPos ,
$chartBoxX ,
$yAxisPos
);
//set cell position for y axis labels
$pdf->SetXY($chartBoxX-$chartLeftPadding , $yAxisPos-2);
//$pdf->Cell($chartLeftPadding-4 , 5 , $dataMax-$i , 1);---------------
$pdf->SetTextColor(0,100,108);
$pdf->Cell($chartLeftPadding-2 , 5 , $dataMax-$i, 0 , 0 , 'R');
$pdf->SetTextColor(0);
}
///horizontal axis
//set cells position
$pdf->SetXY($chartBoxX , $chartBoxY+$chartBoxHeight);
//cell's width
$xLabelWidth=$chartBoxWidth / count($data);
//$pdf->Cell($xLabelWidth , 5 , $itemName , 1 , 0 , 'C');-------------
//loop horizontal axis and draw the bar
$barXPos1=0;
foreach($data1 as $itemName1=>$item1)
{
//print the label
//$pdf->Cell($xLabelWidth , 5 , $itemName , 1 , 0 , 'C');--------------
//$pdf->Cell($xLabelWidth , 5 , $itemName , 0 , 0 , 'C');
///drawing the bar
//bar color
$pdf->SetFillColor($item1['color'][0],$item1['color'][1],$item1['color'][2]);
//bar height
$barHeight=$yAxisUnits1*$item1['value'];
//bar x position
$barX1=($xLabelWidth/2)+($xLabelWidth*$barXPos1);
$barX1=$barX1-($barWidth/2);
$barX1=$barX1+$chartBoxX;
//bar y position
$barY1=$chartBoxHeight-$barHeight;
$barY1=$barY1+$chartBoxY;
//draw the bar
$pdf->Rect($barX1,$barY1,$barWidth,$barHeight,'DF');
//increase x position (next series)
$barXPos1++;
}
$barXPos=0;
//highlight_string("<?php\n\$datas =\n" . var_export($data1 , true) . ";\n>");
foreach($data as $itemName=>$item)
{
//print the label
//$pdf->Cell($xLabelWidth , 5 , $itemName , 1 , 0 , 'C');--------------
$pdf->Cell($xLabelWidth , 5 , $itemName , 0 , 0 , 'C');
///drawing the bar
//bar color
$pdf->SetFillColor($item['color'][0],$item['color'][1],$item['color'][2]);
//bar height
$barHeight=$yAxisUnits*$item['value'];
//bar x position
$barX=($xLabelWidth/2)+($xLabelWidth*$barXPos);
$barX=$barX-($barWidth/2);
$barX=$barX+$chartBoxX+5;
//bar y position
$barY=$chartBoxHeight-$barHeight;
$barY=$barY+$chartBoxY;
//draw the bar
$pdf->Rect($barX,$barY,$barWidth,$barHeight,'DF');
//increase x position (next series)
$barXPos++;
}
//axis labels
$pdf->SetFont('Arial','B',9);
$pdf->SetXY($chartX,$chartY);
$pdf->Cell(30,10,"Taux",0);
$pdf->SetXY(($chartWidth/2)-50+$chartX,$chartY+$chartHeight-($chartBottomPadding/2));
$pdf->SetXY(($chartWidth/2)-50+$chartX,$chartY+$chartHeight-($chartBottomPadding/2));
$pdf->AddPage('L'); //DEBUT FT 13
$p_factures = $this->detailsp->depensesparfamilledactesetparprestataires($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin,$p_limite);
$pdf->SetMargins(10, 10, 10) ;
$pdf->Image($_SESSION['dossierSociete'].'/Tarifs/Img/newkit4.jpg', 0, 0, 297);
$pdf->SetY(15);
$pdf->SetFont('Helvetica', 'B', 18);
$pdf->SetTextColor( 65, 185, 80 );
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->MultiCell(150, 8, convertirc(_("DÉPENSES PAR FAMILLE D'ACTES ET PAR PRESTATAIRES")), 0, 'L' );
$pdf->Ln(8);
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->SetTextColor(0);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(50, 6, convertirc(_('PÉRIODE COMPTABLE CONSIDÉRÉE').' : '.dateLang($p_datedebut, $_SESSION['lang']).' '._('AU').' '.dateLang($p_datefin, $_SESSION['lang'])), 0, 1, 'L', false);
$pdf->Ln(10);
if ($p_id!=null){
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('GARANT')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['garant'])), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('SOUSCRIPTEUR')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['souscripteur'])), 0, 1, 'L', false);
//$pdf->Cell(0, 8, convertirc(_('SOUSCRIPTEUR').' : '.$entete['souscripteur']), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('POLICE No')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['numeroPolice'].' / '.$entete['libellePolice'])), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('COURTIER')), 0, 0, 'L', false);
$pdf->Cell(0, 6, 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('Helvetica', 'BUI', 11);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('GARANT')), 0, 0, 'L', false);
$pdf->SetFont('Helvetica', 'BI', 11);
$pdf->Cell(0, 6, convertirc(_(' : '.$p_garant)), 0, 1, 'L', false);
}
$pdf->Ln(10);
$pdf->Ln(4);
$pdf->SetX(65);
$pdf->Cell(170,6,convertirc(_('DÉPENSES SUPERIEURES A').' : '.format_N($depenses).' '.$_SESSION['devise_C']),1,1,'C',false);
$pdf->Ln(2);
$hl=7;
$pdf->SetFont('Arial','B',6);
$pdf->SetFillColor(143,206,143);
$pdf->Cell(62,$hl,convertirc(_("Prestataire")),1,0,'C',true);
$pdf->Cell(15,$hl,convertirc(_('Consultation')),1,0,'C',true);
$pdf->Cell(16,$hl,convertirc(_("Imagerie")),1,0,'C',true);
$pdf->Cell(16,$hl,convertirc(_("Biologie")),1,0,'C',true);
$pdf->Cell(15,$hl,convertirc(_("Dentisterie")),1,0,'C',true);
$pdf->Cell(15,$hl,convertirc(_("Optique")),1,0,'C',true);
$pdf->Cell(15,$hl,convertirc(_("Hospitalisation")),1,0,'C',true);
$pdf->Cell(15,$hl,convertirc(_("Pharmacie")),1,0,'C',true);
$pdf->Cell(16,$hl,convertirc(_("Maternité")),1,0,'C',true);
$pdf->Cell(15,$hl,convertirc(_("# Autres.")),1,0,'C',true);
$pdf->Cell(16,$hl,convertirc(_("# Aux Med.")),1,0,'C',true);
$pdf->Cell(16,$hl,convertirc(_("Assistance")),1,0,'C',true);
$pdf->Cell(16,$hl,convertirc(_("# Trans Med.")),1,0,'C',true);
$pdf->Cell(15,$hl,convertirc(_("# Bilan.")),1,0,'C',true);
$pdf->Cell(15,$hl,convertirc(_("Totaux")),1,1,'C',true);
$total_CONSULTATION =
$total_IMAGERIE =
$total_BIOLOGIE =
$total_DENTISTERIE =
$total_OPTIQUE =
$total_HOSPITALISATION =
$total_PHARMACIE =
$total_MATERNITE =
$total_AUTRES_EXAMENS =
$total_AUXILIAIRES_MEDICAUX =
$total_ASSISTANCE =
$total_TRANSPORT_MEDICALISE =
$total_BILAN_DE_SANTE =
$total_TOTAUX = 0;
$pdf->SetFont('Arial','',6);
foreach ($p_factures as $dep)
{
$pdf->Cell(62,$hl,convertirc(substr($dep['Prestataire'],1,47)),1,0,'L',false);
$pdf->Cell(15,$hl,convertirc(format_N($dep['CONSULTATION'])),1,0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['IMAGERIE'])),1,0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['BIOLOGIE'])),1,0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($dep['DENTISTERIE'])),1,0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($dep['OPTIQUE'])),1,0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($dep['HOSPITALISATION'])),1,0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($dep['PHARMACIE'])),1,0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['MATERNITE'])),1,0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($dep['AUTRES EXAMENS'])),1,0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['AUXILIAIRES MEDICAUX'])),1,0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['ASSISTANCE'])),1,0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['TRANSPORT MEDICALISE'])),1,0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($dep['BILAN DE SANTE'])),1,0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($dep['TOTAUX'])),1,1,'C',false);
$total_CONSULTATION = $total_CONSULTATION + $dep['CONSULTATION'];
$total_IMAGERIE = $total_IMAGERIE + $dep['IMAGERIE'];
$total_BIOLOGIE = $total_BIOLOGIE + $dep['BIOLOGIE'];
$total_DENTISTERIE = $total_DENTISTERIE + $dep['DENTISTERIE'];
$total_OPTIQUE = $total_OPTIQUE + $dep['OPTIQUE'];
$total_HOSPITALISATION = $total_HOSPITALISATION + $dep['HOSPITALISATION'];
$total_PHARMACIE = $total_PHARMACIE + $dep['PHARMACIE'];
$total_MATERNITE = $total_MATERNITE + $dep['MATERNITE'];
$total_AUTRES_EXAMENS = $total_AUTRES_EXAMENS + $dep['AUTRES EXAMENS'];
$total_AUXILIAIRES_MEDICAUX = $total_AUXILIAIRES_MEDICAUX + $dep['AUXILIAIRES MEDICAUX'];
$total_ASSISTANCE = $total_ASSISTANCE + $dep['ASSISTANCE'];
$total_TRANSPORT_MEDICALISE = $total_TRANSPORT_MEDICALISE + $dep['TRANSPORT MEDICALISE'];
$total_BILAN_DE_SANTE = $total_BILAN_DE_SANTE + $dep['BILAN DE SANTE'];
$total_TOTAUX = $total_TOTAUX + $dep['TOTAUX'];
}
$pdf->SetFont('Arial','B',8);
$pdf->SetFillColor(143,206,143);
$pdf->Cell(62,$hl,convertirc("TOTAL GENERAL"),"1",0,'C',true);
$pdf->Cell(15,$hl,format_N($total_CONSULTATION),1,0,'C',true);
$pdf->Cell(16,$hl,format_N($total_IMAGERIE),1,0,'C',true);
$pdf->Cell(16,$hl,format_N($total_BIOLOGIE),1,0,'C',true);
$pdf->Cell(15,$hl,format_N($total_DENTISTERIE),1,0,'C',true);
$pdf->Cell(15,$hl,format_N($total_OPTIQUE),1,0,'C',true);
$pdf->Cell(15,$hl,format_N($total_HOSPITALISATION),1,0,'C',true);
$pdf->Cell(15,$hl,format_N($total_PHARMACIE),1,0,'C',true);
$pdf->Cell(16,$hl,format_N($total_MATERNITE),1,0,'C',true);
$pdf->Cell(15,$hl,format_N($total_AUTRES_EXAMENS),1,0,'C',true);
$pdf->Cell(16,$hl,format_N($total_AUXILIAIRES_MEDICAUX),1,0,'C',true);
$pdf->Cell(16,$hl,format_N($total_ASSISTANCE),1,0,'C',true);
$pdf->Cell(16,$hl,format_N($total_TRANSPORT_MEDICALISE),1,0,'C',true);
$pdf->Cell(15,$hl,format_N($total_BILAN_DE_SANTE),1,0,'C',true);
$pdf->Cell(15,$hl,format_N($total_TOTAUX),1,1,'C',true);
$pdf->Cell(45,$hl,convertirc(_("Légende")),0,0,'L',false);
$pdf->Ln(8);
$pdf->Cell(45,$hl,convertirc(_("Autres. = Autres Examens")),0,0,'L',false);
$pdf->Ln(5);
$pdf->Cell(45,$hl,convertirc(_("Aux Med. = Auxiliaire Médicaux")),0,0,'L',false);
$pdf->Ln(5);
$pdf->Cell(45,$hl,convertirc(_("Trans Med. = Transport Medicalisé")),0,0,'L',false);
$pdf->Ln(5);
$pdf->Cell(45,$hl,convertirc(_("Bilan. = Bilan de santé")),0,0,'L',false);
$pdf->Ln(2);
$pdf->AddPage();
$pdf->Image($_SESSION['dossierSociete'].'/Tarifs/Img/newkit9.jpg', 0, 0, 210);
$fichier="Temp/TMP_KIT_STATISTIQUES_FAMILLE"."_".$famille.".pdf";
if(is_file($fichier)){
$fichier="Temp/TMP_KIT_STATISTIQUES_FAMILLE"."_".$famille."_".uniqid().".pdf";
}
$pdf->Output($fichier,"F");
return($fichier);
}
function statsparticulier($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin,$depenses,$chargeravantapres ){
$entete = $this->detailsp->detailrapportspperiodepdfentete_new($p_id, $p_datedebut, $p_datefin);
$infocollege = $this->college->getCollegepoliceId($idCollege);
$tableaudajustements = $this->detailsp->gettableauAjustementGarant($codeGcAssureur);
$infosDuGarant = $this->police_societe->getInfosGarant($codeGcAssureur);
$pdf = new FPDF1();
$pdf->AliasNbPages();
$pdf->AddPage(); // debut page de garde
$pdf->SetMargins(10, 10, 10) ;
$pdf->Image($_SESSION['dossierSociete'].'/Tarifs/Img/newkit1.jpg', 0, 0, 210);
$pdf->SetY(75);
$pdf->SetFont('Helvetica', 'B', 36);
$pdf->SetTextColor( 37, 36, 97 );
$pdf->Cell(0, 6, convertirc(_('STATISTIQUES MALADIE')), 0, 1, 'C', false);
$pdf->SetY(240);
$pdf->SetFont('Times', 'BI', 13);
$pdf->SetTextColor( 0, 0, 0 );
$pdf->Cell(0, 6, convertirc(_('PÉRIODE CONSIDÉRÉE').' : '.dateLang($p_datedebut, $_SESSION['lang']).' '._('AU').' '.dateLang($p_datefin, $_SESSION['lang'])), 0, 1, 'C', false);
$pdf->Ln(10);
$pdf->SetTextColor( 37, 36, 97 );
if ($p_id!=null){
$pdf->SetFont('Helvetica', 'BI', 12);
$pdf->Cell(75, 5, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(22, 5, convertirc(_('GARANT :')), 0, 0, 'L', false);
$pdf->MultiCell(115, 5, convertirc(_($entete['garant'])), 0, 'L');
$pdf->Ln(2);
$pdf->Cell(75, 5, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(38, 5, convertirc(_('SOUSCRIPTEUR :')), 0, 0, 'L', false);
$pdf->MultiCell(115, 5, convertirc(_($entete['souscripteur'])), 0, 'L');
$pdf->Ln(2);
$pdf->Cell(75, 5, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(21, 5, convertirc(_('POLICE :')), 0, 0, 'L', false);
$pdf->MultiCell(115, 5, convertirc(_($entete['libellePolice'])), 0, 'L');
}else{
$pdf->SetFont('Times', 'BI', 16);
$pdf->Cell(100, 5, convertirc(_('GARANT :')), 0, 0, 'L', false);
$pdf->SetFont('Times', 'BI', 14);
$pdf->MultiCell(115, 5, convertirc(_($infosDuGarant['libelle'])), 0, 'L' );
$pdf->Ln(40);
}
$pdf->AddPage(); // SOMMAIRE
$pdf->SetMargins(10, 10, 10) ;
$pdf->Image($_SESSION['dossierSociete'].'/Tarifs/Img/newkit2.jpg', 0, 0, 210);
$pdf->Ln(10);
$pdf->SetTextColor(255, 255, 255);
$pdf->SetFont('Arial', 'B', 24);
$pdf->Cell(34,12,convertirc(''),0,0,'C',false);
$pdf->Cell(100,12,convertirc(_("SOMMAIRE")),0,0,'C',false);
$pdf->Ln(20);
$pdf->SetFont('Helvetica', 'B', 9);
$pdf->Cell(10,0,convertirc(''),0,0,'C',false);
$pdf->Cell(34,0,convertirc(_("DONNÉES ÉLEMENTAIRES")),0,0,'L',false);
$pdf->Cell(140,0,convertirc(''),0,0,'L',false);
$pdf->Ln(8);
$pdf->Cell(10,0,convertirc(''),0,0,'C',false);
$pdf->Cell(34,0,convertirc(_("MOUVEMENTS D'EFFECTIFS PAR COLLEGE")),0,0,'L',false);
$pdf->Cell(140,0,convertirc(''),0,0,'L',false);
$pdf->Ln(8);
$pdf->Cell(10,0,convertirc(''),0,0,'C',false);
$pdf->Cell(34,0,convertirc(_("DÉPENSES PAR FAMILLES ET PAR COLLEGE")),0,0,'L',false);
$pdf->Cell(140,0,convertirc(''),0,0,'L',false);
$pdf->Ln(8);
$pdf->Cell(10,0,convertirc(''),0,0,'C',false);
$pdf->Cell(34,0,convertirc(_("RÉCAPITULATIF DES DÉPENSES PAR STATUT DE BÉNÉFICIAIRES")),0,0,'L',false);
$pdf->Cell(140,0,convertirc(''),0,0,'L',false);
$pdf->Ln(8);
$pdf->Cell(10,0,convertirc(''),0,0,'C',false);
$pdf->Cell(34,0,convertirc(_("ÉVOLUTION MENSUELLE DES DÉPENSES")),0,0,'L',false);
$pdf->Cell(140,0,convertirc(''),0,0,'L',false);
$pdf->Ln(8);
$pdf->Cell(10,0,convertirc(''),0,0,'C',false);
$pdf->Cell(34,0,convertirc(_("RÉCAPITULATIF DES DÉPENSES PAR FAMILLE DACTES MÉDICAUX")),0,0,'L',false);
$pdf->Cell(140,0,convertirc(''),0,1,'L',false);
$pdf->Ln(8);
$pdf->Cell(10,0,convertirc(''),0,0,'C',false);
$pdf->Cell(36,0,convertirc(_("COMPARATIF DES DÉPENSES DES ANNÉES N-1 ET N")),0,0,'L',false);
$pdf->Cell(140,0,convertirc(''),0,1,'L',false);
$pdf->Ln(8);
$pdf->Cell(10,0,convertirc(''),0,0,'C',false);
$pdf->Cell(36,0,convertirc(_("DÉPENSES PAR FAMILLE DACTES ET PAR PRESTATAIRES")),0,0,'L',false);
$pdf->Cell(140,0,convertirc(''),0,0,'L',false);
$pdf->AddPage(); //
$pdf->Cell(0,8,convertirc(_("FICHE DE SUIVI")),0,1,'C',TRUE);
$pdf->Ln(8);
$h=5;
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('Times', 'BI', 9);
$pdf->Cell(75,$h,convertirc(_("PERIODE")),1,0,'L',false);
$pdf->Cell(115,$h,convertirc(dateLang($p_datedebut, $_SESSION['lang']).' '._('AU').' '.dateLang($p_datefin, $_SESSION['lang'])),1,1,'L',false);
$beneficiaires = $this->detailsp->getficheSuivie1($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin);
$agemoyens = $this->detailsp->getficheSuivie2($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin);
$tranchesages = $this->detailsp->getficheSuivie3($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin);
$topactes = $this->detailsp->getficheSuivie4($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin);
$topprestataires = $this->detailsp->getficheSuivie5($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin);
$topaffections = $this->detailsp->getficheSuivie6($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin);
$sinistrialites = $this->detailsp->getficheSuivie7($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin,$Chargement,$chargeravantapres);
$nombreBeneficiaire = 0;
foreach($beneficiaires as $keybenf=>$beneficiaire){
if($keybenf == 0){
$nombreTraiteA= $beneficiaire['Nombretraite'];
$DepensesA= $beneficiaire['Depenses'];
$taux_DepenseA= $beneficiaire['Taux_Depense'];
$coutMoyenA= $beneficiaire['CoutMoyen'];
}elseif($keybenf == 1){
$nombreTraiteC= $beneficiaire['Nombretraite'];
$DepensesC= $beneficiaire['Depenses'];
$taux_DepenseC= $beneficiaire['Taux_Depense'];
$coutMoyenC= $beneficiaire['CoutMoyen'];
}
elseif($keybenf == 2){
$nombreTraiteE= $beneficiaire['Nombretraite'];
$DepensesE= $beneficiaire['Depenses'];
$taux_DepenseE= $beneficiaire['Taux_Depense'];
$coutMoyenE= $beneficiaire['CoutMoyen'];
}
$nombreBeneficiaire = $nombreBeneficiaire+ $beneficiaire['Nombre'];
}
$coutMoyens = max(array($coutMoyenA,$coutMoyenC,$coutMoyenE));
if( $coutMoyens=$coutMoyenA){
$libelle = "Adhérent(e)s";
}elseif( $coutMoyens== $coutMoyenC){
$libelle = "Conjoint(e)s";
}
elseif( $coutMoyens == $coutMoyenE){
$libelle = "Enfants";
}
foreach($agemoyens as $keyage=>$agemoyen){
if($keyage == 0){
$Age_MoyenA= $agemoyen['Age_Moyen'];
}elseif($keyage == 1){
$Age_MoyenC= $agemoyen['Age_Moyen'];
}
elseif($keyage == 3){
$Age_MoyenE= $agemoyen['Age_Moyen'];
}
}
foreach($tranchesages as $keytranche=>$tranchesage){
if($keytranche == 0){
$Depenses1= $tranchesage['Depense_Tranche'];
$taux_Depense1= $tranchesage['Taux_Depense'];
$coutMoyen1= $beneficiaire['CoutMoyen'];
}elseif($keytranche == 1){
$Depenses2= $tranchesage['Depense_Tranche'];
$taux_Depense2= $tranchesage['Taux_Depense'];
$coutMoyen2= $beneficiaire['CoutMoyen'];
}
elseif($keytranche == 2){
$Depenses3= $tranchesage['Depense_Tranche'];
$taux_Depense3= $tranchesage['Taux_Depense'];
$coutMoyen3= $beneficiaire['CoutMoyen'];
}
elseif($keytranche == 3){
$Depenses4= $tranchesage['Depense_Tranche'];
$taux_Depense4= $tranchesage['Taux_Depense'];
$coutMoyen4= $beneficiaire['CoutMoyen'];
}
elseif($keytranche == 4){
$Depenses4= $tranchesage['Depense_Tranche'];
$taux_Depense4= $tranchesage['Taux_Depense'];
$coutMoyen4= $beneficiaire['CoutMoyen'];
}
}
$pdf->Cell(75,$h,convertirc(_("BENEFICIAIRES")),1,0,'L',false);
$pdf->Cell(115,$h,convertirc(format_N($nombreBeneficiaire)),1,1,'L',false);
$pdf->Cell(75,$h,convertirc(''),"LTR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_("Adhérent(e)s : ".format_N($nombreTraiteA))),"LTR",1,'L',false);
$pdf->Cell(75,$h,convertirc(_("BENEFICIAIRES TRAITES")),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_("Conjoint(e)s : ".format_N($nombreTraiteC))),"LR",1,'L',false);
$pdf->Cell(75,$h,convertirc(''),"LBR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_("Enfants : ".format_N($nombreTraiteE))),"LBR",1,'L',false);
$pdf->Cell(75,$h,convertirc(''),"LTR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_("Adhérent(e)s : ".format_N($Age_MoyenA)." ans")),"LTR",1,'L',false);
$pdf->Cell(75,$h,convertirc(_("AGE MOYEN DE LA POPULATION")),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_("Conjoint(e)s : ".format_N($Age_MoyenC)." ans")),"LR",1,'L',false);
$pdf->Cell(75,$h,convertirc(''),"LBR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_("Enfants : ".format_N($Age_MoyenE)." ans")),"LBR",1,'L',false);
$pdf->Cell(75,$h,convertirc(''),"LTR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_("Adhérent(e)s : ".format_N($DepensesA)." ".$_SESSION['devise_C']." soit ".$taux_DepenseA." %")),"LTR",1,'L',false);
$pdf->Cell(75,$h,convertirc(_("SINISTRIALITE PAR STATUT DE BENEFICIAIRE")),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_("Conjoint(e)s : ".format_N($DepensesC)." ".$_SESSION['devise_C']." soit ".$taux_DepenseC." %")),"LR",1,'L',false);
$pdf->Cell(75,$h,convertirc(''),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_("Enfants : ".format_N($DepensesE)." ".$_SESSION['devise_C']." soit ".$taux_DepenseE." %")),"LR",1,'L',false);
$pdf->Cell(75,$h,convertirc(''),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_("On observe un coût moyen plus élevé chez les ".$libelle." ".format_N($coutMoyens)." ".$_SESSION['devise_C'])),"LR",1,'L',false);
$pdf->Cell(75,$h,convertirc(''),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc(''),"LR",1,'L',false);
$keytop=0;
foreach($topactes as $keytop=>$topacte){
if($keytop == 0){
$pdf->Cell(75,$h,convertirc(_("TOP DES ACTES")),"LTR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_($topacte['libelle']." : "." ".format_N($topacte['MontantRembourse'])." ".$_SESSION['devise_C']." soit ".$topacte['Taux']." %")),"LTR",1,'L',false);
}else{
$pdf->Cell(75,$h,convertirc(''),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_($topacte['libelle']." : "." ".format_N($topacte['MontantRembourse'])." ".$_SESSION['devise_C']." soit ".$topacte['Taux']." %")),"LR",1,'L',false);
}
}
$pdf->Cell(75,$h,convertirc(''),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc(''),"LR",1,'L',false);
foreach($topprestataires as $keytop1=>$topprestataire){
if($keytop1 == 0){
$pdf->Cell(75,$h,convertirc(_("TOP DES PRESTATAIRES")),"LTR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_($topprestataire['Prestataire']." :"." ".format_N($topprestataire['montantApayer'])." ".$_SESSION['devise_C'])),"LTR",1,'L',false);
}else{
$pdf->Cell(75,$h,convertirc(''),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_($topprestataire['Prestataire'].": "." ".format_N($topprestataire['montantApayer'])." ".$_SESSION['devise_C'])),"LR",1,'L',false);
}
}
$pdf->Cell(75,$h,convertirc(''),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc(''),"LR",1,'L',false);
foreach($topaffections as $keytop2=>$topaffection){
if($keytop2 == 0){
$pdf->Cell(75,$h,convertirc(_("TOP DES AFFECTIONS")),"LTR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_($topaffection['affection']." : "." ".format_N($topaffection['apresDecompte'])." ".$_SESSION['devise_C']." soit ".$topaffection['Taux']." %")),"LTR",1,'L',false);
}else{
$pdf->Cell(75,$h,convertirc(''),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_($topaffection['affection']." : "." ".format_N($topaffection['apresDecompte'])." ".$_SESSION['devise_C']." soit ".$topaffection['Taux']." %")),"LR",1,'L',false);
}
}
$pdf->Cell(75,$h,convertirc(''),"LTR",0,'L',false);
$pdf->Cell(115,$h,convertirc(''),"LTR",1,'L',false);
$pdf->Cell(75,$h,convertirc(_("SINISTRIALITÉ")),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_("PROVISION MOYENNE : ".format_N($sinistrialites['PROVISION'])." ".$_SESSION['devise_C'])),"LR",1,'L',false);
$pdf->Cell(75,$h,convertirc(''),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_("SINISTRIALITÉ MOYENNE : ".format_N($sinistrialites['SINISTRES'])." ".$_SESSION['devise_C'])),"LR",1,'L',false);
$pdf->Cell(75,$h,convertirc(''),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_("ÉCART : ".format_N($sinistrialites['ECART'])." ".$_SESSION['devise_C'])),"LR",1,'L',false);
// tableau d'ajustement
$pdf->Cell(75,$h,convertirc(''),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc(''),"LR",1,'L',false);
foreach($tableaudajustements as $keytop3=>$tableaudajustement){
if($tableaudajustement['codeGcAssureur'] ==$entete['codeGcAssureur'] ){
$ajustement = $tableaudajustement['tauxAjustement']>0.00 ? ' Majoration ' : ' Minoration ';
if($tableaudajustement['spMin']<= $sinistrialites['RAPPRSP'] && $tableaudajustement['spMax']>= $sinistrialites['RAPPRSP'] ){
$pdf->SetFont('Times', 'BI', 11);
$pdf->SetTextColor(255, 0, 0);
$conclusion = $ajustement==" Majoration " ? "La tendance est ascendante par conséquent la police sera majorée au renouvelement." : "La tendance est constante par conséquent la police ne sera pas majorée au renouvelement." ;
}else{
$pdf->SetFont('Times', 'BI', 9);
$pdf->SetTextColor(0, 0, 0);
}
if($keytop3 == 0){
$pdf->Cell(75,$h,convertirc(_("Tableau d'ajustement")),"LTR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_( "de ".$tableaudajustement['spMin']." à ".$tableaudajustement['spMax'].$ajustement.$tableaudajustement['tauxAjustement'] )),"LTR",1,'L',false);
}else{
$pdf->Cell(75,$h,convertirc(''),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc(_("de ".$tableaudajustement['spMin']." à ".$tableaudajustement['spMax'].$ajustement.$tableaudajustement['tauxAjustement'] )),"LR",1,'L',false);
}
}
}
$pdf->Cell(75,$h,convertirc(''),"LR",0,'L',false);
$pdf->Cell(115,$h,convertirc(''),"LR",1,'L',false);
$pdf->Cell(190,$h,convertirc(_($conclusion)),"LBR",1,'L',false);
$pdf->AddPage(); // DEBUT FT1
$statutsfts = $this->detailsp->donneelementaire_rp($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin);
$primeSinistrefts = $this->detailsp->donneelementaire_rp2_1($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin,$Chargement,$chargeravantapres );
$pdf->SetMargins(10, 10, 10) ;
$pdf->Image($_SESSION['dossierSociete'].'/Tarifs/Img/newkit3.jpg', 0, 0, 210);
$pdf->SetY(40);
$pdf->SetFont('Helvetica', 'B', 18);
$pdf->SetTextColor( 65, 185, 80 );
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(50, 6, convertirc(_('DONNÉES ÉLÉMENTAIRES')), 0, 1, 'L', false);
$pdf->Ln(8);
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->SetTextColor(0);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(50, 6, convertirc(_('PÉRIODE COMPTABLE CONSIDÉRÉE').' : '.dateLang($p_datedebut, $_SESSION['lang']).' '._('AU').' '.dateLang($p_datefin, $_SESSION['lang'])), 0, 1, 'L', false);
$pdf->Ln(8);
if ($p_id!=null){
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->Cell(10, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('GARANT')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['garant'])), 0, 1, 'L', false);
$pdf->Cell(10, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('SOUSCRIPTEUR')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['souscripteur'])), 0, 1, 'L', false);
//$pdf->Cell(0, 8, convertirc(_('SOUSCRIPTEUR').' : '.$entete['souscripteur']), 0, 1, 'L', false);
$pdf->Cell(10, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('POLICE No')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['numeroPolice'].' / '.$entete['libellePolice'])), 0, 1, 'L', false);
$pdf->Cell(10, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('COURTIER')), 0, 0, 'L', false);
$pdf->Cell(0, 6, 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('Helvetica', 'BUI', 11);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('GARANT')), 0, 0, 'L', false);
$pdf->SetFont('Helvetica', 'BI', 11);
$pdf->Cell(0, 6, convertirc(_(' : '.$p_garant)), 0, 1, 'L', false);
}
$pdf->SetX(15);
$pdf->SetFont('Helvetica', 'BI', 11);
$pdf->Cell(35, 6, convertirc(_('POPULATION')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : cf Tableau ci-dessous : ' )), 0, 1, 'L', false);
// $pdf->Cell(0, 6, convertirc(_("POPULATION").' : cf Tableau ci-dessous : '), 0, 1, 'L', false);
$pdf->Ln(10);
$hl=6;
$pdf->SetX(12);
$pdf->SetFont('Arial', 'B', 8);
$pdf->SetFillColor(143, 206, 143);
$pdf->Cell(35, $hl, convertirc(_('Statut bénéficiaire')), 1, 0, 'C', true);
$pdf->Cell(50, $hl, convertirc(_("Nombre d'assurés sur la période")), 1, 0, 'C', true);
$pdf->Cell(50, $hl, convertirc(_("Bénéficiaires traités sur la période")), 1, 0, 'C', true);
$pdf->Cell(50, $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 ($statutsfts as $statutsf) {
$pdf->SetX(12);
$pdf->Cell(35, $hl, convertirc($statutsf['libelle']), 1, 0, 'L', false);
$pdf->Cell(50, $hl, convertirc(format_N($statutsf['Nombre'])), 1, 0, 'C', false);
$pdf->Cell(50, $hl, convertirc(format_N($statutsf['Nombretraite'])), 1, 0, 'C', false);
$pdf->Cell(50, $hl, convertirc($statutsf['Taux_EffTraite']." %"), 1, 1, 'C', false);
$total_assure = $total_assure + $statutsf['Nombre'];
$total_traite = $total_traite + $statutsf['Nombretraite'];
$total_taux = $total_taux + $statutsf['Taux_EffTraite'];
}
$hl=8;
$pdf->SetFont('Arial', 'B', 9);
$pdf->SetFillColor(143, 206, 143);
$pdf->SetX(12);
$pdf->Cell(35, $hl, convertirc(_('TOTAL')), 1, 0, 'C', true);
$pdf->Cell(50, $hl, convertirc(_(format_N($total_assure))), 1, 0, 'C', true);
$pdf->Cell(50, $hl, convertirc(_(format_N($total_traite))), 1, 0, 'C', true);
$pdf->Cell(50, $hl, convertirc(_(format_N($total_taux)." %")), 1, 1, 'C', true);
$pdf->Ln(15);
$tp = 11;
$ht = 6;
$pdf->SetFont('Arial', 'BI', $tp);
$pdf->SetTextColor( 65, 185, 80 );
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(190, $ht, convertirc("PRIMES ET SINISTRALITÉ DE LA POLICE "), 0, 1, 'C', false);
$pdf->SetTextColor( 0, 0, 0 );
foreach ($primeSinistrefts as $primeSinistreft) {
}
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->Ln(5);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(100, $ht, convertirc(_("RAPPEL PRIME NETTE TOTALE :")), 0, 0, 'L', false);
$pdf->Cell(40, $ht, format_N($primeSinistreft['PRIMETOTALE']), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(100, $ht, convertirc(_("PRIME NETTE DE LA PÉRIODE :")), 0, 0, 'L', false);
$pdf->Cell(40, $ht, format_N($primeSinistreft['PRIMENETTE']), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(100, $ht, convertirc(_("CHARGEMENT DE LA PÉRIODE :")), 0, 0, 'L', false);
$pdf->Cell(40, $ht, format_N($primeSinistreft['CHARGEMENT']), 0, 1, 'L', false);
$pdf->Ln(5);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(100, $ht, convertirc(_("PROVISION POUR SINISTRE DE LA PÉRIODE :")), 0, 0, 'L', false);
$pdf->Cell(40, $ht, format_N($primeSinistreft['PROVISION']), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(100, $ht, convertirc(_("SINISTRE DE LA PÉRIODE :")), 0, 0, 'L', false);
$pdf->Cell(40, $ht, format_N($primeSinistreft['SINISTRES']), 0, 1, 'L', false);
$pdf->Ln(10);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(120, $ht, convertirc(_("RÉSULTATS TECHNIQUES DE LA PÉRIODE (Rapport Sinistres/Primes) :")), 0, 1, 'L', false);
if($chargeravantapres =="AVANT"){
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(125, $ht, convertirc(_("RAPPORT (SINISTRES/PRIME NETTE DE LA PÉRIODE) NET :")), 0, 0, 'L', false);
$pdf->Cell(40, $ht, number_format($primeSinistreft['RAPPRSP'], 2, '.', ','), 0, 1, 'L', false);
}else{
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(110, $ht, convertirc(_("RAPPORT (SINISTRES/PROVISION) NET :")), 0, 0, 'L', false);
$pdf->Cell(40, $ht, number_format($primeSinistreft['RAPPRSP'], 2, '.', ','), 0, 1, 'L', false);
}
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(125, $ht, convertirc(_("EXCEDENT (ou DEFICIT (-)) :")), 0, 0, 'L', false);
$pdf->Cell(40, $ht, format_N($primeSinistreft['ECART']), 0, 1, 'L', false);
$pdf->AddPage('L'); // debut MOUVEMENTS D'EFFECTIFS PAR COLLEGE
$p_factures = $this->detailsp->mouvementeffectifcollege($p_garant, $p_id_clients, $p_id, $p_id_college,$p_apporteur, $p_datedebut, $p_datefin,$p_limite );
$pdf->SetMargins(10, 10, 10) ;
$pdf->Image($_SESSION['dossierSociete'].'/Tarifs/Img/newkit7.jpg', 0, 0, 297);
$pdf->SetY(15);
$pdf->SetFont('Helvetica', 'B', 18);
$pdf->SetTextColor( 65, 185, 80 );
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->MultiCell(150, 8, convertirc(_("MOUVEMENTS D'EFFECTIFS PAR COLLEGE")), 0, 'L' );
$pdf->Ln(8);
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->SetTextColor(0);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(50, 6, convertirc(_('PÉRIODE COMPTABLE CONSIDÉRÉE').' : '.dateLang($p_datedebut, $_SESSION['lang']).' '._('AU').' '.dateLang($p_datefin, $_SESSION['lang'])), 0, 1, 'L', false);
$pdf->Ln(10);
if ($p_id!=null){
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('GARANT')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['garant'])), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('SOUSCRIPTEUR')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['souscripteur'])), 0, 1, 'L', false);
//$pdf->Cell(0, 8, convertirc(_('SOUSCRIPTEUR').' : '.$entete['souscripteur']), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('POLICE No')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['numeroPolice'].' / '.$entete['libellePolice'])), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('COURTIER')), 0, 0, 'L', false);
$pdf->Cell(0, 6, 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('Helvetica', 'BUI', 11);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('GARANT')), 0, 0, 'L', false);
$pdf->SetFont('Helvetica', 'BI', 11);
$pdf->Cell(0, 6, convertirc(_(' : '.$p_garant)), 0, 1, 'L', false);
}
$pdf->Ln(10);
$hl=7;
$pdf->SetFont('Arial','',7);
$pdf->SetFillColor(143,206,143);
$pdf->Cell(15,$hl,convertirc(_('idCollege')),1,0,'C',true);
$pdf->Cell(60,$hl,convertirc(_("College")),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;
foreach ($p_factures as $dep)
{
$taillelibelleCollege = strlen($dep['libelleCollege']); // compter le nombre de caractere de la chaine
if($taillelibelleCollege>43) {
$hl= 4;
$text = wordwrap($dep['libelleCollege'], 45, "***", 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(15,$hl,convertirc($dep['idCollege']),"LTR",0,'C',false);
$pdf->Cell(60,$hl,convertirc($part1),"LTR",0,'L',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['JANVIER'])),"LTR",0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['FEVRIER'])),"LTR",0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($dep['MARS'])),"LTR",0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($dep['AVRIL'])),"LTR",0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($dep['MAI'])),"LTR",0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($dep['JUIN'])),"LTR",0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['JUILLET'])),"LTR",0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($dep['AOUT'])),"LTR",0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['SEPTEMBRE'])),"LTR",0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['OCTOBRE'])),"LTR",0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['NOVEMBRE'])),"LTR",0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['DECEMBRE'])),"LTR",0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['TOTAUX'])),"LTR",1,'C',false);
$pdf->Cell(15,$hl,convertirc(""),"LBR",0,'C',false);
$pdf->Cell(60,$hl,convertirc($part2),"LBR",0,'L',false);
$pdf->Cell(16,$hl,convertirc(""),"LBR",0,'C',false);
$pdf->Cell(16,$hl,convertirc(""),"LBR",0,'C',false);
$pdf->Cell(15,$hl,convertirc(""),"LBR",0,'C',false);
$pdf->Cell(15,$hl,convertirc(""),"LBR",0,'C',false);
$pdf->Cell(15,$hl,convertirc(""),"LBR",0,'C',false);
$pdf->Cell(15,$hl,convertirc(""),"LBR",0,'C',false);
$pdf->Cell(16,$hl,convertirc(""),"LBR",0,'C',false);
$pdf->Cell(15,$hl,convertirc(""),"LBR",0,'C',false);
$pdf->Cell(16,$hl,convertirc(""),"LBR",0,'C',false);
$pdf->Cell(16,$hl,convertirc(""),"LBR",0,'C',false);
$pdf->Cell(16,$hl,convertirc(""),"LBR",0,'C',false);
$pdf->Cell(16,$hl,convertirc(""),"LBR",0,'C',false);
$pdf->Cell(16,$hl,convertirc(""),"LBR",1,'C',false);
}
else{
$pdf->Cell(15,$hl,convertirc($dep['idCollege']),1,0,'C',false);
$pdf->Cell(60,$hl,convertirc($dep['libelleCollege']),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(143,206,143);
$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);
$pdf->Ln(5);
$pdf->Cell(45,$hl,convertirc(_("Nombre de lignes: ").count($p_factures)),0,0,'L',false);
$pdf->AddPage(); // debut etat des depenses par college
$p_factures = $this->detailsp->get_depense_contrat_college_rp($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin);
$pdf->SetMargins(10, 10, 10) ;
$pdf->Image($_SESSION['dossierSociete'].'/Tarifs/Img/newkit5.jpg', 0, 0, 210);
$pdf->SetFont('Arial','B',13);
$pdf->SetY(40);
$pdf->SetFont('Helvetica', 'B', 18);
$pdf->SetTextColor( 65, 185, 80 );
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->MultiCell(145, 8, convertirc(_("DÉPENSES PAR FAMILLES ET PAR COLLEGE")), 0, 'L' );
$pdf->Ln(8);
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->SetTextColor(0);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(50, 6, convertirc(_('PÉRIODE COMPTABLE CONSIDÉRÉE').' : '.dateLang($p_datedebut, $_SESSION['lang']).' '._('AU').' '.dateLang($p_datefin, $_SESSION['lang'])), 0, 1, 'L', false);
$pdf->Ln(10);
if ($p_id!=null){
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('GARANT')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['garant'])), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('SOUSCRIPTEUR')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['souscripteur'])), 0, 1, 'L', false);
//$pdf->Cell(0, 8, convertirc(_('SOUSCRIPTEUR').' : '.$entete['souscripteur']), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('POLICE No')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['numeroPolice'].' / '.$entete['libellePolice'])), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('COURTIER')), 0, 0, 'L', false);
$pdf->Cell(0, 6, 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('Helvetica', 'BUI', 11);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('GARANT')), 0, 0, 'L', false);
$pdf->SetFont('Helvetica', 'BI', 11);
$pdf->Cell(0, 6, convertirc(_(' : '.$p_garant)), 0, 1, 'L', false);
}
$pdf->Ln(5);
$hl=7;
$pdf->SetFont('Arial','B',8);
$pdf->SetFillColor(143,206,143);
$pdf->Cell(16,$hl,convertirc(_("Id")),1,0,'C',true);
$pdf->Cell(94,$hl,convertirc(_("College")),1,0,'C',true);
$pdf->Cell(30,$hl,convertirc(_("Mt Recl.")),1,0,'C',true);
$pdf->Cell(30,$hl,convertirc(_("Mt Remb.")),1,0,'C',true);
$pdf->Cell(20,$hl,convertirc(_("Taux (%)")),1,1,'C',true);
$pdf->SetFont('Arial','',8);
$total_montantFacture = 0;
$total_apresDecompte = 0;
$total_taux = 0;
foreach ($p_factures as $p_facture){
$total_montantFacture = $total_montantFacture + $p_facture['montantFacture'];
$total_apresDecompte = $total_apresDecompte + $p_facture['apresDecompte'];
$total_taux = $total_taux + $p_facture['Taux'];
$pdf->Cell(16,$hl,convertirc($p_facture['id']),1,0,'C',false);
$pdf->Cell(94,$hl,convertirc($p_facture['libelleCollege']),1,0,'L',false);
$pdf->Cell(30,$hl,convertirc(format_N($p_facture['montantFacture'])),1,0,'C',false);
$pdf->Cell(30,$hl,convertirc(format_N($p_facture['apresDecompte'])),1,0,'C',false);
$pdf->Cell(20,$hl,convertirc($p_facture['Taux']),1,1,'C',false);
}
$pdf->Cell(110,$hl,convertirc("TOTAL GENERAL"),1,0,'L',true);
$pdf->Cell(30,$hl,convertirc(format_N($total_montantFacture)),1,0,'C',true);
$pdf->Cell(30,$hl,convertirc(format_N($total_apresDecompte)),1,0,'C',true);
$pdf->Cell(20,$hl,convertirc(format_N($total_taux)),1,1,'C',true);
$pdf->SetFont('Helvetica','B',10);
$pdf->Cell(45,$hl,convertirc(_(" * Légende :")),0,0,'L',false);
$pdf->Ln(5);
$pdf->SetX(16);
$pdf->Cell(45,$hl,convertirc(_("Mt Recl. = Montant reclamé ")),0,0,'L',false);
$pdf->Ln(5);
$pdf->SetX(16);
$pdf->Cell(45,$hl,convertirc(_("Mt Remb. = Montant rembousé")),0,0,'L',false);
$pdf->AddPage(); // debut ft3
$p_factures = $this->detailsp->recapdepensesstatutbenef($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin);
$statutsfts = $this->detailsp->recapdepensesstatutbenefdeux($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin);
$statuts = $this->detailsp->listestatutbeneficiaire($idPolice,$p_datedebut,$p_datefin);
$pdf->SetMargins(10, 10, 10) ;
$pdf->Image($_SESSION['dossierSociete'].'/Tarifs/Img/newkit3.jpg', 0, 0, 210);
$pdf->SetY(30);
$pdf->SetFont('Helvetica', 'B', 18);
$pdf->SetTextColor( 65, 185, 80 );
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->MultiCell(145, 8, convertirc(_("RÉCAPITULATIF DES DÉPENSES PAR STATUT DE BÉNEFICIAIRES")), 0, 'L' );
$pdf->Ln(8);
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->SetTextColor(0);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(50, 6, convertirc(_('PÉRIODE COMPTABLE CONSIDÉRÉE').' : '.dateLang($p_datedebut, $_SESSION['lang']).' '._('AU').' '.dateLang($p_datefin, $_SESSION['lang'])), 0, 1, 'L', false);
$pdf->Ln(10);
if ($p_id!=null){
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('GARANT')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['garant'])), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('SOUSCRIPTEUR')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['souscripteur'])), 0, 1, 'L', false);
//$pdf->Cell(0, 8, convertirc(_('SOUSCRIPTEUR').' : '.$entete['souscripteur']), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('POLICE No')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['numeroPolice'].' / '.$entete['libellePolice'])), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('COURTIER')), 0, 0, 'L', false);
$pdf->Cell(0, 6, 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('Helvetica', 'BUI', 11);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('GARANT')), 0, 0, 'L', false);
$pdf->SetFont('Helvetica', 'BI', 11);
$pdf->Cell(0, 6, convertirc(_(' : '.$p_garant)), 0, 1, 'L', false);
}
$pdf->Ln(5);
$hl=6;
$pdf->SetX(13);
$pdf->SetFont('Arial','B',9);
$pdf->Cell(184,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->SetX(13);
$pdf->Cell(34,$hl,convertirc(_('Statut bénéficiaire')),1,0,'C',true);
$pdf->Cell(25,$hl,convertirc(_("Nombre")),1,0,'C',true);
$pdf->Cell(25,$hl,convertirc(_("Taux effectif")),1,0,'C',true);
$pdf->Cell(25,$hl,convertirc(_("Age moyen")),1,0,'C',true);
$pdf->Cell(27,$hl,convertirc(_("Montant")),1,0,'C',true);
$pdf->Cell(24,$hl,convertirc(_("Taux")),1,0,'C',true);
$pdf->Cell(24,$hl,convertirc(_("Coût moyen")),1,1,'C',true);
$pdf->SetFont('Arial','',9);
$total_Nombre = 0;
$total_Taux_Eff = 0;
$total_Age_Moyen = 0;
$total_Montant = 0;
$total_tauxMontantTraite = 0;
$total_coutMoyenTraite = 0;
foreach ($p_factures as $p_facture)
{
$pdf->SetX(13);
$pdf->Cell(34,$hl,convertirc($p_facture['libelle']),1,0,'L',false);
$pdf->Cell(25,$hl,convertirc(format_N($p_facture['Nombre'])),1,0,'C',false);
$pdf->Cell(25,$hl,convertirc($p_facture['Taux_Eff']."%"),1,0,'C',false);
$pdf->Cell(25,$hl,convertirc($p_facture['Age_Moyen']),1,0,'C',false);
$pdf->Cell(27,$hl,convertirc(format_N($p_facture['Montant'])),1,0,'C',false);
$pdf->Cell(24,$hl,convertirc($p_facture['Taux_Depense']."%"),1,0,'C',false);
$pdf->Cell(24,$hl,convertirc(format_N($p_facture['CoutMoyen'])),1,1,'C',false);
$total_Nombre = $total_Nombre + $p_facture['Nombre'];
$total_Taux_Eff = $total_Taux_Eff + $p_facture['Taux_Eff'];
$total_Age_Moyen = $total_Age_Moyen + $p_facture['Age_Moyen'];
$total_Montant = $total_Montant + $p_facture['Montant'];
$total_tauxMontantTraite = $total_tauxMontantTraite + $p_facture['Taux_Depense'];
$total_coutMoyenTraite = $total_coutMoyenTraite + $p_facture['CoutMoyen'];
}
$pdf->SetFont('Arial','B',9);
$pdf->SetX(13);
$total_Age_Moyen =$total_Age_Moyen /6;
$pdf->Cell(34,$hl,convertirc("TOTAL GENERAL"),"1",0,'C',true);
$pdf->Cell(25,$hl,format_N($total_Nombre),1,0,'C',true);
$pdf->Cell(25,$hl,format_N($total_Taux_Eff)."%",1,0,'C',true);
$pdf->Cell(25,$hl,format_N($total_Age_Moyen),1,0,'C',true);
$pdf->Cell(27,$hl,format_N($total_Montant),1,0,'C',true);
$pdf->Cell(24,$hl,format_N($total_tauxMontantTraite)."%",1,0,'C',true);
$pdf->Cell(24,$hl,format_N($total_coutMoyenTraite),1,0,'C',true);
$pdf->SetFont('Arial','B',8);
$pdf->SetY(160);
$pdf->Cell(10,8,(''),0,0);
$pdf->Cell(80,8,convertirc(_('Récapitulatif dépenses par statut bénéficiaire (%)')),1,0,'C',false);
$pdf->Cell(10,8,(''),0,0);
$pdf->Cell(80,8,convertirc(_('Récapitulatif des bénéficiaires traités par statut (%)')),1,1,'C',false);
$pdf->Ln(5);
$pdf->Rect(20,168, 80, 52, 'D');
$pdf->Rect(110, 168, 80, 52, 'D');
// DEBUT GRAPH
$valeur0=0;
$valeur1=0;
$valeur2=0;
$valeur3=0;
$valeur4=0;
$valeur5=0;
$value=0;
$v=0;
$valeurs=array();
foreach($p_factures as $key => $value){
array_push($valeurs,$value['Taux_Depense']);
}
foreach($valeurs as $key =>$valeur){
if ($key == 0) {
$valeur0 = $valeur;
}
if ($key == 1) {
$valeur1 = $valeur;
}
if ($key == 2) {
$valeur2 = $valeur;
}
if ($key == 3) {
$valeur3 = $valeur;
}
if ($key == 4) {
$valeur4 = $valeur;
}
if ($key == 5) {
$valeur5 = $valeur;
}
$data=Array(
'A'=>[
'color'=>[255,0,0],
'value'=>$valeur0],
'C'=>[
'color'=>[255,255,0],
'value'=>$valeur1],
'E'=>[
'color'=>[50,0,255],
'value'=>$valeur2],
'O'=>[
'color'=>[255,0,255],
'value'=>$valeur3],
'F'=>[
'color'=>[0,255,0],
'value'=>$valeur4],
'D'=>[
'color'=>[0,0,0],
'value'=>$valeur5]
);
}
//pie and legend properties
$pieX=40;
$pieY=195;
$r=14;//radius
$legendX=65;
$legendY=185;
//get total data summary
$dataSum=0;
foreach($data as $item){
$dataSum+=$item['value'];
}
//get scale unit for each degree
$degUnit=360/$dataSum;
//variable to store current angle
$currentAngle=0;
//store current legend Y position
$currentLegendY=$legendY;
$pdf->SetFont('Arial','',8);
//simplify the code by drawing both pie and legend in one loop
foreach($data as $index=>$item){
//draw the pie
//slice size
$deg=$degUnit*$item['value'];
//set color
$pdf->SetFillColor($item['color'][0],$item['color'][1],$item['color'][2]);
//remove border
$pdf->SetDrawColor($item['color'][0],$item['color'][1],$item['color'][2]);
//draw the slice
$pdf->Sector($pieX,$pieY,$r,$currentAngle,$currentAngle+$deg);
//add slice angle to currentAngle var
$currentAngle+=$deg;
//draw the legend
$pdf->SetFont('Arial','',8);
// $pdf->SetXY($chartX,$chartY);
$pdf->Rect($legendX,$currentLegendY,4,4,'DF');
$pdf->SetXY($legendX + 6,$currentLegendY);
foreach($valeurs as $key =>$valeur){
if ($key == 0) {
$v0 = $valeur;
}
if ($key == 1) {
$v1 = $valeur;
}
if ($key == 2) {
$v2 = $valeur;
}
if ($key == 3) {
$v3 = $valeur;
}
if ($key == 4) {
$v4 = $valeur;
}
if ($key == 5) {
$v5 = $valeur;
}
}
$pdf->Cell(20,5,convertirc(_($index)),0,0);
if ($index == 'A') {
$pdf->Cell(10,5,convertirc(_($v0)),0,0);
}
if ($index == 'C') {
$pdf->Cell(10,5,convertirc(_($v1)),0,0);
}
if ($index == 'E') {
$pdf->Cell(10,5,convertirc(_($v2)),0,0);
}
if ($index == 'O') {
$pdf->Cell(10,5,convertirc(_('0')),0,0);
}
if ($index == 'F') {
$pdf->Cell(10,5,convertirc(_($v4)),0,0);
}
if ($index == 'D') {
$pdf->Cell(10,5,convertirc(_($v5)),0,0);
}
$currentLegendY+=5;
}
$valeur0=0;
$valeur1=0;
$valeur2=0;
$valeur3=0;
$valeur4=0;
$valeur5=0;
$value=0;
$v=0;
$valeurs=array();
foreach($statutsfts as $key => $value){
array_push($valeurs,$value['Taux_Eff']);
}
foreach($valeurs as $key =>$valeur){
if ($key == 0) {
$valeur0 = $valeur;
}
if ($key == 1) {
$valeur1 = $valeur;
}
if ($key == 2) {
$valeur2 = $valeur;
}
if ($key == 3) {
$valeur3 = $valeur;
}
if ($key == 4) {
$valeur4 = $valeur;
}
if ($key == 5) {
$valeur5 = $valeur;
}
$data=Array(
'A'=>[
'color'=>[255,0,0],
'value'=>$valeur0],
'C'=>[
'color'=>[255,255,0],
'value'=>$valeur1],
'E'=>[
'color'=>[50,0,255],
'value'=>$valeur2],
'O'=>[
'color'=>[255,0,255],
'value'=>$valeur3],
'F'=>[
'color'=>[0,255,0],
'value'=>$valeur4],
'D'=>[
'color'=>[0,0,0],
'value'=>$valeur5]
);
}
//pie and legend properties
$pieX=130;
$pieY=195;
$r=14;//radius
$legendX=155;
$legendY=185;
//get total data summary
$dataSum=0;
foreach($data as $item){
$dataSum+=$item['value'];
}
//get scale unit for each degree
$degUnit=360/$dataSum;
//variable to store current angle
$currentAngle=0;
//store current legend Y position
$currentLegendY=$legendY;
$pdf->SetFont('Arial','',8);
//simplify the code by drawing both pie and legend in one loop
foreach($data as $index=>$item){
//draw the pie
//slice size
$deg=$degUnit*$item['value'];
//set color
$pdf->SetFillColor($item['color'][0],$item['color'][1],$item['color'][2]);
//remove border
$pdf->SetDrawColor($item['color'][0],$item['color'][1],$item['color'][2]);
//draw the slice
$pdf->Sector($pieX,$pieY,$r,$currentAngle,$currentAngle+$deg);
//add slice angle to currentAngle var
$currentAngle+=$deg;
//draw the legend
$pdf->SetFont('Arial','',8);
// $pdf->SetXY($chartX,$chartY);
$pdf->Rect($legendX,$currentLegendY,4,4,'DF');
$pdf->SetXY($legendX + 6,$currentLegendY);
foreach($valeurs as $key =>$valeur){
if ($key == 0) {
$v0 = $valeur;
}
if ($key == 1) {
$v1 = $valeur;
}
if ($key == 2) {
$v2 = $valeur;
}
if ($key == 3) {
$v3 = $valeur;
}
if ($key == 4) {
$v4 = $valeur;
}
if ($key == 5) {
$v5 = $valeur;
}
}
$pdf->Cell(20,5,convertirc(_($index)),0,0);
if ($index == 'A') {
$pdf->Cell(10,5,convertirc(_($v0)),0,0);
}
if ($index == 'C') {
$pdf->Cell(10,5,convertirc(_($v1)),0,0);
}
if ($index == 'E') {
$pdf->Cell(10,5,convertirc(_($v2)),0,0);
}
if ($index == 'O') {
$pdf->Cell(10,5,convertirc(_($v3)),0,0);
}
if ($index == 'F') {
$pdf->Cell(10,5,convertirc(_($v4)),0,0);
}
if ($index == 'D') {
$pdf->Cell(10,5,convertirc(_($v5)),0,0);
}
$currentLegendY+=5;
}
$pdf->Ln(18);
$hl=5;
$pdf->SetX(13);
$pdf->SetFont('Arial','B',9);
$pdf->Cell(184,6,convertirc(_('Dépenses des bénéficiaires traités par statut')),1,1,'C',false);
$pdf->SetFont('Arial','B',8);
$pdf->SetX(13);
$pdf->SetFillColor(143,206,143);
$pdf->Cell(34,$hl,convertirc(_('Statut bénéficiaire')),1,0,'C',true);
$pdf->Cell(51,$hl,convertirc(_("Nombre de fois traités sur la période")),1,0,'C',true);
$pdf->Cell(24,$hl,convertirc(_("Taux traités")),1,0,'C',true);
$pdf->Cell(27,$hl,convertirc(_("Dépenses")),1,0,'C',true);
$pdf->Cell(24,$hl,convertirc(_("Taux")),1,0,'C',true);
$pdf->Cell(24,$hl,convertirc(_("Coût moyen")),1,1,'C',true);
$pdf->SetFont('Arial','',9);
$total_BenefTraite = 0;
$total_Taux_EffTraite = 0;
$total_Depensestraite = 0;
$total_Taux_Depense =0;
$total_coutMoyenTraite = 0;
foreach ($statutsfts as $statutsft)
{
$pdf->SetX(13);
$pdf->Cell(34,$hl,convertirc($statutsft['libelle']),1,0,'L',false);
$pdf->Cell(51,$hl,convertirc(format_N($statutsft['BenefTraite'])),1,0,'C',false);
$pdf->Cell(24,$hl,convertirc($statutsft['Taux_Eff']."%"),1,0,'C',false);
$pdf->Cell(27,$hl,convertirc(format_N($statutsft['Depenses'])),1,0,'C',false);
$pdf->Cell(24,$hl,convertirc($statutsft['Taux_Depense']."%"),1,0,'C',false);
$pdf->Cell(24,$hl,convertirc(format_N($statutsft['CoutMoyen'])),1,1,'C',false);
$total_BenefTraite = $total_BenefTraite + $statutsft['BenefTraite'];
$total_Taux_EffTraite = $total_Taux_EffTraite + $statutsft['Taux_Eff'];
$total_Depensestraite = $total_Depensestraite + $statutsft['Depenses'];
$total_Taux_Depense = $total_Taux_Depense+ $statutsft['Taux_Depense'];
$total_coutMoyenTraite = $total_coutMoyenTraite + $statutsft['CoutMoyen'];
}
$pdf->SetFont('Arial','B',9);
$pdf->SetX(13);
$pdf->Cell(34,$hl,convertirc("TOTAL GÉNERAL"),"1",0,'C',true);
$pdf->Cell(51,$hl,format_N($total_BenefTraite),1,0,'C',true);
$pdf->Cell(24,$hl,$total_Taux_EffTraite."%",1,0,'C',true);
$pdf->Cell(27,$hl,format_N($total_Depensestraite),1,0,'C',true);
$pdf->Cell(24,$hl,format_N($total_tauxMontantTraite)."%",1,0,'C',true);
$pdf->Cell(24,$hl,format_N($total_coutMoyenTraite),1,0,'C',true);
$pdf->AddPage();// debut ft 8
$p_factures = $this->detailsp->etatrecapdepensesparfamilledactesmedicaux($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin);
$pdf->SetMargins(10, 10, 10) ;
$pdf->Image($_SESSION['dossierSociete'].'/Tarifs/Img/newkit5.jpg', 0, 0, 210);
$pdf->SetY(15);
$pdf->SetFont('Helvetica', 'B', 18);
$pdf->SetTextColor( 65, 185, 80 );
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->MultiCell(150, 8, convertirc(_("RÉCAPITULATIF DES DÉPENSES PAR FAMILLE D'ACTES")), 0, 'L' );
$pdf->Ln(8);
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->SetTextColor(0);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(50, 6, convertirc(_('PÉRIODE COMPTABLE CONSIDÉRÉE').' : '.dateLang($p_datedebut, $_SESSION['lang']).' '._('AU').' '.dateLang($p_datefin, $_SESSION['lang'])), 0, 1, 'L', false);
$pdf->Ln(10);
if ($p_id!=null){
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('GARANT')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['garant'])), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('SOUSCRIPTEUR')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['souscripteur'])), 0, 1, 'L', false);
//$pdf->Cell(0, 8, convertirc(_('SOUSCRIPTEUR').' : '.$entete['souscripteur']), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('POLICE No')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['numeroPolice'].' / '.$entete['libellePolice'])), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('COURTIER')), 0, 0, 'L', false);
$pdf->Cell(0, 6, 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('Helvetica', 'BUI', 11);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('GARANT')), 0, 0, 'L', false);
$pdf->SetFont('Helvetica', 'BI', 11);
$pdf->Cell(0, 6, convertirc(_(' : '.$p_garant)), 0, 1, 'L', false);
}
$pdf->Ln(10);
$hl=6;
$pdf->SetFont('Arial', 'B', 8);
$pdf->SetFillColor(143, 206, 143);
$pdf->Cell(15, $hl, convertirc(_('Code')), 1, 0, 'C', true);
$pdf->SetFillColor(143, 206, 143);
$pdf->Cell(80, $hl, convertirc(_("Libellé")), 1, 0, 'C', true);
$pdf->SetFillColor(143, 206, 143);
$pdf->Cell(20, $hl, convertirc(_("Quantité")), 1, 0, 'C', true);
$pdf->SetFillColor(143, 206, 143);
$pdf->Cell(30, $hl, convertirc(_("Montant Remboursé")), 1, 0, 'C', true);
$pdf->SetFillColor(143, 206, 143);
$pdf->Cell(25, $hl, convertirc(_("Coût Moyen")), 1, 0, 'C', true);
$pdf->SetFillColor(143, 206, 143);
$pdf->Cell(20, $hl, convertirc(_("Taux")), 1, 1, 'C', true);
$pdf->SetFont('Arial', '', 9);
$total_assure = 0;
$total_coutmoyen =0;
$total_quantite =0;
$total_montantrembourse =0;
$total_traite = 0;
$total_taux = 0;
foreach ($p_factures as $p_facture) {
$pdf->Cell(15, $hl, convertirc($p_facture['codeGarantie']), 1, 0, 'L', false);
$pdf->Cell(80, $hl, convertirc($p_facture['libelle']), 1, 0, 'L', false);
$pdf->Cell(20, $hl, convertirc(format_N($p_facture['Quantite'])), 1, 0, 'C', false);
$pdf->Cell(30, $hl, convertirc(format_N($p_facture['MontantRembourse'])), 1, 0, 'R', false);
$pdf->Cell(25, $hl, convertirc(format_N($p_facture['Coutmoyen'])), 1, 0, 'R', false);
$pdf->Cell(20, $hl, convertirc($p_facture['Taux']), 1, 1, 'C', false);
$total_coutmoyen = $total_coutmoyen + $p_facture['Coutmoyen'];
$total_quantite = $total_quantite + $p_facture['Quantite'];
$total_montantrembourse = $total_montantrembourse + $p_facture['MontantRembourse'];
$total_taux = $total_taux + $p_facture['Taux'];
}
$hl=8;
$pdf->SetFont('Arial', 'B', 9);
$pdf->SetFillColor(143, 206, 143);
$pdf->Cell(95, $hl, convertirc(_('TOTAL')), 1, 0, 'C', true);
$pdf->SetFillColor(143, 206, 143);
$pdf->Cell(20, $hl, convertirc(_(format_N($total_quantite))), 1, 0, 'C', true);
$pdf->SetFillColor(143, 206, 143);
$pdf->Cell(30, $hl, convertirc(_(format_N($total_montantrembourse))), 1, 0, 'C', true);
$pdf->SetFillColor(143, 206, 143);
$pdf->Cell(25, $hl, convertirc(_(format_N($total_coutmoyen))), 1, 0, 'C', true);
$pdf->SetFillColor(143, 206, 143);
$pdf->Cell(20, $hl, convertirc(_(convertirc('100 %'))), 1, 1, 'C', true);
$chartX=15;
$chartY=175;
//dimension
$chartWidth=180;
$chartHeight=100;
//padding
$chartTopPadding=12;
$chartLeftPadding=20;
$chartBottomPadding=10;
$chartRightPadding=5;
//chart box
$chartBoxX=$chartX+$chartLeftPadding;
$chartBoxY=$chartY+$chartTopPadding;
$chartBoxWidth=$chartWidth-$chartLeftPadding-$chartRightPadding;
$chartBoxHeight=$chartHeight-$chartBottomPadding-$chartTopPadding;
//bar width
$barWidth=8;
$valeur0=0;
$valeur1=0;
$valeur2=0;
$valeur3=0;
$valeur4=0;
$valeur5=0;
$valeur6=0;
$valeur7=0;
$valeur8=0;
$valeur9=0;
$valeur10=0;
$value=0;
$v=0;
$valeurs=array();
foreach($p_factures as $p_factures['codeGarantie'] => $value)
{
array_push($valeurs,$value['Taux']);
foreach($valeurs as $key =>$valeur)
{
if ($value['codeGarantie'] == 'AUX') {
$valeur1 = $value['Taux'];
}
if ($value['codeGarantie'] == 'BIO') {
$valeur2 = $value['Taux'];
}
if ($value['codeGarantie'] == 'CON') {
$valeur3 = $value['Taux'];
}
if ($value['codeGarantie'] == 'DEN') {
$valeur4 = $value['Taux'];
}
if ($value['codeGarantie'] == 'EXA') {
$valeur5 = $value['Taux'];
}
if ($value['codeGarantie'] == 'HOS') {
$valeur6 = $value['Taux'];
}
if ($value['codeGarantie'] == 'IMA') {
$valeur7 = $value['Taux'];
}
if ($value['codeGarantie'] == 'MAT') {
$valeur8 = $value['Taux'];
}
if ($value['codeGarantie'] == 'OPT') {
$valeur9 = $value['Taux'];
}
if ($value['codeGarantie'] == 'PHA') {
$valeur10 = $value['Taux'];
}
$data=Array(
'AUX'=>[
'color'=>[255,0,0],
'value'=>$valeur1],
'BIO'=>[
'color'=>[255,255,0],
'value'=>$valeur2],
'CON'=>[
'color'=>[50,0,255],
'value'=>$valeur3],
'DEN'=>[
'color'=>[255,0,255],
'value'=>$valeur4],
'EXA'=>[
'color'=>[0,255,0],
'value'=>$valeur5],
'HOS'=>[
'color'=>[200,255,100],
'value'=>$valeur6],
'IMA'=>[
'color'=>[121,248,248],
'value'=>$valeur7],
'MAT'=>[
'color'=>[121,210,180],
'value'=>$valeur8],
'OPT'=>[
'color'=>[221,248,248],
'value'=>$valeur9],
'PHA'=>[
'color'=>[0,100,108],
'value'=>$valeur10]
);
}
}
$dataMax=0;
foreach($data as $item){
if($item['value']>$dataMax)
$dataMax=$item['value'];
}
//data step
if($dataMax>200 and $dataMax<600){
$dataStep=20;
}
if($dataMax<200){
$dataStep=10;
}
if($dataMax>1000){
$dataStep=100;
}
//set font, line width and color
$pdf->SetFont('Arial','',8);
$pdf->SetLineWidth(0.1);
$pdf->SetDrawColor(0);
//chart boundary
$pdf->Rect($chartX,$chartY,$chartWidth,$chartHeight);
//vertical axis line
$pdf->Line(
$chartBoxX ,
$chartBoxY ,
$chartBoxX ,
($chartBoxY+$chartBoxHeight)
);
//horizontal axis line
$pdf->Line(
$chartBoxX-2 ,
($chartBoxY+$chartBoxHeight) ,
$chartBoxX+($chartBoxWidth) ,
($chartBoxY+$chartBoxHeight)
);
///vertical axis
//calculate chart's y axis scale unit
$yAxisUnits=$chartBoxHeight/$dataMax;
//draw the vertical (y) axis labels
for($i=0 ; $i<=$dataMax ; $i+=$dataStep){
//y position
$yAxisPos=$chartBoxY+($yAxisUnits*$i);
//draw y axis line
$pdf->Line(
$chartBoxX-2 ,
$yAxisPos ,
$chartBoxX ,
$yAxisPos
);
//set cell position for y axis labels
$pdf->SetXY($chartBoxX-$chartLeftPadding , $yAxisPos-2);
//$pdf->Cell($chartLeftPadding-4 , 5 , $dataMax-$i , 1);---------------
$pdf->Cell($chartLeftPadding-4 , 5 , $dataMax-$i, 0 , 0 , 'R');
}
///horizontal axis
//set cells position
$pdf->SetXY($chartBoxX , $chartBoxY+$chartBoxHeight);
//cell's width
$xLabelWidth=$chartBoxWidth / count($data);
//$pdf->Cell($xLabelWidth , 5 , $itemName , 1 , 0 , 'C');-------------
//loop horizontal axis and draw the bar
$barXPos=0;
foreach($data as $itemName=>$item){
//print the label
//$pdf->Cell($xLabelWidth , 5 , $itemName , 1 , 0 , 'C');--------------
$pdf->Cell($xLabelWidth , 5 , $itemName , 0 , 0 , 'C');
///drawing the bar
//bar color
$pdf->SetFillColor($item['color'][0],$item['color'][1],$item['color'][2]);
//bar height
$barHeight=$yAxisUnits*$item['value'];
//bar x position
$barX=($xLabelWidth/2)+($xLabelWidth*$barXPos);
$barX=$barX-($barWidth/2);
$barX=$barX+$chartBoxX;
//bar y position
$barY=$chartBoxHeight-$barHeight;
$barY=$barY+$chartBoxY;
//draw the bar
$pdf->Rect($barX,$barY,$barWidth,$barHeight,'DF');
//increase x position (next series)
$barXPos++;
}
//axis labels
$pdf->SetFont('Arial','B',9);
$pdf->SetXY($chartX,$chartY);
$pdf->Cell(30,10,"Taux",0);
$pdf->SetXY(($chartWidth/2)-50+$chartX,$chartY+$chartHeight-($chartBottomPadding/2));
$pdf->Cell(100,5,convertirc(_("Récapitulatif des dépenses par famille d'acte")),0,0,'C');
$pdf->AddPage();// debut fiche 11
$depensesFamillesA = $this->detailsp->etatcomparatifdesdepensesA($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin, $p_limite);
$depensesFamillesB = $this->detailsp->etatcomparatifdesdepensesB($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin, $p_limite);
$pdf->SetMargins(10, 10, 10) ;
$pdf->Image($_SESSION['dossierSociete'].'/Tarifs/Img/newkit5.jpg', 0, 0, 210);
$pdf->SetY(10);
$pdf->SetFont('Helvetica', 'B', 18);
$pdf->SetTextColor( 65, 185, 80 );
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->MultiCell(150, 8, convertirc(_("COMPARATIF DES DÉPENSES DES ANNÉE N-1 ET N")), 0, 'L' );
$pdf->Ln(8);
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->SetTextColor(0);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(50, 6, convertirc(_('PÉRIODE COMPTABLE CONSIDÉRÉE').' : '.dateLang($p_datedebut, $_SESSION['lang']).' '._('AU').' '.dateLang($p_datefin, $_SESSION['lang'])), 0, 1, 'L', false);
$pdf->Ln(9);
if ($p_id!=null){
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('GARANT')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['garant'])), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('SOUSCRIPTEUR')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['souscripteur'])), 0, 1, 'L', false);
//$pdf->Cell(0, 8, convertirc(_('SOUSCRIPTEUR').' : '.$entete['souscripteur']), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('POLICE No')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['numeroPolice'].' / '.$entete['libellePolice'])), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('COURTIER')), 0, 0, 'L', false);
$pdf->Cell(0, 6, 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('Helvetica', 'BUI', 11);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('GARANT')), 0, 0, 'L', false);
$pdf->SetFont('Helvetica', 'BI', 11);
$pdf->Cell(0, 6, convertirc(_(' : '.$p_garant)), 0, 1, 'L', false);
}
$pdf->Ln(2);
$hl=7;
$pdf->SetFont('Arial','BU',10);
$annee = date("Y", strtotime($p_datefin));
$precannee = $annee -1;
$pdf->Cell(95,$hl,convertirc(_('Etat des dépenses de l\'année n-1')),1,0,'C',FALSE);
$pdf->Cell(95,$hl,convertirc(_('Etat des dépenses de l\'année n')),1,1,'C',FALSE);
$pdf->SetFillColor(255,250,205);
$pdf->SetFont('Arial','B',6);
$pdf->Cell(44,$hl,convertirc(_('Famille d\'actes')),1,0,'C',true);
$pdf->Cell(13,$hl,convertirc(_("Nombre")),1,0,'C',true);
$pdf->Cell(14,$hl,convertirc(_("Montant net ")),1,0,'C',true);
$pdf->Cell(13,$hl,convertirc(_("Coût moyen")),1,0,'C',true);
$pdf->Cell(10,$hl,convertirc(_("Taux %")),1,0,'C',true);
$pdf->SetX(106);
$pdf->SetFillColor(0,100,108);
$pdf->SetTextColor(255,255,255);
$pdf->Cell(44,$hl,convertirc(_('Famille d\'actes')),1,0,'C',true);
$pdf->Cell(13,$hl,convertirc(_("Nombre")),1,0,'C',true);
$pdf->Cell(14,$hl,convertirc(_("Montant net ")),1,0,'C',true);
$pdf->Cell(13,$hl,convertirc(_("Coût moyen")),1,0,'C',true);
$pdf->Cell(10,$hl,convertirc(_("Taux %")),1,1,'C',true);
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','',6);
$total_popActive = 0;
$total_popTraite = 0;
$total_quantite = 0;
$total_taux =0;
$total_montantReclame = 0;
$total_montantNonRembourse = 0;
$total_montantRembourse = 0;
$total_coutMoyen = 0;
$total_popActiveA = 0;
$total_popTraiteA = 0;
$total_montantReclameA = 0;
$total_montantNonRembourseA = 0;
$total_montantRembourseA = 0;
$total_coutMoyenA = 0;
$total_tauxA =0;
$total_quantiteA = 0;
foreach ($depensesFamillesA as $depA)
{
$pdf->Cell(44,$hl,convertirc($depA['libelle']),1,0,'L',false);
$pdf->Cell(13,$hl,convertirc($depA['Quantite']),1,0,'C',false);
$pdf->Cell(14,$hl,convertirc(format_N($depA['MontantRembourse'])),1,0,'C',false);
$pdf->Cell(13,$hl,convertirc(format_N($depA['Coutmoyen'])),1,0,'C',false);
$pdf->Cell(10,$hl,convertirc(($depA['Taux'])),1,1,'C',false);
$total_quantiteA = $total_quantiteA + $depA['Quantite'];
$total_montantRembourseA = $total_montantRembourseA + $depA['MontantRembourse'];
$total_coutMoyenA = $total_montantRembourseA / $total_quantiteA;
$total_tauxA = $total_tauxA + $depA['Taux'];
}
$pdf->SetFont('Arial','B',6);
$pdf->SetFillColor(255,250,205);
$pdf->Cell(44,$hl,convertirc("TOTAL GENERAL"),"1",0,'C',true);
$pdf->Cell(13,$hl,format_N($total_quantiteA),1,0,'C',true);
$pdf->Cell(14,$hl,format_N($total_montantRembourseA),1,0,'C',true);
$pdf->Cell(13,$hl,format_N($total_coutMoyenA),1,0,'C',true);
$pdf->Cell(10,$hl,format_N(100),1,0,'C',true);
$pdf->SetY(89);
if ($p_id!=null){
$pdf->SetY(89);
}else{
$pdf->SetY(65);
}
foreach ($depensesFamillesB as $dep)
{
$pdf->SetX(106);
$pdf->Cell(44,$hl,convertirc($dep['libelle']),1,0,'L',false);
$pdf->Cell(13,$hl,convertirc($dep['Quantite']),1,0,'C',false);
$pdf->Cell(14,$hl,convertirc(format_N($dep['MontantRembourse'])),1,0,'C',false);
$pdf->Cell(13,$hl,convertirc(format_N($dep['Coutmoyen'])),1,0,'C',false);
$pdf->Cell(10,$hl,convertirc($dep['Taux']),1,1,'C',false);
$total_quantite = $total_quantite + $dep['Quantite'];
$total_montantRembourse = $total_montantRembourse + $dep['MontantRembourse'];
$total_coutMoyen = $total_montantRembourse / $total_quantite;
$total_taux = $total_taux + $dep['Taux'];
}
$pdf->SetX(106);
$pdf->SetFont('Arial','B',6);
$pdf->SetFillColor(0,100,108);
$pdf->SetTextColor(255,255,255);
$pdf->Cell(44,$hl,convertirc("TOTAL GENERAL"),"1",0,'C',true);
$pdf->Cell(13,$hl,format_N($total_quantite),1,0,'C',true);
$pdf->Cell(14,$hl,format_N($total_montantRembourse),1,0,'C',true);
$pdf->Cell(13,$hl,format_N($total_coutMoyen),1,0,'C',true);
$pdf->Cell(10,$hl,format_N(100),1,1,'C',true);
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','BU',10);
$pdf->SetY(175);
$pdf->SetX(50);
$pdf->Cell(120,8,convertirc(_('Comparaison des dépenses de l\'année n-1 et l\'année n ')),1,1,'C',false);
$chartX=15;
$chartY=175;
//dimension
$chartWidth=180;
$chartHeight=100;
//padding
$chartTopPadding=12;
$chartLeftPadding=20;
$chartBottomPadding=10;
$chartRightPadding=5;
//chart box
$chartBoxX=$chartX+$chartLeftPadding;
$chartBoxY=$chartY+$chartTopPadding;
$chartBoxWidth=$chartWidth-$chartLeftPadding-$chartRightPadding;
$chartBoxHeight=$chartHeight-$chartBottomPadding-$chartTopPadding;
//bar width
$barWidth=5;
$barWidth1=5;
$valeur0=0;
$valeur1=0;
$valeur2=0;
$valeur3=0;
$valeur4=0;
$valeur5=0;
$valeur6=0;
$valeur7=0;
$valeur8=0;
$valeur9=0;
$value=0;
$v=0;
$valeur0A=0;
$valeur1A=0;
$valeur2A=0;
$valeur3A=0;
$valeur4A=0;
$valeur5A=0;
$valeur6A=0;
$valeur7A=0;
$valeur8A=0;
$valeur9A=0;
$value1=0;
$v=0;
$valeurs=array();
$valeurs1=array();
foreach($depensesFamillesA as $depensesFamillesA['codeGarantie'] => $value1)
{
array_push($valeurs1,$value1['Taux']);
foreach($valeurs1 as $key =>$valeurA)
{
if ($value1['codeGarantie'] == 'AUX') {
$valeur1A = $value1['Taux'];
}
if ($value1['codeGarantie'] == 'BIO') {
$valeur2A = $value1['Taux'];
}
if ($value1['codeGarantie'] == 'CON') {
$valeur3A = $value1['Taux'];
}
if ($value1['codeGarantie'] == 'DEN') {
$valeur4A = $value1['Taux'];
}
if ($value1['codeGarantie'] == 'EXA') {
$valeur5A = $value1['Taux'];
}
if ($value1['codeGarantie'] == 'HOS') {
$valeur6A = $value1['Taux'];
}
if ($value1['codeGarantie'] == 'IMA') {
$valeur7A = $value1['Taux'];
}
if ($value1['codeGarantie'] == 'MAT') {
$valeur8A = $value1['Taux'];
}
if ($value1['codeGarantie'] == 'OPT') {
$valeur9A = $value1['Taux'];
}
if ($value1['codeGarantie'] == 'PHA') {
$valeur10A = $value1['Taux'];
}
$data1=Array(
'AUX'=>[
'color'=>[255,250,205],
'value'=>$valeur1A],
'BIO'=>[
'color'=>[255,250,205],
'value'=>$valeur2A],
'CON'=>[
'color'=>[255,250,205],
'value'=>$valeur3A],
'DEN'=>[
'color'=>[255,250,205],
'value'=>$valeur4A],
'EXA'=>[
'color'=>[255,250,205],
'value'=>$valeur5A],
'HOS'=>[
'color'=>[255,250,205],
'value'=>$valeur6A],
'IMA'=>[
'color'=>[255,250,205],
'value'=>$valeur7A],
'MAT'=>[
'color'=>[255,250,205],
'value'=>$valeur8A],
'OPT'=>[
'color'=>[255,250,205],
'value'=>$valeur9A],
'PHA'=>[
'color'=>[255,250,205],
'value'=>$valeur10A]
);
}
}
foreach($depensesFamillesB as $depensesFamillesB['codeGarantie'] => $value)
{
array_push($valeurs,$value['Taux']);
foreach($valeurs as $key =>$valeur)
{
if ($value['codeGarantie'] == 'AUX') {
$valeur1 = $value['Taux'];
}
if ($value['codeGarantie'] == 'BIO') {
$valeur2 = $value['Taux'];
}
if ($value['codeGarantie'] == 'CON') {
$valeur3 = $value['Taux'];
}
if ($value['codeGarantie'] == 'DEN') {
$valeur4 = $value['Taux'];
}
if ($value['codeGarantie'] == 'EXA') {
$valeur5 = $value['Taux'];
}
if ($value['codeGarantie'] == 'HOS') {
$valeur6 = $value['Taux'];
}
if ($value['codeGarantie'] == 'IMA') {
$valeur7 = $value['Taux'];
}
if ($value['codeGarantie'] == 'MAT') {
$valeur8 = $value['Taux'];
}
if ($value['codeGarantie'] == 'OPT') {
$valeur9 = $value['Taux'];
}
if ($value['codeGarantie'] == 'PHA') {
$valeur10 = $value['Taux'];
}
$data=Array(
'AUX'=>[
'color'=>[0,100,108],
'value'=>$valeur1],
'BIO'=>[
'color'=>[0,100,108],
'value'=>$valeur2],
'CON'=>[
'color'=>[0,100,108],
'value'=>$valeur3],
'DEN'=>[
'color'=>[0,100,108],
'value'=>$valeur4],
'EXA'=>[
'color'=>[0,100,108],
'value'=>$valeur5],
'HOS'=>[
'color'=>[0,100,108],
'value'=>$valeur6],
'IMA'=>[
'color'=>[0,100,108],
'value'=>$valeur7],
'MAT'=>[
'color'=>[0,100,108],
'value'=>$valeur8],
'OPT'=>[
'color'=>[0,100,108],
'value'=>$valeur9],
'PHA'=>[
'color'=>[0,100,108],
'value'=>$valeur10]
);
}
}
//$dataMax
$dataMax1=0;
foreach($data1 as $item1)
{
if($item1['value']>$dataMax1)
$dataMax1=$item1['value'];
}
//data step
if($dataMax1>200 and $dataMax1<600)
{
$dataStep1=20;
}
if($dataMax1<200){
$dataStep1=10;
}
if($dataMax1>1000){
$dataStep1=100;
}
$dataMax=0;
foreach($data as $item)
{
if($item['value']>$dataMax)
$dataMax=$item['value'];
}
//data step
if($dataMax>200 and $dataMax<600)
{
$dataStep=20;
}
if($dataMax<200){
$dataStep=10;
}
if($dataMax>1000){
$dataStep=100;
}
//set font, line width and color
$pdf->SetFont('Arial','',8);
$pdf->SetLineWidth(0.1);
$pdf->SetDrawColor(0);
//chart boundary
$pdf->Rect($chartX,$chartY,$chartWidth,$chartHeight);
//vertical axis line
$pdf->Line(
$chartBoxX ,
$chartBoxY ,
$chartBoxX ,
($chartBoxY+$chartBoxHeight)
);
//horizontal axis line
$pdf->Line(
$chartBoxX-2 ,
($chartBoxY+$chartBoxHeight) ,
$chartBoxX+($chartBoxWidth) ,
($chartBoxY+$chartBoxHeight)
);
///vertical axis
//calculate chart's y axis scale unit
$yAxisUnits=$chartBoxHeight/$dataMax;
$yAxisUnits1=$chartBoxHeight/$dataMax1;
//draw the vertical (y) axis labels
for($i=0 ; $i<=$dataMax1 ; $i+=$dataStep1)
{
//y position
$yAxisPos1=$chartBoxY+($yAxisUnits1*$i);
//draw y axis line
$pdf->Line(
$chartBoxX-2 ,
$yAxisPos1 ,
$chartBoxX ,
$yAxisPos1
);
//set cell position for y axis labels
$pdf->SetTextColor(255,250,205);
$pdf->SetXY($chartBoxX-$chartLeftPadding , $yAxisPos1-2);
//$pdf->Cell($chartLeftPadding-4 , 5 , $dataMax-$i , 1);---------------
$pdf->Cell($chartLeftPadding-4 , 5 , $dataMax1-$i, 0 , 0 , 'L');
}
for($i=0 ; $i<=$dataMax ; $i+=$dataStep)
{
//y position
$yAxisPos=$chartBoxY+($yAxisUnits*$i);
//draw y axis line
$pdf->Line(
$chartBoxX-2 ,
$yAxisPos ,
$chartBoxX ,
$yAxisPos
);
//set cell position for y axis labels
$pdf->SetXY($chartBoxX-$chartLeftPadding , $yAxisPos-2);
//$pdf->Cell($chartLeftPadding-4 , 5 , $dataMax-$i , 1);---------------
$pdf->SetTextColor(0,100,108);
$pdf->Cell($chartLeftPadding-2 , 5 , $dataMax-$i, 0 , 0 , 'R');
$pdf->SetTextColor(0);
}
///horizontal axis
//set cells position
$pdf->SetXY($chartBoxX , $chartBoxY+$chartBoxHeight);
//cell's width
$xLabelWidth=$chartBoxWidth / count($data);
//$pdf->Cell($xLabelWidth , 5 , $itemName , 1 , 0 , 'C');-------------
//loop horizontal axis and draw the bar
$barXPos1=0;
foreach($data1 as $itemName1=>$item1)
{
//print the label
//$pdf->Cell($xLabelWidth , 5 , $itemName , 1 , 0 , 'C');--------------
//$pdf->Cell($xLabelWidth , 5 , $itemName , 0 , 0 , 'C');
///drawing the bar
//bar color
$pdf->SetFillColor($item1['color'][0],$item1['color'][1],$item1['color'][2]);
//bar height
$barHeight=$yAxisUnits1*$item1['value'];
//bar x position
$barX1=($xLabelWidth/2)+($xLabelWidth*$barXPos1);
$barX1=$barX1-($barWidth/2);
$barX1=$barX1+$chartBoxX;
//bar y position
$barY1=$chartBoxHeight-$barHeight;
$barY1=$barY1+$chartBoxY;
//draw the bar
$pdf->Rect($barX1,$barY1,$barWidth,$barHeight,'DF');
//increase x position (next series)
$barXPos1++;
}
$barXPos=0;
//highlight_string("<?php\n\$datas =\n" . var_export($data1 , true) . ";\n>");
foreach($data as $itemName=>$item)
{
//print the label
//$pdf->Cell($xLabelWidth , 5 , $itemName , 1 , 0 , 'C');--------------
$pdf->Cell($xLabelWidth , 5 , $itemName , 0 , 0 , 'C');
///drawing the bar
//bar color
$pdf->SetFillColor($item['color'][0],$item['color'][1],$item['color'][2]);
//bar height
$barHeight=$yAxisUnits*$item['value'];
//bar x position
$barX=($xLabelWidth/2)+($xLabelWidth*$barXPos);
$barX=$barX-($barWidth/2);
$barX=$barX+$chartBoxX+5;
//bar y position
$barY=$chartBoxHeight-$barHeight;
$barY=$barY+$chartBoxY;
//draw the bar
$pdf->Rect($barX,$barY,$barWidth,$barHeight,'DF');
//increase x position (next series)
$barXPos++;
}
//axis labels
$pdf->SetFont('Arial','B',9);
$pdf->SetXY($chartX,$chartY);
$pdf->Cell(30,10,"Taux",0);
$pdf->SetXY(($chartWidth/2)-50+$chartX,$chartY+$chartHeight-($chartBottomPadding/2));
$pdf->SetXY(($chartWidth/2)-50+$chartX,$chartY+$chartHeight-($chartBottomPadding/2));
$pdf->AddPage('L'); //DEBUT FT 13
$p_factures = $this->detailsp->depensesparfamilledactesetparprestataires($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin,$p_limite);
$pdf->SetMargins(10, 10, 10) ;
$pdf->Image($_SESSION['dossierSociete'].'/Tarifs/Img/newkit4.jpg', 0, 0, 297);
$pdf->SetY(15);
$pdf->SetFont('Helvetica', 'B', 18);
$pdf->SetTextColor( 65, 185, 80 );
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->MultiCell(150, 8, convertirc(_("DÉPENSES PAR FAMILLE D'ACTES ET PAR PRESTATAIRES")), 0, 'L' );
$pdf->Ln(8);
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->SetTextColor(0);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(50, 6, convertirc(_('PÉRIODE COMPTABLE CONSIDÉRÉE').' : '.dateLang($p_datedebut, $_SESSION['lang']).' '._('AU').' '.dateLang($p_datefin, $_SESSION['lang'])), 0, 1, 'L', false);
$pdf->Ln(10);
if ($p_id!=null){
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('GARANT')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['garant'])), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('SOUSCRIPTEUR')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['souscripteur'])), 0, 1, 'L', false);
//$pdf->Cell(0, 8, convertirc(_('SOUSCRIPTEUR').' : '.$entete['souscripteur']), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('POLICE No')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['numeroPolice'].' / '.$entete['libellePolice'])), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('COURTIER')), 0, 0, 'L', false);
$pdf->Cell(0, 6, 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('Helvetica', 'BUI', 11);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('GARANT')), 0, 0, 'L', false);
$pdf->SetFont('Helvetica', 'BI', 11);
$pdf->Cell(0, 6, convertirc(_(' : '.$p_garant)), 0, 1, 'L', false);
}
$pdf->Ln(10);
$pdf->Ln(4);
$pdf->SetX(65);
$pdf->Cell(170,6,convertirc(_('DÉPENSES SUPERIEURES A').' : '.format_N($depenses).' '.$_SESSION['devise_C']),1,1,'C',false);
$pdf->Ln(2);
$hl=7;
$pdf->SetFont('Arial','B',6);
$pdf->SetFillColor(143,206,143);
$pdf->Cell(62,$hl,convertirc(_("Prestataire")),1,0,'C',true);
$pdf->Cell(15,$hl,convertirc(_('Consultation')),1,0,'C',true);
$pdf->Cell(16,$hl,convertirc(_("Imagerie")),1,0,'C',true);
$pdf->Cell(16,$hl,convertirc(_("Biologie")),1,0,'C',true);
$pdf->Cell(15,$hl,convertirc(_("Dentisterie")),1,0,'C',true);
$pdf->Cell(15,$hl,convertirc(_("Optique")),1,0,'C',true);
$pdf->Cell(15,$hl,convertirc(_("Hospitalisation")),1,0,'C',true);
$pdf->Cell(15,$hl,convertirc(_("Pharmacie")),1,0,'C',true);
$pdf->Cell(16,$hl,convertirc(_("Maternité")),1,0,'C',true);
$pdf->Cell(15,$hl,convertirc(_("# Autres.")),1,0,'C',true);
$pdf->Cell(16,$hl,convertirc(_("# Aux Med.")),1,0,'C',true);
$pdf->Cell(16,$hl,convertirc(_("Assistance")),1,0,'C',true);
$pdf->Cell(16,$hl,convertirc(_("# Trans Med.")),1,0,'C',true);
$pdf->Cell(15,$hl,convertirc(_("# Bilan.")),1,0,'C',true);
$pdf->Cell(15,$hl,convertirc(_("Totaux")),1,1,'C',true);
$total_CONSULTATION =
$total_IMAGERIE =
$total_BIOLOGIE =
$total_DENTISTERIE =
$total_OPTIQUE =
$total_HOSPITALISATION =
$total_PHARMACIE =
$total_MATERNITE =
$total_AUTRES_EXAMENS =
$total_AUXILIAIRES_MEDICAUX =
$total_ASSISTANCE =
$total_TRANSPORT_MEDICALISE =
$total_BILAN_DE_SANTE =
$total_TOTAUX = 0;
$pdf->SetFont('Arial','',6);
foreach ($p_factures as $dep)
{
$pdf->Cell(62,$hl,convertirc(substr($dep['Prestataire'],1,47)),1,0,'L',false);
$pdf->Cell(15,$hl,convertirc(format_N($dep['CONSULTATION'])),1,0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['IMAGERIE'])),1,0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['BIOLOGIE'])),1,0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($dep['DENTISTERIE'])),1,0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($dep['OPTIQUE'])),1,0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($dep['HOSPITALISATION'])),1,0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($dep['PHARMACIE'])),1,0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['MATERNITE'])),1,0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($dep['AUTRES EXAMENS'])),1,0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['AUXILIAIRES MEDICAUX'])),1,0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['ASSISTANCE'])),1,0,'C',false);
$pdf->Cell(16,$hl,convertirc(format_N($dep['TRANSPORT MEDICALISE'])),1,0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($dep['BILAN DE SANTE'])),1,0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($dep['TOTAUX'])),1,1,'C',false);
$total_CONSULTATION = $total_CONSULTATION + $dep['CONSULTATION'];
$total_IMAGERIE = $total_IMAGERIE + $dep['IMAGERIE'];
$total_BIOLOGIE = $total_BIOLOGIE + $dep['BIOLOGIE'];
$total_DENTISTERIE = $total_DENTISTERIE + $dep['DENTISTERIE'];
$total_OPTIQUE = $total_OPTIQUE + $dep['OPTIQUE'];
$total_HOSPITALISATION = $total_HOSPITALISATION + $dep['HOSPITALISATION'];
$total_PHARMACIE = $total_PHARMACIE + $dep['PHARMACIE'];
$total_MATERNITE = $total_MATERNITE + $dep['MATERNITE'];
$total_AUTRES_EXAMENS = $total_AUTRES_EXAMENS + $dep['AUTRES EXAMENS'];
$total_AUXILIAIRES_MEDICAUX = $total_AUXILIAIRES_MEDICAUX + $dep['AUXILIAIRES MEDICAUX'];
$total_ASSISTANCE = $total_ASSISTANCE + $dep['ASSISTANCE'];
$total_TRANSPORT_MEDICALISE = $total_TRANSPORT_MEDICALISE + $dep['TRANSPORT MEDICALISE'];
$total_BILAN_DE_SANTE = $total_BILAN_DE_SANTE + $dep['BILAN DE SANTE'];
$total_TOTAUX = $total_TOTAUX + $dep['TOTAUX'];
}
$pdf->SetFont('Arial','B',8);
$pdf->SetFillColor(143,206,143);
$pdf->Cell(62,$hl,convertirc("TOTAL GENERAL"),"1",0,'C',true);
$pdf->Cell(15,$hl,format_N($total_CONSULTATION),1,0,'C',true);
$pdf->Cell(16,$hl,format_N($total_IMAGERIE),1,0,'C',true);
$pdf->Cell(16,$hl,format_N($total_BIOLOGIE),1,0,'C',true);
$pdf->Cell(15,$hl,format_N($total_DENTISTERIE),1,0,'C',true);
$pdf->Cell(15,$hl,format_N($total_OPTIQUE),1,0,'C',true);
$pdf->Cell(15,$hl,format_N($total_HOSPITALISATION),1,0,'C',true);
$pdf->Cell(15,$hl,format_N($total_PHARMACIE),1,0,'C',true);
$pdf->Cell(16,$hl,format_N($total_MATERNITE),1,0,'C',true);
$pdf->Cell(15,$hl,format_N($total_AUTRES_EXAMENS),1,0,'C',true);
$pdf->Cell(16,$hl,format_N($total_AUXILIAIRES_MEDICAUX),1,0,'C',true);
$pdf->Cell(16,$hl,format_N($total_ASSISTANCE),1,0,'C',true);
$pdf->Cell(16,$hl,format_N($total_TRANSPORT_MEDICALISE),1,0,'C',true);
$pdf->Cell(15,$hl,format_N($total_BILAN_DE_SANTE),1,0,'C',true);
$pdf->Cell(15,$hl,format_N($total_TOTAUX),1,1,'C',true);
$pdf->Cell(45,$hl,convertirc(_("Légende")),0,0,'L',false);
$pdf->Ln(8);
$pdf->Cell(45,$hl,convertirc(_("Autres. = Autres Examens")),0,0,'L',false);
$pdf->Ln(5);
$pdf->Cell(45,$hl,convertirc(_("Aux Med. = Auxiliaire Médicaux")),0,0,'L',false);
$pdf->Ln(5);
$pdf->Cell(45,$hl,convertirc(_("Trans Med. = Transport Medicalisé")),0,0,'L',false);
$pdf->Ln(5);
$pdf->Cell(45,$hl,convertirc(_("Bilan. = Bilan de santé")),0,0,'L',false);
$pdf->Ln(2);
$pdf->AddPage('L');
//
$p_factures = $this->detailsp->evolutiondepfamilleAct($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin,$p_limite );
$pdf->SetMargins(10, 10, 10) ;
$pdf->Image($_SESSION['dossierSociete'].'/Tarifs/Img/newkit4.jpg', 0, 0, 297);
$pdf->SetY(15);
$pdf->SetFont('Helvetica', 'B', 18);
$pdf->SetTextColor( 65, 185, 80 );
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->MultiCell(150, 8, convertirc(_("ÉVOLUTION MENSUELLE DES DÉPENSES PAR FAMILLE D'ACTES")), 0, 'L' );
$pdf->Ln(8);
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->SetTextColor(0);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(50, 6, convertirc(_('PÉRIODE COMPTABLE CONSIDÉRÉE').' : '.dateLang($debutStat, $_SESSION['lang']).' '._('AU').' '.dateLang($finStat, $_SESSION['lang'])), 0, 1, 'L', false);
$pdf->Ln(10);
if ($p_id!=null){
$pdf->SetFont('Helvetica', 'B', 11);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('GARANT')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['garant'])), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('SOUSCRIPTEUR')), 0, 0, 'L', false);
$pdf->Cell(0, 6, convertirc(_(' : '.$entete['souscripteur'])), 0, 1, 'L', false);
//$pdf->Cell(0, 8, convertirc(_('SOUSCRIPTEUR').' : '.$entete['souscripteur']), 0, 1, 'L', false);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('POLICE No')), 0, 0, 'L', false);
$pdf->MultiCell(115, 6, convertirc(_(' : '.$entete['numeroPolice'].' / '.$entete['libellePolice'])), 0, 'L');
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('COURTIER')), 0, 0, 'L', false);
$pdf->Cell(0, 6, 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('Helvetica', 'BUI', 11);
$pdf->Cell(5, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(35, 6, convertirc(_('GARANT')), 0, 0, 'L', false);
$pdf->SetFont('Helvetica', 'BI', 11);
$pdf->Cell(0, 6, convertirc(_(' : '.$p_garant)), 0, 1, 'L', false);
}
$pdf->Ln(4);
$pdf->SetX(65);
$pdf->Cell(170,6,convertirc(_('DÉPENSES SUPÉRIEURES À').' : '.format_N($depenses).' '.$_SESSION['devise_C']),1,1,'C',false);
$pdf->Ln(8);
$hl=7;
$pdf->SetFont('Arial','B',7);
$pdf->SetFillColor(143,206,143);
$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(143,206,143);
$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);
$pdf->AddPage();
$pdf->Image($_SESSION['dossierSociete'].'/Tarifs/Img/newkit9.jpg', 0, 0, 210);
$caractere = array(" ","/");
$nomdedossier =str_replace($caractere,"_",$entete['libellePolice']);
$telephonePortable = (!empty($entete['telephonePortable']) && strlen($entete['telephonePortable']) >= 10)
? $entete['telephonePortable']
: '2250152706497';
$fichier="Temp/TMP_KIT_STATISTIQUES_FAMILLE"."_".$nomdedossier.".pdf";
if(is_file($fichier)){
$fichier="Temp/TMP_KIT_STATISTIQUES_FAMILLE"."_".$nomdedossier."_".uniqid().".pdf";
}
$pdf->Output($fichier,"F");
if(is_file($fichier)){
$fichierpdf="https://gestionnaire.vitalis-ci.com/Temp/TMP_KIT_STATISTIQUES_FAMILLE"."_".$nomdedossier.".pdf";
$caption ="Cher Assuré(e),veuillez trouver ci-joint les statistiques de votre police.";
$filename = "KIT_STATISTIQUES".dateLang($p_datedebut, $_SESSION['lang']).' '._('AU').' '.dateLang($p_datefin, $_SESSION['lang']).'.pdf';
$params=array(
'token' => '5ujfcrqcc9qykwdq',
'to' => $telephonePortable,
'filename' => $filename,
'document' => $fichierpdf,
'caption' => $caption,
'priority' => '',
'referenceId' => '',
'nocache' => '',
'msgId' => '',
'mentions' => ''
);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.ultramsg.com/instance72717/messages/document",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => http_build_query($params),
CURLOPT_HTTPHEADER => array(
"content-type: application/x-www-form-urlencoded"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
}
return($fichier);
}
}