production/Controleur/ControleurAjaxmedicamentsprescrits.php
2025-12-02 11:29:44 +00:00

227 lines
7.0 KiB
PHP
Executable File

<?php
require_once 'Framework/Controleur.php';
require_once 'Modele/Detailprescription.php';
class ControleurAjaxmedicamentsprescrits extends Controleur {
private $detailprescription;
public function __construct() {
$this->detailprescription = new Detailprescription();
}
public function index()
{
$numeroFeuilleMaladie = $this->requete->getParametreFormulaire("numeroFeuilleMaladie");
if($numeroFeuilleMaladie ==""){
$numeroFeuilleMaladie = $_SESSION['numeroFeuilleMaladiepha'];
}else{
$_SESSION['numeroFeuilleMaladiepha'] = $numeroFeuilleMaladie;
}
$_SESSION["validerTout"] = isset($_SESSION["validerTout"]) ? $_SESSION["validerTout"] : "0";
$_SESSION["refuserTout"] = isset($_SESSION["refuserTout"]) ? $_SESSION["refuserTout"] : "0";
$numeroPrescription = $this->detailprescription->getnumeroprescription($numeroFeuilleMaladie);
$_SESSION['p_numeroPrescription_C'] = $numeroPrescription;
$prescription = $this->detailprescription->getprescription($numeroPrescription);
$motifmedicaments = $this->detailprescription->getmotifmedicamentfeuille($numeroFeuilleMaladie);
$detailprescriptions = $this->detailprescription->getdetailprescription($numeroPrescription);
$montantTotalMedicament = $this->detailprescription->getParamMontantTotalMedicament();
$this->genererVueAjax(array('prescription' => $prescription,'motifmedicaments' => $motifmedicaments, 'detailprescriptions' => $detailprescriptions, 'montantTotalMedicament' => $montantTotalMedicament));
}
public function ajoutermedicament()
{
$codeMedicament = $this->requete->getParametreFormulaire("codeMedicament");
$this->detailprescription->ajoutermedicament($codeMedicament);
$this->executerAction("index");
}
public function majquantite()
{
$idMedicament = $this->requete->getParametre("idMedicament");
$quantite = $this->requete->getParametreFormulaire("quantite", "numerique");
$this->detailprescription->majquantite($idMedicament, $quantite);
$this->executerAction("index");
}
public function majquantiteprod()
{
$idMedicament = $this->requete->getParametre("idMedicament");
$quantite = $this->requete->getParametreFormulaire("quantite", "numerique");
$this->detailprescription->majquantiteprod($idMedicament, $quantite);
$this->executerAction("index");
}
public function majposologie()
{
$idMedicament = $this->requete->getParametre("idMedicament");
$posologie = $this->requete->getParametreFormulaire("posologie");
$this->detailprescription->majposologie($idMedicament, $posologie);
$this->executerAction("index");
}
public function supprimer()
{
$idMedicament = $this->requete->getParametre("idMedicament");
$this->detailprescription->supprimer($idMedicament);
$this->executerAction("index");
}
public function initremplacement()
{
$idMedicament = $this->requete->getParametre("idMedicament");
$_SESSION['p_idMedicament_a_remplacer'] = $idMedicament;
}
public function consulterremplacement()
{
$numeroBonOrdonnance = $_SESSION['p_numeroBonOrdonnance_C'];
$medicaments_remplaces = $this->detailprescription->getmedicamentsremplaces($numeroBonOrdonnance);
$this->genererVueAjax(array('medicaments_remplaces' => $medicaments_remplaces));
}
public function remplacermedicament()
{
$codeMedicamentNouv = $this->requete->getParametreFormulaire("codeMedicamentNouv");
$this->detailprescription->remplacermedicament($codeMedicamentNouv);
// $this->executerAction("index");
}
public function accordpharmacie()
{
$montantTotalMedicament = $this->prescription->getParamMontantTotalMedicament();
$this->detailprescription->majdetailprescriptionaccordprealable($montantTotalMedicament);
$this->executerAction("index");
}
public function validermedicament()
{
$idMedicament = $this->requete->getParametre("idMedicament");
$numeroFeuilleMaladie = $this->requete->getParametre("numeroFeuilleMaladie");
$p_choix = $this->requete->getParametre("p_choix");
$this->detailprescription->validermedicament($idMedicament,$numeroFeuilleMaladie,$p_choix);
$this->executerAction("index");
}
public function annulervalidermedicament()
{
$idMedicament = $this->requete->getParametre("idMedicament");
$numeroFeuilleMaladie = $this->requete->getParametre("numeroFeuilleMaladie");
$p_choix = $this->requete->getParametre("p_choix");
$this->detailprescription->annulervalidermedicament($idMedicament,$numeroFeuilleMaladie,$p_choix);
$this->executerAction("index");
}
public function refusermedicament()
{
$idMedicament = $this->requete->getParametre("idMedicament");
$numeroFeuilleMaladie = $this->requete->getParametre("numeroFeuilleMaladie");
$p_choix = $this->requete->getParametre("p_choix");
$this->detailprescription->refusermedicament($idMedicament,$numeroFeuilleMaladie,$p_choix);
$this->executerAction("index");
}
public function annulerrefusermedicament()
{
$idMedicament = $this->requete->getParametre("idMedicament");
$numeroFeuilleMaladie = $this->requete->getParametre("numeroFeuilleMaladie");
$p_choix = $this->requete->getParametre("p_choix");
$this->detailprescription->annulerrefusmedicament($idMedicament,$numeroFeuilleMaladie,$p_choix);
$this->executerAction("index");
}
public function validertousmedicaments()
{
$numeroFeuilleMaladie = $this->requete->getParametre("numeroFeuilleMaladie");
$p_choix = $this->requete->getParametre("p_choix");
$_SESSION["validerTout"] = "1";
$this->detailprescription->validertousmedicaments($numeroFeuilleMaladie,$p_choix);
$this->executerAction("index");
}
public function annulervalidertous()
{
$numeroFeuilleMaladie = $this->requete->getParametre("numeroFeuilleMaladie");
$p_choix = $this->requete->getParametre("p_choix");
$_SESSION["validerTout"] = "0";
$this->detailprescription->annulervalidertousmedicament($numeroFeuilleMaladie);
$this->executerAction("index");
}
public function refusertousmedicaments()
{
$numeroFeuilleMaladie = $this->requete->getParametre("numeroFeuilleMaladie");
$p_choix = $this->requete->getParametre("p_choix");
$_SESSION["refuserTout"] = "1";
$this->detailprescription->refusertousmedicaments($numeroFeuilleMaladie,$p_choix);
$this->executerAction("index");
}
public function annulerrefusertous()
{
$numeroFeuilleMaladie = $this->requete->getParametre("numeroFeuilleMaladie");
$p_choix = $this->requete->getParametre("p_choix");
$_SESSION["refuserTout"] = "0";
$this->detailprescription->annulerrefusertousmedicaments($numeroFeuilleMaladie,$p_choix);
$this->executerAction("index");
}
}