Implemented an Items tab for attachments and modified the existing setup attachments.
[fa-stable.git] / inventory / includes / db / items_db.inc
index 02345a67edfad638868a5fb86e06bb6d5b2863f1..b61f4140e2f47b157749bf1bde269b85f9e15c9f 100644 (file)
@@ -228,3 +228,15 @@ function get_items_search($description, $type)
        return db_query($sql, "Failed in retreiving item list.");
 }
 
+function get_item_code_id($stock_id)
+{
+       $sql = "SELECT ic.id
+               FROM ".TB_PREF."item_codes ic, ".TB_PREF."stock_master sm
+               WHERE ic.item_code = ".db_escape($stock_id)." AND ic.item_code = ic.stock_id AND
+       ic.stock_id = sm.stock_id";
+
+       $result = db_query($sql, "could not get item id");
+       $row = db_fetch_row($result);
+
+       return is_array($row) ? $row[0] : false;
+}
\ No newline at end of file