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 //--------------------------------------------------------------------------------------
15 function add_shipper($shipper_name, $contact, $phone, $phone2, $address)
17 $sql = "INSERT INTO ".TB_PREF."shippers (shipper_name, contact, phone, phone2, address)
18 VALUES (" . db_escape($shipper_name) . ", " .
19 db_escape($contact). ", " .
20 db_escape($phone). ", " .
21 db_escape($phone2). ", " .
22 db_escape($address) . ")";
24 db_query($sql,"The Shipping Company could not be added");
27 //--------------------------------------------------------------------------------------
29 function update_shipper($selected_id, $shipper_name, $contact, $phone, $phone2, $address)
31 $sql = "UPDATE ".TB_PREF."shippers SET shipper_name=" . db_escape($shipper_name). " ,
32 contact =" . db_escape($contact). " ,
33 phone =" . db_escape($phone). " ,
34 phone2 =" . db_escape($phone2). " ,
35 address =" . db_escape($address). "
36 WHERE shipper_id = ".db_escape($selected_id);
38 db_query($sql,"The shipping company could not be updated");
41 //--------------------------------------------------------------------------------------
43 function delete_shipper($selected_id)
45 $sql="DELETE FROM ".TB_PREF."shippers WHERE shipper_id=".db_escape($selected_id);
47 db_query($sql,"could not delete shipper");
50 //--------------------------------------------------------------------------------------
52 function get_shippers($show_inactive)
54 $sql = "SELECT * FROM ".TB_PREF."shippers";
55 if (!$show_inactive) $sql .= " WHERE !inactive";
56 $sql .= " ORDER BY shipper_id";
58 return db_query($sql,"could not get shippers");
61 //--------------------------------------------------------------------------------------
63 function get_shipper($selected_id)
65 $sql = "SELECT * FROM ".TB_PREF."shippers WHERE shipper_id=".db_escape($selected_id);
67 $result = db_query($sql, "could not get shipper");
68 return db_fetch($result);