Fixed default POST assigning [fixes 0000009]
[fa-stable.git] / inventory / includes / db / items_units_db.inc
index f7ad5f655241135c9db5a1d8bee2972ce7ad1ffd..1f63252a3e932eef412790129c53b1d02165da2b 100644 (file)
@@ -53,4 +53,15 @@ function get_all_item_units() {
     $sql = "SELECT * FROM ".TB_PREF."item_units ORDER BY name";
     return  db_query($sql, "could not get stock categories");
 }
+// 2008-06-15. Added Joe Hunt to get a measure of unit by given stock_id
+function get_unit_dec($stock_id)
+{
+       $sql = "SELECT decimals FROM ".TB_PREF."item_units,     ".TB_PREF."stock_master
+               WHERE abbr=units AND stock_id='$stock_id' LIMIT 1";
+       $result = db_query($sql, "could not get unit decimals");
+
+       $row = db_fetch_row($result);
+       return $row[0];
+}
+
 ?>
\ No newline at end of file