function resetModifications()
 {
     $typeRepas = new CTypeRepas();
     $typeRepas->load($this->typerepas_id);
     $service = new CService();
     $service->load($this->service_id);
     $service->loadRefsBack();
     foreach ($service->_ref_chambres as $chambre_id => &$chambre) {
         $chambre->loadRefsBack();
         foreach ($chambre->_ref_lits as $lit_id => &$lit) {
             $lit->loadAffectations($this->date);
             foreach ($lit->_ref_affectations as $affectation_id => &$affectation) {
                 $affectation->loadRefSejour();
                 $affectation->loadMenu($this->date, array($this->typerepas_id => null));
                 $sejour =& $affectation->_ref_sejour;
                 $date_entree = substr($affectation->entree, 0, 10);
                 $date_sortie = substr($affectation->sortie, 0, 10);
                 $heure_entree = substr($affectation->entree, 11, 5);
                 $heure_sortie = substr($affectation->sortie, 11, 5);
                 if (!$sejour->sejour_id || $sejour->type == "ambu" || $this->date == $date_entree && $heure_entree > $typeRepas->fin || $this->date == $date_sortie && $heure_sortie < $typeRepas->debut) {
                 } else {
                     $repas =& $affectation->_list_repas[$this->date][$this->typerepas_id];
                     if ($repas->modif) {
                         $repas->modif = 0;
                         $repas->_no_synchro = true;
                         $repas->store();
                     }
                 }
             }
         }
     }
 }
/**
 * $Id: offline_prescriptions_multipart.php 27852 2015-04-03 09:55:15Z alexis_granger $
 *
 * @package    Mediboard
 * @subpackage Soins
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 27852 $
 */
ob_clean();
CApp::setMemoryLimit("1024M");
CApp::setTimeLimit(240);
$service_id = CValue::get("service_id");
$date = CValue::get("date", CMbDT::date());
$service = new CService();
$service->load($service_id);
$datetime_min = "{$date} 00:00:00";
$datetime_max = "{$date} 23:59:59";
$datetime_avg = "{$date} " . CMbDT::time();
$sejour = new CSejour();
$where = array();
$ljoin = array();
$ljoin["affectation"] = "sejour.sejour_id = affectation.sejour_id";
$where["sejour.entree"] = "<= '{$datetime_max}'";
$where["sejour.sortie"] = " >= '{$datetime_min}'";
$where["affectation.entree"] = "<= '{$datetime_max}'";
$where["affectation.sortie"] = ">= '{$datetime_min}'";
$where["affectation.service_id"] = " = '{$service_id}'";
/** @var CSejour[] $sejours */
$sejours = $sejour->loadList($where, null, null, "sejour.sejour_id", $ljoin);
$ordonnances = array();
예제 #3
0
    }
    // Praticien demandeur
    $bilan = $_sejour->_ref_bilan_ssr;
    $bilan->loadRefPraticienDemandeur();
    // Chargement du lit
    $_sejour->loadRefCurrAffectation()->loadRefLit();
}
if ($order_col == "lit_id") {
    $sorter_lit = CMbArray::pluck($sejours, "_ref_curr_affectation", "_ref_lit", "_view");
    $sorter_patient_nom = CMbArray::pluck($sejours, "_ref_patient", "nom");
    $sorter_patient_prenom = CMbArray::pluck($sejours, "_ref_patient", "prenom");
    array_multisort($sorter_lit, constant("SORT_{$order_way}"), $sorter_patient_nom, SORT_ASC, $sorter_patient_prenom, SORT_ASC, $sejours);
}
// Ajustements services
$service = new CService();
$service->load($filter->service_id);
$services[$service->_id] = $service;
unset($services[""]);
// Ajustements kinés
$kine = new CMediusers();
$kine->load($filter->referent_id);
$kine->loadRefFunction();
$kines[$kine->_id] = $kine;
unset($kines[""]);
// Tris a posteriori : détruit les clés !
array_multisort(CMbArray::pluck($kines, "_view"), SORT_ASC, $kines);
array_multisort(CMbArray::pluck($services, "_view"), SORT_ASC, $services);
array_multisort(CMbArray::pluck($praticiens, "_view"), SORT_ASC, $praticiens);
// Couleurs
$libelles = CMbArray::pluck($sejours, "libelle");
$colors = CColorLibelleSejour::loadAllFor($libelles);
예제 #4
0
<?php

/* $Id: do_delivery_aed.php 6067 2009-04-14 08:04:15Z phenxdesign $ */
/**
 * @package Mediboard
 * @subpackage soins
 * @version $Revision: 6067 $
 * @author SARL OpenXtrem
 * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html 
 */
$service_id = CValue::get('service_id');
$date_min = CValue::get('date_min');
$date_max = CValue::get('date_max');
$service = new CService();
$orders = array();
if ($service->load($service_id) && $date_min && $date_max) {
    $stocks = $service->loadBackRefs('product_stock_services');
    if ($stocks) {
        foreach ($stocks as $stock) {
            $stock->loadRefsFwd();
            $stock_group = CProductStockGroup::getFromCode($stock->_ref_product->code);
            $target_quantity = $stock->order_threshold_optimum ? $stock->order_threshold_optimum : $stock->order_threshold_max;
            if (CAppUI::conf('dPstock CProductStockService infinite_quantity') != 1) {
                $effective_quantity = $stock->quantity;
                $where = array('product_delivery.date_dispensation' => "BETWEEN '{$date_min} 00:00:00' AND '{$date_max} 23:59:59'", 'product_delivery.stock_id' => " = '{$stock_group->_id}'", 'product_delivery.stock_class' => " = '{$stock_group->_class}'", 'product.category_id' => " = '" . CAppUI::conf('dPmedicament CBcbProduitLivretTherapeutique product_category_id') . "'");
                $ljoin = array('product_stock_group' => 'product_delivery.stock_id = product_stock_group.stock_id', 'product' => 'product.product_id = product_stock_group.product_id');
                $delivery = new CProductDelivery();
                $deliveries = $delivery->loadList($where, null, null, null, $ljoin);
                foreach ($deliveries as $delivery) {
                    if ($delivery->order == 1 && $delivery->quantity > 0) {
                        $effective_quantity += $delivery->quantity;
예제 #5
0
/**
 * Mettre en cache les lits
 *
 * @param CAffectation $affectation Affectation
 *
 * @return void
 */
function cacheLit(CAffectation $affectation)
{
    // Cache des lits
    $lit_id = $affectation->lit_id;
    static $lits = array();
    if (!array_key_exists($lit_id, $lits)) {
        $lit = new C**t();
        $lit->load($lit_id);
        $lits[$lit_id] = $lit;
    }
    $lit = $lits[$lit_id];
    $lit->_ref_affectations[$affectation->_id] = $affectation;
    // Cache des chambres
    $chambre_id = $lit->chambre_id;
    static $chambres = array();
    if (!array_key_exists($chambre_id, $chambres)) {
        $chambre = new CChambre();
        $chambre->load($chambre_id);
        $chambres[$chambre_id] = $chambre;
    }
    $chambre = $chambres[$chambre_id];
    $chambre->_ref_lits[$lit_id] = $lit;
    // Cache de services
    global $sejoursParService;
    $service_id = $chambre->service_id;
    if (!array_key_exists($service_id, $sejoursParService)) {
        $service = new CService();
        $service->load($service_id);
        $sejoursParService[$service_id] = $service;
    }
    $service = $sejoursParService[$service_id];
    $service->_ref_chambres[$chambre_id] = $chambre;
}