예제 #1
0
 *
 * @package    Mediboard
 * @subpackage Stock
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
// If it is a return to the group stock
if (isset($_POST['_return']) && isset($_POST['_code'])) {
    $stock_service = CProductStockService::getFromCode($_POST['_code']);
    $stock_group = CProductStockGroup::getFromCode($_POST['_code']);
    $_POST['quantity'] = -abs($_POST['quantity']);
    $_POST['_code'] = null;
    $_POST['_return'] = null;
    if ($stock_service && $stock_group) {
        $delivery = new CProductDelivery();
        $where = array('stock_id' => "= '{$stock_group->_id}'", 'stock_class' => "= 'CProductStockGroup'", 'service_id' => "= '{$stock_service->service_id}'", 'quantity' => "< 0");
        if (!$delivery->loadObject($where)) {
            $delivery->stock_id = $stock_group->_id;
            $delivery->stock_class = $stock_group->_class;
            $delivery->service_id = $stock_service->service_id;
        }
        $delivery->quantity += $_POST['quantity'];
        $delivery->date_dispensation = CMbDT::dateTime();
        if ($msg = $delivery->store()) {
            CAppUI::setMsg($msg, UI_MSG_ERROR);
        }
        $_POST['delivery_id'] = $delivery->_id;
    }
}
$do = new CDoObjectAddEdit('CProductDeliveryTrace');
 *  @version $Revision: 6146 $
 *  @author SARL OpenXtrem
 *  @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html 
 */
CCanDo::checkRead();
$service_id = CValue::getOrSession('service_id');
$mode = CValue::get('mode');
$start = CValue::get('start');
$order_by = 'service_id, patient_id, date_dispensation ASC';
$where = array();
if ($service_id) {
    $where['service_id'] = " = '{$service_id}'";
}
$where['date_delivery'] = "IS NULL";
$where['quantity'] = " > 0";
$delivery = new CProductDelivery();
/** @var CProductDelivery[] $deliveries */
$deliveries = $delivery->loadList($where, $order_by, $mode ? null : intval($start) . ",30");
$deliveries_count = $delivery->countList($where);
$deliveries_nominatif = array();
$deliveries_global = array();
// Creation d'un tableau de patient
$patients = array();
if (count($deliveries)) {
    foreach ($deliveries as $_delivery) {
        $_delivery->loadRefsFwd();
        $_delivery->loadRefsBack();
        $_delivery->_ref_stock->loadRefsFwd();
        $_delivery->loadRefPatient();
        $_delivery->loadRefSejour();
        $_delivery->loadRefService();
예제 #3
0
<?php

/* $Id: httpreq_vw_restockages_service_list.php 6146 2009-04-21 14:40:08Z alexis_granger $ */
/**
 *	@package Mediboard
 *	@subpackage soins
 *	@version $Revision: 6146 $
 *  @author SARL OpenXtrem
 *  @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html 
 */
CCanDo::checkEdit();
$service_id = CValue::get('service_id');
$delivery = new CProductDelivery();
$where = array("service_id" => "= '{$service_id}'", "stock_id" => "IS NULL", "stock_class" => "= 'CProductStockGroup'");
/** @var CProductDelivery[] $deliveries */
$deliveries = $delivery->loadList($where, "date_dispensation DESC", 50);
foreach ($deliveries as $_delivery) {
    $_delivery->loadRefStock();
    $_delivery->_ref_stock->loadRefsFwd();
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign('deliveries', $deliveries);
$smarty->display('inc_vw_custom_orders.tpl');
예제 #4
0
// Loads the required Product and its References
$product = new CProduct();
if ($product->load($product_id)) {
    $product->loadRefsBack();
    $endowment_item = new CProductEndowmentItem();
    $ljoin = array('product_endowment' => "product_endowment.endowment_id = product_endowment_item.endowment_id");
    foreach ($product->_ref_stocks_service as $_stock) {
        $where = array("product_endowment.service_id" => "= '{$_stock->object_id}'", "product_endowment_item.product_id" => "= '{$product->_id}'");
        $_stock->_ref_endowment_items = $endowment_item->loadList($where, null, null, null, $ljoin);
    }
    foreach ($product->_ref_references as $_reference) {
        $_reference->loadRefProduct();
        $_reference->loadRefSociete();
    }
    $product->loadRefStock();
    $where = array("stock_class" => " = 'CProductStockGroup'", "stock_id" => " = '{$product->_ref_stock_group->stock_id}'");
    $delivery = new CProductDelivery();
    $product->_ref_deliveries = $delivery->loadList($where, "date_dispensation DESC, date_delivery DESC", 50);
    foreach ($product->_ref_deliveries as $_delivery) {
        $_delivery->loadRefsBack();
    }
    $product->loadView();
}
// Loads the required Category the complete list
$category = new CProductCategory();
$list_categories = $category->loadList(null, 'name');
// Smarty template
$smarty = new CSmartyDP();
$smarty->assign('product', $product);
$smarty->assign('list_categories', $list_categories);
$smarty->display('inc_edit_product.tpl');
예제 #5
0
$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;
                    }
                }
                if ($target_quantity > $effective_quantity) {
                    // This the GROUP stock!
                    $orders[$stock_group->_id] = $target_quantity - $effective_quantity;
                }
            } else {
                $orders[$stock_group->_id] = $target_quantity;
            }
        }
    }
 /**
  * Get stock
  *
  * @return CProductStock
  */
 function getStock()
 {
     return $this->_ref_delivery->loadRefStock();
 }
