Added customer filter in sales order inquiries.
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Sat, 26 Mar 2011 14:30:40 +0000 (15:30 +0100)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Sat, 26 Mar 2011 14:30:40 +0000 (15:30 +0100)
sales/includes/db/sales_order_db.inc
sales/inquiry/sales_orders_view.php

index 34da078bed63acc19394682bd50cf50d15747151..f8afbc7683ebcbedada5bbfa4d31e4d3dcea7054 100644 (file)
@@ -489,7 +489,7 @@ function get_branch_to_order($customer_id, $branch_id) {
 }
 
 function get_sql_for_sales_orders_view($selected_customer, $trans_type, $trans_no, $filter, 
-       $stock_item=null, $from='', $to='', $ref='', $location='')
+       $stock_item=null, $from='', $to='', $ref='', $location='', $customer_id=ALL_TEXT)
 {
 
        $sql = "SELECT 
@@ -561,6 +561,10 @@ function get_sql_for_sales_orders_view($selected_customer, $trans_type, $trans_n
 
                elseif ($filter=='InvoiceTemplates' || $filter=='DeliveryTemplates')
                        $sql .= " AND sorder.type=1";
+                       \r
+               //Chaiatanya : New Filter\r
+               if ($customer_id != ALL_TEXT)\r
+                       $sql .= " AND sorder.debtor_no = ".db_escape($customer_id);             \r
 
                $sql .= " GROUP BY sorder.order_no,
                                        sorder.debtor_no,
index 5f23e891a989b0aa497b711da1e71c645e7e9f12..2fa4fd1ae988139cff91e289ef020dc80f0b6a91 100644 (file)
@@ -231,7 +231,7 @@ if($show_dates) {
        start_row();
 }
 stock_items_list_cells(_("Item:"), 'SelectStockFromList', null, true);
-
+customer_list_cells(_("Select a customer: "), 'customer_id', null, true);\r
 if ($trans_type == ST_SALESQUOTE)
        check_cells(_("Show All:"), 'show_all');
 
@@ -246,7 +246,7 @@ end_table(1);
 //     Orders inquiry table
 //
 $sql = get_sql_for_sales_orders_view($selected_customer, $trans_type, $_POST['OrderNumber'], $_POST['order_view_mode'],
-       @$selected_stock_item, @$_POST['OrdersAfterDate'], @$_POST['OrdersToDate'], @$_POST['OrderReference'], $_POST['StockLocation']);
+       @$selected_stock_item, @$_POST['OrdersAfterDate'], @$_POST['OrdersToDate'], @$_POST['OrderReference'], $_POST['StockLocation'], $_POST['customer_id']);\r
 
 if ($trans_type == ST_SALESORDER)
        $cols = array(