$extractPassages->fin_selection = $fin_selection; $extractPassages->group_id = CGroups::loadCurrent()->_id; $extractPassages->store(); $doc_valid = null; $where = array(); /** Indispensable pour le cas des hospit sans relicat */ //$where['sejour.type'] = " = 'urg'"; $where['sejour.annule'] = " = '0'"; $where['sejour.entree'] = " BETWEEN '{$debut_selection}' AND '{$fin_selection}' "; $where['sejour.group_id'] = " = '" . CGroups::loadCurrent()->_id . "'"; $leftjoin = array(); $leftjoin['sejour'] = 'sejour.sejour_id = rpu.sejour_id'; $order = "entree ASC"; $rpu = new CRPU(); /** @var CRPU[] $rpus */ $rpus = $rpu->loadList($where, $order, null, null, $leftjoin); if (count($rpus) == 0) { CAppUI::stepAjax("Aucun RPU à extraire.", UI_MSG_ERROR); } foreach ($rpus as $_rpu) { $sejour = $_rpu->_ref_sejour; $sejour->loadExtDiagnostics(); $sejour->loadDiagnosticsAssocies(false); $sejour->loadRefsConsultations(); } // Appel de la fonction d'extraction du RPUSender $rpuSender = $extractPassages->getRPUSender(); if (!$rpuSender) { CAppUI::stepAjax("Aucun sender définit dans le module dPurgences.", UI_MSG_ERROR); } $extractPassages = $rpuSender->extractRPU($extractPassages, $rpus);
$where["entree"] = "<= '{$date_max}'"; $where["sortie"] = ">= '{$date_min}'"; $where[] = $q; $affs = $affectation->loadList($where); foreach ($affs as $_aff) { $affectations[$_aff->lit_id] = "1"; } } else { $date_tolerance = CAppUI::conf("dPurgences date_tolerance"); $date_before = CMbDT::date("-{$date_tolerance} DAY", $date); $date_after = CMbDT::date("+1 DAY", $date); $ljoin = array(); $ljoin["sejour"] = "rpu.sejour_id = sejour.sejour_id"; $where = array(); $where["sejour.type"] = " = 'urg'"; $where["sejour.entree"] = " BETWEEN '{$date_before}' AND '{$date_after}'"; $where["sejour.annule"] = " = '0'"; $where["sejour.group_id"] = "= '" . CGroups::loadCurrent()->_id . "'"; $where[] = $q; $rpu = new CRPU(); $rpus = $rpu->loadList($where, null, null, null, $ljoin); foreach ($rpus as $_rpu) { $affectations[$_rpu->box_id] = "1"; } } // Création du template $smarty = new CSmartyDP(); $smarty->assign("chambre", $chambre); $smarty->assign("patient", $patient); $smarty->assign("affectations", $affectations); $smarty->display("inc_choice_lit.tpl");