prestation/Controleur/ControleurAjaximprimerfacturehospitalisation.php
2025-12-01 18:54:33 +00:00

850 lines
31 KiB
PHP

<?php
require_once 'Framework/Controleurrequete.php'; // OK
//require_once 'Framework/dompdf/autoload.inc.php';
require_once 'Modele/Detailtarifacte.php';
require_once 'Modele/Prestationactes.php';
require_once 'Modele/Feuillemaladie.php';
require_once 'Modele/Prescription.php';
require_once 'Modele/Garantiesbaremepriseencharge.php';
class ControleurAjaximprimerfacturehospitalisation extends Controleurrequete
{
private $acte;
private $prestation;
private $familleacte;
private $prescription;
private $feuillemaladie;
private $garantie;
public function __construct()
{
$this->prestation = new Prestationactes();
$this->prescription = new Prescription();
$this->feuillemaladie = new Feuillemaladie();
$this->garantie = new Garantiesbaremepriseencharge();
$this->acte = new Detailtarifacte();
}
public function index()
{
$codeGarantie = "HOS";
$numeroFeuilleMaladie = $_SESSION['p_numeroFeuilleMaladie_C'];
$codePrestataire = $_SESSION['p_codePrestataire_C'];
$datePrestation = $_SESSION['datePrestation'];
$idBeneficiaire = $_SESSION['p_idBeneficiaire_C'];
$this->garantie->getsourcebaremegarantienew($idBeneficiaire, $codeGarantie, $datePrestation);
$nomForm = $this->requete->getParametreFormulaire("nomForm");
if($nomForm == "facturepartielle"){
$this->prestation->selectionnertoushospit($numeroFeuilleMaladie, $codePrestataire);
}
$feuillemaladie = $this->feuillemaladie->getfeuillemaladie($numeroFeuilleMaladie);
$dateFinDerniereProlongation = $this->feuillemaladie->getDateFinDerniereProlongation();
$tMGarantie = $_SESSION['p_bareme']['bareme_ticketModerateur'];//$this->prescription->ticketModerateurGarantieBeneficiaire($codeGarantie);
$tauxCouverture = $this->prescription->tauxCouverture($tMGarantie);
$listeProlongations = $this->feuillemaladie->getListeProlongations($numeroFeuilleMaladie);
$hospit_total = $this->prestation->gethospitalisation_total($numeroFeuilleMaladie);
$prestations = $this->prestation->getactesmedicauxhospitalisationimpression($numeroFeuilleMaladie, $codePrestataire);
$prestations_total = $this->prestation->getactesmedicauxhospitalisation_total($numeroFeuilleMaladie, $codePrestataire);
$actVisible = $_SESSION['p_actVisible'];
$dateDebutHospit = $feuillemaladie['dateDebutHospit'];
$dureeHospit = $feuillemaladie['dureeHospit'];
$dureeCorrigeeHospit = $feuillemaladie['dureeCorrigeeHospit'];
$dateFinHospit = $feuillemaladie['dateFinHospit'];
$prolongationHospit = $feuillemaladie['prolongationHospit'];
$dateDebutPrologation = $feuillemaladie['dateDebutPrologation'];
$dureeProlongation = $feuillemaladie['dureeProlongation'];
$dureeCorrigeeProlongation = $feuillemaladie['dureeCorrigeeProlongation'];
$dateFinProlongation = $feuillemaladie['dateFinProlongation'];
$numeroChambreProlongation = $feuillemaladie['numeroChambreProlongation'];
$motifHospitalisation = $feuillemaladie['motifHospitalisation'];
$instructionHospit = $feuillemaladie['instructionHospit'];
$idProlongationFeuille = $feuillemaladie['idProlongation'];
$noChambre = $feuillemaladie['numeroChambre'];
$optionHospitalisation = $feuillemaladie['optionHospitalisation'];
$codeActeHospitalisation = ($optionHospitalisation=="option-1") ? "HHM" : "HHC";
if(isset($dateFinDerniereProlongation) || !empty($dateFinDerniereProlongation)){
$dateFinHospit = $dateFinDerniereProlongation;
}
//var_dump($idProlongationFeuille);
if (isset($_SESSION['p_lang']) && $_SESSION['p_lang']=="en_US")
{
$subtypeHospit = ($optionHospitalisation=="option-1") ? "Medical" : "Surgical";
}
else
{
$subtypeHospit = ($optionHospitalisation=="option-1") ? "Médicale" : "Chirurgicale";
}
$pdf = new FPDF_Protection();
$pdf->SetAuthor('EBENE SOLUTIONS INFORMATIQUES');
$userPassword = '';
$ownerPassword = null;
$pdf->SetProtection(['print'], $userPassword, $ownerPassword);
$pdf->AliasNbPages();
$pdf->AddPage();
$ht=8;
$hl=5;
$pdf->SetMargins(10, 10, 10) ;
$pdf->Image($_SESSION['p_lienLogo'],94,3,18);
$pdf->Ln(2);
$pdf->SetFont('Arial','', 7);
$pdf->Cell(0,$ht,convertirc(_('Edité le')." ".heureCouranteLang($_SESSION['p_lang'])),0,1,'R',false);
$pdf->SetFont('Arial','B', 18);
$pdf->Cell(0,$ht,convertirc(_("FACTURE")." No: FAC/".$feuillemaladie['numeroFeuilleMaladie']."/".$codeActeHospitalisation."/".$feuillemaladie['numeroBonHospitalisation']),'TLBR',1,'C',false);
$pdf->Ln(5);
$pdf->SetFont('Arial','', 10);
$pdf->Cell(30,$ht,convertirc(_('Souscripteur')),0,0,'L',false);
$pdf->Cell(45,$ht,convertirc(" : ".substr($_SESSION['p_nomClient_C'],0,34)),0,0,'L',false);
$pdf->Cell(35);
$pdf->Cell(20,$ht,convertirc(_('Bon No')),'TL',0,'L',false);
$pdf->Cell(60,$ht,convertirc(" : ".$feuillemaladie['numeroBonHospitalisation']),'TR',1,'L',false);
$pdf->Cell(30,$ht,convertirc(_('Adhérent')),0,0,'L',false);
$pdf->Cell(45,$ht,convertirc(" : ".$_SESSION['p_numeroAdherent_C']." / ".substr($_SESSION['p_adherent_C'],0,23)),0,0,'L',false);
$pdf->Cell(35);
$pdf->Cell(20,$ht,convertirc(_('Type hospit.')),'L',0,'L',false);
$pdf->Cell(60,$ht,convertirc(" : ".$subtypeHospit),'R',1,'L',false);
//substr($libelleActe,0,30)
$pdf->SetFont('Arial','BU', 10);
$pdf->Cell(30,$ht,convertirc(_('Patient')),0,0,'L',false);
$pdf->Cell(45,$ht,convertirc(" : ".$_SESSION['p_numeroBeneficiaire_C']." / ".substr($_SESSION['p_beneficiaire_C'],0,20)),0,0,'L',false);
$pdf->SetFont('Arial','', 10);
$pdf->Cell(35);
$pdf->Cell(20,$ht,convertirc(_('Entré(e) le')),'L',0,'L',false);
$pdf->Cell(60,$ht,convertirc(" : ".datefr($dateDebutHospit)),'R',1,'L',false);
$pdf->SetFont('Arial','', 10);
$pdf->Cell(30,$ht,convertirc(_('Lien de parenté')),0,0,'L',false);
$pdf->Cell(35,$ht,convertirc(" : ".$_SESSION['p_lienparente_C']),0,0,'L',false);
$pdf->SetFont('Arial','', 10);
$pdf->Cell(10,$ht,convertirc(_('Genre')),0,0,'L',false);
$pdf->Cell(10,$ht,convertirc(" : ".$_SESSION['p_sexe_C']),0,0,'L',false);
$pdf->Cell(25);
$pdf->Cell(20,$ht,convertirc(_('Sorti(e) le')),'L',0,'L',false);
$pdf->Cell(60,$ht,convertirc(" : ".datefr($dateFinHospit)),'R',1,'L',false);
$pdf->Cell(31,$ht,convertirc(_('Né(e) le')),0,0,'L',false);
$pdf->Cell(45,$ht,convertirc(": ".dateLang($_SESSION['p_dateNaissance_C'])),0,0,'L',false);
$pdf->Cell(34);
$pdf->Cell(20,$ht,convertirc(_('Chambre')),'LB',0,'L',false);
$pdf->Cell(60,$ht,convertirc(" : ".$noChambre),'BR',1,'L',false);
$pdf->SetFont('Arial','BU', 10);
$pdf->Cell(30,$ht,convertirc(_('Prise en charge')),0,0,'L',false);
$pdf->Cell(5,$ht,convertirc(" : ".$tauxCouverture),0,0,'L',false);
$pdf->Ln(10);
///////////////////////////////////////////////////////
$pdf->SetFont('Arial','B', 7);
$pdf->SetFillColor(223, 232, 247);
$pdf->Cell(50,$ht,convertirc(_("Libellé de l'acte")),'TLBR',0,'C',true);
$pdf->SetFillColor(223, 232, 247);
$pdf->Cell(15,$ht,convertirc(_("Réclamé")),'TBLR',0,'C',true);
$pdf->SetFillColor(223, 232, 247);
$pdf->Cell(15,$ht,convertirc(_("Appliqué")),'TBLR',0,'C',true);
$pdf->SetFillColor(223, 232, 247);
$pdf->Cell(10,$ht,convertirc(_("Nb/Qt")),'TBLR',0,'C',true);
$pdf->SetFillColor(223, 232, 247);
$pdf->Cell(20,$ht,convertirc(_("Tot Réclamé")),'TBLR',0,'C',true);
$pdf->SetFillColor(223, 232, 247);
$pdf->Cell(20,$ht,convertirc(_("Tot Appliqué")),'TBLR',0,'C',true);
$pdf->SetFillColor(223, 232, 247);
$pdf->Cell(20,$ht,convertirc(_("TM")),'TBLR',0,'C',true);
$pdf->SetFillColor(223, 232, 247);
$pdf->Cell(20,$ht,convertirc(_("A Remb")),'TBLR',0,'C',true);
$pdf->SetFillColor(223, 232, 247);
$pdf->Cell(20,$ht,convertirc(_("Dépas")),'TBLR',1,'C',true);
foreach ($prestations as $prestation){
$idPrestationactes = $prestation['id'];
$supprimable = $prestation['supprimable'];
$codeTypePrestation = $prestation['codeTypePrestation'];
$ententePrealable = $prestation['ententePrealable'];
$autorisation = $prestation['autorisation'];
$codeTarifActe = $prestation['codeTarifActe'];
$libelleConsommable = $prestation['libelleConsommable'];
if (isset($_SESSION['p_lang']) && $_SESSION['p_lang']=="en_US")
{
$libelleActe = $prestation['libelleActeEng'];
}
else
{
$libelleActe = $prestation['libelleActe'];
}
$codeActe = $prestation['codeActe'];
if($codeActe == "CSM"){
$libelleActe = $libelleConsommable;
}
if($actVisible!="1")
{
$libelleActe = $codeActe;
}
$valeurActe = $prestation['valeurActe'];
$plafondActe = $prestation['plafondActe'];
$valeurActeManuel = $prestation['valeurActeManuel'];
if($valeurActeManuel == "0" ){
$valeurActeManuel = $prestation['prixPrestataire'];
}
$pdf->SetFont('Arial','', 7);
$pdf->Cell(50,$hl,convertirc(substr($libelleActe,0,30)),'LBR',0,'L',false);
$pdf->Cell(15,$hl,convertirc(format_N($valeurActeManuel)),'BR',0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($valeurActe)),'BR',0,'C',false);
$pdf->Cell(10,$hl,convertirc($prestation['quantite']),'BR',0,'C',false);
$pdf->Cell(20,$hl,convertirc(format_N($prestation['prixManuel'])),'BR',0,'C',false);
$pdf->Cell(20,$hl,convertirc(format_N($prestation['fraisReel'])),'BR',0,'C',false);
$pdf->Cell(20,$hl,convertirc(format_N($prestation['montantTm'])),'BR',0,'C',false);
$pdf->Cell(20,$hl,convertirc(format_N($prestation['montantArembourser'])),'BR',0,'C',false);
$pdf->Cell(20,$hl,convertirc(format_N($prestation['depassement'])),'BR',1,'C',false);
}
if ($prolongationHospit=="1"){
$pdf->SetFont('Arial','B', 9);
$pdf->Cell(90,$ht,convertirc(_("Sous-total")),1,0,'C',false);
$pdf->Cell(20,$ht,convertirc(format_N($prestations_total['totalPrixManuel'])),'BR',0,'C',false);
$pdf->Cell(20,$ht,convertirc(format_N($prestations_total['fraisReel'])),'BR',0,'C',false);
$pdf->Cell(20,$ht,convertirc(format_N($prestations_total['montantTm'])),'BR',0,'C',false);
$pdf->Cell(20,$ht,convertirc(format_N($prestations_total['montantArembourser'])),'BR',0,'C',false);
$pdf->Cell(20,$ht,convertirc(format_N($prestations_total['depassement'])),'BR',1,'C',false);
$i = 0;
foreach ($listeProlongations as $v){
$idProlongation =$v['id'];
$prolongations = $this->prestation->getactesmedicauxhospitalisationprolongationimpression($idProlongation);
$prolongations_total = $this->prestation->getactesmedicauxhospitalisationprolongation_total($idProlongation);
if (isset($_SESSION['p_lang']) && $_SESSION['p_lang']=="en_US")
{
$typeHospit = $v['typeHospitEng'];
}
else
{
$typeHospit = $v['typeHospit'];
}
$i++;
$pdf->SetFont('Arial','U', 10);
//$pdf->SetFillColor(200, 238, 200);
$pdf->Cell(30,$ht,convertirc(_('Prorogation : '.$i)),'TLB',0,'L',false);
$pdf->Cell(70,$ht,convertirc(substr($typeHospit,23,50)),'TB',0,'C',false);
$pdf->Cell(30,$ht,convertirc(" du : ".datefr($v['debut'])),'TB',0,'L',false);
$pdf->Cell(30,$ht,convertirc(" au : ".datefr($v['fin'])),'TB',0,'L',false);
$pdf->Cell(30,$ht,convertirc(" Chambre : ".$v['numeroChambre']),'TBR',1,'L',false);
foreach ($prolongations as $prolongation){
$libelleConsommablePro = $prolongation['libelleConsommable'];
if (isset($_SESSION['p_lang']) && $_SESSION['p_lang']=="en_US")
{
$libelleActePro = substr($prolongation['libelleActeEng'],0,57);
}
else
{
$libelleActePro = substr($prolongation['libelleActe'],0,57);
}
$codeActePro = $prolongation['codeActe'];
if($codeActePro == "CSM"){
$libelleActePro = substr($libelleConsommablePro,0,57);
}
if($actVisible!="1")
{
$libelleActePro = $codeActePro;
}
$valeurActePro = $prolongation['valeurActe'];
$valeurActeManuelPro = $prolongation['valeurActeManuel'];
if($valeurActeManuel == "0" ){
$valeurActeManuelPro = $prolongation['prixPrestataire'];
}
$pdf->SetFont('Arial','', 7);
$pdf->Cell(50,$hl,convertirc(substr($libelleActePro,0,30)),'LBR',0,'L',false);
$pdf->Cell(15,$hl,convertirc(format_N($valeurActeManuelPro)),'BR',0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($valeurActePro)),'BR',0,'C',false);
$pdf->Cell(10,$hl,convertirc($prolongation['quantite']),'BR',0,'C',false);
$pdf->Cell(20,$hl,convertirc(format_N($prolongation['prixManuel'])),'BR',0,'C',false);
$pdf->Cell(20,$hl,convertirc(format_N($prolongation['fraisReel'])),'BR',0,'C',false);
$pdf->Cell(20,$hl,convertirc(format_N($prolongation['montantTm'])),'BR',0,'C',false);
$pdf->Cell(20,$hl,convertirc(format_N($prolongation['montantArembourser'])),'BR',0,'C',false);
$pdf->Cell(20,$hl,convertirc(format_N($prolongation['depassement'])),'BR',1,'C',false);
}
$pdf->SetFont('Arial','B', 9);
$pdf->Cell(90,$ht,convertirc(_("Sous-total")),1,0,'C',false);
$pdf->Cell(20,$ht,convertirc(format_N($prolongations_total['totalPrixManuel'])),'BR',0,'C',false);
$pdf->Cell(20,$ht,convertirc(format_N($prolongations_total['fraisReel'])),'BR',0,'C',false);
$pdf->Cell(20,$ht,convertirc(format_N($prolongations_total['montantTm'])),'BR',0,'C',false);
$pdf->Cell(20,$ht,convertirc(format_N($prolongations_total['montantArembourser'])),'BR',0,'C',false);
$pdf->Cell(20,$ht,convertirc(format_N($prolongations_total['depassement'])),'BR',1,'C',false);
}
}
$pdf->SetFont('Arial','B', 10);
$pdf->Cell(90,$ht,convertirc(_("Total")),1,0,'C',false);
$pdf->Cell(20,$ht,convertirc(format_N($hospit_total['totalPrixManuel'])),'BR',0,'C',false);
$pdf->Cell(20,$ht,convertirc(format_N($hospit_total['fraisReel'])),'BR',0,'C',false);
$pdf->Cell(20,$ht,convertirc(format_N($hospit_total['montantTm'])),'BR',0,'C',false);
$pdf->Cell(20,$ht,convertirc(format_N($hospit_total['montantArembourser'])),'BR',0,'C',false);
$pdf->Cell(20,$ht,convertirc(format_N($hospit_total['depassement'])),'BR',1,'C',false);
$pdf->Ln(5);
if($pdf->GetY()=="262"){
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->Image($_SESSION['p_lienLogo'],94,3,18);
$pdf->Ln(2);
$pdf->SetFont('Arial','', 7);
$pdf->Cell(0,$ht,convertirc(' Edité le '.heureCouranteLang($_SESSION['p_lang'])),0,1,'R',false);
$pdf->Ln(10);
}
$pdf->SetFont('Arial','B', 10);
//$pdf->Cell(30);
$pdf->Cell(95,$ht,convertirc(""),0,0,'L',false);
$pdf->Cell(50,$ht,convertirc(_("Part Assurance")),1,0,'L',false);
$pdf->Cell(45,$ht,convertirc(format_N($hospit_total['montantArembourser'])),1,1,'R',false);
//$pdf->Cell(30);
$pdf->Cell(95,$ht,convertirc(""),0,0,'L',false);
$pdf->Cell(50,$ht,convertirc(_("Part Assuré")),1,0,'L',false);
$pdf->Cell(45,$ht,convertirc(format_N($hospit_total['montantTm']+$hospit_total['depassement'])),1,1,'R',false);
//$pdf->Cell(30);
$pdf->Cell(95,$ht,convertirc(""),0,0,'L',false);
$pdf->Cell(50,$ht,convertirc(_("Net à payer")),1,0,'L',false);
$pdf->Cell(45,$ht,convertirc(format_N($hospit_total['totalPrixManuel'])),1,1,'R',false);
/////////////////////////////////////////////////////////////////
$aPayer = $hospit_total['totalPrixManuel'];
$pdf->Ln(5);
$pdf->SetFont('Arial','B', 10);
$pdf->Cell(0,6,convertirc(_('Arrêté la présente facture à la somme de').' : '),0,1,'L',false);
$pdf->Ln(3);
$pdf->SetFont('Arial','I',11);
$pdf->Cell(0,15, convetirEnLettre($aPayer, $_SESSION['p_lang'])." ".$_SESSION['p_devise_C'],'TLBR',1,'C',false);
$pdf->Ln(20);
$pdf->SetFont('','BU');
$pdf->Cell(0,6,convertirc($_SESSION['p_prestataire_C']),0,0,'R',false);
$fichier="Temp/TMP_facture_hospitalisation"."_".uniqid().".pdf";
$pdf->Output($fichier,"F");
$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;
exit();
}
public function bonpec()
{
$codeGarantie = "HOS";
$numeroFeuilleMaladie = $_SESSION['p_numeroFeuilleMaladie_C'];
$codePrestataire = $_SESSION['p_codePrestataire_C'];
$datePrestation = $_SESSION['datePrestation'];
$idBeneficiaire = $_SESSION['p_idBeneficiaire_C'];
$this->garantie->getsourcebaremegarantienew($idBeneficiaire, $codeGarantie, $datePrestation);
$nomForm = $this->requete->getParametreFormulaire("nomForm");
if($nomForm == "facturepartielle"){
$this->prestation->selectionnertoushospit($numeroFeuilleMaladie, $codePrestataire);
}
$feuillemaladie = $this->feuillemaladie->getfeuillemaladie($numeroFeuilleMaladie);
$dateFinDerniereProlongation = $this->feuillemaladie->getDateFinDerniereProlongation();
$listeProlongations = $this->feuillemaladie->getListeProlongations($numeroFeuilleMaladie);
$tMGarantie = $_SESSION['p_bareme']['bareme_ticketModerateur'];//$this->prescription->ticketModerateurGarantieBeneficiaire($codeGarantie);
$tauxCouverture = $this->prescription->tauxCouverture($tMGarantie);
$hospit_total = $this->prestation->gethospitalisation_total($numeroFeuilleMaladie);
$factures = $this->prestation->gettousactesmedicauxhospitalisation($numeroFeuilleMaladie, $codePrestataire);
$factures_total = $this->prestation->gettousactesmedicauxhospitalisation_total($numeroFeuilleMaladie, $codePrestataire);
$plafondHospitalisation = $this->acte->getSituationGarantieBeneficiaire($codeGarantie, $datePrestation);
//highlight_string("<?php\n\$datas =\n" . var_export($plafondHospitalisation , true) . ";\n>");
//die();
$actVisible = $_SESSION['p_actVisible'];
$dateDebutHospit = $feuillemaladie['dateDebutHospit'];
$dureeHospit = $feuillemaladie['dureeHospit'];
$dureeCorrigeeHospit = $feuillemaladie['dureeCorrigeeHospit'];
$dateFinHospit = $feuillemaladie['dateFinHospit'];
$prolongationHospit = $feuillemaladie['prolongationHospit'];
$dateDebutPrologation = $feuillemaladie['dateDebutPrologation'];
$dureeProlongation = $feuillemaladie['dureeProlongation'];
$dureeCorrigeeProlongation = $feuillemaladie['dureeCorrigeeProlongation'];
$dateFinProlongation = $feuillemaladie['dateFinProlongation'];
$numeroChambreProlongation = $feuillemaladie['numeroChambreProlongation'];
$motifHospitalisation = $feuillemaladie['motifHospitalisation'];
$instructionHospit = $feuillemaladie['instructionHospit'];
$idProlongationFeuille = $feuillemaladie['idProlongation'];
$noChambre = $feuillemaladie['numeroChambre'];
if(isset($dateFinDerniereProlongation) || !empty($dateFinDerniereProlongation)){
$dateFinHospit = $dateFinDerniereProlongation;
}
$optionHospitalisation = $feuillemaladie['optionHospitalisation'];
$codeActeHospitalisation = ($optionHospitalisation=="option-1") ? "HHM" : "HHC";
if(isset($dateFinDerniereProlongation) || !empty($dateFinDerniereProlongation)){
$dateFinHospit = $dateFinDerniereProlongation;
}
//var_dump($idProlongationFeuille);
if (isset($_SESSION['p_lang']) && $_SESSION['p_lang']=="en_US")
{
$subtypeHospit = ($optionHospitalisation=="option-1") ? "Medical" : "Surgical";
}
else
{
$subtypeHospit = ($optionHospitalisation=="option-1") ? "Médicale" : "Chirurgicale";
}
$feuilleMaladie = $_SESSION['p_numeroFeuilleMaladie_C'];
$motifsententes = $this->prestation->getmotifententeprealable($feuilleMaladie);
$nbreMotifs = count($motifsententes);
$pdf = new FPDF_Protection();
$pdf->SetAuthor('EBENE SOLUTIONS INFORMATIQUES');
$userPassword = '';
$ownerPassword = null;
$pdf->SetProtection(['print'], $userPassword, $ownerPassword);
$pdf->AliasNbPages();
$pdf->AddPage();
$ht=8;
$hl=8;
$pdf->SetMargins(10, 10, 10) ;
$pdf->Image($_SESSION['p_lienLogo'],94,3,18);
//$pdf->Ln(2);
$pdf->SetFont('Arial','', 7);
$pdf->Cell(0,$ht,convertirc('Edité le'.' '.heureCouranteLang($_SESSION['p_lang'])),0,1,'R',false);
//$pdf->Ln(5);
// Décalage à droite
$pdf->Cell(30);
$pdf->SetFont('Arial','B', 18);
$pdf->Cell(140,$ht,convertirc(_('BON')." No: PEC/".$feuillemaladie['numeroFeuilleMaladie']."/".$codeActeHospitalisation."/".$feuillemaladie['numeroBonHospitalisation']),'TLBR',1,'C',false);
$pdf->Ln(2);
$pdf->SetFont('Arial','', 12);
$pdf->Cell(55,$ht,convertirc(_('Souscripteur')),0,0,'L',false);
$pdf->SetFont('Arial','B', 12);
$pdf->Cell(55,$ht,convertirc(": ".substr($_SESSION['p_nomClient_C'],0,37)),0,1,'L',false);
$pdf->SetFont('Arial','', 12);
$pdf->Cell(55,$ht,convertirc(_('Adhérent')),0,0,'L',false);
$pdf->SetFont('Arial','B', 12);
$pdf->Cell(55,$ht,convertirc(": ".$_SESSION['p_numeroAdherent_C']." / ".substr($_SESSION['p_adherent_C'],0,37)),0,1,'L',false);
$pdf->SetFont('Arial','', 12);
$pdf->Cell(55,$ht,convertirc(_('Patient')),0,0,'L',false);
$pdf->SetFont('Arial','B', 12);
$pdf->Cell(55,$ht,convertirc(": ".$_SESSION['p_numeroBeneficiaire_C']." / ".substr($_SESSION['p_beneficiaire_C'],0,37)),0,1,'L',false);
$pdf->SetFont('Arial','', 12);
$pdf->Cell(55,$ht,convertirc(_('Genre')),0,0,'L',false);
$pdf->SetFont('Arial','B', 12);
$pdf->Cell(25,$ht,convertirc(": ".$_SESSION['p_sexe_C']),0,0,'L',false);
$pdf->SetFont('Arial','', 12);
$pdf->Cell(30,$ht,convertirc(_('Né(e) le')),0,0,'L',false);
$pdf->SetFont('Arial','B', 12);
$pdf->Cell(15,$ht,convertirc(": ".dateLang($_SESSION['p_dateNaissance_C'])),0,1,'L',false);
$pdf->SetFont('Arial','', 12);
$pdf->Cell(55,$ht,convertirc(_('Numéro de Bon')),0,0,'L',false);
$pdf->SetFont('Arial','B', 12);
$pdf->Cell(25,$ht,convertirc(": ".$feuillemaladie['numeroBonHospitalisation']),0,0,'L',false);
$pdf->SetFont('Arial','', 12);
$pdf->Cell(30,$ht,convertirc(_('Prise en charge')),0,0,'L',false);
$pdf->SetFont('Arial','B', 12);
$pdf->Cell(55,$ht,convertirc(": ".taux_couverture($_SESSION['p_tm_C'])),0,1,'L',false);
$pdf->Ln(2);
///////////////////////////////////////////////////////
/*
$pdf->SetFont('Arial','B', 12);
$pdf->SetFillColor(223, 232, 247);
$pdf->Cell(100,$ht,convertirc(_("Libellé")),'TLR',0,'L',true);
$pdf->SetFillColor(223, 232, 247);
$pdf->Cell(90,$ht,convertirc(_("Plafond")),'LTR',1,'C',true);
*/
if($plafondHospitalisation['plafond'] > "0" && $plafondHospitalisation['plafond'] !="9999999999"){
$pdf->SetFont('Arial','', 11);
$pdf->Cell(55,$hl,convertirc(_("Plafond Hospitalisation")),0,0,'L',false);
$pdf->SetFont('Arial','B', 11);
$pdf->Cell(55,$hl,convertirc(": ".format_N($plafondHospitalisation['plafond'])." ".$_SESSION['p_devise_C']),0,1,'L',false);
}
$pdf->Ln(5);
$pdf->SetFont('Arial','B', 10);
$pdf->SetFillColor(223, 232, 247);
$pdf->Cell(20,$ht,convertirc(_("Date")),'TLR',0,'C',true);
$pdf->SetFillColor(223, 232, 247);
$pdf->Cell(72,$ht,convertirc(_("Acte")),'LTR',0,'C',true);
$pdf->SetFillColor(223, 232, 247);
$pdf->Cell(18,$ht,convertirc(_("Plafond")),'LTR',0,'C',true);
$pdf->SetFillColor(223, 232, 247);
$pdf->Cell(20,$ht,convertirc(_("P U")),'LTR',0,'C',true);
$pdf->SetFillColor(223, 232, 247);
$pdf->Cell(10,$ht,convertirc(_("Nbre")),'LTR',0,'C',true);
$pdf->SetFillColor(223, 232, 247);
$pdf->Cell(20,$ht,convertirc(_("Total")),'LTR',0,'C',true);
$pdf->SetFillColor(223, 232, 247);
$pdf->Cell(30,$ht,convertirc(_("Net à Payer")),1,1,'C',true);
$pdf->Cell(20,$hl,convertirc(""),'LBR',0,'C',true);
$pdf->SetFillColor(223, 232, 247);
$pdf->Cell(72,$hl,convertirc(""),'LBR',0,'C',true);
$pdf->SetFillColor(223, 232, 247);
$pdf->Cell(18,$hl,convertirc(""),'LBR',0,'C',true);
$pdf->SetFillColor(223, 232, 247);
$pdf->Cell(20,$hl,convertirc(""),'LBR',0,'C',true);
$pdf->SetFillColor(223, 232, 247);
$pdf->Cell(10,$hl,convertirc(""),'LBR',0,'C',true);
$pdf->SetFillColor(223, 232, 247);
$pdf->Cell(20,$hl,convertirc(""),'LBR',0,'C',true);
$pdf->SetFillColor(223, 232, 247);
$pdf->Cell(15,$hl,convertirc(_("TM")),1,0,'C',true);
$pdf->Cell(15,$hl,convertirc(_("Dépas")),1,1,'C',true);
/////////////////////////////////////////////////////////////////
foreach($factures as $facture){
$idPrestationactes = $facture['id'];
$supprimable = $facture['supprimable'];
$codeTypePrestation = $facture['codeTypePrestation'];
$ententePrealable = $facture['ententePrealable'];
$autorisation = $facture['autorisation'];
$codeTarifActe = $facture['codeTarifActe'];
$libelleConsommable = $facture['libelleConsommable'];
if (isset($_SESSION['p_lang']) && $_SESSION['p_lang']=="en_US")
{
$libelleActe = $facture['libelleActeEng'];
}
else
{
$libelleActe = $facture['libelleActe'];
}
$codeActe = $facture['codeActe'];
if($codeActe == "CSM"){
$libelleActe = $libelleConsommable;
}
if($actVisible!="1")
{
$libelleActe = $codeActe;
}
$valeurActe = $facture['valeurActe'];
$plafondActe = $facture['plafondActe'];
$valeurActeManuel = $facture['valeurActeManuel'];
if($valeurActeManuel == "0" ){
$valeurActeManuel = $facture['prixPrestataire'];
}
if ($facture['plafondActe'] > "0" && $facture['plafondActe'] !="9999999999"){
$plafondActe = $facture['plafondActe'];
}else{
$plafondActe = "0";
}
$idProlongation = $facture['idProlongation'];
if($idProlongation > "0"){
$libelleActe = $libelleActe." - "."PROROGATION";
}
//highlight_string("<?php\n\$datas =\n" . var_export($factures , true) . ";\n>");
$pdf->SetFont('Arial','', 8);
$pdf->Cell(20,$hl,convertirc(dateLang($facture['datePrestation'],$_SESSION['p_lang'])),'LBR',0,'C',false);
$pdf->SetFont('Arial','', 6);
$pdf->Cell(72,$hl,convertirc(substr($libelleActe,0,50)),'BR',0,'L',false);
$pdf->SetFont('Arial','', 8);
$pdf->Cell(18,$hl,convertirc(format_N($plafondActe)),'BR',0,'C',false);
$pdf->Cell(20,$hl,convertirc(format_N($facture['valeurActeManuel'])),'BR',0,'C',false);
$pdf->Cell(10,$hl,convertirc($facture['quantite']),'BR',0,'C',false);
$pdf->Cell(20,$hl,convertirc(format_N($facture['prixManuel'])),'BR',0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($facture['montantTm'])),1,0,'C',false);
$pdf->Cell(15,$hl,convertirc(format_N($facture['depassement'])),1,1,'C',false);
}
$aPayer = $factures_total['montantTm']+$factures_total['depassement'];
$pdf->SetFont('Arial','B', 10);
$pdf->Cell(140,10,convertirc(_("Total")),1,0,'C',false);
$pdf->Cell(20,10,convertirc(format_N($factures_total['totalPrixManuel'])),1,0,'C',false);
$pdf->Cell(30,10,convertirc(format_N($aPayer)),1,1,'C',false);
$pdf->SetFont('Arial','', 7);
if($pdf->GetY()=="262"){
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->Image($_SESSION['p_lienLogo'],94,3,18);
$pdf->Ln(1);
$pdf->SetFont('Arial','', 7);
$pdf->Cell(0,$ht,convertirc(' Edité le '.heureCouranteLang($_SESSION['p_lang'])),0,1,'R',false);
}
if($pdf->GetY()=="262"){
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->Image($_SESSION['p_lienLogo'],94,3,18);
$pdf->Ln(2);
$pdf->SetFont('Arial','', 7);
$pdf->Cell(0,$ht,convertirc(' Edité le '.heureCouranteLang($_SESSION['p_lang'])),0,1,'R',false);
//$pdf->Ln(10);
}
if(count($motifsententes) > "0"){
$pdf->SetFont('Arial','B', 10);
$ht= 6;
$pdf->Ln(5);
$pdf->SetFillColor(223, 232, 247);
$pdf->Cell(190,$ht,convertirc(_("Instructions Particulières")),1,1,'C',true);
$pdf->Cell(70,$ht,convertirc(_("Acte")),1,0,'C',true);
$pdf->Cell(60,$ht,convertirc(_("Instructions Assureur")),1,0,'C',true);
//$pdf->Cell(10,$ht,convertirc(_("Prorogation")),1,0,'C',true);
$pdf->Cell(60,$ht,convertirc(_("Réponse Assureur")),1,1,'C',true);
$pdf->SetFont('Arial','', 7);
foreach($motifsententes as $motifsentente){
//$pro = ($motifsentente['idProlongationHospit'] > "0") ? "Oui" : "Non";
$pdf->Cell(70,$ht,convertirc(substr($motifsentente['libelleActe'],0,52)),1,0,'L',false);
$pdf->Cell(60,$ht,convertirc(substr($motifsentente['motifReel'],0,45)),1,0,'L',false);
//$pdf->Cell(10,$ht,convertirc($pro),1,0,'C',false);
$pdf->Cell(60,$ht,convertirc(substr($motifsentente['reponsentEnteprealable'],0,45)),1,1,'C',false);
}
}
$pdf->Ln(5);
$pdf->SetFont('Arial','B', 12);
$pdf->Cell(42,6,convertirc(_('Part Assuré').' : '),0,0,'L',false);
$pdf->SetFont('Arial','BU', 12);
$pdf->Cell(25,6,convertirc(format_N($aPayer)." ".$_SESSION['p_devise_C']),0,1,'L',false);
$pdf->Ln(2);
$pdf->SetFont('Arial','B', 12);
$pdf->Cell(42,6,convertirc(_('Net à Rembourser').' : '),0,0,'L',false);
$pdf->SetFont('Arial','BU', 12);
$pdf->Cell(25,6,convertirc(format_N($factures_total['montantArembourser'])." ".$_SESSION['p_devise_C']),0,1,'L',false);
$pdf->Ln(8);
$pdf->SetFont('Arial','B', 12);
$pdf->Cell(0,6,convertirc(_('Montant de la prise en charge').' : '),0,1,'C',false);
$pdf->Ln(3);
$pdf->SetFont('Arial','I',12);
$pdf->Cell(0,15, convetirEnLettre($factures_total['montantArembourser'], $_SESSION['p_lang'])." ".$_SESSION['p_devise_C'],'TLBR',1,'C',false);
$ica ='';
$ica ='CE0353';
if($ica!=$_SESSION['p_codePrestataire_C']){
$pdf->Ln(10);
$pdf->SetFont('','BU');
$pdf->Cell(0,6,convertirc($_SESSION['p_prestataire_C']),0,0,'R',false);
} else{
$pdf->Ln(20);
$pdf->SetFont('', 'BU', 10);
$pdf->Cell(42, 6, convertirc(_('Médecin conseil')), 0, 0, 'L', false);
$pdf->Cell(100, 6, convertirc(_('Signature et Téléphone')), 0, 0, 'C', false);
$pdf->Cell(60, 6, convertirc('Signature et cachet'), 0, 0, 'C', false);
$pdf->Ln(7);
$pdf->Cell(40, 6, convertirc(''), 0, 0, 'L', false);
$pdf->Cell(100, 6, convertirc(_('Du Patient')), 0, 0, 'C', false);
$pdf->Ln(2);
$pdf->Cell(0,6,convertirc($_SESSION['p_prestataire_C']),0,0,'R',false);
}
//highlight_string("<?php\n\$datas =\n" . var_export($_SESSION , true) . ";\n>");
$fichier="Temp/TMP_facture_partielle"."_".uniqid().".pdf";
$pdf->Output($fichier,"F");
$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;
exit();
}
}