コード例 #1
0
$type = CValue::get('type');
$keywords = CValue::get('keywords');
$category_id = CValue::get('category_id');
$invoiced = CValue::get('invoiced');
$start = CValue::get('start', array());
$page = CValue::read($start, $type, 0);
$where = array();
if ($category_id) {
    $where["product.category_id"] = "= '{$category_id}'";
}
if ($type == "received" && !$invoiced) {
    $where["bill_number"] = "IS NULL";
}
// @todo faire de la pagination
$order = new CProductOrder();
$orders = $order->search($type, $keywords, "{$page}, 25", $where);
$count = $order->_search_count;
foreach ($orders as $_order) {
    //$_order->updateCounts();
    $_order->countRenewedItems();
    if ($_order->object_id) {
        $_order->loadTargetObject();
        $_order->_ref_object->loadRefsFwd();
    }
}
// Smarty template
$smarty = new CSmartyDP();
$smarty->assign('orders', $orders);
$smarty->assign('count', $count);
$smarty->assign('type', $type);
$smarty->assign('page', $page);
コード例 #2
0
 * @subpackage Stock
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkEdit();
$category_id = CValue::getOrSession('category_id');
$societe_id = CValue::getOrSession('societe_id');
$letter = CValue::getOrSession('letter');
$_autofill = CValue::get('_autofill');
// Categories list
$category = new CProductCategory();
$list_categories = $category->loadList(null, 'name');
// Suppliers list
$list_societes = CSociete::getSuppliers(false);
$order = new CProductOrder();
$list_orders = $order->search("waiting", null, 30);
foreach ($list_orders as $_order) {
    $_order->countBackRefs("order_items");
    $_order->loadRefsOrderItems();
}
// Smarty template
$smarty = new CSmartyDP();
$smarty->assign('_autofill', $_autofill);
$smarty->assign('list_categories', $list_categories);
$smarty->assign('category_id', $category_id);
$smarty->assign('list_societes', $list_societes);
$smarty->assign('societe_id', $societe_id);
$smarty->assign('letter', $letter);
$smarty->assign('list_orders', $list_orders);
$smarty->display('vw_aed_order.tpl');
コード例 #3
0
<?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();
$type = CValue::post("type", "pending");
$keywords = CValue::post("keywords");
$order = new CProductOrder();
$orders_list = $order->search($type, $keywords, 30);
foreach ($orders_list as $_order) {
    $_order->countBackRefs("order_items");
    $_order->updateCounts();
}
// Smarty template
$smarty = new CSmartyDP();
$smarty->assign("orders", $orders_list);
$smarty->display("inc_orders_autocomplete.tpl");
コード例 #4
0
ファイル: print_orders.php プロジェクト: fbone/mediboard4
 * @subpackage Stock
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkRead();
$invoiced = CValue::get("invoiced");
$not_invoiced = CValue::get("not-invoiced");
$date_min = CValue::get("date_min");
$date_max = CValue::get("date_max");
$where = array("DATE(date_ordered) BETWEEN '{$date_min}' AND '{$date_max}'");
if ($invoiced xor $not_invoiced) {
    $where["bill_number"] = $invoiced ? "IS NOT NULL" : "IS NULL";
}
$order = new CProductOrder();
$orders = $order->search("received", null, null, $where);
$count = $order->_search_count;
$total = 0;
$total_ttc = 0;
foreach ($orders as $_order) {
    $_order->countRenewedItems();
    foreach ($_order->_ref_order_items as $item) {
        $item->loadRefsReceptions();
        $rec = reset($item->_ref_receptions);
        $_order->_date_received = $rec ? $rec->date : null;
    }
    if ($_order->object_id) {
        $_object = $_order->loadTargetObject();
        $_object->loadRefSejour()->loadNDA();
        $_object->loadRefsFwd();
    }
コード例 #5
0
 if ($context_guid = CValue::post("_context_guid")) {
     list($object_class, $object_id) = explode("-", $context_guid);
     $where["product_order.object_class"] = "= '{$object_class}'";
     $where["product_order.object_id"] = "= '{$object_id}'";
     if ($septic = CValue::post("septic")) {
         unset($_POST["context_guid"]);
         $where["product_order_item.septic"] = "= '{$septic}'";
     } else {
         $where["product_order_item.septic"] = "= '0'";
     }
 } elseif ($comments = CValue::read($_POST, "_comments")) {
     $where["product_order.comments"] = "LIKE '{$comments}%'";
 }
 $where["product_order.group_id"] = "= '" . CProductStockGroup::getHostGroup() . "'";
 $order = new CProductOrder();
 $orders = $order->search("waiting", null, 1, $where);
 if (($context_guid || $comments == CProductOrder::$_return_form_label) && count($orders) == 0) {
     $orders = $order->search("locked", null, 1, $where);
 }
 // If no order found
 if (count($orders) == 0) {
     if ($context_guid) {
         $context = CMbObject::loadFromGuid($context_guid);
         $order->setObject($context);
         $order->locked = 1;
     }
     $comments = CValue::read($_POST, "_comments");
     $order->societe_id = $reference->societe_id;
     $order->group_id = CProductStockGroup::getHostGroup();
     $order->comments = $comments;
     if (strpos(CProductOrder::$_return_form_label, $comments) === 0) {