Exemplo n.º 1
0
 /**
  * @see parent::updateFormFields()
  */
 function updateFormFields()
 {
     parent::updateFormFields();
     if ($this->end_datetime && $this->start_datetime) {
         $this->_duration = CMbDT::timeRelative($this->start_datetime, $this->end_datetime);
     }
 }
Exemplo n.º 2
0
    $op->loadBrancardage();
    if ($use_poste) {
        $op->loadRefPoste();
        $op->loadRefPostePreop();
    }
    $op->loadRefSortieLocker()->loadRefFunction();
    if (in_array($type, array("ops", "reveil")) && CModule::getActive("bloodSalvage")) {
        $salvage = $op->loadRefBloodSalvage();
        $salvage->loadRefPlageOp();
        $salvage->_totaltime = "00:00:00";
        if ($salvage->recuperation_start && $salvage->transfusion_end) {
            $salvage->_totaltime = CMbDT::timeRelative($salvage->recuperation_start, $salvage->transfusion_end);
        } elseif ($salvage->recuperation_start) {
            $from = $salvage->recuperation_start;
            $to = CMbDT::date($salvage->_datetime) . " " . CMbDT::time();
            $salvage->_totaltime = CMbDT::timeRelative($from, $to);
        }
    }
    if (in_array($type, array("out", "reveil"))) {
        if (!$op->sortie_reveil_reel) {
            $nb_sorties_non_realisees++;
        }
        $sejour->loadRefsAffectations();
        if ($sejour->_ref_first_affectation->_id) {
            $sejour->_ref_first_affectation->loadRefLit();
            $sejour->_ref_first_affectation->_ref_lit->loadCompleteView();
        }
    }
}
// Chargement de la liste du personnel pour le reveil
$personnels = array();
                 }
                 $curr_plage->_duree_total_personnel[$_key_cat]["duree"] = $new_total;
             }
         }
     }
 }
 // Totaux
 // Durée prévue
 $newTotalPrevu = CMbDT::addTime($curr_plage->_duree_prevue, $total["duree_prevue"]);
 if ($newTotalPrevu < $total["duree_prevue"]) {
     $total["days_duree_prevue"]++;
 }
 $total["duree_prevue"] = $newTotalPrevu;
 // Durée première à la dernière
 if ($curr_plage->_first_op && $curr_plage->_last_op && $curr_plage->_first_op < $curr_plage->_last_op) {
     $curr_plage->_duree_first_to_last = CMbDT::timeRelative($curr_plage->_first_op, $curr_plage->_last_op);
     $newTotalFirstToLast = CMbDT::addTime($curr_plage->_duree_first_to_last, $total["duree_first_to_last"]);
     if ($newTotalFirstToLast < $total["duree_first_to_last"]) {
         $total["days_duree_first_to_last"]++;
     }
     $total["duree_first_to_last"] = $newTotalFirstToLast;
 }
 // Durée réèlle
 $newTotalReel = CMbDT::addTime($curr_plage->_duree_total_op, $total["duree_reelle"]);
 if ($newTotalReel < $total["duree_reelle"]) {
     $total["days_duree_reelle"]++;
 }
 $total["duree_reelle"] = $newTotalReel;
 // Durée du personnel
 foreach ($curr_plage->_duree_total_personnel as $_key_cat => $_curr_cat) {
     if (!isset($total["personnel"][$_key_cat])) {
Exemplo n.º 4
0
 /**
  * Load ref consult
  *
  * @return CConsultation
  */
 function loadRefConsult()
 {
     // Chargement de la consultation ATU
     if (!$this->_ref_sejour) {
         $this->loadRefSejour();
     }
     $sejour =& $this->_ref_sejour;
     $sejour->loadRefsConsultations();
     if (!CAppUI::conf("dPurgences create_sejour_hospit") && $this->mutation_sejour_id) {
         $this->loadRefSejourMutation()->loadRefsConsultations();
         $this->_ref_consult = $this->_ref_sejour_mutation->_ref_consult_atu;
     } else {
         $this->_ref_consult = $this->_ref_sejour->_ref_consult_atu;
     }
     // Calcul du l'attente
     $this->_attente = $this->_presence;
     if ($this->_ref_consult->_id) {
         $entree = CMbDT::time($this->_ref_sejour->_entree);
         $this->_attente = CMbDT::subTime(CMbDT::transform($entree, null, "%H:%M:00"), CMbDT::transform(CMbDT::time($this->_ref_consult->heure), null, "%H:%M:00"));
     }
     $this->_can_leave_level = $sejour->sortie_reelle ? "" : "ok";
     if (!$sejour->sortie_reelle) {
         if (!$this->_ref_consult->_id) {
             $this->_can_leave_level = "warning";
         }
         // En consultation
         if ($this->_ref_consult->chrono != 64) {
             $this->_can_leave = -1;
             $this->_can_leave_level = "warning";
         } else {
             if (CMbDT::time($sejour->sortie_prevue) > CMbDT::time()) {
                 $this->_can_leave_since = true;
                 $this->_can_leave = CMbDT::timeRelative(CMbDT::time(), CMbDT::time($sejour->sortie_prevue));
             } else {
                 $this->_can_leave_about = true;
                 $this->_can_leave = CMbDT::timeRelative(CMbDT::time($sejour->sortie_prevue), CMbDT::time());
             }
             if (CAppUI::conf("dPurgences rpu_warning_time") < $this->_can_leave) {
                 $this->_can_leave_level = "warning";
             }
             if (CAppUI::conf("dPurgences rpu_warning_time") < $this->_can_leave) {
                 $this->_can_leave_level = "error";
             }
         }
     }
     return $this->_ref_consult;
 }
 * $Id:$
 *
 * @package    Mediboard
 * @subpackage bloodSalvage
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision:$
 */
CCanDo::checkRead();
$blood_salvage_id = CValue::get("blood_salvage_id");
$totaltime = CValue::getOrSession("totaltime", "00:00:00");
$blood_salvage = new CBloodSalvage();
$timeleft = "06:00:00";
if ($blood_salvage_id) {
    $blood_salvage->load($blood_salvage_id);
    $blood_salvage->loadRefPlageOp();
    if ($blood_salvage->recuperation_start && $blood_salvage->transfusion_end) {
        $totaltime = CMbDT::timeRelative($blood_salvage->recuperation_start, $blood_salvage->transfusion_end);
    } elseif ($blood_salvage->recuperation_start) {
        $totaltime = CMbDT::timeRelative($blood_salvage->recuperation_start, CMbDT::date($blood_salvage->_datetime) . " " . CMbDT::time());
    }
    $timeleft = CMbDT::timeRelative($totaltime, "06:00:00");
    if ($totaltime > "06:00:00") {
        $timeleft = "00:00:00";
    }
}
$smarty = new CSmartyDP();
$smarty->assign("blood_salvage", $blood_salvage);
$smarty->assign("totaltime", $totaltime);
$smarty->assign("timeleft", $timeleft);
$smarty->display("inc_total_time.tpl");
Exemplo n.º 6
0
 /**
  * @see parent::updateFormFields()
  */
 function updateFormFields()
 {
     parent::updateFormFields();
     $this->_duree_prevue = CMbDT::timeRelative($this->debut, $this->fin);
     $this->_view = "Plage du " . $this->getFormattedValue("date");
 }
Exemplo n.º 7
0
 /**
  * @see parent::updateFormFields()
  */
 function updateFormFields()
 {
     parent::updateFormFields();
     $this->updateEntreeSortie();
     if (CAppUI::conf("dPplanningOp CSejour systeme_isolement") == "expert") {
         $this->updateIsolement();
     }
     // Durées
     if (CMbDT::date($this->entree_prevue) == CMbDT::date($this->sortie_prevue)) {
         $this->_duree_prevue = 0;
     } else {
         $this->_duree_prevue = CMbDT::daysRelative($this->entree_prevue, $this->sortie_prevue);
     }
     if (!$this->_duree_prevue_heure) {
         $this->_duree_prevue_heure = CMbDT::timeRelative(CMbDT::time($this->entree_prevue), CMbDT::time($this->sortie_prevue), "%02d");
     }
     $this->_duree_reelle = CMbDT::daysRelative($this->entree_reelle, $this->sortie_reelle);
     $this->_duree = CMbDT::daysRelative($this->_entree, $this->_sortie);
     // Dates
     $this->_date_entree_prevue = CMbDT::date(null, $this->entree_prevue);
     $this->_date_sortie_prevue = CMbDT::date(null, $this->sortie_prevue);
     // Horaires
     // @todo: A supprimer
     $this->_time_entree_prevue = CMbDT::format($this->entree_prevue, "%H:%M:00");
     $this->_time_sortie_prevue = CMbDT::format($this->sortie_prevue, "%H:%M:00");
     $this->_hour_entree_prevue = CMbDT::format($this->entree_prevue, "%H");
     $this->_hour_sortie_prevue = CMbDT::format($this->sortie_prevue, "%H");
     $this->_min_entree_prevue = CMbDT::format($this->entree_prevue, "%M");
     $this->_min_sortie_prevue = CMbDT::format($this->sortie_prevue, "%M");
     switch (CAppUI::conf("dPpmsi systeme_facturation")) {
         case "siemens":
             $this->_guess_NDA = CMbDT::format($this->entree_prevue, "%y");
             $this->_guess_NDA .= $this->type == "exte" ? "5" : $this->type == "ambu" ? "4" : "0";
             $this->_guess_NDA .= "xxxxx";
             break;
         default:
             $this->_guess_NDA = "-";
     }
     $this->_at_midnight = $this->_date_entree_prevue != $this->_date_sortie_prevue;
     if ($this->entree_prevue && $this->sortie_prevue) {
         $this->_view = "Séjour du " . CMbDT::format($this->_entree, CAppUI::conf("date"));
         $this->_shortview = "Du " . CMbDT::format($this->_entree, CAppUI::conf("date"));
         if (CMbDT::format($this->_entree, CAppUI::conf("date")) != CMbDT::format($this->_sortie, CAppUI::conf("date"))) {
             $this->_view .= " au " . CMbDT::format($this->_sortie, CAppUI::conf("date"));
             $this->_shortview .= " au " . CMbDT::format($this->_sortie, CAppUI::conf("date"));
         }
     }
     $this->_acte_execution = CMbDT::dateTime($this->entree_prevue);
     $this->_praticien_id = $this->praticien_id;
     $this->_adresse_par = $this->etablissement_entree_id || $this->adresse_par_prat_id;
     if ($this->adresse_par_prat_id) {
         $medecin_adresse_par = $this->loadRefAdresseParPraticien();
         $this->_adresse_par_prat = $medecin_adresse_par->_view;
     }
     if ($this->etablissement_entree_id) {
         $etab = $this->loadRefEtablissementProvenance();
         $this->_ref_etablissement_provenance = $etab->_view;
     }
     // Etat d'un sejour : encours, clôturé ou preadmission
     $this->_etat = "preadmission";
     if ($this->entree_reelle) {
         $this->_etat = "encours";
     }
     if ($this->sortie_reelle) {
         $this->_etat = "cloture";
     }
     // Motif complet du séjour
     $this->_motif_complet .= $this->libelle;
     $this->_motif_complet = "";
     if ($this->recuse == -1) {
         $this->_motif_complet .= "[Att] ";
     }
     $this->_motif_complet .= $this->libelle;
     if (!$this->annule && $this->recuse == -1) {
         $this->_view = "[Att] " . $this->_view;
     }
     if (CModule::getActive("dPfacturation") && CAppUI::conf("dPplanningOp CFactureEtablissement use_facture_etab")) {
         $this->loadRefsFactureEtablissement();
         if ($this->_ref_last_facture) {
             $facture = $this->_ref_last_facture;
             $this->_type_sejour = $facture->type_facture;
             $this->_statut_pro = $facture->statut_pro;
             $this->_dialyse = $facture->dialyse;
             $this->_cession_creance = $facture->cession_creance;
             $this->_assurance_maladie = $facture->assurance_maladie;
             $this->_assurance_accident = $facture->assurance_accident;
             $this->_rques_assurance_maladie = $facture->rques_assurance_maladie;
             $this->_rques_assurance_accident = $facture->rques_assurance_accident;
         }
     }
 }