Small changes in costing by Chaitanya.
[fa-stable.git] / sales / includes / db / sales_order_db.inc
index 34da078bed63acc19394682bd50cf50d15747151..3785cb563b7e18d0b36ce15972c2955afbc71bf4 100644 (file)
@@ -285,7 +285,8 @@ function get_sales_order_header($order_no, $trans_type)
          ."stype.tax_included, "
          ."ship.shipper_name, "
          ."tax_group.name AS tax_group_name , "
-         ."tax_group.id AS tax_group_id "
+         ."tax_group.id AS tax_group_id, "
+         ."cust.tax_id "
        ."FROM ".TB_PREF."sales_orders sorder, "
          .TB_PREF."debtors_master cust,"
          .TB_PREF."sales_types stype, "
@@ -489,7 +490,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 +562,10 @@ function get_sql_for_sales_orders_view($selected_customer, $trans_type, $trans_n
 
                elseif ($filter=='InvoiceTemplates' || $filter=='DeliveryTemplates')
                        $sql .= " AND sorder.type=1";
+                       
+               //Chaiatanya : New Filter
+               if ($customer_id != ALL_TEXT)
+                       $sql .= " AND sorder.debtor_no = ".db_escape($customer_id);             
 
                $sql .= " GROUP BY sorder.order_no,
                                        sorder.debtor_no,