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 ***********************************************************************/
13 function get_fixed_asset_classes()
15 $sql="SELECT * FROM ".TB_PREF."stock_fa_class";
17 $result = db_query($sql,"fixed asset classes could not be retrieved");
22 function update_fixed_asset_class($fa_class_id, $parent_id, $description, $long_description, $depreciation_method, $depreciation_rate, $depreciation_period)
24 $sql = "UPDATE ".TB_PREF."stock_fa_class SET
25 parent_id=".db_escape($parent_id).",
26 description=".db_escape($description).",
27 long_description=".db_escape($long_description).",
28 depreciation_method=".db_escape($depreciation_method).",
29 depreciation_rate=".db_escape($depreciation_rate).",
30 depreciation_period=".db_escape($depreciation_period)."
31 WHERE fa_class_id=".db_escape($fa_class_id);
33 db_query($sql, "The fixed asset class could not be updated");
36 function add_fixed_asset_class($fa_class_id, $parent_id, $description, $long_description, $depreciation_method, $depreciation_rate, $depreciation_period)
38 $sql = "INSERT INTO ".TB_PREF."stock_fa_class (fa_class_id, parent_id, description, long_description,
39 depreciation_method, depreciation_rate, depreciation_period) VALUES ("
40 .db_escape($fa_class_id).", ".db_escape($parent_id).", "
41 .db_escape($description).", ".db_escape($long_description).", "
42 .db_escape($depreciation_method).", ".db_escape($depreciation_rate).", "
43 .db_escape($depreciation_period).")";
45 db_query($sql, "The fixed asset class could not be added");
48 function delete_fixed_asset_class($fa_class_id)
50 $sql = "DELETE FROM ".TB_PREF."stock_fa_class WHERE fa_class_id=".db_escape($fa_class_id);
52 db_query($sql, "The fixed asset class could not be deleted");