Esempio n. 1
0
 /**
  *
  */
 function loadRefsLits($annule = false)
 {
     $lit = new C**t();
     $where = array();
     $ljoin = array();
     $where["chambre.service_id"] = "= '{$this->_id}'";
     $ljoin["chambre"] = "lit.chambre_id = chambre.chambre_id";
     if (!$annule) {
         $where["lit.annule"] = "= '0'";
         $where["chambre.annule"] = "= '0'";
     }
     $order = "ISNULL(chambre.rank), chambre.rank, chambre.nom, ISNULL(lit.rank), lit.rank,lit.nom ";
     $lits = $lit->loadList($where, $order, null, null, $ljoin);
     $this->_ref_chambres = self::massLoadFwdRef($lits, "chambre_id", null, true);
     foreach ($lits as $_lit) {
         $_chambre = $_lit->loadRefChambre();
         $_chambre->_ref_service = $this;
         $_chambre->_ref_lits[$_lit->_id] = $_lit;
     }
     return $lits;
 }
Esempio n. 2
0
 /**
  * Load lits
  *
  * @param bool $annule Annulé
  *
  * @return C**t[]
  */
 function loadRefsLits($annule = false)
 {
     $lit = new C**t();
     $where = array("chambre_id" => "= '{$this->_id}'");
     if (!$annule) {
         $where["annule"] = " ='0'";
     }
     $order = "ISNULL(lit.rank), lit.rank, ";
     $order .= $this->lits_alpha ? "lit.nom ASC" : "lit.nom DESC";
     return $this->_ref_lits = $this->_back["lits"] = $lit->loadList($where, $order);
 }
Esempio n. 3
0
        }
    }
    if (!count($services_ids_suggest)) {
        $services_ids_suggest = array($affectation->_ref_lit->_ref_chambre->service_id);
    }
} else {
    $services_ids_suggest = explode(",", $services_ids_suggest);
}
$sortie = $affectation->sortie;
$where = array();
$where["chambre.service_id"] = CSQLDataSource::prepareIn($services_ids_suggest);
$ljoin = array();
$ljoin["chambre"] = "lit.chambre_id = chambre.chambre_id";
$lit = new C**t();
/** @var C**t[] $lits */
$lits = $lit->loadList($where, null, null, null, $ljoin);
//unset($lits[$affectation->lit_id]);
$max_entree = 0;
$max_sortie = 0;
$ds = $lit->getDS();
foreach ($lits as $key => $_lit) {
    $_lit->_ref_affectations = array();
    $_lit->loadCompleteView();
    if ($_lit->_id == $affectation->lit_id) {
        $_lit->_ref_last_dispo = new CAffectation();
        $_lit->_ref_last_dispo->sortie = $entree;
        $_lit->_dispo_depuis = 0;
    } else {
        $where = array();
        $where["lit_id"] = "= '{$_lit->_id}'";
        $where["entree"] = "<= '{$sortie}'";
Esempio n. 4
0
$sejour->loadNDA();
$sejour->loadRefsConsultations();
$sejour->loadRefCurrAffectation();
// Horaire par défaut
$sejour->sortie_reelle = $sortie_reelle;
if (!$sejour->sortie_reelle) {
    $sejour->sortie_reelle = CMbDT::dateTime();
}
$where = array();
$where["entree"] = "<= '{$sejour->sortie_reelle}'";
$where["sortie"] = ">= '{$sejour->sortie_reelle}'";
$where["function_id"] = "IS NOT NULL";
$leftjoin = array("affectation" => "affectation.lit_id = lit.lit_id");
$lit = new C**t();
//Lit réservé pour les urgences
$lits_urgence = $lit->loadList($where, null, null, null, $leftjoin);
$where["function_id"] = "IS NULL";
$where["sejour_id"] = "IS NULL";
$where["lit.lit_id"] = CSQLDataSource::prepareIn(array_keys($lits_urgence));
//lit qui sont bloqués
$lits_bloque = $lit->loadList($where, null, null, null, $leftjoin);
$affectation = new CAffectation();
unset($where["lit.lit_id"]);
unset($where["sejour_id"]);
/** @var C**t $_lit */
foreach ($lits_urgence as $_lit) {
    $sortie = CMbDT::transform($affectation->sortie, null, "%Hh%M %d-%m-%Y");
    $_lit->loadRefService()->loadRefsChambres();
    if (array_key_exists($_lit->_id, $lits_bloque)) {
        $_lit->_view .= " (bloqué jusqu'au {$sortie})";
        continue;