Php notices removed form error logoing to avoid flood from @ constructs.
[fa-stable.git] / purchasing / includes / purchasing_db.inc
index 7236962fba711561f0594bcd09fde126c7a20a7d..da038358b1faf5fb95d3cf13e42f1745a6112f88 100644 (file)
@@ -62,6 +62,23 @@ function get_purchase_price($supplier_id, $stock_id)
        }       
 }
 
+function get_purchase_conversion_factor($supplier_id, $stock_id)
+{
+       $sql = "SELECT conversion_factor FROM ".TB_PREF."purch_data 
+               WHERE supplier_id = '" . $supplier_id . "' 
+               AND stock_id = '". $stock_id . "'";
+       $result = db_query($sql, "The supplier pricing details for " . $stock_id . " could not be retrieved");    
+
+       if (db_num_rows($result) == 1)
+       {
+               $myrow = db_fetch($result);
+               return $myrow['conversion_factor'];
+       } 
+       else 
+       {
+               return 1;
+       }       
+}
 //----------------------------------------------------------------------------------------
 
 function get_purchase_data($supplier_id, $stock_id)