$series[0]["data"][] = array(count($series[0]["data"]) * 2 - 0.6, $total); // Hack pour les etablissements qui ont un service "Périmés" $where_services = array("nom" => "= 'Périmés'"); $services_expired = new CService(); $services_expired_ids = $services_expired->loadIds($where_services); // Output ////////////////// $where = array("product_delivery.stock_class" => "= 'CProductStockGroup'", "product_delivery.stock_id" => "= '{$product->_ref_stock_group->_id}'", "product_delivery_trace.date_delivery" => "BETWEEN '{$date}' AND '{$to}'"); if (count($services_expired_ids)) { $where[100] = "(product_delivery.type != 'expired' OR product_delivery.type IS NULL)\r\n AND product_delivery.service_id NOT IN (" . implode(',', $services_expired_ids) . ")"; } else { $where[100] = "product_delivery.type != 'expired' OR product_delivery.type IS NULL"; } $ljoin = array("product_delivery" => "product_delivery.delivery_id = product_delivery_trace.delivery_id"); $trace = new CProductDeliveryTrace(); /** @var CProductDeliveryTrace $traces */ $traces = $trace->loadList($where, null, null, null, $ljoin); $total = 0; foreach ($traces as $_trace) { $total += $_trace->quantity; } $max = max($max, $total); $series[1]["data"][] = array(count($series[1]["data"]) * 2, $total); // Output expired /////////////////// if (count($services_expired_ids)) { $where[100] = "product_delivery.type = 'expired' OR product_delivery.service_id IN (" . implode(',', $services_expired_ids) . ")"; } else { $where[100] = "product_delivery.type = 'expired'"; } $traces = $trace->loadList($where, null, null, null, $ljoin); $total_expired = 0; foreach ($traces as $_trace) {
* $Id: vw_traceability.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(); $code = CValue::getOrSession('code'); $codes = array(); $products = array(); if (strlen($code) > 2) { $where = array('code' => "LIKE '%{$code}%'"); $delivery = new CProductDeliveryTrace(); $list_deliveries = $delivery->loadList($where, 'date_delivery'); $reception = new CProductOrderItemReception(); $list_order_reception = $reception->loadList($where, 'date'); foreach ($list_order_reception as $trace) { if (!isset($codes[$trace->code])) { $codes[$trace->code] = array(); } $trace->loadRefsFwd(); if (!isset($products[$trace->code])) { $trace->loadRefOrderItem(); $trace->_ref_order_item->loadReference(); $trace->_ref_order_item->_ref_reference->loadRefsFwd(); $products[$trace->code] = $trace->_ref_order_item->_ref_reference->_ref_product; } // date_reception if ($trace->date) {