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 get_branch($branch_id)
14 $sql = "SELECT ".TB_PREF."cust_branch.*,".TB_PREF."salesman.salesman_name
15 FROM ".TB_PREF."cust_branch, ".TB_PREF."salesman
16 WHERE ".TB_PREF."cust_branch.salesman=".TB_PREF."salesman.salesman_code
17 AND branch_code=$branch_id";
19 $result = db_query($sql, "Cannot retreive a customer branch");
21 return db_fetch($result);
24 function get_branch_accounts($branch_id)
26 $sql = "SELECT receivables_account,sales_account, sales_discount_account, payment_discount_account
27 FROM ".TB_PREF."cust_branch WHERE branch_code=$branch_id";
29 $result = db_query($sql, "Cannot retreive a customer branch");
31 return db_fetch($result);
34 function get_branch_name($branch_id)
36 $sql = "SELECT br_name FROM ".TB_PREF."cust_branch
37 WHERE branch_code = '$branch_id'";
39 $result = db_query($sql,"could not retreive name for branch" . $branch_id);
41 $myrow = db_fetch_row($result);
45 function get_cust_branches_from_group($group_no)
47 $sql = "SELECT branch_code, debtor_no FROM ".TB_PREF."cust_branch
48 WHERE group_no = '$group_no'";
50 return db_query($sql,"could not retreive branches for group " . $group_no);