2 /**********************************************************************
3 Copyright (C) FrontAccounting, LLC.
4 Released under the terms of the GNU General Public License, GPL,
5 as published by the Free Software Foundation, either version 3
6 of the License, or (at your option) any later version.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
11 ***********************************************************************/
12 function add_item_category($description)
15 $sql = "INSERT INTO ".TB_PREF."stock_category (description)
16 VALUES (".db_escape($description).")";
18 db_query($sql,"an item category could not be added");
21 function update_item_category($ItemCategory, $description)
24 $sql = "UPDATE ".TB_PREF."stock_category SET description = ".db_escape($description)."
25 WHERE category_id = '$ItemCategory'";
27 db_query($sql,"an item category could not be updated");
30 function delete_item_category($ItemCategory)
32 $sql="DELETE FROM ".TB_PREF."stock_category WHERE category_id='$ItemCategory'";
34 db_query($sql,"an item category could not be deleted");
37 function get_item_category($ItemCategory)
39 $sql="SELECT * FROM ".TB_PREF."stock_category WHERE category_id='$ItemCategory'";
41 $result = db_query($sql,"an item category could not be retrieved");
43 return db_fetch($result);
46 function get_category_name($id)
48 $sql = "SELECT description FROM ".TB_PREF."stock_category WHERE category_id=$id";
50 $result = db_query($sql, "could not get sales type");
52 $row = db_fetch_row($result);