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 $systypes_array = array (
51 ST_JOURNAL => _("Journal Entry"),
52 ST_BANKPAYMENT => _("Bank Payment"),
53 ST_BANKDEPOSIT => _("Bank Deposit"),
54 ST_BANKTRANSFER => _("Funds Transfer"),
55 ST_SALESINVOICE => _("Sales Invoice"),
56 ST_CUSTCREDIT => _("Customer Credit Note"),
57 ST_CUSTPAYMENT => _("Customer Payment"),
58 ST_CUSTDELIVERY => _("Delivery Note"),
59 ST_LOCTRANSFER => _("Location Transfer"),
60 ST_INVADJUST => _("Inventory Adjustment"),
61 ST_PURCHORDER => _("Purchase Order"),
62 ST_SUPPINVOICE => _("Supplier Invoice"),
63 ST_SUPPCREDIT => _("Supplier Credit Note"),
64 ST_SUPPAYMENT => _("Supplier Payment"),
65 ST_SUPPRECEIVE => _("Purchase Order Delivery"),
66 ST_WORKORDER => _("Work Order"),
67 ST_MANUISSUE => _("Work Order Issue"),
68 ST_MANURECEIVE => _("Work Order Production"),
69 ST_SALESORDER => _("Sales Order"),
70 ST_SALESQUOTE => _("Sales Quotation"),
71 ST_COSTUPDATE => _("Cost Update"),
72 ST_DIMENSION => _("Dimension")
75 //----------------------------------------------------------------------------------
76 // Bank transaction types
78 define('BT_TRANSFER', 0);
79 define('BT_CHEQUE', 1);
80 define('BT_CREDIT', 2);
83 $bank_account_types = array (
84 BT_TRANSFER => _("Savings Account"),
85 _("Chequing Account"),
90 $bank_transfer_types = array(
91 BT_TRANSFER => _("Transfer"),
97 include_once($path_to_root . "/manufacturing/includes/manufacturing_db.inc");
98 include_once($path_to_root . "/purchasing/includes/purchasing_db.inc");
99 include_once($path_to_root . "/sales/includes/sales_db.inc");
100 include_once($path_to_root . "/dimensions/includes/dimensions_db.inc");
101 //----------------------------------------------------------------------------------
104 define('PT_MISC', 0);
105 define('PT_WORKORDER', 1);
106 define('PT_CUSTOMER', 2);
107 define('PT_SUPPLIER', 3);
108 define('PT_QUICKENTRY', 4);
109 define('PT_DIMESION', 5);
111 $payment_person_types = array (
112 PT_MISC => _("Miscellaneous"),
119 function payment_person_currency($type, $person_id) {
125 return get_company_currency();
128 return get_customer_currency($person_id);
131 return get_supplier_currency($person_id);
134 return get_company_currency();
138 function payment_person_name($type, $person_id, $full=true) {
139 global $payment_person_types;
146 $qe = get_quick_entry($person_id);
147 return ($full ? $payment_person_types[$type] . " ":"") . $qe["description"];
149 global $wo_cost_types;
150 return $wo_cost_types[$person_id];
152 return ($full ?$payment_person_types[$type] . " ":"") . get_customer_name($person_id);
154 return ($full ? $payment_person_types[$type] . " ":"") . get_supplier_name($person_id);
156 //DisplayDBerror("Invalid type sent to person_name");
162 function payment_person_has_items($type) {
168 return db_has_quick_entries();
169 case PT_WORKORDER : // 070305 changed to open workorders JH
170 return db_has_open_workorders();
172 return db_has_customers();
174 return db_has_suppliers();
176 display_db_error("Invalid type sent to has_items", "");
181 //----------------------------------------------------------------------------------
182 // Manufacturing types
184 define('WO_ASSEMBLY', 0);
185 define('WO_UNASSEMBLY', 1);
186 define('WO_ADVANCED', 2);
188 $wo_types_array = array (
189 WO_ASSEMBLY => _("Assemble"),
190 WO_UNASSEMBLY => _("Unassemble"),
191 WO_ADVANCED => _("Advanced Manufacture")
194 define('WO_LABOUR', 0);
195 define('WO_OVERHEAD', 1);
197 $wo_cost_types = array(
198 WO_LABOUR => _("Labour Cost"),
199 WO_OVERHEAD => _("Overhead Cost"),
202 //----------------------------------------------------------------------------------
203 // GL account classes
205 define('CL_NONE', 0); // for backward compatibility
206 define('CL_ASSETS', 1);
207 define('CL_LIABILITIES', 2);
208 define('CL_EQUITY', 3);
209 define('CL_INCOME', 4);
210 define('CL_COGS', 5);
211 define('CL_EXPENSE', 6);
213 $class_types = array(
214 CL_ASSETS => _("Assets"),
215 CL_LIABILITIES => _("Liabilities"),
216 CL_EQUITY => _("Equity"),
217 CL_INCOME => _("Income"),
218 CL_COGS => _("Cost of Goods Sold"),
219 CL_EXPENSE => _("Expense"),
222 function get_class_type_convert($ctype)
224 global $use_oldstyle_convert;
225 if (isset($use_oldstyle_convert) && $use_oldstyle_convert == 1)
226 return (($ctype >= CL_INCOME || $ctype == CL_NONE) ? -1 : 1);
228 return ((($ctype >= CL_LIABILITIES && $ctype <= CL_INCOME) || $ctype == CL_NONE) ? -1 : 1);
230 //----------------------------------------------------------------------------------
233 $quick_actions = array(
234 '=' => _('Remainder'), // post current base amount to GL account
235 'a' => _('Amount'), // post amount to GL account
236 'a+' => _('Amount, increase base'), // post amount to GL account and increase base
237 'a-' => _('Amount, reduce base'), // post amount to GL account and reduce base
238 '%' => _('% amount of base'), // store acc*amount% to GL account
239 '%+' => _('% amount of base, increase base'), // ditto & increase base amount
240 '%-' => _('% amount of base, reduce base'), // ditto & reduce base amount
241 'T' => _('Taxes added'), // post taxes calculated on base amount
242 'T+' => _('Taxes added, increase base'), // ditto & increase base amount
243 'T-' => _('Taxes added, reduce base'), // ditto & reduce base amount
244 't' => _('Taxes included'), // post taxes calculated on base amount
245 't+' => _('Taxes included, increase base'), // ditto & increase base amount
246 't-' => _('Taxes included, reduce base') // ditto & reduce base amount
249 define('QE_PAYMENT', '1');
250 define('QE_DEPOSIT', '2');
251 define('QE_JOURNAL', '3');
252 define('QE_SUPPINV', '4');
254 $quick_entry_types = array(
255 QE_DEPOSIT => _("Bank Deposit"),
256 QE_PAYMENT => _("Bank Payment"),
257 QE_JOURNAL => _("Journal Entry"),
258 QE_SUPPINV => _("Supplier Invoice/Credit")
261 //----------------------------------------------------------------------------------
262 // Special option values for various list selectors.
264 define('ANY_TEXT', '');
265 define('ANY_NUMERIC', -1);
266 define('ALL_TEXT', '');
267 define('ALL_NUMERIC', -1);
270 //----------------------------------------------------------------------------------
271 // Types of stock items
272 $stock_types = array(
273 'M' => _("Manufactured"),
274 'B' => _("Purchased"),
278 //----------------------------------------------------------------------------------
280 define('TAG_ACCOUNT', 1);
281 define('TAG_DIMENSION', 2);
284 TAG_ACCOUNT => _("Account"),
285 TAG_DIMENSION => _("Dimension")