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 //----------------------------------------------------------------------------------
13 // FrontAccounting system transaction types
15 define('ST_JOURNAL', 0);
17 define('ST_BANKPAYMENT', 1);
18 define('ST_BANKDEPOSIT', 2);
19 define('ST_BANKTRANSFER', 4);
21 define('ST_SALESINVOICE', 10);
22 define('ST_CUSTCREDIT', 11);
23 define('ST_CUSTPAYMENT', 12);
24 define('ST_CUSTDELIVERY', 13);
26 define('ST_LOCTRANSFER', 16);
27 define('ST_INVADJUST', 17);
29 define('ST_PURCHORDER', 18);
30 define('ST_SUPPINVOICE', 20);
31 define('ST_SUPPCREDIT', 21);
32 define('ST_SUPPAYMENT', 22);
33 define('ST_SUPPRECEIVE', 25);
35 define('ST_WORKORDER', 26);
36 define('ST_MANUISSUE', 28);
37 define('ST_MANURECEIVE', 29);
40 define('ST_SALESORDER', 30);
41 define('ST_SALESQUOTE', 32);
42 define('ST_COSTUPDATE', 35);
43 define('ST_DIMENSION', 40);
45 // Don't include these defines in the $systypes_array.
46 // They are used for documents only.
47 define ('ST_STATEMENT', 91);
48 define ('ST_CHEQUE', 92);
50 // document inheritance
51 $document_child_types = array(
52 ST_SALESQUOTE => ST_SALESORDER,
53 ST_SALESORDER => ST_CUSTDELIVERY,
54 ST_CUSTDELIVERY => ST_SALESINVOICE,
55 ST_SALESINVOICE => ST_CUSTCREDIT,
57 ST_PURCHORDER => ST_SUPPRECEIVE,
58 ST_SUPPRECEIVE => ST_SUPPINVOICE,
59 ST_SUPPINVOICE => ST_SUPPCREDIT,
62 function get_child_type($type)
64 global $document_child_types;
65 return isset($document_child_types[$type]) ? $document_child_types[$type] : 0;
68 function get_parent_type($type)
70 global $document_child_types;
71 $child = array_search($type, $document_child_types);
72 return $child ? $child : 0;
75 //----------------------------------------------------------------------------------
76 // Bank transaction types
78 define('BT_TRANSFER', 0);
79 define('BT_CHEQUE', 1);
80 define('BT_CREDIT', 2);
83 include_once($path_to_root . "/manufacturing/includes/manufacturing_db.inc");
84 include_once($path_to_root . "/purchasing/includes/purchasing_db.inc");
85 include_once($path_to_root . "/sales/includes/sales_db.inc");
86 include_once($path_to_root . "/dimensions/includes/dimensions_db.inc");
87 //----------------------------------------------------------------------------------
91 define('PT_WORKORDER', 1);
92 define('PT_CUSTOMER', 2);
93 define('PT_SUPPLIER', 3);
94 define('PT_QUICKENTRY', 4);
95 define('PT_DIMESION', 5);
97 function payment_person_currency($type, $person_id) {
103 return get_company_currency();
106 return get_customer_currency($person_id);
109 return get_supplier_currency($person_id);
112 return get_company_currency();
116 function payment_person_name($type, $person_id, $full=true) {
117 global $payment_person_types;
124 $qe = get_quick_entry($person_id);
125 return ($full ? $payment_person_types[$type] . " ":"") . $qe["description"];
127 return ($full ?$payment_person_types[$type] . " ":"") . get_customer_name($person_id);
129 return ($full ? $payment_person_types[$type] . " ":"") . get_supplier_name($person_id);
131 //DisplayDBerror("Invalid type sent to person_name");
137 function payment_person_has_items($type) {
143 return db_has_quick_entries();
144 case PT_WORKORDER : // 070305 changed to open workorders JH
145 return db_has_open_workorders();
147 return db_has_customers();
149 return db_has_suppliers();
151 display_db_error("Invalid type sent to has_items", "");
155 //----------------------------------------------------------------------------------
156 // Payment terms categories
159 define('PM_CASH', 1);
160 define('PM_CREDIT', 2);
162 //----------------------------------------------------------------------------------
163 // Manufacturing types
165 define('WO_ASSEMBLY', 0);
166 define('WO_UNASSEMBLY', 1);
167 define('WO_ADVANCED', 2);
169 define('WO_LABOUR', 0);
170 define('WO_OVERHEAD', 1);
171 define('WO_MATERIALS', 2);
173 //----------------------------------------------------------------------------------
174 // GL account classes
176 define('CL_NONE', 0); // for backward compatibility
177 define('CL_ASSETS', 1);
178 define('CL_LIABILITIES', 2);
179 define('CL_EQUITY', 3);
180 define('CL_INCOME', 4);
181 define('CL_COGS', 5);
182 define('CL_EXPENSE', 6);
184 function get_class_type_convert($ctype)
186 global $use_oldstyle_convert;
187 if (isset($use_oldstyle_convert) && $use_oldstyle_convert == 1)
188 return (($ctype >= CL_INCOME || $ctype == CL_NONE) ? -1 : 1);
190 return ((($ctype >= CL_LIABILITIES && $ctype <= CL_INCOME) || $ctype == CL_NONE) ? -1 : 1);
192 //----------------------------------------------------------------------------------
195 define('QE_PAYMENT', '1');
196 define('QE_DEPOSIT', '2');
197 define('QE_JOURNAL', '3');
198 define('QE_SUPPINV', '4');
200 //----------------------------------------------------------------------------------
201 // Special option values for various list selectors.
203 define('ANY_TEXT', '');
204 define('ANY_NUMERIC', -1);
205 define('ALL_TEXT', '');
206 define('ALL_NUMERIC', -1);
208 //----------------------------------------------------------------------------------
209 // Special class values for tables (start_table())
210 define('TABLESTYLE', 1);
211 define('TABLESTYLE2', 2);
212 define('TABLESTYLE_NOBORDER', 3);
214 //----------------------------------------------------------------------------------
216 define('TAG_ACCOUNT', 1);
217 define('TAG_DIMENSION', 2);
219 //----------------------------------------------------------------------------------
220 // Payment term types
222 define('PTT_PRE', 1);
223 define('PTT_CASH', 2);
224 define('PTT_DAYS', 3);
225 define('PTT_FOLLOWING', 4);
227 //----------------------------------------------------------------------------------
228 // Tax calculation algorithms used in als and purchase (depends on supplier's invoicing software)
230 define('TCA_TOTALS', 1); // taxes are calculated from respective net totals for all lines
231 define('TCA_LINES', 2); // taxes calculated for every line, then summed
233 include_once($path_to_root . '/includes/sysnames.inc');