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

258 lines
12 KiB
PHP
Executable File

<?php
require_once 'Framework/Controleurrequete.php'; // OK
require_once 'Modele/Statistique.php';
require_once 'Modele/Collegepolice.php';
require_once $_SESSION['dossierSociete'].'/Html2pdf/lib/html2pdf.php';
class ControleurAjaxstatsmaladiefichetechniquedouzepdf extends Controleur
{
private $detailsp;
public function __construct()
{
$this->detailsp = new Statistique();
$this->college = new Collegepolice();
}
public function index()
{
$idPolice = $this->requete->getParametreFormulaire("idPolice");
$idCollege = $this->requete->getParametreFormulaire("idCollege");
if( $idCollege == ""){
$idCollege = null;
}
$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 = $idCollege;
$p_id_clients = null;
$infocollege = $this->college->getCollegepoliceId($idCollege);
$_SESSION['collegeStat'] = $infocollege['libelleCollege'];
$p_factures = $this->detailsp->depensesparprestatairemedicaux($p_garant, $p_id_clients, $p_id, $p_id_college, $p_datedebut, $p_datefin);
//highlight_string("<?php\n\$datas =\n" . var_export($p_factures, true) . ";\n>");
$datas =array();
ob_start();
?>
<style type="text/css">
table {
width: 100%;
color: #000;
border-collapse: collapse;
}
h2 { margin: 0; padding: 0px; }
p { margin: 5px; }
.no-border td {
border: none;
padding: 4px 2px;
}
.border th {
border: 1px solid #000;
color: black;
background: #B6D8F2;
padding: 4px 2px;
font-weight: bold;
font-size: 12px;
text-align: center; }
.border td {
border: 1px solid #000;
font-size: 11px;
padding: 5px 4px;
text-align: center;
}
.space { padding-top: 250px; }
.45p { width: 45%; }.20p { width: 20%; }
.10p { width: 10%; } .15p { width: 15%; }
.5p { width: 5%; } .12p { width: 12%; }
.25p { width: 25%; } .50p { width: 50%; }
.60p { width: 60%; } .75p { width: 75%; }
.100p { width: 100%;}.20p { width: 20%; }
.90p { width: 90%;}.35p { width: 35%;}
.header
{
width:100%;
font-size: 10px;
}
</style>
<page backtop="15mm" backleft="5mm" backright="5mm" backbottom="10mm" footer="page;">
<page_header>
<table class="header">
<tr>
<td class="25p" style="text-align: left;font-weight: bold;">
FICHE TECHNIQUE No 12
</td>
<td class="50p" style="text-align: center;">
<img src="<?php echo($_SESSION['lienLogo']); ?>" style="width:50px;height:40px;"/>
</td>
<td class="25p" style="text-align: right;">
Edition du : <?php echo heureCouranteLang($_SESSION['lang']); ?>
</td>
</tr>
</table>
</page_header>
<page_footer>
</page_footer>
<table>
<tr >
<td class="100p" style=" border: 1px solid #000; color: black; background: #B6D8F2; padding: 5px 15px; font-weight: bold; font-size: 18px; text-align: center;">
ETAT DES DEPENSES PAR PRESTATAIRES MEDICAUX
</td>
</tr>
</table>
<p style=" margin-top: 10px; padding: 5px; font-weight: bold; font-size: 16px; text-align: center;">
<br><br>
PERIODE COMPTABLE CONSIDEREE <?php echo dateLang($debutStat, $_SESSION['lang']).' '._('AU').' '.dateLang($finStat, $_SESSION['lang']); ?>
</p>
<p style=" margin-top: 15px; font-weight: bold; font-size: 14px; text-align: left;">
<i> <?php if($p_id!=null):?>
<u>GARANT</u> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: <?php echo($entete['garant'])?> <br><br>
<u>SOUSCRIPTEUR</u>&nbsp;&nbsp; : <?php echo($entete['souscripteur'])?> <br><br>
<u>POLICE</u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: <?php echo($entete['libellePolice'])?> <br><br>
<U>COURTIER</U> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: <?php echo($entete['courtier'])?> <br><br>
<?php if($p_id_college!=null):?>
<U>COLLEGE</U> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: <?php echo($_SESSION['collegeStat'])?> <br><br>
<?php endif?>
<?php else:?>
<u>GARANT</u> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: <?php echo($p_garant)?> <br><br>
<?php endif?>
</i>
</p>
<table style="margin-top: 30px;" class="border">
<?php
$TypeP_old= "";
$total_montantFacture=
$total_apresDecompte=
$total_Coutmoyen=
$total_Taux=
$quantite = 0;
$quantite = count($p_factures);
foreach ($p_factures as $p_facture) {
$datas['Compte'] = $p_facture['Compte'];
$datas['codeeP'] = $p_facture['codeeP'];
$datas['TypeP'] = $p_facture['TypeP'];
$datas['Compte'] = $p_facture['Compte'];
$datas['Beneficiaire'] = $p_facture['Beneficiaire'];
$datas['montantFacture'] = $p_facture['montantFacture'];
$datas['apresDecompte'] = $p_facture['apresDecompte'];
$datas['Coutmoyen'] = $p_facture['Coutmoyen'];
$datas['Taux'] = $p_facture['Taux'];
$total_montantFacture= $total_montantFacture + $p_facture['montantFacture'];
$total_apresDecompte= $total_apresDecompte + $p_facture['apresDecompte'];
$total_Coutmoyen= $total_Coutmoyen + $p_facture['Coutmoyen'];
$total_Taux= $total_Taux + $p_facture['Taux'];
if ($TypeP_old!=$datas['TypeP']) {
/* if ($datas['TypeP'] != "Polyclinique") {
*/ ?>
<tr style="color: black; background: #8DC3F0;" >
<th colspan=6 style="text-align: left; font-size: 14px; background: #f1f2ff; border-right: none; border-left: none; padding: 8px;" ><?php echo($datas['TypeP']); ?></th>
</tr>
<tr>
<th class="10p">Compte</th>
<th class="45p">Prestataire médicaux</th>
<th class="12p">Montant Facture</th>
<th class="12p">Apres Décompte </th>
<th class="10p">Coût moyen</th>
<th class="10p">Taux</th>
</tr>
<thead>
<tr>
</tr>
</thead>
<?php
/* }*/
}
?>
<tbody>
<tr>
<td class="10p"><?php echo($datas['Compte']); ?></td>
<td class="45p" style="text-align: left;"><?php echo($datas['Beneficiaire']);?></td>
<td class="12p" style="text-align: right;"><?php echo(format_N($datas['montantFacture']));?></td>
<td class="12p" style="text-align: right;"><?php echo(format_N($datas['apresDecompte']));?></td>
<td class="10p"style="text-align: right;"><?php echo(format_N($datas['Coutmoyen'])); ?></td>
<td class="10p"style="text-align: right;"> <?php echo($datas['Taux']); ?>%</td>
</tr>
</tbody>
<?php
$TypeP_old=$datas['TypeP'];
}
$total_Coutmoyen = ($quantite>0) ? $total_Coutmoyen/$quantite : 0;
?>
<tr style=" font-weight: bold; font-size: 10px; border: 2px solid #000; background: #B6D8F2;">
<td colspan=2 style="text-align: left;">TOTAL GENERAL</td>
<td style="text-align: right;"><?php echo(format_N($total_montantFacture));?></td>
<td style="text-align: right;"><?php echo(format_N($total_apresDecompte)); ?></td>
<td style="text-align: right;"><?php echo(format_N($total_Coutmoyen)); ?></td>
<td style="text-align: right;"><?php echo(format_N($total_Taux)); ?>%</td>
</tr>
</table>
</page>
<?php
$content = ob_get_clean();
try {
// $pdf->setTestIsImage(false);
$pdf = new HTML2PDF("p", "A4", "fr");
$pdf->pdf->SetAuthor('Vitalissanté');
$pdf->pdf->SetSubject('Etat des dépenses par prestataires médicaux');
$pdf->pdf->SetKeywords('HTML2PDF, ETATSTATS, PHP');
$pdf->writeHTML($content);
$fichier="Temp/TMP_CUMUL_SP_FICHE12"."_".uniqid().".pdf";
$pdf->Output($fichier, "F");
$pdf->pdf->SetTitle($fichier);
$t_html =' <div id ="div_export_a" class="alert alert-info"> ';
$t_html .=' <a style="font-size:15pt;" href="'.$fichier.'" target="_blank" > TELECHARGER </a> ';
$t_html .=' </div> ';
echo $t_html;
} catch (HTML2PDF_exception $e) {
die($e);
}
}
}
?>