259 lines
8.7 KiB
PHP
259 lines
8.7 KiB
PHP
<?php
|
|
require_once 'Framework/Controleur.php';
|
|
require_once 'Modele/Menuvueutilisateur.php';
|
|
require_once 'Modele/Beneficiaire.php';
|
|
require_once 'Modele/Detailprescription.php';
|
|
require_once 'Modele/Prescription_temp.php';
|
|
require_once 'Modele/Prestationactes.php';
|
|
require_once 'Modele/Finger.php';
|
|
require_once 'Modele/Ged.php';
|
|
require_once 'Modele/Ged.php';
|
|
require_once 'Modele/Detailtarifacte.php';
|
|
require_once 'Modele/Garantiesbaremepriseencharge.php';
|
|
require_once 'Modele/Feuillemaladie.php';
|
|
|
|
class ControleurPharmacien extends Controleur {
|
|
private $menuvue;
|
|
private $beneficiaire;
|
|
private $prescription;
|
|
private $detailprescription;
|
|
private $prestation;
|
|
private $finger;
|
|
private $ged;
|
|
private $acte;
|
|
private $garantie;
|
|
private $feuille;
|
|
|
|
public function __construct() {
|
|
$this->menuvue = new Menuvueutilisateur();
|
|
$this->menuvue->getMenuVue('Pharmacien');
|
|
|
|
$this->prescription = new Prescription_temp();
|
|
$this->detailprescription = new Detailprescription();
|
|
$this->prestation = new Prestationactes();
|
|
$this->ged = new Ged();
|
|
$this->acte = new Detailtarifacte();
|
|
$this->garantie = new Garantiesbaremepriseencharge();
|
|
|
|
$this->beneficiaire = new Beneficiaire();
|
|
viderContexte();
|
|
$_SESSION['p_okId'] = "-1";
|
|
|
|
$this->finger = new Finger();
|
|
|
|
$_SESSION['p_codeTypeFacture_C'] = "PHAR";
|
|
|
|
$_SESSION["proforma"] = "0";
|
|
|
|
$this->feuille = new Feuillemaladie();
|
|
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
$garantieadherent_temp = null;
|
|
$codePrestataire = $_SESSION['p_codePrestataire_C'];
|
|
|
|
$numeroBonOrdonnance = $_SESSION['p_numeroBonOrdonnance_C'];
|
|
|
|
|
|
|
|
if($numeroBonOrdonnance=="-1")
|
|
{
|
|
// $this->genererVue();
|
|
|
|
$this->genererVue();
|
|
|
|
}
|
|
else
|
|
{
|
|
$resultat = $this->beneficiaire->getBeneficiaireOrdonnancePha($numeroBonOrdonnance);
|
|
|
|
|
|
$numeroPrescription = $_SESSION['p_numeroPrescription_C'];
|
|
|
|
$idBeneficiaire = $resultat['idBeneficiaire'];
|
|
|
|
$beneficiaire = $this->beneficiaire->getContexteBeneficiaireId($idBeneficiaire);
|
|
|
|
|
|
$this->prescription->initpharmacie_pha($numeroBonOrdonnance);
|
|
|
|
$prescription = $this->prescription->getprescription_pha($numeroBonOrdonnance);
|
|
|
|
$idPrestationactes = $prescription['idPrestationactes'];
|
|
$remplace = $prescription['remplace'];
|
|
$numeroRemplace = $prescription['numeroRemplace'];
|
|
$numeroFeuilleMaladie = $prescription['numeroFeuilleMaladie'];
|
|
$numeroPrescription = $prescription['numeroPrescription'];
|
|
$_SESSION['prixMedicamentModifiable'] = $prescription['prixMedicamentModifiable'];
|
|
|
|
$contestation = $this->feuille->getContestation($numeroFeuilleMaladie);
|
|
|
|
$datePrestation = $this->prescription->getDatePrestation($numeroFeuilleMaladie);
|
|
|
|
|
|
$_SESSION['datePrestation'] = $datePrestation;
|
|
|
|
$codeActe = "PH";
|
|
$codeGarantie = "PHA";
|
|
|
|
$this->garantie->getsourcebaremenew($idBeneficiaire, $codeActe, $datePrestation);
|
|
|
|
$baremesolde = $this->garantie->getbaremesoldeacte($idBeneficiaire,$codeActe,$codeGarantie,$datePrestation);
|
|
$statut = $this->garantie->getstatutacte($idBeneficiaire,$codeActe,$codeGarantie);
|
|
|
|
|
|
$dateFinDelaiCarenceActe = $_SESSION['p_bareme']['bareme_finDelaiCarence'];//$this->acte->getDateFinDelaiCarenceActe();
|
|
|
|
/*
|
|
$situation = $this->acte->getSituationActeBeneficiaire($codeActe, $datePrestation);
|
|
$situationGarantie = $this->acte->getSituationGarantieBeneficiaire($codeGarantie, $datePrestation);
|
|
$situationAnnuelle = $this->acte->getSituationAnnuelleBeneficiaire($datePrestation);
|
|
$situationFamille = $this->acte->getSituationFamilleBeneficiaire($datePrestation);
|
|
*/
|
|
|
|
$soldeConsommation = $baremesolde['soldeConsommation'];
|
|
$soldeNbreTransaction = $baremesolde['soldeNbreTransaction'];
|
|
|
|
if($soldeConsommation < 0)
|
|
{
|
|
$soldeConsommation = 0;
|
|
}
|
|
|
|
if($soldeNbreTransaction < 0)
|
|
{
|
|
$soldeNbreTransaction = 0;
|
|
}
|
|
|
|
|
|
$detailprescriptions = $this->detailprescription->getdetailprescription_pha($numeroBonOrdonnance);
|
|
|
|
$marges = $this->detailprescription->getMarges();
|
|
|
|
$detailnonlivres = $this->prescription->getdetailnonlivre();
|
|
|
|
//var_dump($detailnonlivres); die();
|
|
|
|
// $detaillivres = $this->prescription->getdetaillivre();
|
|
$detaillivres = $this->prescription->getdetaillivrepha();
|
|
|
|
|
|
$factures = $this->prescription->getfactures_ordonnance($numeroBonOrdonnance);
|
|
$factures_toal = $this->prescription->getfactures_total_ordonnance($numeroBonOrdonnance);
|
|
|
|
$user_id = $_SESSION['p_user_id_C'];
|
|
$this->finger->vider_finger_temp($user_id);
|
|
|
|
|
|
|
|
$facturable=($numeroRemplace != $numeroBonOrdonnance);
|
|
|
|
$this->prestation->vider_garantieadherent_temp($numeroFeuilleMaladie, $codePrestataire);
|
|
|
|
// if($idPrestationactes==0)
|
|
// if($idPrestationactes==0 && $facturable)
|
|
if($facturable)
|
|
{
|
|
$garantieadherent_temp = $this->prestation->init_garantieadherent_temp_pha($numeroFeuilleMaladie, $codePrestataire);
|
|
}
|
|
|
|
unset($_FILES['fichier_upload']);
|
|
$geds = $this->ged->getgedpharmacie();
|
|
|
|
|
|
|
|
$_SESSION['p_numeroFeuilleMaladie_C'] = $numeroFeuilleMaladie;
|
|
|
|
$_SESSION['p_idMedicament_C'] = "0";
|
|
$_SESSION['p_nomPrescrit_C'] = "";
|
|
$_SESSION['p_prixTarif_C'] = "0";
|
|
$_SESSION['p_idSubstitut_C'] = "0";
|
|
$_SESSION['p_libelleSubstitut_C'] = "";
|
|
$_SESSION['p_prixSubstitut_C'] = "0";
|
|
$_SESSION['p_prixPublicSubstitut_C'] = "0";
|
|
|
|
$idPrestationactes = $this->prescription->getIdPrestationactes();
|
|
|
|
$referencementpolice = $this->beneficiaire->getReferencementPolice($_SESSION['p_idPolice_C']);
|
|
|
|
$prestataireReference = $this->beneficiaire->getReferencementPrestataire($_SESSION['p_codePrestataire_C']);
|
|
|
|
$avecReferencement = $referencementpolice['avecReferencement'];
|
|
|
|
$tauxAvecReferencement = $referencementpolice['tauxAvecReferencement'];
|
|
$tauxSansReferencement = $referencementpolice['tauxSansReferencement'];
|
|
|
|
//$tMacte = $_SESSION['p_bareme']['bareme_ticketModerateur'];//$this->prescription->ticketModerateurActeBeneficiaire($codeActe);
|
|
|
|
$tMacte = $this->acte->ticketModerateurDefinitif($codeGarantie, $codeActe, $datePrestation);
|
|
|
|
$tmDerogation = $this->acte->getTmDerogation($codeGarantie);
|
|
|
|
$tmAffection = $this->prestation->getTmAffection($numeroFeuilleMaladie);
|
|
|
|
|
|
$dateRef = $beneficiaire['dateReference'];
|
|
|
|
$bool = true;
|
|
|
|
if (!empty($dateRef)){
|
|
|
|
$diff = abs(strtotime($dateRef) - strtotime($date));
|
|
|
|
$years = floor($diff / (365*60*60*24));
|
|
$months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
|
|
|
|
$days = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
|
|
|
|
if($days > $beneficiaire['dureeCode']){
|
|
$this->beneficiaire->reinitCodeReference($idBeneficiaire);
|
|
$bool = true;
|
|
}else{
|
|
$bool = false;
|
|
}
|
|
}
|
|
|
|
if($prestataireReference=="1"){
|
|
$tm = 100-$tauxAvecReferencement;
|
|
}else
|
|
{
|
|
if($avecReferencement=="1"){
|
|
if($bool==true){
|
|
$tm = 100-$tauxSansReferencement;
|
|
}else{
|
|
$tm = 100-$tauxAvecReferencement;
|
|
}
|
|
}else{
|
|
$tm = $_SESSION['p_bareme']['bareme_ticketModerateur'];
|
|
}
|
|
}
|
|
|
|
|
|
if($tmAffection=="1000"){
|
|
$tauxCouverture = (100-$tMacte)."%";
|
|
$tm = $tMacte;
|
|
}else{
|
|
$tauxCouverture = (100-$tmAffection)."%";
|
|
$tm = $tmAffection;
|
|
}
|
|
|
|
$Affection = $this->prestation->getAffection($numeroFeuilleMaladie);
|
|
|
|
|
|
$_SESSION['p_tm_C'] = $tm;
|
|
|
|
//var_dump($tm);
|
|
|
|
$prixZero = $this->prescription->getNombrePrixZero($numeroPrescription);
|
|
|
|
$this->genererVue(array('prescription' => $prescription, 'detailprescriptions' => $detailprescriptions, 'detailnonlivres' => $detailnonlivres,
|
|
'detaillivres' => $detaillivres, 'garantieadherent_temp' => $garantieadherent_temp, 'factures' => $factures, 'factures_toal' => $factures_toal,
|
|
'geds' => $geds, 'tauxCouverture' => $tauxCouverture, 'marges' => $marges, 'idPrestationactes' => $idPrestationactes, /*'situation' => $situation,*/
|
|
'referencementpolice' => $referencementpolice, 'prestataireReference' => $prestataireReference, 'tm' => $tm, /*'situationGarantie' => $situationGarantie,*/
|
|
'dateFinDelaiCarenceActe' => $dateFinDelaiCarenceActe, /* 'situationAnnuelle' => $situationAnnuelle, 'situationFamille' => $situationFamille,*/
|
|
'tmAffection' => $tmAffection, 'Affection' => $Affection, 'soldeConsommation' => $soldeConsommation, 'soldeNbreTransaction' => $soldeNbreTransaction,
|
|
'statut' => $statut, 'contestation' => $contestation, 'prixZero' => $prixZero));
|
|
}
|
|
}
|
|
} |