/** * $Id$ * * @package Mediboard * @subpackage Stock * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ CCanDo::checkEdit(); $start = intval(CValue::get("start", 0)); $keywords = CValue::get("keywords"); $without_supplier = CValue::get("without_supplier"); // Chargement des receptions de l'etablissement $reception = new CProductReception(); $where = array(); $where["group_id"] = "= '" . CProductStockGroup::getHostGroup() . "'"; if (!$without_supplier) { $where["societe_id"] = "IS NOT NULL"; } $receptions = $reception->seek($keywords, $where, "{$start}, 25", true, null, "date DESC"); $total = $reception->_totalSeek; foreach ($receptions as $_reception) { $_reception->countReceptionItems(); } // Smarty template $smarty = new CSmartyDP(); $smarty->assign("reception", $reception); $smarty->assign("receptions", $receptions); $smarty->assign("total", $total);
<?php /** * $Id: print_reception_barcodes.php 26699 2015-01-08 13:07:38Z phenxdesign $ * * @package Mediboard * @subpackage Stock * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision: 26699 $ */ CCanDo::checkRead(); $reception_id = CValue::get('reception_id'); $lot_id = CValue::get('lot_id'); $force_print = CValue::get('force_print'); $reception = new CProductReception(); if ($reception_id) { $reception->load($reception_id); $reception->loadRefsFwd(); $reception->loadRefsBack(); } $pdf = new CMbPdf(); $pdf->setFont("vera", '', "10"); // Définition des marges de la pages //$pdf->SetMargins(15, 15); $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); $pdf->SetAutoPageBreak(0); // Creation d'une nouvelle page $pdf->AddPage(); if ($reception->_id) {
/** * Load order items * * @param object $reception reception * * @return CProductOrderItem[] */ function loadRefsaddItems() { $_reception = new CProductReception(); $where = array(); $where["reference"] = "LIKE '{$this->order_number}-%'"; $receptions = $_reception->loadIds($where); $where = array(); $where[] = "product_order_item_reception.reception_id " . CSQLDataSource::prepareIn(array_values($receptions)) . " OR product_order_item.order_id = '{$this->_id}'"; $ljoin = array(); $ljoin["product_order_item_reception"] = "product_order_item_reception.order_item_id = product_order_item.order_item_id"; $order_item = new CProductOrderItem(); /* @var CProductOrderItem[] $order_items*/ $order_items = $order_item->loadList($where, "order_item_id", null, null, $ljoin); foreach ($order_items as $_order) { if (!$_order->order_id) { $_order->quantity = 0; } $_order->updatePriceTVA(); } return $this->_ref_order_items_add = $order_items; }
<?php /** * $Id$ * * @package Mediboard * @subpackage Stock * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ CCanDo::checkRead(); $reception_id = CValue::get('reception_id'); $reception = new CProductReception(); $reception->load($reception_id); $reception->loadRefsBack(); $reception->loadRefsFwd(); $reception->updateTotal(); foreach ($reception->_ref_reception_items as $_reception_item) { $_reception_item->loadRefs(); } // Smarty template $smarty = new CSmartyDP(); $smarty->assign("reception", $reception); $smarty->display('print_reception.tpl');
/** * @see parent::store() */ function store() { $this->completeField("reception_id"); $is_new = !$this->_id; if ($is_new && $this->cancelled === null) { $this->cancelled = 0; } if ($is_new) { $this->loadRefOrderItem(); $this->_ref_order_item->loadOrder(); } if ($is_new && !$this->reception_id) { $order = $this->_ref_order_item->_ref_order; $reception = new CProductReception(); $reception->date = CMbDT::dateTime(); $reception->societe_id = $order->societe_id; $reception->group_id = CProductStockGroup::getHostGroup(); // Recherche de receptions ayant un numero de reception similaire pour gerer l'increment if ($order->order_number) { $where = array("reference" => "LIKE '{$order->order_number}%'"); $number = $reception->countList($where) + 1; $reception->reference = "{$order->order_number}-{$number}"; } if ($msg = $reception->store()) { return $msg; } $this->reception_id = $reception->_id; } if ($is_new) { $this->_ref_order_item->loadRefsFwd(); $this->_ref_order_item->_ref_reference->loadRefsFwd(); $this->_ref_order_item->_ref_reference->_ref_product->loadRefStock(); $product =& $this->_ref_order_item->_ref_reference->_ref_product; $product->updateFormFields(); if ($product->loadRefStock()) { $stock = $product->_ref_stock_group; $stock->quantity += $this->quantity; } else { $qty = $this->quantity; $stock = new CProductStockGroup(); $stock->product_id = $product->_id; $stock->group_id = CProductStockGroup::getHostGroup(); $stock->quantity = $qty; $stock->order_threshold_min = $qty; CAppUI::setMsg("Un nouveau stock a été créé", UI_MSG_OK); //CAppUI::setMsg("Un nouveau stock pour [%s] a été créé", UI_MSG_OK, $product->_view); } if ($msg = $stock->store()) { return $msg; } } if ($msg = parent::store()) { return $msg; } // If the order is received, we set the flag if ($is_new) { $order = $this->_ref_order_item->_ref_order; if (!$order->received) { $count_renewed = $order->countRenewedItems(); $count_received = $order->countReceivedItems() - (count($order->_ref_order_items) - $count_renewed); if ($count_renewed && $count_received >= $count_renewed) { $order->received = 1; $order->store(); } } } return null; }
<?php /** * $Id$ * * @package Mediboard * @subpackage Stock * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ CCanDo::checkEdit(); $reception_id = CValue::get('reception_id'); $order_id = CValue::get('order_id'); $letter = CValue::getOrSession('letter', "%"); $reception = new CProductReception(); if ($order_id) { $reception->findFromOrder($order_id); } else { $reception->load($reception_id); } $reception->loadRefsBack(); foreach ($reception->_ref_reception_items as $_reception) { $_reception->loadRefOrderItem()->loadReference(); } // Categories list $category = new CProductCategory(); $list_categories = $category->loadList(null, 'name'); $order = new CProductOrder(); $order->load($order_id); $order->updateCounts();
<?php /** * $Id$ * * @package Mediboard * @subpackage Stock * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ CCanDo::checkRead(); $reception_id = CValue::get('reception_id'); // Loads the expected Order $reception = new CProductReception(); $reception->load($reception_id); $reception->loadRefsBack(); foreach ($reception->_ref_reception_items as $_reception) { $_reception->loadRefOrderItem()->loadReference(); } // Smarty template $smarty = new CSmartyDP(); $smarty->assign('reception', $reception); $smarty->display('inc_reception.tpl');