409 lines
13 KiB
PHP
Executable File
409 lines
13 KiB
PHP
Executable File
<?php
|
|
require_once 'Framework/Modele.php';
|
|
|
|
class Prescription_temp extends Modele {
|
|
|
|
public function getprescription()
|
|
{
|
|
$numeroPrescription = $_SESSION['p_numeroPrescription_C'];
|
|
$idSaisie = $_SESSION['p_idSaisie'];
|
|
$user = $_SESSION['p_login'];
|
|
|
|
$sql = 'call sp_p_get_prescription_temp(?, ?, ?)';
|
|
|
|
$prescription = $this->executerRequete($sql, array($numeroPrescription, $idSaisie, $user));
|
|
|
|
return $prescription->fetch(PDO::FETCH_ASSOC);
|
|
}
|
|
|
|
public function getprescription_pha($numeroBonOrdonnance)
|
|
{
|
|
$idSaisie = $_SESSION['p_idSaisie'];
|
|
$user = $_SESSION['p_login'];
|
|
|
|
$sql = 'call sp_p_get_prescription_temp_pha(?, ?, ?)';
|
|
|
|
$prescription = $this->executerRequete($sql, array($numeroBonOrdonnance, $idSaisie, $user));
|
|
|
|
$ligne = $prescription->fetch(PDO::FETCH_ASSOC);
|
|
$_SESSION['p_numeroPrescription_C'] = $ligne['numeroPrescription'];
|
|
$_SESSION['p_numeroFeuilleMaladie_C'] = $ligne['numeroFeuilleMaladie'];
|
|
$_SESSION['p_idFacture_C'] = $ligne['idFacture'];
|
|
|
|
return $ligne;
|
|
}
|
|
|
|
public function getinfosprescription_pha($numeroBonOrdonnance)
|
|
{
|
|
$idSaisie = $_SESSION['p_idSaisie'];
|
|
$user = $_SESSION['p_login'];
|
|
|
|
$sql = 'call sp_p_get_infos_prescription_temp_pha(?, ?, ?)';
|
|
|
|
$prescription = $this->executerRequete($sql, array($numeroBonOrdonnance, $idSaisie, $user));
|
|
|
|
$ligne = $prescription->fetch(PDO::FETCH_ASSOC);
|
|
$_SESSION['p_numeroPrescription_C'] = $ligne['numeroPrescription'];
|
|
$_SESSION['p_numeroFeuilleMaladie_C'] = $ligne['numeroFeuilleMaladie'];
|
|
|
|
return $ligne;
|
|
}
|
|
|
|
public function initpharmacie_cso()
|
|
{
|
|
$codePrestataire = $_SESSION['p_codePrestataire_C'];
|
|
$codeActePharmacie = $_SESSION['p_codeActePharmacie_C'];
|
|
$numeroPrescription = $_SESSION['p_numeroPrescription_C'];
|
|
$idSaisie = $_SESSION['p_idSaisie'];
|
|
$user = $_SESSION['p_login'];
|
|
|
|
$codeTarifMedicament = $_SESSION['p_codeTarifMedicament_C'];
|
|
$tm = $_SESSION['p_tm_C'];
|
|
|
|
$sql = 'call sp_p_init_pharmacie_cso(?, ?, ?, ?, ?, ?, ?)';
|
|
|
|
$this->executerRequete($sql, array($codePrestataire, $codeActePharmacie, $idSaisie, $numeroPrescription, $user, $codeTarifMedicament, $tm));
|
|
}
|
|
|
|
public function getTarifActeAdherent($idAdherent)
|
|
{
|
|
$sql="SELECT fn_tarifActe_college_adherent(?) tarifActe;";
|
|
|
|
$resultat = $this->executerRequete($sql, array($idAdherent))->fetch(PDO::FETCH_ASSOC);
|
|
|
|
return $resultat['tarifActe'];
|
|
}
|
|
|
|
|
|
public function getAdherentBonOrdonnance($numeroBonOrdonnance)
|
|
{
|
|
$sql="SELECT idAdherent from p_feuillemaladie where numeroBonOrdonnance=? ;";
|
|
|
|
$resultat = $this->executerRequete($sql, array($numeroBonOrdonnance))->fetch(PDO::FETCH_ASSOC);
|
|
|
|
return $resultat['idAdherent'];
|
|
}
|
|
|
|
public function getTmBonOrdonnance($numeroBonOrdonnance)
|
|
{
|
|
$sql="SELECT tm from p_feuillemaladie where numeroBonOrdonnance=? ;";
|
|
|
|
$resultat = $this->executerRequete($sql, array($numeroBonOrdonnance))->fetch(PDO::FETCH_ASSOC);
|
|
|
|
return $resultat['tm'];
|
|
}
|
|
|
|
public function initpharmacie_pha($numeroBonOrdonnance)
|
|
{
|
|
$_SESSION['p_numeroBonOrdonnance_C'] = $numeroBonOrdonnance;
|
|
|
|
//$idAdherent = $this->getAdherentBonOrdonnance($numeroBonOrdonnance);
|
|
|
|
$codePrestataire = $_SESSION['p_codePrestataire_C'];
|
|
$codeActePharmacie = $_SESSION['p_codeActePharmacie_C'];
|
|
$idSaisie = $_SESSION['p_idSaisie'];
|
|
$user = $_SESSION['p_login'];
|
|
|
|
//$codeTarifActe = $this->getTarifActeAdherent($idAdherent);
|
|
|
|
$codeTarifMedicament = $_SESSION['p_codeTarifMedicament_C'];
|
|
|
|
|
|
|
|
//$tm = $_SESSION['p_tm_C'];
|
|
$tm = $this->getTmBonOrdonnance($numeroBonOrdonnance);
|
|
//var_dump($tm);
|
|
//die();
|
|
|
|
$sql = 'call sp_p_init_pharmacie_pha(?, ?, ?, ?, ?, ?, ?)';
|
|
|
|
$this->executerRequete($sql, array($codePrestataire, $codeActePharmacie, $idSaisie, $numeroBonOrdonnance, $user, $codeTarifMedicament, $tm));
|
|
}
|
|
|
|
public function getContexteAjaxPrescription($numeroPrescription)
|
|
{
|
|
$_SESSION['p_numeroPrescription_C'] = $numeroPrescription;
|
|
}
|
|
|
|
public function getContexteAjaxOrdonnance($numeroBonOrdonnance)
|
|
{
|
|
$_SESSION['p_numeroBonOrdonnance_C'] = $numeroBonOrdonnance;
|
|
}
|
|
|
|
public function enregistrerprescription($numeroBon, $codeMedecin)
|
|
{
|
|
$idBeneficiaire = $_SESSION['p_idBeneficiaire_C'];
|
|
$numeroFeuilleMaladie = $_SESSION['p_numeroFeuilleMaladie_C'];
|
|
$numeroPrescription = $_SESSION['p_numeroPrescription_C'];
|
|
$user = $_SESSION['p_login'];
|
|
|
|
$sql = 'call sp_p_enregistrer_prescription(?, ?, ?, ?, ?, ?)';
|
|
|
|
$this->executerRequete($sql, array($idBeneficiaire, $numeroFeuilleMaladie, $numeroPrescription, $numeroBon, $codeMedecin, $user));
|
|
}
|
|
|
|
public function getdetailnonlivre()
|
|
{
|
|
$numeroPrescription = $_SESSION['p_numeroPrescription_C'];
|
|
$idSaisie = $_SESSION['p_idSaisie'];
|
|
$user = $_SESSION['p_login'];
|
|
|
|
$sql = 'call sp_p_get_detail_non_livre(?, ?, ?)';
|
|
|
|
$resultat = $this->executerRequete($sql, array($numeroPrescription, $idSaisie, $user));
|
|
|
|
return $resultat->fetchAll(PDO::FETCH_ASSOC);
|
|
}
|
|
|
|
public function getdetaillivre()
|
|
{
|
|
$codePrestataire = $_SESSION['p_codePrestataire_C'];
|
|
$numeroPrescription = $_SESSION['p_numeroPrescription_C'];
|
|
$idSaisie = $_SESSION['p_idSaisie'];
|
|
$user = $_SESSION['p_login'];
|
|
|
|
$sql = 'call sp_p_get_detail_livre(?, ?, ?, ?)';
|
|
|
|
$resultat = $this->executerRequete($sql, array($numeroPrescription, $idSaisie, $user, $codePrestataire));
|
|
|
|
return $resultat->fetchAll(PDO::FETCH_ASSOC);
|
|
}
|
|
|
|
public function getdetaillivrecso()
|
|
{
|
|
$codePrestataire = $_SESSION['p_codePrestataire_C'];
|
|
$numeroPrescription = $_SESSION['p_numeroPrescription_C'];
|
|
$idSaisie = $_SESSION['p_idSaisie'];
|
|
$user = $_SESSION['p_login'];
|
|
|
|
// $sql = 'call sp_p_get_detail_livre(?, ?, ?, ?)';
|
|
$sql = 'call sp_p_get_detail_livre_cso(?, ?, ?, ?)';
|
|
|
|
$resultat = $this->executerRequete($sql, array($numeroPrescription, $idSaisie, $user, $codePrestataire));
|
|
|
|
return $resultat->fetchAll(PDO::FETCH_ASSOC);
|
|
}
|
|
|
|
public function getdetaillivrepha()
|
|
{
|
|
$codePrestataire = $_SESSION['p_codePrestataire_C'];
|
|
$numeroPrescription = $_SESSION['p_numeroPrescription_C'];
|
|
$idSaisie = $_SESSION['p_idSaisie'];
|
|
$user = $_SESSION['p_login'];
|
|
|
|
// $sql = 'call sp_p_get_detail_livre(?, ?, ?, ?)';
|
|
$sql = 'call sp_p_get_detail_livre_pha(?, ?, ?, ?)';
|
|
|
|
$resultat = $this->executerRequete($sql, array($numeroPrescription, $idSaisie, $user, $codePrestataire));
|
|
|
|
return $resultat->fetchAll(PDO::FETCH_ASSOC);
|
|
}
|
|
|
|
public function ajoutermedicament($idMedicament)
|
|
{
|
|
$sql = 'call sp_p_ajouter_medicament_temp(?)';
|
|
|
|
$this->executerRequete($sql, array($idMedicament));
|
|
}
|
|
|
|
|
|
public function ajoutermedicamentcso($idMedicament)
|
|
{
|
|
// $sql = 'call sp_p_ajouter_medicament_temp(?)';
|
|
$sql = 'call sp_p_ajouter_medicament_temp_cso(?)';
|
|
|
|
$this->executerRequete($sql, array($idMedicament));
|
|
}
|
|
|
|
public function ajoutermedicamenttous()
|
|
{
|
|
$numeroPrescription = $_SESSION['p_numeroPrescription_C'];
|
|
$idSaisie = $_SESSION['p_idSaisie'];
|
|
$user = $_SESSION['p_login'];
|
|
|
|
$sql = 'call sp_p_ajouter_medicament_temp_tous(?, ?, ?)';
|
|
|
|
$this->executerRequete($sql, array($numeroPrescription, $idSaisie, $user));
|
|
}
|
|
|
|
public function ajoutermedicamenttouscso()
|
|
{
|
|
$numeroPrescription = $_SESSION['p_numeroPrescription_C'];
|
|
$idSaisie = $_SESSION['p_idSaisie'];
|
|
$user = $_SESSION['p_login'];
|
|
|
|
// $sql = 'call sp_p_ajouter_medicament_temp_tous(?, ?, ?)';
|
|
$sql = 'call sp_p_ajouter_medicament_temp_tous_cso(?, ?, ?)';
|
|
|
|
$this->executerRequete($sql, array($numeroPrescription, $idSaisie, $user));
|
|
}
|
|
|
|
public function retirermedicament($idMedicament)
|
|
{
|
|
$sql = 'call sp_p_retirer_medicament_temp(?)';
|
|
|
|
$this->executerRequete($sql, array($idMedicament));
|
|
}
|
|
|
|
public function retirermedicamentcso($idMedicament)
|
|
{
|
|
$sql = 'call sp_p_retirer_medicament_temp_cso(?)';
|
|
|
|
$this->executerRequete($sql, array($idMedicament));
|
|
}
|
|
|
|
|
|
public function retirermedicamenttous()
|
|
{
|
|
$numeroPrescription = $_SESSION['p_numeroPrescription_C'];
|
|
$idSaisie = $_SESSION['p_idSaisie'];
|
|
$user = $_SESSION['p_login'];
|
|
|
|
$sql = 'call sp_p_retirer_medicament_temp_tous(?, ?, ?)';
|
|
|
|
$this->executerRequete($sql, array($numeroPrescription, $idSaisie, $user));
|
|
}
|
|
|
|
|
|
public function retirermedicamenttouscso()
|
|
{
|
|
$numeroPrescription = $_SESSION['p_numeroPrescription_C'];
|
|
$idSaisie = $_SESSION['p_idSaisie'];
|
|
$user = $_SESSION['p_login'];
|
|
|
|
// $sql = 'call sp_p_retirer_medicament_temp_tous(?, ?, ?)';
|
|
$sql = 'call sp_p_retirer_medicament_temp_tous_cso(?, ?, ?)';
|
|
|
|
$this->executerRequete($sql, array($numeroPrescription, $idSaisie, $user));
|
|
}
|
|
|
|
public function enregistrerpharmacie()
|
|
{
|
|
$numeroPrescription = $_SESSION['p_numeroPrescription_C'];
|
|
$idSaisie = $_SESSION['p_idSaisie'];
|
|
$user = $_SESSION['p_login'];
|
|
|
|
$idAdherent = $_SESSION['p_idAdherent_C'];
|
|
$numeroAdherent = $_SESSION['p_numeroAdherent_C'];
|
|
$idBeneficiaire = $_SESSION['p_idBeneficiaire_C'];
|
|
$numeroBeneficiaire = $_SESSION['p_numeroBeneficiaire_C'];
|
|
|
|
$sql = 'call sp_p_enregistrer_pharmacie_cso(?, ?, ? , ? , ?, ?, ?)';
|
|
|
|
$this->executerRequete($sql, array($numeroPrescription, $idSaisie, $user, $idAdherent, $numeroAdherent, $idBeneficiaire, $numeroBeneficiaire));
|
|
}
|
|
|
|
public function facturerpharmacie()
|
|
{
|
|
$numeroPrescription = $_SESSION['p_numeroPrescription_C'];
|
|
$idSaisie = $_SESSION['p_idSaisie'];
|
|
$user = $_SESSION['p_login'];
|
|
|
|
$user_id = $_SESSION['p_user_id_C'];
|
|
|
|
$idAdherent = $_SESSION['p_idAdherent_C'];
|
|
$numeroAdherent = $_SESSION['p_numeroAdherent_C'];
|
|
$idBeneficiaire = $_SESSION['p_idBeneficiaire_C'];
|
|
$numeroBeneficiaire = $_SESSION['p_numeroBeneficiaire_C'];
|
|
|
|
$sql = 'call sp_p_enregistrer_pharmacie_pha(?, ?, ?, ?, ? , ?, ?, ?)';
|
|
|
|
$this->executerRequete($sql, array($numeroPrescription, $idSaisie, $user, $user_id, $idAdherent, $numeroAdherent, $idBeneficiaire, $numeroBeneficiaire));
|
|
}
|
|
|
|
public function annulersubstitutionmedicament($idMedicament)
|
|
{
|
|
$sql = 'call sp_p_annuler_substitution_medicament_temp(?)';
|
|
|
|
$this->executerRequete($sql, array($idMedicament));
|
|
}
|
|
|
|
public function getmedicament($idMedicament)
|
|
{
|
|
$sql = 'call sp_p_get_medicament(?)';
|
|
|
|
$resultat = $this->executerRequete($sql, array($idMedicament));
|
|
|
|
return $resultat->fetch(PDO::FETCH_ASSOC);
|
|
}
|
|
|
|
public function enregistrersubstitutionmedicament($idMedicament, $prixSubstitut)
|
|
{
|
|
$sql = 'call sp_p_enregistrer_substitution_medicament_temp(?, ?)';
|
|
|
|
$this->executerRequete($sql, array($idMedicament, $prixSubstitut));
|
|
}
|
|
|
|
public function getfactures_ordonnance($numeroBonOrdonnance)
|
|
{
|
|
$codePrestataire = $_SESSION['p_codePrestataire_C'];
|
|
|
|
$sql = 'call sp_p_get_facture_ordonnance(?, ?)';
|
|
|
|
$resultat = $this->executerRequete($sql, array($numeroBonOrdonnance, $codePrestataire));
|
|
|
|
return $resultat->fetchAll(PDO::FETCH_ASSOC);
|
|
}
|
|
|
|
public function getfactures_total_ordonnance($numeroBonOrdonnance)
|
|
{
|
|
$codePrestataire = $_SESSION['p_codePrestataire_C'];
|
|
|
|
$sql = 'call sp_p_get_total_facture_ordonnance(?, ?)';
|
|
|
|
$resultat = $this->executerRequete($sql, array($numeroBonOrdonnance, $codePrestataire));
|
|
|
|
return $resultat->fetch(PDO::FETCH_ASSOC);
|
|
}
|
|
|
|
public function affiche_detailpha()
|
|
{
|
|
$codePrestataire = $_SESSION['p_codePrestataire_C'];
|
|
$numeroPrescription = $_SESSION['p_numeroPrescription_C'];
|
|
$idSaisie = $_SESSION['p_idSaisie'];
|
|
$user = $_SESSION['p_login'];
|
|
|
|
$sql="SELECT A.*, B.libelle AS libelleMedicament, B.unite, B.codeForme,
|
|
C.libelle AS forme, C.libelleEng AS formeEng, B.nomSubstitut
|
|
FROM p_prestationmedicaments_temp A
|
|
LEFT JOIN p_medicament B ON (B.codeMedicament=A.codeMedicament)
|
|
JOIN p_formemedicament C ON (C.codeForme=B.codeForme)
|
|
WHERE (A.numeroPrescription=?)
|
|
AND (A.idSaisie=?) AND (A.userP=?)
|
|
AND (A.livre='1') AND (A.codePrestataireLivraison=?)
|
|
AND (A.consultation!='1') AND (A.idFacture='0')
|
|
ORDER BY A.typeSysteme, B.libelle;";
|
|
|
|
|
|
$resultat = $this->executerRequete($sql, array($numeroPrescription, $idSaisie, $user, $codePrestataire));
|
|
|
|
return $resultat->fetchAll(PDO::FETCH_ASSOC);
|
|
}
|
|
|
|
|
|
public function majprixmanuelpha($idLivre, $valeurActeManuel, $prixManuel, $montantTm, $montantArembourser)
|
|
{
|
|
$numeroPrescription = $_SESSION['p_numeroPrescription_C'];
|
|
$idSaisie = $_SESSION['p_idSaisie'];
|
|
$user = $_SESSION['p_login'];
|
|
//$tm = ($_SESSION['p_tm_TP']>"0") ? $_SESSION['p_tm_TP'] : $_SESSION['p_tm_C'];
|
|
|
|
//var_dump($montantTm);
|
|
//var_dump($montantArembourser);
|
|
|
|
|
|
//die();
|
|
/*
|
|
$sql = "CALL sp_p_maj_prixManuel_pha(?,?,?,?,?,?,?,?);";
|
|
|
|
$this->executerRequete($sql, array($idLivre, $prixManuel, $montantTm, $montantArembourser, $user,
|
|
$numeroPrescription,$idSaisie, $tm));
|
|
*/
|
|
$sql = "CALL sp_p_maj_prixManuel_pha(?,?,?,?,?,?,?,?);";
|
|
|
|
$this->executerRequete($sql, array($idLivre, $valeurActeManuel, $prixManuel, $montantTm, $montantArembourser, $user,
|
|
$numeroPrescription,$idSaisie));
|
|
}
|
|
}
|
|
|