Customer links work.
authorMaxime Bourget <bmx007@gmail.com>
Mon, 6 May 2013 17:01:39 +0000 (18:01 +0100)
committerMaxime Bourget <bmx007@gmail.com>
Mon, 6 May 2013 17:01:39 +0000 (18:01 +0100)
Also add allow all customer.

includes/order_lines.inc
order_lines_view.php

index d55fba92b6c59cf1fc215f9d67174d60f55568c8..0238b343fb71813b067077a36e52803849b88e17 100644 (file)
@@ -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
index 361de53c41431a2b3de1a56dacbdbc18bf00f813..97de2957538365988ad3bc7a38be3da78035beba 100644 (file)
@@ -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' => ''),