- $sql= "SELECT COUNT(*) FROM ".TB_PREF."stock_master WHERE category_id=".db_escape($selected_id);
- $result = db_query($sql, "could not query stock master");
- $myrow = db_fetch_row($result);
- if ($myrow[0] > 0)
+ if (key_in_foreign_table($selected_id, 'stock_master', 'category_id'))
-$sql = "SELECT c.*, t.name as tax_name FROM ".TB_PREF."stock_category c, "
- .TB_PREF."item_tax_types t WHERE c.dflt_tax_type=t.id";
-if (!check_value('show_inactive')) $sql .= " AND !c.inactive";
-
-$result = db_query($sql, "could not get stock categories");
+$result = get_item_categories(check_value('show_inactive'));
$th = array(_("Name"), _("Tax type"), _("Units"), _("Type"), _("Sales Act"),
_("Inventory Account"), _("COGS Account"), _("Adjustment Account"),
_("Assembly Account"), "", "");
$th = array(_("Name"), _("Tax type"), _("Units"), _("Type"), _("Sales Act"),
_("Inventory Account"), _("COGS Account"), _("Adjustment Account"),
_("Assembly Account"), "", "");