213 lines
6.8 KiB
PHP
Executable File
213 lines
6.8 KiB
PHP
Executable File
<?php
|
|
require_once 'Framework/Controleur.php';
|
|
require_once 'Modele/Menuvueutilisateur.php';
|
|
require_once 'Modele/Beneficiaire.php';
|
|
require_once 'Modele/Detailexamem.php';
|
|
require_once 'Modele/Examen_temp.php';
|
|
require_once 'Modele/Prestationactes.php';
|
|
require_once 'Modele/Finger.php';
|
|
require_once 'Modele/Detailtarifacte.php';
|
|
require_once 'Modele/Ged.php';
|
|
require_once 'Modele/Feuillemaladie.php';
|
|
|
|
|
|
class ControleurLaboratoire extends Controleur {
|
|
private $menuvue;
|
|
private $beneficiaire;
|
|
private $prescription;
|
|
private $detailprescription;
|
|
private $prestation;
|
|
private $finger;
|
|
private $acte;
|
|
private $ged;
|
|
private $feuille;
|
|
|
|
public function __construct() {
|
|
$this->menuvue = new Menuvueutilisateur();
|
|
$this->menuvue->getMenuVue('Laboratoire');
|
|
|
|
$this->prescription = new Examen_temp();
|
|
$this->detailprescription = new Detailexamem();
|
|
$this->prestation = new Prestationactes();
|
|
|
|
$this->beneficiaire = new Beneficiaire();
|
|
$this->feuille = new Feuillemaladie();
|
|
|
|
viderContexte();
|
|
|
|
$_SESSION['p_okId'] = "-1";
|
|
|
|
$this->finger = new Finger();
|
|
$this->acte = new Detailtarifacte();
|
|
$this->ged = new Ged();
|
|
|
|
$_SESSION['p_codeTypeFacture_C'] = "LAB";
|
|
$_SESSION["proforma"] = "0";
|
|
}
|
|
|
|
public function index($msgErreur=null)
|
|
{
|
|
$message = "";
|
|
|
|
$nouveau_fichier = "Rien";
|
|
|
|
if(!empty($_POST))
|
|
{
|
|
define('TARGET', $_SESSION['cheminGed']); // Repertoire cible
|
|
define('MAX_SIZE', 10000000); // Taille max en octets du fichier
|
|
|
|
// Tableaux de donnees
|
|
// ".avi", ".bmp", ".doc", ".docx", ".gif", ".jpeg", "jpg", "jpe", ".mkv", ".mp3", ".pdf", ".png", ".pps", ".xls", ".xlsx", ".wav"
|
|
// $tabExt = array('jpg','png','jpeg'); // Extensions autorisees
|
|
|
|
$tabExt = array("avi", "bmp", "doc", "docx", "gif", "jpeg", "jpg", "jpe", "mkv", "mp3", "mp4", "pdf", "png", "pps", "xls", "xlsx", "wav"); // Extensions autorisees
|
|
|
|
// Variables
|
|
$extension = '';
|
|
|
|
if( !is_dir(TARGET) )
|
|
{
|
|
if( !mkdir(TARGET, 0755) )
|
|
{
|
|
$message = 'Erreur : le répertoire cible ne peut-être créé ! Vérifiez que vous diposiez des droits suffisants pour le faire ou créez le manuellement !';
|
|
}
|
|
}
|
|
|
|
// On verifie si le champ est rempli
|
|
if( !empty($_FILES['fichier_upload']['name']) )
|
|
{
|
|
// Recuperation de l'extension du fichier
|
|
|
|
$extension = pathinfo($_FILES['fichier_upload']['name'], PATHINFO_EXTENSION);
|
|
|
|
// On verifie l'extension du fichier
|
|
if(in_array(strtolower($extension), $tabExt))
|
|
{
|
|
$message = $_FILES['fichier_upload']['size'];
|
|
|
|
// On verifie les dimensions et taille du fichier
|
|
if($_FILES['fichier_upload']['size'] <= MAX_SIZE)
|
|
{
|
|
$taille = $_FILES['fichier_upload']['size'];
|
|
|
|
// Parcours du tableau d'erreurs
|
|
if(isset($_FILES['fichier_upload']['error']) && UPLOAD_ERR_OK === $_FILES['fichier_upload']['error'])
|
|
{
|
|
// On renomme le fichier
|
|
$nomOrigine = $_FILES['fichier_upload']['name'];
|
|
$nouveau_fichier = dateJourSql()."_".uniqid().".".$extension;
|
|
|
|
// Si c'est OK, on teste l'upload
|
|
if(move_uploaded_file($_FILES['fichier_upload']['tmp_name'], TARGET.$nouveau_fichier))
|
|
{
|
|
$message = 'Chargé avec succès / Uploaded successfully';
|
|
|
|
// on va envoyer dans la base de données
|
|
// $this->ged->enregistrergedpharmacie($nomOrigine, $nouveau_fichier, $taille);
|
|
$this->ged->enregistrergedprescriptionexamen($nomOrigine, $nouveau_fichier, $taille);
|
|
|
|
}
|
|
else
|
|
{
|
|
// Sinon on affiche une erreur systeme
|
|
$message = 'Problème lors du chargement !';
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$message = 'Une erreur interne a empêché le chargement';
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$message .= $_FILES['fichier_upload']['size']." Erreur dans les dimensions du fichier !";
|
|
// $message = 'Erreur dans les dimensions du fichier !';
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// Sinon on affiche une erreur pour l'extension
|
|
$message = 'Extension du fichier est incorrecte !';
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// Sinon on affiche une erreur pour le champ vide
|
|
$message = 'Veuillez sélectionner un fichier SVP! / Please select a file!';
|
|
}
|
|
|
|
// fin upload
|
|
}
|
|
|
|
$msgErreur = $message;
|
|
|
|
unset($_FILES['fichier_upload']);
|
|
|
|
$geds = $this->ged->getgedexamen();
|
|
|
|
$garantieadherent_temp = null;
|
|
$codePrestataire = $_SESSION['p_codePrestataire_C'];
|
|
|
|
$numeroBonExamen = $_SESSION['p_numeroBonExamen_C'];
|
|
|
|
if($numeroBonExamen=="-1")
|
|
{
|
|
$this->genererVue();
|
|
}
|
|
else
|
|
{
|
|
$resultat = $this->beneficiaire->getBeneficiaireOrdonnanceLab($numeroBonExamen);
|
|
|
|
$idBeneficiaire = $resultat['idBeneficiaire'];
|
|
|
|
$beneficiaire = $this->beneficiaire->getContexteBeneficiaireId($idBeneficiaire);
|
|
|
|
$this->prescription->initexamen_lab($numeroBonExamen);
|
|
|
|
$numeroExamen = $_SESSION['p_numeroExamen_C'];
|
|
|
|
//var_dump($numeroExamen);
|
|
//die();
|
|
|
|
$prescription = $this->prescription->getprescription_lab($numeroBonExamen);
|
|
|
|
$detailprescriptions = $this->detailprescription->getdetailprescription_lab($numeroBonExamen);
|
|
|
|
$detailnonlivres = $this->prescription->getdetailnonlivre();
|
|
|
|
$detaillivres = $this->prescription->getdetaillivre();
|
|
|
|
$user_id = $_SESSION['p_user_id_C'];
|
|
$this->finger->vider_finger_temp($user_id);
|
|
|
|
$facture = $prescription['facture'];
|
|
$numeroFeuilleMaladie = $prescription['numeroFeuilleMaladie'];
|
|
$numeroExamen = $prescription['numeroExamen'];
|
|
|
|
$contestation = $this->feuille->getContestation($numeroFeuilleMaladie);
|
|
|
|
$this->prestation->vider_garantieadherent_temp($numeroFeuilleMaladie, $codePrestataire);
|
|
|
|
if($facture==0)
|
|
{
|
|
$garantieadherent_temp = $this->prestation->init_garantieadherent_temp_lab($numeroFeuilleMaladie, $codePrestataire);
|
|
}
|
|
|
|
$factures = $this->prescription->getfactures_examen($numeroBonExamen);
|
|
$factures_toal = $this->prescription->getfactures_total_examen($numeroBonExamen);
|
|
|
|
$datePrestation = $this->acte->getDatePrestation($numeroFeuilleMaladie);
|
|
|
|
|
|
$tm = $this->acte->ticketModerateurDefinitif("", "", $datePrestation);
|
|
|
|
$tauxCouverture = (100-$tm)."%";
|
|
|
|
|
|
$this->genererVue(array('prescription' => $prescription, 'detailprescriptions' => $detailprescriptions,
|
|
'detailnonlivres' => $detailnonlivres, 'detaillivres' => $detaillivres, 'garantieadherent_temp' => $garantieadherent_temp,
|
|
'factures' => $factures, 'factures_toal' => $factures_toal, 'tauxCouverture' => $tauxCouverture,
|
|
'geds' => $geds, 'msgErreur' => $msgErreur, 'contestation' => $contestation));
|
|
}
|
|
}
|
|
} |