From: Maxime Bourget Date: Mon, 3 Jun 2013 17:31:53 +0000 (+0100) Subject: Display available quantity in order line view (for customer) X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=3df7c3277a8c0502dca5cfeb32d63db1bef67267;p=order_line_extra.git Display available quantity in order line view (for customer) --- diff --git a/includes/order_lines.inc b/includes/order_lines.inc index 52d315d..5f8d922 100644 --- a/includes/order_lines.inc +++ b/includes/order_lines.inc @@ -133,11 +133,13 @@ $row_id = $row['id']; "; } -function get_order_details_extra($customer_id) { +function get_order_details_extra($customer_id, $location) { $sql = "SELECT sod.id , so.order_no , stk_code - , quantity - qty_sent + , sod.quantity - qty_sent + , GREATEST(0, LEAST(qoh.quantity - quantity_before, sod.quantity - qty_sent)) + , quantity_before , required_date ,comment FROM ".TB_PREF."sales_order_details sod @@ -146,7 +148,9 @@ function get_order_details_extra($customer_id) { AND so.trans_type = ".ST_SALESORDER." AND so.debtor_no = $customer_id ) - WHERE quantity > qty_sent + JOIN ".TB_PREF."denorm_qoh qoh ON (stock_id = stk_code AND loc_code = '$location') + JOIN ".TB_PREF."denorm_order_details_queue d ON (d.id = sod.id) + WHERE sod.quantity > qty_sent "; return $sql; diff --git a/order_lines_view.php b/order_lines_view.php index 5f2e5b8..e136626 100644 --- a/order_lines_view.php +++ b/order_lines_view.php @@ -68,12 +68,13 @@ end_table(1); // Orders inquiry table // if($customer_id) { - $sql = get_order_details_extra($customer_id); + $sql = get_order_details_extra($customer_id, 'DEF'); $cols = array( 'detail_id' => 'skip' , _("Order #") => array('fun'=>'view_link', 'ord' => '') ,_("Item Code") => array('ord' => '', 'fun' => 'item_link') ,_("Quantity") => array('type' => 'qty', 'dec' => 0) + ,_("Available") => array('type' => 'qty', 'dec' => 0, 'ord' => '') ,_("Required Date") => array('fun' => 'input_date_details', 'ord' => '') ,_("Comment") => array('fun' => 'input_comment_details', 'ord' => '') );