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 //----------------------------------------------------------------------------------
14 $systypes_array = array (
15 0=> array ('name' => _("Journal Entry")),
16 1=> array ('name' => _("Bank Payment")),
17 2=> array ('name' => _("Bank Deposit")),
18 4=> array ('name' => _("Funds Transfer")),
19 10=> array ('name' => _("Sales Invoice")),
20 11=> array ('name' => _("Customer Credit Note")),
21 12=> array ('name' => _("Customer Payment")),
22 13=> array ('name' => _("Delivery Note")),
23 16=> array ('name' => _("Location Transfer")),
24 17=> array ('name' => _("Inventory Adjustment")),
25 18=> array ('name' => _("Purchase Order")),
26 20=> array ('name' => _("Supplier Invoice")),
27 21=> array ('name' => _("Supplier Credit Note")),
28 22=> array ('name' => _("Supplier Payment")),
29 25=> array ('name' => _("Purchase Order Delivery")),
30 26=> array ('name' => _("Work Order")),
31 28=> array ('name' => _("Work Order Issue")),
32 29=> array ('name' => _("Work Order Production")),
33 30=> array ('name' => _("Sales Order")),
34 35=> array ('name' => _("Cost Update")),
35 40=> array ('name' => _("Dimension"))
40 function journal_entry()
45 function bank_payment()
50 function bank_deposit()
55 function bank_transfer()
60 function cust_payment()
65 function cust_dispatch()
70 function location_transfer()
75 function inventory_adjustment()
85 function supp_payment()
95 function sales_order()
100 function cost_update()
110 function name($index)
112 global $systypes_array;
115 return $systypes_array[$index]['name'];
119 //----------------------------------------------------------------------------------
121 $bank_account_types_array = array (
122 0=> array ('id' => 0, 'name' => _("Savings Account"), 'ptype' => _("Transfer")),
123 1=> array ('id' => 1, 'name' => _("Chequing Account"),'ptype' => _("Cheque")),
124 2=> array ('id' => 2, 'name' => _("Credit Account"), 'ptype' => _("Credit")),
125 3=> array ('id' => 3, 'name' => _("Cash Account"), 'ptype' => _("Cash"))
128 class bank_account_types
133 global $bank_account_types_array;
134 return $bank_account_types_array;;
137 function name($index)
139 global $bank_account_types_array;
140 return $bank_account_types_array[$index]['name'];
143 function transfer_type($index)
145 global $bank_account_types_array;
146 return $bank_account_types_array[$index]['ptype'];
149 //----------------------------------------------------------------------------------
151 include_once($path_to_root . "/manufacturing/includes/manufacturing_db.inc");
152 include_once($path_to_root . "/purchasing/includes/purchasing_db.inc");
153 include_once($path_to_root . "/sales/includes/sales_db.inc");
154 include_once($path_to_root . "/dimensions/includes/dimensions_db.inc");
156 $payment_person_types_array = array (
157 0=> array ('id' => 0, 'name' => _("Miscellaneous")),
158 1=> array ('id' => 1, 'name' => _("Work Order")),
159 2=> array ('id' => 2, 'name' => _("Customer")),
160 3=> array ('id' => 3, 'name' => _("Supplier")),
161 4=> array ('id' => 4, 'name' => _("Quick Entry"))
164 class payment_person_types
169 global $payment_person_types_array;
170 return $payment_person_types_array;
193 function QuickEntry()
203 function type_name($type)
205 global $payment_person_types_array;
206 return $payment_person_types_array[$type]['name'];
209 function person_name($type, $person_id, $full=true)
213 case payment_person_types::misc() :
215 case payment_person_types::QuickEntry() :
216 $qe = get_quick_entry($person_id);
217 return ($full?payment_person_types::type_name($type) . " ":"") . $qe["description"];
218 case payment_person_types::WorkOrder() :
219 $wo = get_work_order($person_id);
220 return ($full?payment_person_types::type_name($type) . " ":"") . $wo["wo_ref"];
221 case payment_person_types::customer() :
222 return ($full?payment_person_types::type_name($type) . " ":"") . get_customer_name($person_id);
223 case payment_person_types::supplier() :
224 return ($full?payment_person_types::type_name($type) . " ":"") . get_supplier_name($person_id);
226 //DisplayDBerror("Invalid type sent to person_name");
232 function person_currency($type, $person_id)
236 case payment_person_types::misc() :
237 case payment_person_types::QuickEntry() :
238 case payment_person_types::WorkOrder() :
239 return get_company_currency();
241 case payment_person_types::customer() :
242 return get_customer_currency($person_id);
244 case payment_person_types::supplier() :
245 return get_supplier_currency($person_id);
248 return get_company_currency();
252 function has_items($type)
256 case payment_person_types::misc() :
258 case payment_person_types::QuickEntry() :
259 return db_has_quick_entries();
260 case payment_person_types::WorkOrder() : // 070305 changed to open workorders JH
261 return db_has_open_workorders();
262 case payment_person_types::customer() :
263 return db_has_customers();
264 case payment_person_types::supplier() :
265 return db_has_suppliers();
267 display_db_error("Invalid type sent to has_items", "");
273 //----------------------------------------------------------------------------------
275 $wo_types_array = array (
276 0=> array ('id' => 0, 'name' => _("Assemble")),
277 1=> array ('id' => 1, 'name' => _("Unassemble")),
278 2=> array ('id' => 2, 'name' => _("Advanced Manufacture"))
289 function unassemble()
301 global $wo_types_array;
302 return $wo_types_array;;
305 function name($index)
307 global $wo_types_array;
308 return $wo_types_array[$index]['name'];
312 $quick_actions = array(
313 '=' => _('Remainder'), // post current base amount to GL account
314 'a' => _('Amount'), // post amount to GL account
315 'a+' => _('Amount, increase base'), // post amount to GL account and increase base
316 'a-' => _('Amount, reduce base'), // post amount to GL account and reduce base
317 '%' => _('% amount of base'), // store acc*amount% to GL account
318 '%+' => _('% amount of base, increase base'), // ditto & increase base amount
319 '%-' => _('% amount of base, reduce base'), // ditto & reduce base amount
320 'T' => _('Taxes added'), // post taxes calculated on base amount
321 'T+' => _('Taxes added, increase base'), // ditto & increase base amount
322 'T-' => _('Taxes added, reduce base'), // ditto & reduce base amount
323 't' => _('Taxes included'), // post taxes calculated on base amount
324 't+' => _('Taxes included, increase base'), // ditto & increase base amount
325 't-' => _('Taxes included, reduce base') // ditto & reduce base amount
328 define('QE_PAYMENT', '1');
329 define('QE_DEPOSIT', '2');
330 define('QE_JOURNAL', '3');
331 define('QE_SUPPINV', '4');
333 $quick_entry_types = array(
334 QE_DEPOSIT => _("Bank Deposit"),
335 QE_PAYMENT => _("Bank Payment"),
336 QE_JOURNAL => _("Journal Entry"),
337 QE_SUPPINV => _("Supplier Invoice/Credit")