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

188 lines
7.1 KiB
PHP
Executable File

<?php
require_once 'Framework/Controleur.php';
require_once 'Modele/Detailprescription.php';
require_once 'Modele/Prescription_temp.php';
require_once 'Modele/Detailtarifacte.php';
require_once 'Modele/Garantiesbaremepriseencharge.php';
class ControleurAjaxdetailpharmacie extends Controleur {
private $prescription;
private $detailprescription;
private $acte;
private $garantie;
public function __construct() {
$this->prescription = new Prescription_temp();
$this->detailprescription = new Detailprescription();
$this->acte = new Detailtarifacte();
$this->garantie = new Garantiesbaremepriseencharge();
}
public function index()
{
$numeroPrescription = $_SESSION['p_numeroPrescription_C'];
$numeroBonOrdonnance = $_SESSION['p_numeroBonOrdonnance_C'];
$prescription = $this->prescription->getprescription();
$detailprescriptions = $this->detailprescription->getdetailprescription($numeroPrescription);
$detailnonlivres = $this->prescription->getdetailnonlivre();
$datePrestation = $_SESSION['datePrestation'];
$idBeneficiaire = $_SESSION['p_idBeneficiaire_C'];
$codeActe = "PH";
$codeGarantie = "PHA";
$this->garantie->getsourcebaremenew($idBeneficiaire, $codeActe, $datePrestation);
$dateFinDelaiCarenceActe = $_SESSION['p_bareme']['bareme_finDelaiCarence'];//$this->acte->getDateFinDelaiCarenceActe();
$baremesolde = $this->garantie->getbaremesoldeacte($idBeneficiaire,$codeActe,$codeGarantie,$datePrestation);
$soldeConsommation = $baremesolde['soldeConsommation'];
$soldeNbreTransaction = $baremesolde['soldeNbreTransaction'];
if($soldeConsommation < 0)
{
$soldeConsommation = 0;
}
if($soldeNbreTransaction < 0)
{
$soldeNbreTransaction = 0;
}
$gar_codePeriodicite = $_SESSION['p_bareme']['gar_codePeriodiciteBeneficiaire'];
$gar_periodicite = $this->garantie->getlibelleperiodicite($gar_codePeriodicite);
$gar_periodiciteEng = $this->garantie->getlibelleperiodicite($gar_codePeriodicite);
$gar_codePeriodicitePlafond = $_SESSION['p_bareme']['gar_codePeriodicitePlafondBeneficiaire'];
$gar_periodicitePlafond = $this->garantie->getlibelleperiodicite($gar_codePeriodicitePlafond);
$gar_periodicitePlafondEng = $this->garantie->getlibelleperiodicite($gar_codePeriodicitePlafond);
$act_codePeriodicite = $_SESSION['p_bareme']['act_codePeriodiciteBeneficiaire'];
$act_periodicite = $this->garantie->getlibelleperiodicite($act_codePeriodicite);
$act_periodiciteEng = $this->garantie->getlibelleperiodicite($act_codePeriodicite);
$act_codePeriodicitePlafond = $_SESSION['p_bareme']['act_codePeriodicitePlafondBeneficiaire'];
$act_periodicitePlafond = $this->garantie->getlibelleperiodicite($act_codePeriodicitePlafond);
$act_periodicitePlafondEng = $this->garantie->getlibelleperiodicite($act_codePeriodicitePlafond);
$gar_nbreTransaction = $_SESSION['p_bareme']['gar_nbreTransactionBeneficiaire'];
$gar_forfaitPlafond = $_SESSION['p_bareme']['gar_forfaitPlafondBeneficiaire'];
$act_forfaitPlafond = $_SESSION['p_bareme']['act_forfaitPlafondBeneficiaire'];
$act_nbreTransaction = $_SESSION['p_bareme']['act_nbreTransactionBeneficiaire'];
$statut = $this->garantie->getstatutacte($idBeneficiaire,$codeActe,$codeGarantie);
$detaillivres = $this->prescription->getdetaillivrecso();
$marges = $this->detailprescription->getMarges();
$factures = $this->prescription->getfactures_ordonnance($numeroBonOrdonnance);
$factures_toal = $this->prescription->getfactures_total_ordonnance($numeroBonOrdonnance);
$this->genererVueAjax(array('prescription' => $prescription, 'detailprescriptions' => $detailprescriptions,
'detailnonlivres' => $detailnonlivres, 'detaillivres' => $detaillivres, 'marges' => $marges,
'soldeConsommation' => $soldeConsommation, 'soldeNbreTransaction' => $soldeNbreTransaction, 'statut' => $statut,
'gar_codePeriodicite' => $gar_codePeriodicite,'gar_periodicite' => $gar_periodicite,
'gar_periodiciteEng' => $gar_periodiciteEng,'gar_codePeriodicitePlafond' => $gar_codePeriodicitePlafond,
'gar_periodicitePlafond' => $gar_periodicitePlafond,'gar_periodicitePlafondEng' => $gar_periodicitePlafondEng,
'act_codePeriodicite' => $act_codePeriodicite,'act_periodicite' => $act_periodicite,
'act_periodiciteEng' => $act_periodiciteEng,'act_codePeriodicitePlafond' => $act_codePeriodicitePlafond,
'act_periodicitePlafond' => $act_periodicitePlafond,'act_periodicitePlafondEng' => $act_periodicitePlafondEng,
'gar_nbreTransaction' => $gar_nbreTransaction,'gar_forfaitPlafond' => $gar_forfaitPlafond,
'act_forfaitPlafond' => $act_forfaitPlafond,'act_nbreTransaction' => $act_nbreTransaction,
'factures' => $factures, 'factures_toal' => $factures_toal
));
}
public function ajoutermedicament()
{
$idMedicament = $this->requete->getParametreFormulaire("idMedicament");
$this->prescription->ajoutermedicamentcso($idMedicament);
$this->executerAction("index");
}
public function ajoutermedicamenttous()
{
$this->prescription->ajoutermedicamenttouscso();
$this->executerAction("index");
}
public function retirermedicament()
{
$idMedicament = $this->requete->getParametreFormulaire("idMedicament");
$this->prescription->retirermedicamentcso($idMedicament);
$this->executerAction("index");
}
public function retirermedicamenttous()
{
$this->prescription->retirermedicamenttouscso();
$this->executerAction("index");
}
public function enregistrerpharmacie()
{
$this->prescription->enregistrerpharmacie();
}
public function demanderaccordpha()
{
$idMedicament = $this->requete->getParametreFormulaire("idMedicament");
$this->detailprescription->demanderaccordpha($idMedicament);
$this->executerAction("index");
}
public function majprixcso()
{
$idMedicament = $this->requete->getParametre("idMedicament");
$prix = $this->requete->getParametreFormulaire("prix", "numerique");
// $this->detailprescription->majquantitepha($idMedicament, $quantite);
$this->detailprescription->majprixcso($idMedicament, $prix);
$this->executerAction("index");
}
public function majquantitecso()
{
$idLivre = $this->requete->getParametre("idLivre");
$quantite = $this->requete->getParametreFormulaire("quantite", "numerique");
$quantiteRestanteInitiale = $this->requete->getParametreFormulaire("quantiteRestanteInitiale", "numerique");
$this->detailprescription->majquantitecso($idLivre, $quantite, $quantiteRestanteInitiale);
$this->executerAction("index");
}
public function majmedicamentsubstitution()
{
$codeMedicament = $this->requete->getParametreFormulaire("codeMedicament");
$codeSubstitut = $this->requete->getParametreFormulaire("codeSubstitut");
$this->prescription->majmedicamentsubstitution($codeMedicament, $codeSubstitut);
}
}