From: Maxime Bourget Date: Sat, 15 Jun 2013 16:26:20 +0000 (+0100) Subject: Filter order details by order. X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=f2ff34f93c60bb4fe9ff886b80c0984e0086697c;p=order_line_extra.git Filter order details by order. --- diff --git a/haxe/ItemScheduler.hx b/haxe/ItemScheduler.hx index 3122a9d..7b988f2 100644 --- a/haxe/ItemScheduler.hx +++ b/haxe/ItemScheduler.hx @@ -241,8 +241,11 @@ class ItemScheduler { if(expiry_date != null && (now.getTime() > expiry_date.getTime())) classes.push('expired'); var cells : Array = [ - order.order_id - , ''+order.deliver_to+'' + ''+order.order_id+'' + , ''+order.deliver_to+'' , order.quantity // '' ,before ,left diff --git a/hincludes/lib/ItemScheduler.class.php b/hincludes/lib/ItemScheduler.class.php index 9e7ae69..530224e 100644 --- a/hincludes/lib/ItemScheduler.class.php +++ b/hincludes/lib/ItemScheduler.class.php @@ -204,7 +204,7 @@ class ItemScheduler { if($expiry_date !== null && $now->getTime() > $expiry_date->getTime()) { $classes->push("expired"); } - $cells = new _hx_array(array($order->order_id, "debtor_no) . "\">" . Std::string($order->deliver_to) . "", $order->quantity, $before, $left, $order->from_stk_loc, $order->hold_until_date, $order->required_date, $order->comment, $this->quantity_box($row_id, $order, $left))); + $cells = new _hx_array(array("debtor_no) . "&order_id=" . Std::string($order->order_id) . "\">" . Std::string($order->order_id) . "", "debtor_no) . "\">" . Std::string($order->deliver_to) . "", $order->quantity, $before, $left, $order->from_stk_loc, $order->hold_until_date, $order->required_date, $order->comment, $this->quantity_box($row_id, $order, $left))); $attributes->push("class=\"" . $classes->join(" ") . "\""); $this->printRow($cells, $attributes); } diff --git a/includes/order_lines.inc b/includes/order_lines.inc index 96c0a27..a3367ea 100644 --- a/includes/order_lines.inc +++ b/includes/order_lines.inc @@ -235,7 +235,7 @@ function pick_checkbox($row) . hidden('pick['.$id.']', $value, false); } -function get_order_details_extra($customer_id, $location, $item_like) { +function get_order_details_extra($customer_id, $location, $item_like, $order_id) { $select = "sod.id , so.order_no , stk_code @@ -270,6 +270,10 @@ function get_order_details_extra($customer_id, $location, $item_like) { $where .= " AND stk_code LIKE '$item_like'"; } + if($order_id) { + $where .= " AND so.order_no = $order_id"; + } + return array('select' => $select, 'from' => $from, 'where' => $where); } diff --git a/order_lines_view.php b/order_lines_view.php index c72f043..a452972 100644 --- a/order_lines_view.php +++ b/order_lines_view.php @@ -27,6 +27,18 @@ add_access_extensions(); $_SESSION['page_title'] = _($help_context = "Edit lines extra parameters"); +function get_parameter($param) { + $value = null; + if(!isset($_POST[$param])) { + if(isset($_GET[$param])) { + $value = $_GET[$param]; + $_POST[$param] = $value; + } + } + else $value = $_POST[$param]; + return $value; +} + // Process POST filter_data($_POST); update_extra_order_details(); @@ -76,6 +88,10 @@ if($customer_id != null) { else $item_like = $_POST['item_like']; text_cells_ex('Filter Item', 'item_like', 50, null, $item_like, null, null, null, true ); + + $order_id = get_parameter('order_id'); + text_cells_ex(_('Order #'), 'order_id', 10, null, $order_id, + null, null, null, true ); } @@ -93,7 +109,7 @@ end_table(1); // if($customer_id) { // Display all item for one customer - $sql = get_order_details_extra($customer_id, 'DEF', $item_like); + $sql = get_order_details_extra($customer_id, 'DEF', $item_like, $order_id); $cols = array( 'detail_id' => 'skip' , _("Order #") => array('fun'=>'view_link', 'ord' => '')