detailsp = new Statistique(); } public function index() { $idPolice = $this->requete->getParametreFormulaire("idPolice"); $debutStat = $this->requete->getParametreDate("debutStat"); $finStat = $this->requete->getParametreDate("finStat"); $codeGcAssureur = $this->requete->getParametreFormulaire("codeGcAssureur"); if($idPolice== ''){ $idPolice = null; } $_SESSION['debutStat'] = $debutStat; $_SESSION['finStat'] = $finStat; $entete = $this->detailsp->detailrapportspperiodepdfentete($idPolice); $p_datedebut = $_SESSION['debutStat']; $p_datefin =$_SESSION['finStat']; $p_garant = $codeGcAssureur; $p_id = $idPolice; $p_id_college = null; $p_id_clients = null; $depensesFamillesA = $this->detailsp->etatcomparatifdesdepensesA($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin); //highlight_string(""); //die(); $depensesFamillesB = $this->detailsp->etatcomparatifdesdepensesB($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin); $pdf = new FPDF_Protection(); $pdf->SetAuthor('EBENE SOLUTIONS INFORMATIQUES'); $userPassword = ''; $ownerPassword = null; $pdf->SetProtection(['print'], $userPassword, $ownerPassword); $pdf->AliasNbPages(); $pdf->AddPage(); ///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// $pdf->SetMargins(10, 10, 10) ; $pdf->Image($_SESSION['lienLogo'],94,3,15); $pdf->SetFont('Arial','B',7); $pdf->Cell(0,5,convertirc(_('FICHE TECHNIQUE No 11')),0,1,'L',false); $pdf->SetY(10); $pdf->SetFont('Arial','',7); $pdf->Cell(0,5,convertirc(_('Edition du').': '.heureCouranteLang($_SESSION['lang'])),0,1,'R',false); $pdf->Ln(2); $pdf->SetFont('Arial','B',13); $pdf->SetFillColor(182,216,242); $pdf->Cell(0,8,convertirc(_("ETAT DES DEPENSES PAR FAMILLE D'ASSURES")),1,0,'C',true); $pdf->Ln(6); $pdf->SetFont('Arial', 'B', 11); $pdf->SetTextColor(0); $pdf->Ln(6); $pdf->Cell(0, 6, convertirc(_('PERIODE COMPTABLE CONSIDEREE').' : '.dateLang($debutStat, $_SESSION['lang']).' '._('AU').' '.dateLang($finStat, $_SESSION['lang'])), 0, 1, 'C', false); if ($p_id!=null){ $pdf->Ln(6); $pdf->SetFont('Arial', 'BUI', 11); $pdf->Cell(35, 8, convertirc(_('GARANT').': '), 0, 0, 'L', false); $pdf->SetFont('Arial', 'BI', 11); $pdf->Cell(0, 8, convertirc($entete['garant']), 0, 1, 'L', false); $pdf->SetFont('Arial', 'BUI', 11); $pdf->Cell(35, 8, convertirc(_('SOUSCRIPTEUR').': '), 0, 0, 'L', false); $pdf->SetFont('Arial', 'BI', 11); $pdf->Cell(0, 8, convertirc($entete['souscripteur']), 0, 1, 'L', false); //$pdf->Cell(0, 8, convertirc(_('SOUSCRIPTEUR').' : '.$entete['souscripteur']), 0, 1, 'L', false); $pdf->SetFont('Arial', 'BUI', 11); $pdf->Cell(35, 8, convertirc(_('POLICE No').': '), 0, 0, 'L', false); $pdf->SetFont('Arial', 'BI', 11); $pdf->Cell(0, 8, convertirc($entete['numeroPolice'].' / '.$entete['libellePolice']), 0, 1, 'L', false); $pdf->SetFont('Arial', 'BUI', 11); $pdf->Cell(35, 8, convertirc(_('COURTIER').': '), 0, 0, 'L', false); $pdf->SetFont('Arial', 'BI', 11); $pdf->Cell(0, 8, convertirc($entete['courtier']), 0, 1, 'L', false); // $pdf->Cell(0, 6, convertirc(_('COURTIER').' : '.$entete['courtier']), 0, 1, 'L', false); }else{ $pdf->Ln(6); $pdf->SetFont('Arial', 'BUI', 11); $pdf->Cell(35, 8, convertirc(_('GARANT').': '), 0, 0, 'L', false); $pdf->SetFont('Arial', 'BI', 11); $pdf->Cell(0, 8, convertirc($p_garant), 0, 1, 'L', false); } $pdf->Ln(2); $hl=7; $pdf->SetFont('Arial','BU',10); $pdf->Cell(190,$hl,convertirc(_('Comparaison des dépenses de l\'année 2021 et l\'année 2022')),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_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_quantiteA = 0; $total_tauxA = 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(format_N($depA['Taux'])),1,1,'C',false); $total_quantiteA = $total_quantiteA + $depA['Quantite']; $total_montantRembourseA = $total_montantRembourseA + $depA['MontantRembourse']; $total_coutMoyenA = ($total_quantiteA>0) ? $total_montantRembourseA / $total_quantiteA : 0; $total_tauxA = $total_tauxA + $dep['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($total_tauxA),1,0,'C',true); $pdf->SetY(89); $total_quantite = 0; $total_taux = 0; 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>0) ? $total_montantRembourse / $total_quantite : 0; $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($total_taux),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 2021 et l\'année 2022')),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; $valeur10=0; $value=0; $v=0; $valeur0A=0; $valeur1A=0; $valeur2A=0; $valeur3A=0; $valeur4A=0; $valeur5A=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($data 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($data 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(""); 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->Cell(100,5,convertirc(_("Récapitulatif des dépenses par famille d'acte")),0,0,'C'); ////////////////////////// $fichier="Temp/TMP_CUMUL_SP_FICHE11"."_".uniqid().".pdf"; $pdf->Output($fichier,"F"); $t_html ='