factor parameter in get_price() is now optional
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Sun, 6 Jul 2008 21:15:23 +0000 (21:15 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Sun, 6 Jul 2008 21:15:23 +0000 (21:15 +0000)
sales/includes/sales_db.inc

index 75fca059a1d98575c5077451b45ecbb0819e112c..5c9d1142a9b79d475957f4769036236b7a4ab4f4 100644 (file)
@@ -6,6 +6,7 @@ include_once($path_to_root . "/sales/includes/db/sales_order_db.inc");
 include_once($path_to_root . "/sales/includes/db/sales_credit_db.inc");
 include_once($path_to_root . "/sales/includes/db/sales_invoice_db.inc");
 include_once($path_to_root . "/sales/includes/db/sales_delivery_db.inc");
+include_once($path_to_root . "/sales/includes/db/sales_types_db.inc");
 include_once($path_to_root . "/sales/includes/db/custalloc_db.inc");
 include_once($path_to_root . "/sales/includes/db/cust_trans_db.inc");
 include_once($path_to_root . "/sales/includes/db/cust_trans_details_db.inc");
@@ -46,10 +47,16 @@ function add_gl_trans_customer($type, $type_no, $date_, $account, $dimension, $d
 
 //----------------------------------------------------------------------------------------
 
-function get_price ($stock_id, $currency, $sales_type_id, $factor, $date=null)
+function get_price ($stock_id, $currency, $sales_type_id, $factor=null, $date=null)
 {
        if ($date == null)
            $date = Today();
+
+       if ($factor == null) 
+       {
+               $myrow = get_sales_type(get_post('sales_type_id'));
+               $factor = $myrow['factor'];
+       }
            
        $sql = "SELECT ".TB_PREF."prices.price
                FROM ".TB_PREF."prices