prestation/Controleur/ControleurAjaximprimerbonexamen.php
2026-06-23 17:22:20 +00:00

244 lines
9.2 KiB
PHP

<?php
require_once 'Framework/Controleurrequete.php'; // OK
require_once 'Modele/Examen_temp.php';
require_once 'Modele/Detailexamem.php';
class ControleurAjaximprimerbonexamen extends Controleurrequete
{
private $examen;
private $detailexamen;
public function __construct() {
$this->examen = new Examen_temp();
$this->detailexamen = new Detailexamem();
}
public function index()
{
$numeroExamen = $_SESSION['p_numeroExamen_C'];
$examen = $this->examen->getexamentemp();
$detailexamens = $this->detailexamen->getdetailexamenfeuillebon();
$numeroFeuilleMaladie = $_SESSION['p_numeroFeuilleMaladie_C'];
$consultation = $this->detailexamen->getdetailconsultation($numeroFeuilleMaladie);
$ticketModerateur = $this->detailexamen->getticketmoderateurconsultation($_SESSION['p_idCollege_C'],$consultation['codeActe']);
$libelleConsultation = $this->detailexamen->getlibelleconsultation($consultation['codeActe']);
//var_dump($libelleConsultation);
$devise = " ".$_SESSION['p_devise_C'];
if($ticketModerateur > "100"){
$tm = $ticketModerateur.$devise;
}else{
$tm = $ticketModerateur." %";
}
$pdf = new FPDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$ht=10;
$hc=6;
$hl=12;
$pdf->SetMargins(10, 10, 10) ;
// Logo
$pdf->Image($_SESSION['p_dossierSociete'].'/images/cnps_logo.jpg',10,35,50);
$pdf->Ln(2);
$pdf->SetFont('Arial','', 7);
$pdf->Cell(0,$ht,convertirc(' Edité le '.heureCouranteLang($_SESSION['p_lang'])),0,1,'R',false);
$pdf->Cell(55);
$pdf->SetFont('Arial','B', 13);
$pdf->Cell(135,$ht,convertirc("BON DE PRISE EN CHARGE EXAMEN N° : ".$_SESSION['p_numeroExamen_C']),0,1,'C',false);
$pdf->Cell(55);
$pdf->SetFont('Arial','UI', 12);
$pdf->Cell(35,$ht,convertirc(_('N° MATRICULE')),'LT',0,'C',false);
$pdf->Cell(35,$ht,convertirc(_('DIRECTION')),'LT',0,'C',false);
$pdf->Cell(30,$ht,convertirc(_('SERVICE')),'LT',0,'C',false);
$pdf->Cell(35,$ht,convertirc(_('N° CARTE')),'LTR',1,'C',false);
$pdf->SetFont('Arial','I', 12);
$pdf->SetY(38);
$pdf->SetX(65);
$pdf->Cell(35,$ht,convertirc(_('Agent')),'L',0,'C',false);
$pdf->Cell(35,$ht,convertirc(_('Adhérent')),'L',0,'C',false);
$pdf->Cell(30,$ht,convertirc(_('Adhérent')),'L',0,'C',false);
$pdf->Cell(35,$ht,convertirc(_('Malade')),'LR',1,'C',false);
$pdf->Cell(55);
$pdf->SetFont('Arial','B', 14);
$pdf->Cell(35,$ht,convertirc($_SESSION['p_numeroAdherent_C']),'LB',0,'C',false);
$pdf->Cell(35,$ht,convertirc(_('')),'LB',0,'C',false);
$pdf->Cell(30,$ht,convertirc(_('')),'LB',0,'C',false);
$pdf->Cell(35,$ht,convertirc($_SESSION['p_numeroBeneficiaire_C']),'LBR',1,'C',false);
$pdf->SetFont('Arial','UI', 9);
$pdf->Cell(45,$ht,convertirc(_("Nom et Prénoms de l'Adhérent")),'LT',0,'L',false);
$pdf->SetFont('Arial','B', 9);
$pdf->Cell(57,$ht,convertirc(": ".substr($_SESSION['p_adherent_C'],0,50)),'T',0,'L',false);
$pdf->SetFont('Arial','UI', 8);
$pdf->Cell(27,$ht,convertirc(_('Date de Naissance')),'LT',0,'C',false);
$pdf->Cell(20,$ht,convertirc(_('Statut')),'LT',0,'C',false);
$pdf->Cell(41,$ht,convertirc(_('RESERVE AU PRATICIEN')),'LTR',1,'C',false);
$pdf->SetFont('Arial','UI', 9);
$pdf->Cell(45,$ht,convertirc(_("Nom et Prénoms du Malade")),'LB',0,'L',false);
$pdf->SetFont('Arial','B', 9);
$pdf->Cell(57,$ht,convertirc(": ".substr($_SESSION['p_beneficiaire_C'],0,50)),'B',0,'L',false);
$pdf->SetFont('Arial','B', 10);
$pdf->Cell(27,$ht,convertirc(dateFr($_SESSION['p_dateNaissance_C'])),'LB',0,'C',false);
if($_SESSION['p_lienparente_C'] == "Assure"){
$statut = "Agent";
}else{
$statut = $_SESSION['p_lienparente_C'];
}
$pdf->SetFont('Arial','B', 10);
$pdf->Cell(20,$ht,convertirc($statut),'LB',0,'C',false);
$pdf->Cell(41,$ht,convertirc(_('')),'LR',1,'C',false);
$pdf->SetFont('Arial','I', 8);
$pdf->Cell(54,$ht,convertirc(_("")),'L',0,'L',false);
$pdf->SetFont('Arial','UI', 8);
$pdf->Cell(35,$ht,convertirc(_("TICKET MODERATEUR")),'L',0,'C',false);
$pdf->SetFont('Arial','UI', 8);
$pdf->Cell(30,$ht,convertirc(_("COUT DE L'ACTE")),'L',0,'C',false);
$pdf->Cell(30,$ht,convertirc(_('PART EMPLOYEUR')),'L',0,'C',false);
$pdf->Cell(41,$ht,convertirc(_('')),'LR',1,'C',false);
$pdf->SetFont('Arial','I', 9);
$pdf->Cell(54,$ht,convertirc(_("")),'L',0,'L',false);
$pdf->SetFont('Arial','B', 10);
/*
$pdf->SetY(70);
$pdf->SetX(64);
*/
$pdf->Cell(35,$ht,convertirc($consultation['codeActe'].": ".$tm),'LB',0,'C',false);
$pdf->Cell(30,$ht,convertirc(format_N($consultation['valeurActe']).$devise),'LB',0,'C',false);
$pdf->Cell(30,$ht,convertirc(format_N($consultation['montantArembourser']).$devise),'LB',0,'C',false);
$pdf->Cell(41,$ht,convertirc(_('')),'LR',1,'C',false);
$pdf->SetFont('Arial','IU', 9);
$pdf->Cell(54,$ht,convertirc(_("")),'L',0,'L',false);
$pdf->Cell(95,$ht,convertirc(_("DESIGNATION DE L'ACTE")),'L',0,'C',false);
$pdf->SetFont('Arial','UI', 8);
$pdf->Cell(41,$ht,convertirc(_('')),'LR',1,'C',false);
//$pdf->Image($_SESSION['p_dossierSociete'].'/images/schema_dentaire.png',12,80,50);
//$pdf->Image($_SESSION['p_dossierSociete'].'/images/dents.png',12,80,50);
$pdf->Image($_SESSION['p_dossierSociete'].'/images/schema_dent.png',12,82,50);
$pdf->Cell(54,$ht,convertirc(_("")),'LB',0,'L',false);
$pdf->SetFont('Arial','B', 10);
$pdf->Cell(95,$ht,convertirc($libelleConsultation),'LB',0,'C',false);
$pdf->Cell(41,$ht,convertirc(_('')),'LBR',1,'C',false);
/*
$pdf->SetFont('Arial','IB', 10);
$pdf->Cell(190,$hc,convertirc(_('CSD + AR + Pharmacie : 20%')),'LBR',1,'C',false);
*/
$pdf->Cell(10,$hl,convertirc(_('N°')),'LBR',0,'C',false);
$pdf->Cell(89,$hl,convertirc(_('EXAMEN')),'LBR',0,'C',false);
$pdf->Cell(50,$hl,convertirc(_('PRESCRIPTION')),'LBR',0,'C',false);
$pdf->Cell(20,$hl,convertirc(_('')),'LBR',0,'C',false);
$pdf->Cell(21,$hl,convertirc(_('')),'LBR',1,'C',false);
$i = 0;
foreach ($detailexamens as $v){
$i++;
$pdf->SetFont('Arial','', 8);
$pdf->Cell(10,$hl,convertirc($i),'LBR',0,'C',false);
$pdf->Cell(89,$hl,convertirc(substr($v['libelleActe'],0,58)),'BR',0,'L',false);
$pdf->Cell(50,$hl,convertirc(_('')),'BR',0,'L',false);
/*
$pdf->Cell(20,$hl,convertirc(format_N($v['valeurActe'])),1,0,'C',false);
$pdf->Cell(21,$hl,convertirc(format_N($v['fraisReel'])),1,1,'C',false);
*/
$pdf->Cell(20,$hl,convertirc(_('')),1,0,'C',false);
$pdf->Cell(21,$hl,convertirc(_('')),1,1,'C',false);
}
/*
$nbreMedocs = count($detailprescriptions);
while($nbreMedocs < $_SESSION['p_nbMedicamentMax'])
{
$nbreMedocs++;
$pdf->Cell(10,$hl,convertirc($nbreMedocs),'LBR',0,'C',false);
$pdf->Cell(89,$hl,convertirc(_('')),'BR',0,'L',false);
$pdf->Cell(50,$hl,convertirc(_('')),'BR',0,'L',false);
$pdf->Cell(20,$hl,convertirc(_('')),1,0,'C',false);
$pdf->Cell(21,$hl,convertirc(_('')),1,1,'C',false);
}
*/
$pdf->SetFont('Arial','B', 9);
$pdf->Cell(50,$hc,convertirc(_('MONTANT')),'LBR',0,'C',false);
$pdf->Cell(30,$hc,convertirc(_('REMISE')),'LBR',0,'C',false);
$pdf->Cell(40,$hc,convertirc(_('PART')),'LBR',0,'C',false);
$pdf->SetFont('Arial','I', 9);
$pdf->Cell(70,$hc,convertirc(_('Fourni le.............................Signature et cachet')),'LR',1,'L',false);
$pdf->Cell(50,$hc,convertirc(_('')),'LR',0,'C',false);
$pdf->Cell(30,$hc,convertirc(_('')),'LR',0,'C',false);
$pdf->SetFont('Arial','I', 8);
$pdf->Cell(20,$hc,convertirc(_('ASSURE 20%')),'LBR',0,'C',false);
$pdf->Cell(20,$hc,convertirc(_('CNPS 80%')),'LBR',0,'C',false);
$pdf->Cell(70,$hc,convertirc(_('')),'LR',1,'L',false);
$pdf->Cell(50,$hl,convertirc(_('')),'LBR',0,'C',false);
$pdf->Cell(30,$hl,convertirc(_('')),'LBR',0,'C',false);
$pdf->Cell(20,$hl,convertirc(_('')),'LBR',0,'C',false);
$pdf->Cell(20,$hl,convertirc(_('')),'LBR',0,'C',false);
$pdf->Cell(70,$hl,convertirc(_('')),'LBR',1,'L',false);
$pdf->SetY(65);
$pdf->SetX(160);
$pdf->SetFont('Arial','BI', 8);
$pdf->Cell(41,$hc,convertirc(_('Code')),0,1,'L',false);
$pdf->SetX(160);
$pdf->Cell(41,$hc,convertirc(_('Date')),0,1,'L',false);
$pdf->SetX(160);
$pdf->Cell(41,$hc,convertirc(_('Cachet et signature')),0,1,'L',false);
$pdf->SetY(117);
$pdf->SetX(140);
$pdf->SetFont('Arial','B', 10);
$pdf->Cell(19,$hl,convertirc(_('')),0,0,'C',false);
$pdf->Cell(20,$hl,convertirc(_('Prix')),0,0,'C',false);
$pdf->Cell(21,$hl,convertirc(_('Montant')),0,0,'C',false);
$pdf->SetY(122);
$pdf->SetX(140);
$pdf->SetFont('Arial','', 10);
$pdf->Cell(19,$hl,convertirc(_('')),0,0,'C',false);
$pdf->Cell(20,$hl,convertirc(_('Unitaire')),0,0,'C',false);
$pdf->Cell(21,$hl,convertirc(_('Total')),0,0,'C',false);
$fichier="Temp/TMP_facture_definitive"."_".uniqid().".pdf";
$pdf->Output($fichier,"F");
$t_html =' <div id ="div_export_b" class="alert alert-info"> ';
$t_html .=' <a style="font-size:15pt;" href="'.$fichier.'" target="_blank" > '._("TELECHARGER").' </a> ';
$t_html .=' </div ';
echo $t_html;
exit();
}
}