From b26ccd4796cfd5771dd2682963d975d8396457d5 Mon Sep 17 00:00:00 2001 From: Maxime Bourget Date: Mon, 6 May 2013 18:01:39 +0100 Subject: [PATCH] Customer links work. Also add allow all customer. --- includes/order_lines.inc | 8 +++++++- order_lines_view.php | 10 +++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/includes/order_lines.inc b/includes/order_lines.inc index d55fba9..0238b34 100644 --- a/includes/order_lines.inc +++ b/includes/order_lines.inc @@ -45,12 +45,18 @@ function view_link($dummy, $order_no) return get_customer_trans_view_str(ST_SALESORDER, $order_no); } + function order_link($row) { return pager_link( _("Sales Order"), "/sales/sales_order_entry.php?NewQuoteToSalesOrder=" .$row['order_no'], ICON_DOC); } +function customer_link($row) { + return pager_link(_($row['debtor_ref']), "/modules/order_line_extra/order_lines_view.php?customer_id=${row['debtor_no']}"); + +} + function input_date_details($row, $date) { $row_id = $row['id']; $name = compute_input_name($row, 'required_date'); @@ -94,7 +100,7 @@ function get_order_details_extra($customer_id) { } function get_order_summary() { - $sql = "SELECT debtor_ref, branch_ref + $sql = "SELECT debtor_no, debtor_ref, branch_ref , min(delivery_date) , sum(quantity - qty_sent) as quantity , sum((quantity - qty_sent)*unit_price*(1-discount_percent/100)) as amount diff --git a/order_lines_view.php b/order_lines_view.php index 361de53..97de295 100644 --- a/order_lines_view.php +++ b/order_lines_view.php @@ -25,6 +25,7 @@ $_SESSION['page_title'] = _($help_context = "Edit lines extra parameters"); update_extra_order_details(); + $js = ""; if ($use_popup_windows) $js .= get_js_open_window(900, 600); @@ -39,7 +40,10 @@ start_form(); start_table(TABLESTYLE_NOBORDER); start_row(); -customer_list_cells(_("Select a customer: "), 'customer_id', false, false, true); + +if(isset($_GET['customer_id']) && !isset($_POST['customer_id'])) $_POST['customer_id']=$_GET['customer_id']; +$customer_id = $_POST['customer_id']; +customer_list_cells(_("Select a customer: "), 'customer_id', $customer_id, true, true); @@ -54,7 +58,6 @@ end_table(1); //--------------------------------------------------------------------------------------------- // Orders inquiry table // -$customer_id = $_POST['customer_id']; if($customer_id) { $sql = get_order_details_extra($customer_id); $cols = array( @@ -69,7 +72,8 @@ if($customer_id) { else { $sql = get_order_summary(); $cols = array( -_("Customer") => array('ord' => ''), + 'customer id' => 'skip', +_("Customer") => array('ord' => '', 'fun' => 'customer_link'), _("Branch") => array('ord' => ''), _("Delivery Date") => array('ord' => ''), _("Quantity") => array('ord' => ''), -- 2.30.2