<?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();
$order_item_id = CValue::get('order_item_id');
$order_item = new CProductOrderItem();
$order_item->load($order_item_id);
// Smarty template
$smarty = new CSmartyDP();
$smarty->assign('order_item', $order_item);
$smarty->display('inc_edit_order_item_unit_price.tpl');
<?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();
$item_id = CValue::get('order_item_id');
// Loads the expected Order Item
$item = new CProductOrderItem();
if ($item->load($item_id)) {
    $item->loadRefs();
    $item->_ref_reference->loadRefsFwd();
}
$item->_quantity_received = $item->quantity_received;
// Smarty template
$smarty = new CSmartyDP();
$smarty->assign('curr_item', $item);
$smarty->assign('order', $item->_ref_order);
$smarty->display('inc_order_item.tpl');
$references_cahpp = array();
foreach ($changes as $_change) {
    if (!isset($references[$_change["reference_id"]])) {
        $_reference = new CProductReference();
        $_reference->load($_change["reference_id"]);
        $references[$_reference->_id] = $_reference;
        $article = new CCAHPPArticle();
        $where = array("reference_fournisseur" => $article->_spec->ds->prepare("=%", $_reference->supplier_code));
        if (!$article->loadObject($where)) {
            $where = array("cip" => $article->_spec->ds->prepare("=%", $_reference->loadRefProduct()->code));
            $article->loadObject($where);
        }
        $references_cahpp[$_reference->_id] = $article;
    }
    $_order_item = new CProductOrderItem();
    $_order_item->load($_change["order_item_id"]);
    $_order_item->loadOrder();
    $_change["order_item"] = $_order_item;
    $changes_struct[$_change["reference_id"]][] = $_change;
}
$order_item = new CProductOrderItem();
$total_order_items = $order_item->countList();
// Smarty template
$smarty = new CSmartyDP();
$smarty->assign('changes', $changes);
$smarty->assign('changes_struct', $changes_struct);
$smarty->assign('references', $references);
$smarty->assign('references_cahpp', $references_cahpp);
$smarty->assign('total_order_items', $total_order_items);
$smarty->assign('ratio', $ratio);
$smarty->display('vw_reference_price_changes.tpl');