Copyright notes at top op every source file
[fa-stable.git] / sales / includes / db / credit_status_db.inc
1 <?php
2 /**********************************************************************
3     Copyright (C) FrontAccounting, LLC.
4         Released under the terms of the GNU Affero General Public License,
5         AGPL, as published by the Free Software Foundation, either version 
6         3 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/agpl-3.0.html>.
11 ***********************************************************************/
12 function add_credit_status($description, $disallow_invoicing)
13 {
14         $sql = "INSERT INTO ".TB_PREF."credit_status (reason_description, dissallow_invoices) 
15                 VALUES (".db_escape($description).",$disallow_invoicing)";
16                 
17         db_query($sql, "could not add credit status");          
18 }
19
20 function update_credit_status($status_id, $description, $disallow_invoicing)
21 {
22         $sql = "UPDATE ".TB_PREF."credit_status SET reason_description=".db_escape($description).",
23                 dissallow_invoices=$disallow_invoicing WHERE id=$status_id";
24         
25         db_query($sql, "could not update credit status");                       
26 }
27
28 function get_all_credit_status()
29 {
30         $sql = "SELECT * FROM ".TB_PREF."credit_status";
31         
32         return db_query($sql, "could not get all credit status");
33
34
35 function get_credit_status($status_id)
36 {
37         $sql = "SELECT * FROM ".TB_PREF."credit_status WHERE id=$status_id";
38         
39         $result = db_query($sql, "could not get credit status");
40         
41         return db_fetch($result);
42 }
43
44 function delete_credit_status($status_id)
45 {
46         $sql="DELETE FROM ".TB_PREF."credit_status WHERE id=$status_id";
47                 
48         db_query($sql, "could not delete credit status");       
49 }
50
51 ?>