prestation/Controleur/ControleurExamenstandard.php
2025-12-05 10:42:46 +00:00

303 lines
10 KiB
PHP
Executable File

<?php
require_once 'Framework/Controleur.php';
require_once 'Modele/Acte_bonprestataire.php';
require_once 'Modele/Dossier.php';
require_once 'Modele/Bonpec.php';
require_once 'Modele/Menuvueprofil.php';
require_once 'Fpdf/fpdf.php';
require_once 'Framework/Pdfaa.php';
require_once 'Modele/Ged.php';
class ControleurExamenstandard extends Controleur {
private $menuvue;
private $acte;
private $dossier;
private $bonpec;
private $codePrestataire;
private $ged;
public function __construct() {
$this->menuvue = new Menuvueprofil();
$this->menuvue->getMenuVue('Examenstandard');
$this->dossier = new Dossier();
$this->bonpec = new Bonpec();
$this->ged = new Ged();
$this->codePrestataire = $_SESSION['p_codePrestataireUtilisateur'];
$this->acte = (new Acte_bonprestataire())->getListe($this->codePrestataire, 'ES');
}
public function index() {
$msgErreur = "";
$codeEtatBon = "";
$montantacte = "0";
$tauxCouverture = "100";
//$montantTm = ($montantacte*(100-$tauxCouverture)/100);
$montantTm = "0";
$this->genererVue(array('acte' => $this->acte, 'msgErreur' => $msgErreur,
'codeEtatBon' => $codeEtatBon, 'montantacte' => $montantacte, 'tauxCouverture' => $tauxCouverture,
'montantTm' => $montantTm));
}
public function enregistredossier() {
if (isset($_POST['codePrestataire']))
{
$codePrestataire = $this->requete->getParametre("codePrestataire");
$numeroBeneficiaire = $this->requete->getParametre("numeroBeneficiaire");
$codeActe = $this->requete->getParametre("codeActe");
$montantacte = $this->requete->getParametreFormulaire("montantacte", "numerique");
$tauxCouverture = $this->requete->getParametreFormulaire("tauxCouverture", "numerique");
$montantTm = $this->requete->getParametreFormulaire("montantTm", "numerique");
$codeMedecin = "";
$codeTypeBon = $this->requete->getParametre("codeTypeBon");
if($codeTypeBon=='1') // Bon pré-imprimé
{
$numeroBon = $this->requete->getParametre("numeroBon");
$this->dossier->ajouterBonPec($codeActe, $codeMedecin, $numeroBon, $montantacte , $tauxCouverture, $montantTm);
$bonpec = $this->bonpec->imrimerBon($numeroBon);
// Création du bon à imprimer avec Fpdf
$pdf = new FPDF_Protection();
$pdf->SetAuthor('EBENE SOLUTIONS INFORMATIQUES');
$userPassword = '';
$ownerPassword = null;
$pdf->SetProtection(['print'], $userPassword, $ownerPassword);
$pdf->SetFont('Arial','BI',9);
$pdf->AddPage();
$pdf->SetXY(30,22);
$pdf->Cell(45,8.5,dateheureFr($bonpec['dateCourante']),0,0,'L');
$pdf->SetX(125);
$pdf->Cell(45,8.5,$bonpec['numeroPolice'],0,1,'L');
$pdf->SetX(30);
$pdf->Cell(40,8.5,convertirc($bonpec['souscripteur']),0,0,'L');
$pdf->SetX(125);
$pdf->Cell(45,8.5,$bonpec['numeroAdherent'],0,1,'L');
$pdf->SetX(30);
$pdf->Cell(40,8.5,convertirc($bonpec['beneficiaire']),0,0,'L');
$pdf->SetX(105);
$pdf->Cell(30,8.5,$bonpec['codeSexe'],0,1,'L');
$pdf->SetX(105);
$pdf->Cell(30,8.5,dateFr($bonpec['dateNaissance']),0,1,'L');
$pdf->SetXY(30,55);
$pdf->Cell(50,10,convertirc($bonpec['assure']),0,1,'L');
$pdf->SetXY(10,90);
//$pdf->Cell(10,10,$bonpec['codeActe'],0,0,'L');
$pdf->Cell(10,10,$bonpec['codeActeVisible'],0,0,'L');
//$pdf->SetX(25);
//$pdf->Cell(20,10,format_N($bonpec['montantacte']),0,0,'L');
//$pdf->SetX(50);
//$pdf->Cell(20,10,format_N($bonpec['montantTm']),0,0,'L');
$pdf->SetXY(160,30);
$pdf->Cell(40,10,$bonpec['prestataire'],0,0,'C');
//$pdf->SetXY(160,47);
//$pdf->Cell(40,10,$bonpec['medecin'],0,0,'C');
$pdf->SetXY(165,70);
$pdf->Cell(22,5,'- Consultation ',0,0,'L');
$pdf->Cell(10,5,' : 100%',0,1,'L');
$pdf->SetX(165);
$pdf->Cell(22,5,'- Pharmacie ',0,0,'L');
$pdf->Cell(10,5,' : 80 %',0,1,'L');
$pdf->SetX(165);
$pdf->Cell(22,5,'- Vaccins ',0,0,'L');
$pdf->Cell(10,5,' : 100%',0,1,'L');
$pdf->SetX(165);
$pdf->Cell(22,5,'- Soins ambul. ',0,0,'L');
$pdf->Cell(10,5,' : 80 %',0,1,'L');
$pdf->SetX(165);
$pdf->Cell(22,5,'- Laboratoire ',0,0,'L');
$pdf->Cell(10,5,' : 100%',0,1,'L');
$pdf->SetX(165);
$pdf->Cell(22,5,'- Radio',0,0,'L');
$pdf->Cell(10,5,' : 100%',0,1,'L');
$pdf->SetX(165);
$pdf->Cell(22,5,'- Hospit.',0,0,'L');
$pdf->Cell(10,5,' : 100%',0,1,'L');
// Fin bon PDF
$fichierBon_C = "";
$rand = rand(1,1000000);
$downloaded = "BON_PEC_EXAM_STD_NO_".$bonpec['numeroBon']."_".convertirc($bonpec['beneficiaire']).".pdf";
$fichierBon=$bonpec['numeroBeneficiaire']."_".$bonpec['numeroBon']."_".$rand.".pdf";
$this->ged->ajouterBon($numeroBeneficiaire, $fichierBon, $downloaded, $accesAssure="1",
$accesPrestataire="1", $accesPartenaire="1", $accesMedecin="1", $accesCompagnie="1", $accesProducteur="1",
$accesGestionnaire="1", $fichierBon, $codeSecret="");
$fichierBon="Bons/".$fichierBon;
$pdf->Output($fichierBon,"F");
$fichierBon_C = $fichierBon;
$this->bonpec->majfichierBon($numeroBon, $fichierBon);
header("Content-type:application/pdf");
header("Content-Disposition:attachment;filename=".$downloaded."");
readfile($fichierBon);
}
else // Bon sur feuille vierge
{
$numeroDossier = $this->dossier->ajouterdemandePecExam($codeActe);
$bonpecvierge = $this->bonpec->imrimerBonVierge($numeroDossier, $montantacte, $tauxCouverture, $montantTm);
$codeSecret = uniqid();
$pdf = new Pdfaa();
$pdf->SetMargins(20, 25, 20) ;
$pdf->SetFont('Arial','',15);
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Arial','',8);
$pdf->SetX(-50);
$pdf->Cell(35,7,convertirc('Numéro Dossier : '.$numeroDossier),1,1,'C',false);
$pdf->SetX(-50);
$pdf->Cell(30,7,$codeSecret,0,1,'C',false);
$pdf->SetXY(63,20);
//$pdf->SetY(40);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(88,15,'PRISE EN CHARGE EXAMENS PARACLINIQUES',1,1,'C',false);
//$pdf->Cell($lgcol2,$ht,convertirc($bonpecvierge['souscripteur']),'LTR',1,'C',false);
// début copie bon pré-imprimé
$pdf->SetXY(20,50);
$pdf->SetFont('Arial','',8);
$pdf->Cell(20,10,'Date :',0,0,'L');
$pdf->Cell(70,10,dateheureFr($bonpecvierge['dateCourante']),0,0,'L');
$pdf->Cell(15,10,convertirc('No police :'),0,0,'L');
$pdf->SetX(125);
$pdf->Cell(45,10,$bonpecvierge['numeroPolice'],0,0,'L');
$pdf->SetX(150);
$pdf->Cell(50,10,convertirc('Prestataire'),1,1,'C');
$pdf->SetX(20);
$pdf->Cell(20,10,'Souscripteur :',0,0,'L');
$pdf->Cell(70,10,convertirc($bonpecvierge['souscripteur']),0,0,'L');
$pdf->Cell(15,10,convertirc('Matricule :'),0,0,'L');
$pdf->SetX(125);
$pdf->Cell(45,10,$bonpecvierge['numeroAdherent'],0,0,'L');
$pdf->SetX(150);
$pdf->Cell(50,10,convertirc($bonpecvierge['prestataire']),1,1,'C');
$pdf->SetX(20);
$pdf->Cell(20,10,convertirc('Bénéficiaire :'),0,0,'L');
$pdf->Cell(70,10,convertirc($bonpecvierge['beneficiaire']),0,0,'L');
$pdf->Cell(15,10,convertirc('Genre :'),0,0,'L');
$pdf->SetX(125);
$pdf->Cell(45,10,$bonpecvierge['codeSexe'],0,0,'L');
$pdf->SetX(150);
$pdf->Cell(15,10,convertirc('Né(e) le :'),0,0,'L');
$pdf->Cell(45,10,dateFr($bonpecvierge['dateNaissance']),0,1,'L');
$pdf->SetX(20);
$pdf->Cell(20,10,convertirc('Assuré :'),0,0,'L');
$pdf->Cell(120,10,convertirc($bonpecvierge['assure']),0,0,'L');
$pdf->SetX(150);
$pdf->Cell(50,10,convertirc('Taux de couverture'),1,1,'C');
$pdf->SetX(150);
$pdf->Cell(30,7,'- Consultations','L','0','L');
$pdf->Cell(20,7,' : 100%','R',1,'C');
$pdf->SetX(150);
$pdf->Cell(30,7,'- Pharmacie','L','0','L');
$pdf->Cell(20,7,' : 80 %','R',1,'C');
$pdf->SetX(150);
$pdf->Cell(30,5,'- Vaccins','L','0','L');
$pdf->Cell(20,5,' : 100%','R',1,'C');
$pdf->SetX(150);
$pdf->Cell(30,5,'- Soins ambulatoires','L','0','L');
$pdf->Cell(20,5,' : 80 %','R',1,'C');
$pdf->SetX(150);
$pdf->Cell(30,5,'- Laboratoire','L','0','L');
$pdf->Cell(20,5,' : 100%','R',1,'C');
$pdf->SetX(150);
$pdf->Cell(30,5,'- Imagerie et radio','L','0','L');
$pdf->Cell(20,5,' : 100%','R',1,'C');
$pdf->SetX(150);
$pdf->Cell(30,5,'- Hospitalisation','LB','0','L');
$pdf->Cell(20,5,' : 100%','RB',1,'C');
//$pdf->Ln(10);
$pdf->SetX(20);
$pdf->Cell(20,10,convertirc('Acte :'),0,0,'L');
// $pdf->Cell(120,10,convertirc($bonpecvierge['codeActe'].' : '.$bonpecvierge['acte']),0,0,'L');
$pdf->Cell(120,10,convertirc($bonpecvierge['codeActeVisible'].' : '.$bonpecvierge['acte']),0,0,'L');
$pdf->SetY(-95);
$pdf->Cell(0,0,convertirc('NB : A joindre à la facture définitive pour le remboursement !'),'0',0,'C',false);
$pdf->SetY(-70);
$pdf->Cell(80,6,'Signature patient',0,0,'C',false);
$pdf->Cell(80,6,'Pour le prestataire',0,1,'C',false);
$fichierBon_C = "";
$rand = rand(1,1000000);
$downloaded = "BON_PEC_EXAM_STD_VIERGE_".$numeroDossier."_".convertirc($bonpecvierge['beneficiaire']).".pdf";
$fichierBon=$bonpecvierge['numeroBeneficiaire']."_EXAM_STD_VIERGE_".$rand.".pdf";
$this->ged->ajouterBonVierge($numeroBeneficiaire, $fichierBon, $downloaded, $accesAssure="1",
$accesPrestataire="1", $accesPartenaire="1", $accesMedecin="1", $accesCompagnie="1", $accesProducteur="1",
$accesGestionnaire="1", $fichierBon, $codeSecret);
$fichierBon="Bons/".$fichierBon;
$pdf->Output($fichierBon,"F");
$fichierBon_C = $fichierBon;
header("Content-type:application/pdf");
header("Content-Disposition:attachment;filename=".$downloaded."");
readfile($fichierBon);
// $this->executerAction("index");
}
} else
{
$this->rediriger("/");
}
}
}