<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage Stock
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
$list = explode("-", CValue::post("list", ""));
CMbArray::removeValue("", $list);
foreach ($list as $_id) {
    $delivery = new CProductDelivery();
    $delivery->load($_id);
    $delivery->date_delivery = CMbDT::dateTime();
    if ($msg = $delivery->store()) {
        CAppUI::setMsg($msg, UI_MSG_WARNING);
    } else {
        CAppUI::setMsg("Réception terminée");
    }
}
echo CAppUI::getMsg();
CApp::rip();
예제 #8
0
 /**
  * @see parent::completeLabelFields()
  */
 function completeLabelFields(&$fields, $params)
 {
     if (!isset($this->_from_op)) {
         $this->loadRefLastOperation()->_from_sejour = 1;
         $this->_ref_last_operation->completeLabelFields($fields, $params);
     }
     $this->loadRefPatient()->completeLabelFields($fields, $params);
     $this->loadRefPraticien();
     $this->loadNDA();
     $this->loadNRA();
     $now = CMbDT::dateTime();
     $affectation = $this->getCurrAffectation($this->entree > $now ? $this->entree : null);
     $affectation->loadView();
     $affectation->loadRefService();
     $souhaits = array();
     if (CAppUI::conf("dPhospi prestations systeme_prestations", CGroups::loadCurrent()) == "expert") {
         /** @var CItemLiaison[] $items_liaisons */
         $items_liaisons = $this->loadBackRefs("items_liaisons", "date");
         CStoredObject::massLoadFwdRef($items_liaisons, "item_souhait_id");
         CStoredObject::massLoadFwdRef($items_liaisons, "sous_item_id");
         foreach ($items_liaisons as $_liaison) {
             $item_souhait = $_liaison->loadRefItem();
             if ($item_souhait->object_class == "CPrestationPonctuelle") {
                 continue;
             }
             $sous_item = $_liaison->loadRefSousItem();
             $nom = $item_souhait;
             if ($sous_item->_id) {
                 $nom = $sous_item->nom;
             }
             $souhaits[] = $nom;
         }
     }
     $meds_dispenses = array();
     if (isset($params["debut_dispensation"]) && isset($params["fin_dispensation"])) {
         $from = $params["debut_dispensation"];
         $to = $params["fin_dispensation"];
         $delivery = new CProductDelivery();
         $where = array("date_dispensation" => "BETWEEN '{$from}' AND '{$to}'", "sejour_id" => "= '{$this->_id}'");
         $deliveries = $delivery->loadList($where);
         $stocks = CStoredObject::massLoadFwdRef($deliveries, "stock_id");
         $products = CStoredObject::massLoadFwdRef($stocks, "product_id");
         /** @var CProduct $_product */
         foreach ($products as $_product) {
             $meds_dispenses[] = $_product->code . " " . $_product->name;
         }
     }
     $fields_sejour = array("DATE ENT" => CMbDT::dateToLocale(CMbDT::date($this->entree)), "HEURE ENT" => CMbDT::transform($this->entree, null, "%H:%M"), "DATE SORTIE" => CMbDT::dateToLocale(CMbDT::date($this->sortie)), "HEURE SORTIE" => CMbDT::transform($this->sortie, null, "%H:%M"), "PRAT RESPONSABLE" => $this->_ref_praticien->_view, "NDOS" => $this->_NDA, "NRA" => $this->_ref_NRA ? $this->_ref_NRA->id400 : "", "CODE BARRE NDOS" => "@BARCODE_" . $this->_NDA . "@", "CHAMBRE COURANTE" => $affectation->_view, "SERVICE COURANT" => $affectation->_ref_service->_view, "MEDICAMENTS DISPENSES" => implode("\n", $meds_dispenses));
     if (CAppUI::conf("dPhospi prestations systeme_prestations", CGroups::loadCurrent()) == "expert") {
         $fields_sejour["PRESTATIONS SOUHAITEES"] = implode(" - ", $souhaits);
     }
     $fields = array_merge($fields, $fields_sejour);
     if (CAppUI::conf("ref_pays") == 2) {
         $fields["NATURE SEJOUR"] = $this->getFormattedValue("_type_sejour");
         $fields["MODE TRT"] = $this->loadRefChargePriceIndicator()->code;
         $this->loadRefsFactureEtablissement();
         if ($this->_ref_last_facture) {
             $this->_ref_last_facture->loadRefAssurance();
             $fields["ASSUR MALADIE"] = $this->_ref_last_facture->_ref_assurance_maladie->nom;
             $fields["ASSUR ACCIDENT"] = $this->_ref_last_facture->_ref_assurance_accident->nom;
         }
     }
 }
