332 lines
16 KiB
PHP
Executable File
332 lines
16 KiB
PHP
Executable File
<?php
|
|
require_once 'Framework/Controleurrequete.php'; // OK
|
|
require_once 'Modele/Facture.php';
|
|
|
|
require_once $_SESSION['p_dossierSociete'].'/Html2pdf/lib/html2pdf.php';
|
|
|
|
class ControleurAjaximprimerfacturedefinitive extends Controleurrequete
|
|
{
|
|
private $facture;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->facture = new Facture();
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
$idFacture = $this->requete->getParametre("idFacture");
|
|
|
|
$entete = $this->facture->consulterfacturefacture($idFacture);
|
|
|
|
$prestations = $this->facture->consulterfactureprestationactes($idFacture);
|
|
|
|
$medicaments = $this->facture->consulterfacturemedicaments($idFacture);
|
|
|
|
$detfeuilleMaladies = $this->facture->getdetfeuilleMaladie($idFacture); ////////////
|
|
|
|
$feuilleMaladie =0;
|
|
foreach($detfeuilleMaladies as $detfeuilleMaladie){
|
|
|
|
}
|
|
$feuilleMaladie = $detfeuilleMaladie['numeroFeuilleMaladie'];
|
|
// $motifsententes = $this->facture->getmotifententeprealable($feuilleMaladie);
|
|
|
|
//highlight_string("<?php\n\$data =\n" . var_export($_SESSION, true) . ";\n>");
|
|
//highlight_string("<?php\n\$data =\n" . var_export($prestations['depassement'], true) . ";\n>");
|
|
//highlight_string("<?php\n\$data =\n" . var_export($detfeuilleMaladies, true) . ";\n>");
|
|
|
|
$factures = $prestations;
|
|
|
|
//highlight_string("<?php\n\$data =\n" . var_export($depassement, true) . ";\n>");
|
|
|
|
$datas =array();
|
|
ob_start();
|
|
?>
|
|
<style type="text/css">
|
|
table {
|
|
width: 100%;
|
|
color: #000;
|
|
border-collapse: collapse;
|
|
font-size: 16px;
|
|
}
|
|
h2 { margin: 0; padding: 0px; }
|
|
p { margin: 5px; }
|
|
.no-border td {
|
|
border: none;
|
|
padding: 6px 8px;
|
|
font-size: 16px;
|
|
}
|
|
.border th {
|
|
border: 1px solid #000;
|
|
color: black;
|
|
background: #dcdcdc;
|
|
padding: 5px 5px;
|
|
font-weight: bold;
|
|
font-size: 12px;
|
|
text-align: center; }
|
|
.border td {
|
|
border: 1px solid #000;
|
|
font-size: 11px;
|
|
padding: 4px 2px;
|
|
text-align: center;
|
|
}
|
|
.space { padding-top: 250px; }
|
|
.45p { width: 45%; }.20p { width: 20%; }.30p { width: 30%; }.36p { width: 36%; }
|
|
.10p { width: 10%; } .15p { width: 15%; }.40p { width: 40%; } .52p { width: 52%; }
|
|
.5p { width: 5%; } .12p { width: 12%; }.17p { width: 17%; }.11p { width: 11%; }
|
|
.25p { width: 25%; } .50p { width: 50%; }.42p { width: 42%; }
|
|
.60p { width: 60%; } .75p { width: 75%; }
|
|
.100p { width: 100%;}.22p { width: 22%; }.28p { width: 28%; }
|
|
.90p { width: 90%;}.46p { width: 46%; }.80p { width: 80%; }
|
|
.header
|
|
{
|
|
width:100%;
|
|
font-size: 9px;
|
|
}
|
|
</style>
|
|
<page backtop="20mm" backleft="5mm" backright="5mm" backbottom="10mm" footer="page;">
|
|
<page_header>
|
|
<table class="header">
|
|
<tr>
|
|
<td class="25p" style="text-align: left;font-weight: bold;">
|
|
|
|
</td>
|
|
<td class="50p" style="text-align: center;">
|
|
<img src="<?php echo($_SESSION['p_dossierLogo']); ?>" style="width:77px;height:60px;"/>
|
|
</td>
|
|
<td class="25p" style="text-align: right;">
|
|
<?= _("Edition du").": " ?> <?php echo heureCouranteLang($_SESSION['p_lang']); ?>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</page_header>
|
|
<page_footer>
|
|
|
|
</page_footer>
|
|
<table>
|
|
<tr >
|
|
<td class="10p" style="text-align: left; border-right: 1px solid #000; ">
|
|
</td>
|
|
<td class="80p" style=" border: 1px solid #000; color: black; padding: 5px 15px; font-weight: bold; font-size: 24px; text-align: center;">
|
|
<?= _("Prise en charge").": " ?> <?php echo $entete['idFacture'] ;?><br>
|
|
<?php echo strtoupper( $_SESSION['p_prestataire_C']) ;?>
|
|
</td>
|
|
<td class="10p" style="text-align: right;">
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<p style=" margin-top: 30px; font-weight: bold; font-size: 14px; text-align: left;">
|
|
|
|
</p>
|
|
<table class="no-border">
|
|
<tr>
|
|
<td class="20p" style="">
|
|
<?= _("Souspcripteur")?>
|
|
</td>
|
|
<td class="60p" style="color: black; text-align: left;">
|
|
: <?php echo $entete['souscripteur'] ;?>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="20p" style="">
|
|
<?= _("Adhérent")?>
|
|
</td>
|
|
<td class="60p" style="color: black; text-align: left;">
|
|
: <?php echo ($entete['numeroAdherent']." / ".$entete['adherent']); ?>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="20p" style="font-weight: bold;">
|
|
<?= _("Patient")?>
|
|
</td>
|
|
<td class="60p" style="color: black; font-weight: bold; text-align: left;">
|
|
: <u> <?php echo ($entete['numeroBeneficiaire']." / ".$entete['beneficiaire']);?></u>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table class="no-border">
|
|
<tr>
|
|
<td class="25p" >
|
|
<?= _("Genre")?>
|
|
</td>
|
|
<td class="20p" style="color: black; font-weight: bold; ext-align: left;">
|
|
: <?php echo ( $detfeuilleMaladie['Sexe']) ;?>
|
|
</td>
|
|
<td class="15p" style=" text-align: center;">
|
|
<?= _("Né(e) le")?>
|
|
</td>
|
|
<td class="20p" style="font-weight: bold; text-align: left;">
|
|
<?php echo ( dateLang($detfeuilleMaladie['dateNaissance'])); ?>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="25p">
|
|
<?= _("Numéro de Bon")?>
|
|
</td>
|
|
<td class="20p" style="color: black; font-weight: bold; text-align: left;">
|
|
: <u> <?php echo ( $detfeuilleMaladie['numeroBonConsultation']) ;?></u>
|
|
</td>
|
|
<td class="5p" style="font-weight: bold;">
|
|
|
|
</td>
|
|
<td class="30p" style="font-weight: bold; text-align: left;">
|
|
/ <?= _("Numéro Dossier")?> : <u> <?php echo ( $detfeuilleMaladie['numeroFeuilleMaladie']); ?></u>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan=4 style="font-weight: bold;">
|
|
<?= _("Taux de couverture").": " ?> <?php echo (taux_couverture($entete['tm'])); ?>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<table style="margin-top: 15px;" class="border">
|
|
<thead>
|
|
<tr>
|
|
<th rowspan=2 class="10p">Date</th>
|
|
<th rowspan=2 class="11p"><?= _("Type acte")?></th>
|
|
<th rowspan=2 class="42p"><?= _("Acte")?></th>
|
|
<th rowspan=2 class="5p"><?= _("Nbre")?></th>
|
|
<th rowspan=2 class="12p"><?= _("Montant acte")?></th>
|
|
<th colspan=2 ><?= _("Net à payer")?></th>
|
|
</tr>
|
|
<tr>
|
|
<th class="10p"><?= _("TM")?></th>
|
|
<th class="10p"># <?= _("Dépas")?></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
$fraisReel = "0";
|
|
$aPayerTotal = "0";
|
|
|
|
foreach ($factures as $v){
|
|
//highlight_string("<?php\n\$data =\n" . var_export($v, true) . ";\n>");
|
|
if (isset($_SESSION['p_lang']) && $_SESSION['p_lang']=="en_US")
|
|
{
|
|
$libelleActe = $v['libelleActeEng'];
|
|
|
|
}else{
|
|
|
|
$libelleActe = $v['libelleActe'];
|
|
}
|
|
|
|
if ($v['depassement'] > "0")
|
|
{
|
|
$aPayer = $v['montantTm'] + $v['depassement'];
|
|
}else{
|
|
$aPayer = $v['montantTm'];
|
|
}
|
|
?>
|
|
<tr>
|
|
<td class="10p"><?php echo(dateLang($v['datePrestation'],$_SESSION['p_lang']));?></td>
|
|
<td class="10p"><?php echo($v['codeTypePrestation']);?></td>
|
|
<td style="text-align: left;" class="42p"><?php echo($libelleActe);?></td>
|
|
<td class="5p"><?php echo($v['quantite']);?></td>
|
|
<td style="text-align: right;"class="12p"><?php echo(format_N($v['fraisReel']));?></td>
|
|
<td class="10p"><?php echo(format_N($v['montantTm']));?></td>
|
|
<td class="10p"><?php echo(format_N($v['depassement']));?></td>
|
|
</tr>
|
|
<?php
|
|
$fraisReel += ($v['fraisReel']);
|
|
$aPayerTotal += ($v['montantTm'] + $v['depassement']);
|
|
}
|
|
?>
|
|
<tr style=" font-weight: bold; font-size: 10px; border: 2px solid #000; ">
|
|
<td colspan=4 style="text-align: center;">Total</td>
|
|
<td style="text-align: right;"><?php echo(format_N($fraisReel)); ?></td>
|
|
<td colspan=2 ><?php echo(format_N( $aPayerTotal)); ?></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<table style="margin-top: 15px;" class="border">
|
|
<thead>
|
|
<tr>
|
|
<th colspan=4 ><?= _("Instructions Particulières")?></th>
|
|
</tr>
|
|
<tr>
|
|
<th class="36p"><?= _("Acte")?></th>
|
|
<th class="52p">Instructions</th>
|
|
<th class="12p"><?= _("Réponse")?></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($factures as $v)
|
|
{
|
|
if (isset($_SESSION['p_lang']) && $_SESSION['p_lang']=="en_US")
|
|
{
|
|
$libelleActe = $v['libelleActeEng'];
|
|
|
|
}else{
|
|
|
|
$libelleActe = $v['libelleActe'];
|
|
}
|
|
if ($v['ententePrealable']>0){
|
|
$motifsententes = $this->facture->getmotifententeprealablenew($feuilleMaladie,$v['codeActe']);
|
|
$beneficiaire = $entete['numeroBeneficiaire'];
|
|
// $plafondacte = $this->facture->getplafondacte($beneficiaire,$v['codeActe']);
|
|
?>
|
|
<tr>
|
|
<td style="text-align: left;" class="36p"><?php echo($motifsententes['libelleActe']); ?></td>
|
|
<td class="52p"><?php echo($motifsententes['motifReel']); ?></td>
|
|
<td class="12p"><?php echo($motifsententes['reponsentEnteprealable']); ?></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
|
|
<table class="no-border" style="font-size: 14px; margin-top: 10px;" >
|
|
<tr>
|
|
<td class="22p"style="">
|
|
<?= _("Part Assurance").": " ?>
|
|
</td>
|
|
<td class="28p"style="color: black; font-weight: bold; text-align: left;">
|
|
<u><?php echo(format_N($fraisReel-$aPayerTotal)); ?></u>
|
|
</td>
|
|
<td class="20p" style="">
|
|
<?= _("Part Assuré").": " ?>
|
|
</td>
|
|
<td class="30p" style="color: black; font-weight: bold; text-align: left;">
|
|
<u> <?php echo(format_N($aPayerTotal)); ?></u>
|
|
</td>
|
|
|
|
</tr>
|
|
</table>
|
|
<p style=" margin-top: 10px;font-size: 18px; font-weight: bold; text-align: center;" ><?= _("Montant de la prise en charge").": " ?></p>
|
|
<table class="border">
|
|
<tr>
|
|
<td style="padding: 10px 15px; font-size: 18px; font-style: italic;" class="100p"><?php echo(convetirEnLettre($fraisReel-$aPayerTotal, $_SESSION['p_lang'])." ".$_SESSION['p_devise_C']);?></td>
|
|
</tr>
|
|
</table>
|
|
</page>
|
|
<?php
|
|
|
|
$content = ob_get_clean();
|
|
try {
|
|
|
|
// $pdf->setTestIsImage(false);
|
|
$pdf = new HTML2PDF("p", "A4", "fr");
|
|
$pdf->pdf->SetAuthor('INTER-SANTE');
|
|
$pdf->pdf->SetSubject('Facture Definitive');
|
|
$pdf->pdf->SetKeywords('HTML2PDF, ETATSTATS, PHP');
|
|
$pdf->writeHTML($content);
|
|
$fichier="Temp/TMP_FACTURE_DEFINITIVE"."_".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);
|
|
}
|
|
|
|
}
|
|
}
|
|
?>
|