From: Maxime Bourget Date: Fri, 14 Jun 2013 10:39:31 +0000 (+0100) Subject: Display to pick quantity on item summary. X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=332a5d50d3551e2171a1a7d6fe72209f68bf72a6;p=order_line_extra.git Display to pick quantity on item summary. --- diff --git a/includes/order_lines.inc b/includes/order_lines.inc index ac05e35..b38e0a7 100644 --- a/includes/order_lines.inc +++ b/includes/order_lines.inc @@ -235,18 +235,19 @@ function pick_checkbox($row) } function get_order_details_extra($customer_id, $location, $item_like) { - $sql = "SELECT sod.id + $select = "sod.id , so.order_no , stk_code , sod.quantity - qty_sent quantity , GREATEST(0, LEAST(qoh.quantity - quantity_before, sod.quantity - qty_sent)) , quantity_before + , p.quantity AS quantity_to_pick , sod.`priority` , hold_until_date , required_date , expiry_date - ,comment - FROM ".TB_PREF."sales_order_details sod + ,comment"; + $from = TB_PREF."sales_order_details sod JOIN ".TB_PREF."sales_orders so ON (so.order_no = sod.order_no AND so.trans_type = sod.trans_type AND so.trans_type = ".ST_SALESORDER." @@ -254,29 +255,36 @@ function get_order_details_extra($customer_id, $location, $item_like) { ) JOIN ".TB_PREF."denorm_qoh qoh ON (stock_id = stk_code AND loc_code = '$location') LEFT JOIN ".TB_PREF."denorm_order_details_queue d ON (d.id = sod.id) - WHERE sod.quantity > qty_sent + LEFT JOIN (".pick_query().") p ON (detail_id = sod.id) + "; + $where = " sod.quantity > qty_sent "; if($item_like) { if($item_like[0]=='/') { $regexp = substr($item_like, 1); - $sql .= " AND stk_code RLIKE '$regexp'"; + $where .= " AND stk_code RLIKE '$regexp'"; } else - $sql .= " AND stk_code LIKE '$item_like'"; + $where .= " AND stk_code LIKE '$item_like'"; } - return $sql; + return array('select' => $select, 'from' => $from, 'where' => $where); } -function get_order_summary($location) { - $held_condition = OrderXtraConfig::sql_held_condition(); - - $pick = "SELECT detail_id, -sum(quantity) as quantity +function pick_query() { + return "SELECT detail_id, -sum(quantity) as quantity FROM ".TB_PREF."topick WHERE type IN ('order', 'booked') GROUP BY detail_id "; +} + +function get_order_summary($location) { + $held_condition = OrderXtraConfig::sql_held_condition(); + + $pick = pick_query(); + $sub = "SELECT debtor_no, debtor_ref, branch_code, branch_ref, stk_code , min(delivery_date) , sum(d.quantity) as quantity diff --git a/includes/picking.inc b/includes/picking.inc index 387bd8e..8bdb1bf 100644 --- a/includes/picking.inc +++ b/includes/picking.inc @@ -11,9 +11,7 @@ function process_picking_flag() { function change_pck_flag($id, $value=null) { -display_warning("value $value"); if($value === null) $value = true; -display_warning("value $value"); global $Ajax; $picker = new Picker(); @@ -58,12 +56,10 @@ class Picker { JOIN ".TB_PREF."denorm_qoh qoh ON (qoh.stock_id = sod.stk_code AND loc_code = '$pick_location') WHERE debtor_no = $debtor_no AND branch_code = $branch_code "; - display_warning("$sql"); $result = db_query($sql, $sql); - display_warning("B $result"); while($row=db_fetch($result)) { foreach($row as $key => $value) { $$key = $value; } - $available = min($quantity, max($qoh-$quantity_before-$held,0 )); + $available = max(min($quantity-$held, $qoh-$quantity_before-$held) ,0 ); $booked = $quantity - $available; $sku = $stock_id; @@ -102,11 +98,9 @@ class Picker { db_query($sql, 'There was a problem inserting the picking information.'); } - display_warning("E"); } function deleteAllForBranch($debtor_no, $branch_code) { - display_warning("deleting for $debtor_no $branch_code"); $sql = "DELETE ".TB_PREF."topick p FROM ".TB_PREF."topick p JOIN ".TB_PREF."sales_order_details sod on (sod.id = p.detail_id) diff --git a/order_lines_view.php b/order_lines_view.php index 00e0258..c72f043 100644 --- a/order_lines_view.php +++ b/order_lines_view.php @@ -101,6 +101,7 @@ if($customer_id) { ,_("Quantity") => array('type' => 'qty', 'dec' => 0) ,_("Available") => array('fun' => 'available_quantity', 'dec' => 0, 'ord' => '') ,_("Before") => 'skip' + ,_("To Pick") => array('type' => 'qty', 'ord' => '', 'dec' => 0) ,_("Priority") => array('type' => 'time', 'ord' => '') ,_("Hold Until") => array('fun' => 'input_hold_until_date_details', 'ord' => '') ,_("Require By") => array('fun' => 'input_required_date_details', 'ord' => '')