<?php

/**
 * $Id: httpreq_vw_deliveries_list.php 19286 2013-05-26 16:59:04Z phenxdesign $
 *
 * @package    Mediboard
 * @subpackage Stock
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 19286 $
 */
CCanDo::checkRead();
$order_by = 'date_dispensation DESC';
$delivery = new CProductDelivery();
$list_latest_deliveries = $delivery->loadList(null, $order_by, 20);
// Création du template
$smarty = new CSmartyDP();
$smarty->assign('list_latest_deliveries', $list_latest_deliveries);
$smarty->display('inc_deliveries_list.tpl');
예제 #10
0
            foreach ($stocks as $_id => $_stock) {
                if ($_stock->_ref_product->cancelled) {
                    unset($stocks[$_id]);
                } else {
                    $_stock->quantity = min($_stock->quantity, $_stock->getOptimumQuantity());
                }
            }
        }
    }
}
// Load the already ordered dispensations
foreach ($stocks as &$_stock) {
    $_stock->loadRefsFwd();
    $where = array('product_delivery.date_dispensation' => "BETWEEN '{$date_min} 00:00:00' AND '{$date_max} 23:59:59'", 'product_delivery.stock_class' => "= '{$_stock->_class}'", 'product_delivery.stock_id' => "= '{$_stock->_id}'", 'product_delivery.service_id' => "= '{$service_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();
    $_stock->_ref_deliveries = $delivery->loadList($where, 'date_dispensation', null, null, $ljoin);
    $_stock->_total_quantity = 0;
    foreach ($_stock->_ref_deliveries as $_deliv) {
        $_stock->_total_quantity += $_deliv->quantity;
    }
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign('single_line', $single_line);
$smarty->assign('start', $start);
$smarty->assign('letter', $letter);
$smarty->assign('stocks', $stocks);
$smarty->assign('count_stocks', $count_stocks);
$smarty->assign('delivrance', $delivrance);
$smarty->assign('keywords', $keywords);