105 lines
3.4 KiB
PHP
105 lines
3.4 KiB
PHP
<?php
|
|
require_once 'Framework/Controleur.php';
|
|
require_once 'Modele/Prescription_temp.php';
|
|
|
|
class ControleurAjaxsubstitutionmedicament extends Controleur {
|
|
private $prescription;
|
|
|
|
public function __construct() {
|
|
$this->prescription = new Prescription_temp();
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
$idMedicament = $this->requete->getParametreFormulaire("idMedicament");
|
|
|
|
$posologie = $this->requete->getParametreFormulaire("posologie");
|
|
|
|
$quantite = $this->requete->getParametreFormulaire("quantite");
|
|
|
|
|
|
$idDemandeSubstitution = $this->requete->getParametreFormulaire("idDemandeSubstitution");
|
|
|
|
|
|
if($_SESSION['p_idDemandeSubstitution_C'] > "0"){
|
|
|
|
$idDemandeSubstitution = $_SESSION['p_idDemandeSubstitution_C'];
|
|
}
|
|
|
|
|
|
|
|
//var_dump($idDemandeSubstitution);
|
|
|
|
$medicament = $this->prescription->getmedicamentID($idMedicament);
|
|
|
|
$medocdispo = $this->prescription->getmedicamentdispo($idMedicament);
|
|
|
|
$idMedicamentSubstitut = $this->prescription->getIdMedicamentSubstitut($medicament['nomSubstitut']);
|
|
|
|
$prixPublicSubstitut = $this->prescription->getPrixPublicSubstitut($idMedicamentSubstitut['id']);
|
|
|
|
$marges = $this->prescription->getMarges();
|
|
|
|
$_SESSION['posologie'] = $posologie;
|
|
|
|
$_SESSION['quantite'] = $quantite;
|
|
|
|
|
|
if($idDemandeSubstitution =="0"){
|
|
$subsEnCours = array('id' => "0",
|
|
'codeReponseEntentePrealable' => "",
|
|
'idSubstitut' => '0',
|
|
'codeMedicamentSubstitution' => "",
|
|
'libelleSubstitut' => "",
|
|
'prixSubstitution' => "0",
|
|
'nvellePosologie' => "",
|
|
'prixSubstitution' => ""
|
|
);
|
|
$libelleReponse = "";
|
|
}else{
|
|
$subsEnCours = $this->prescription->getSubstitutionEncours($idDemandeSubstitution);
|
|
$libelleReponse = $this->prescription->getLibelleReponse($subsEnCours['codeReponseEntentePrealable']);
|
|
}
|
|
|
|
|
|
$this->genererVueAjax(array('medicament' => $medicament, 'medocdispo' => $medocdispo, 'idMedicamentSubstitut' => $idMedicamentSubstitut,
|
|
'marges' => $marges, 'subsEnCours' => $subsEnCours, 'libelleReponse' => $libelleReponse, 'prixPublicSubstitut' => $prixPublicSubstitut));
|
|
}
|
|
|
|
public function substituermedicament()
|
|
{
|
|
$idMedicament = $this->requete->getParametreFormulaire("idMedicament");
|
|
|
|
$this->prescription->annulersubstitutionmedicament($idMedicament);
|
|
|
|
// $this->executerAction("index");
|
|
}
|
|
|
|
public function prixsubstitut()
|
|
{
|
|
$codeMedicament = $this->requete->getParametreFormulaire("codeMedicament");
|
|
$libelle = $this->requete->getParametreFormulaire("libelle");
|
|
|
|
$idMedicament = $this->prescription->getIDmedicament($codeMedicament);
|
|
|
|
$prixPublicSubstitut = $this->prescription->getPrixPublicSubstitut($idMedicament);
|
|
$medoc = $this->prescription->getInfomedicament($libelle);
|
|
$ententePrealableSubstitut = $medoc['ententePrealable'];
|
|
|
|
echo $prixPublicSubstitut.'/'.$idMedicament.'/'.$ententePrealableSubstitut;
|
|
}
|
|
|
|
public function infosubstitut()
|
|
{
|
|
$libelle = $this->requete->getParametreFormulaire("libelle");
|
|
|
|
$medoc = $this->prescription->getInfomedicament($libelle);
|
|
|
|
$prixPublicSubstitut = $this->prescription->getPrixPublicSubstitut($medoc['idMedicament']);
|
|
|
|
$ententePrealableSubstitut = $medoc['ententePrealable'];
|
|
|
|
echo $prixPublicSubstitut.'/'.$medoc['idMedicament'].'/'.$ententePrealableSubstitut;
|
|
}
|
|
|
|
} |