Replaced the global variables for table styles to defined CSS classes.
[fa-stable.git] / includes / types.inc
1 <?php
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
14 //
15 define('ST_JOURNAL', 0);
16
17 define('ST_BANKPAYMENT', 1);
18 define('ST_BANKDEPOSIT', 2);
19 define('ST_BANKTRANSFER', 4);
20
21 define('ST_SALESINVOICE', 10);
22 define('ST_CUSTCREDIT', 11);
23 define('ST_CUSTPAYMENT', 12);
24 define('ST_CUSTDELIVERY', 13);
25
26 define('ST_LOCTRANSFER', 16);
27 define('ST_INVADJUST', 17);
28
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);
34
35 define('ST_WORKORDER', 26);
36 define('ST_MANUISSUE', 28);
37 define('ST_MANURECEIVE', 29);
38
39
40 define('ST_SALESORDER', 30);
41 define('ST_SALESQUOTE', 32);
42 define('ST_COSTUPDATE', 35);
43 define('ST_DIMENSION', 40);
44
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);
49
50 //----------------------------------------------------------------------------------
51 //              Bank transaction types
52 //
53 define('BT_TRANSFER', 0);
54 define('BT_CHEQUE', 1);
55 define('BT_CREDIT', 2);
56 define('BT_CASH', 3);
57
58 include_once($path_to_root . "/manufacturing/includes/manufacturing_db.inc");
59 include_once($path_to_root . "/purchasing/includes/purchasing_db.inc");
60 include_once($path_to_root . "/sales/includes/sales_db.inc");
61 include_once($path_to_root . "/dimensions/includes/dimensions_db.inc");
62 //----------------------------------------------------------------------------------
63 //      Payment types
64 //
65 define('PT_MISC', 0);
66 define('PT_WORKORDER', 1);
67 define('PT_CUSTOMER', 2);
68 define('PT_SUPPLIER', 3);
69 define('PT_QUICKENTRY', 4);
70 define('PT_DIMESION', 5);
71
72 function payment_person_currency($type, $person_id)  {
73         switch ($type)
74         {
75                 case PT_MISC :
76                 case PT_QUICKENTRY :
77                 case PT_WORKORDER :
78                         return get_company_currency();
79
80                 case PT_CUSTOMER :
81                         return get_customer_currency($person_id);
82
83                 case PT_SUPPLIER :
84                         return get_supplier_currency($person_id);
85
86                 default :
87                         return get_company_currency();
88         }
89 }
90
91 function payment_person_name($type, $person_id, $full=true) {
92         global $payment_person_types;
93
94         switch ($type)
95         {
96                 case PT_MISC :
97                         return $person_id;
98                 case PT_QUICKENTRY :
99                         $qe = get_quick_entry($person_id);
100                         return ($full ? $payment_person_types[$type] . " ":"") . $qe["description"];
101                 case PT_WORKORDER :
102                         global $wo_cost_types;
103                         return $wo_cost_types[$person_id];
104                 case PT_CUSTOMER :
105                         return ($full ?$payment_person_types[$type] . " ":"") . get_customer_name($person_id);
106                 case PT_SUPPLIER :
107                         return ($full ? $payment_person_types[$type] . " ":"") . get_supplier_name($person_id);
108                 default :
109                         //DisplayDBerror("Invalid type sent to person_name");
110                         //return;
111                         return '';
112         }
113 }
114
115 function payment_person_has_items($type) {
116         switch ($type)
117         {
118                 case PT_MISC :
119                         return true;
120                 case PT_QUICKENTRY :
121                         return db_has_quick_entries();
122                 case PT_WORKORDER : // 070305 changed to open workorders JH
123                         return db_has_open_workorders();
124                 case PT_CUSTOMER :
125                         return db_has_customers();
126                 case PT_SUPPLIER :
127                         return db_has_suppliers();
128                 default :
129                         display_db_error("Invalid type sent to has_items", "");
130                         return false;
131         }
132 }
133
134 //----------------------------------------------------------------------------------
135 //      Manufacturing types
136 //
137 define('WO_ASSEMBLY', 0);
138 define('WO_UNASSEMBLY', 1);
139 define('WO_ADVANCED', 2);
140
141 define('WO_LABOUR', 0);
142 define('WO_OVERHEAD', 1);
143
144 //----------------------------------------------------------------------------------
145 //      GL account classes
146 //
147 define('CL_NONE', 0); // for backward compatibility
148 define('CL_ASSETS', 1);
149 define('CL_LIABILITIES', 2);
150 define('CL_EQUITY', 3);
151 define('CL_INCOME', 4);
152 define('CL_COGS', 5);
153 define('CL_EXPENSE', 6);
154
155 function get_class_type_convert($ctype)
156 {
157         global $use_oldstyle_convert;
158         if (isset($use_oldstyle_convert) && $use_oldstyle_convert == 1)
159                 return (($ctype >= CL_INCOME || $ctype == CL_NONE) ? -1 : 1);
160         else    
161                 return ((($ctype >= CL_LIABILITIES && $ctype <= CL_INCOME) || $ctype == CL_NONE) ? -1 : 1);
162 }
163 //----------------------------------------------------------------------------------
164 //      Quick entry types
165 //
166 define('QE_PAYMENT', '1');
167 define('QE_DEPOSIT', '2');
168 define('QE_JOURNAL', '3');
169 define('QE_SUPPINV', '4');
170
171 //----------------------------------------------------------------------------------
172 //      Special option values for various list selectors.
173 //
174 define('ANY_TEXT', '');
175 define('ANY_NUMERIC', -1);
176 define('ALL_TEXT', '');
177 define('ALL_NUMERIC', -1);
178
179 //----------------------------------------------------------------------------------
180 // Special class values for tables (start_table())
181 define('TABLESTYLE',  1);
182 define('TABLESTYLE2', 2);
183 define('TABLESTYLE_NOBORDER', 3);
184
185 //----------------------------------------------------------------------------------
186
187 define('TAG_ACCOUNT',   1);
188 define('TAG_DIMENSION', 2);
189
190 include_once($path_to_root . '/includes/sysnames.inc');
191
192 ?>