Smallfield naming bug.
[fa-stable.git] / reporting / reports_main.php
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 $path_to_root="..";
13 $page_security = 'SA_OPEN';
14 include_once($path_to_root . "/includes/session.inc");
15
16 include_once($path_to_root . "/includes/date_functions.inc");
17 include_once($path_to_root . "/includes/data_checks.inc");
18 include_once($path_to_root . "/includes/ui.inc");
19 include_once($path_to_root . "/reporting/includes/reports_classes.inc");
20 $js = "";
21 if ($use_date_picker)
22         $js .= get_js_date_picker();
23 page(_($help_context = "Reports and Analysis"), false, false, "", $js);
24
25 $reports = new BoxReports;
26
27 $dim = get_company_pref('use_dimension');
28
29 $reports->addReportClass(_('Customer'), RC_CUSTOMER);
30 $reports->addReport(RC_CUSTOMER, 101, _('Customer &Balances'),
31         array(  _('Start Date') => 'DATEBEGIN',
32                         _('End Date') => 'DATEENDM',
33                         _('Customer') => 'CUSTOMERS_NO_FILTER',
34                         _('Currency Filter') => 'CURRENCY',
35                         _('Comments') => 'TEXTBOX',
36                         _('Destination') => 'DESTINATION'));
37 $reports->addReport(RC_CUSTOMER, 102, _('&Aged Customer Analysis'),
38         array(  _('End Date') => 'DATE',
39                         _('Customer') => 'CUSTOMERS_NO_FILTER',
40                         _('Currency Filter') => 'CURRENCY',
41                         _('Summary Only') => 'YES_NO',
42                         _('Graphics') => 'GRAPHIC',
43                         _('Comments') => 'TEXTBOX',
44                         _('Destination') => 'DESTINATION'));
45 $reports->addReport(RC_CUSTOMER, 103, _('Customer &Detail Listing'),
46         array(  _('Activity Since') => 'DATEBEGIN',
47                         _('Sales Areas') => 'AREAS',
48                         _('Sales Folk') => 'SALESMEN',
49                         _('Activity Greater Than') => 'TEXT',
50                         _('Activity Less Than') => 'TEXT',
51                         _('Comments') => 'TEXTBOX',
52                         _('Destination') => 'DESTINATION'));
53 $reports->addReport(RC_CUSTOMER, 104, _('&Price Listing'),
54         array(  _('Currency Filter') => 'CURRENCY',
55                         _('Inventory Category') => 'CATEGORIES',
56                         _('Sales Types') => 'SALESTYPES',
57                         _('Show Pictures') => 'YES_NO',
58                         _('Show GP %') => 'YES_NO',
59                         _('Comments') => 'TEXTBOX',
60                         _('Destination') => 'DESTINATION'));
61 $reports->addReport(RC_CUSTOMER, 105, _('&Order Status Listing'),
62         array(  _('Start Date') => 'DATEBEGINM',
63                         _('End Date') => 'DATEENDM',
64                         _('Inventory Category') => 'CATEGORIES',
65                         _('Stock Location') => 'LOCATIONS',
66                         _('Back Orders Only') => 'YES_NO',
67                         _('Comments') => 'TEXTBOX',
68                         _('Destination') => 'DESTINATION'));
69 $reports->addReport(RC_CUSTOMER, 106, _('&Salesman Listing'),
70         array(  _('Start Date') => 'DATEBEGINM',
71                         _('End Date') => 'DATEENDM',
72                         _('Summary Only') => 'YES_NO',
73                         _('Comments') => 'TEXTBOX',
74                         _('Destination') => 'DESTINATION'));
75 $reports->addReport(RC_CUSTOMER, 107, _('Print &Invoices/Credit Notes'),
76         array(  _('From') => 'INVOICE',
77                         _('To') => 'INVOICE',
78                         _('Currency Filter') => 'CURRENCY',
79                         _('email Customers') => 'YES_NO',
80                         _('Payment Link') => 'PAYMENT_LINK',
81                         _('Comments') => 'TEXTBOX'));
82 $reports->addReport(RC_CUSTOMER, 110, _('Print &Deliveries'),
83         array(  _('From') => 'DELIVERY',
84                         _('To') => 'DELIVERY',
85                         _('email Customers') => 'YES_NO',
86                         _('Print as Packing Slip') => 'YES_NO',
87                         _('Comments') => 'TEXTBOX'));
88 $reports->addReport(RC_CUSTOMER, 108, _('Print &Statements'),
89         array(  _('Customer') => 'CUSTOMERS_NO_FILTER',
90                         _('Currency Filter') => 'CURRENCY',
91                         _('Email Customers') => 'YES_NO',
92                         _('Comments') => 'TEXTBOX'));
93 $reports->addReport(RC_CUSTOMER, 109, _('&Print Sales Orders'),
94         array(  _('From') => 'ORDERS',
95                         _('To') => 'ORDERS',
96                         _('Currency Filter') => 'CURRENCY',
97                         _('Email Customers') => 'YES_NO',
98                         _('Print as Quote') => 'YES_NO',
99                         _('Comments') => 'TEXTBOX'));
100 $reports->addReport(RC_CUSTOMER, 111, _('&Print Sales Quotations'),
101         array(  _('From') => 'QUOTATIONS',
102                         _('To') => 'QUOTATIONS',
103                         _('Currency Filter') => 'CURRENCY',
104                         _('Email Customers') => 'YES_NO',
105                         _('Comments') => 'TEXTBOX'));
106 $reports->addReport(RC_CUSTOMER, 111, _('&Print Sales Quotations'),
107         array(  _('From') => 'QUOTATIONS',
108                         _('To') => 'QUOTATIONS',
109                         _('Currency Filter') => 'CURRENCY',
110                         _('Email Customers') => 'YES_NO',
111                         _('Comments') => 'TEXTBOX'));
112 $reports->addReport(RC_CUSTOMER, 112, _('Print Receipts'),
113         array(  _('From') => 'RECEIPT',
114                         _('To') => 'RECEIPT',
115                         _('Currency Filter') => 'CURRENCY',
116                         _('Comments') => 'TEXTBOX'));
117
118 $reports->addReportClass(_('Supplier'), RC_SUPPLIER);
119 $reports->addReport(RC_SUPPLIER, 201, _('Supplier &Balances'),
120         array(  _('Start Date') => 'DATEBEGIN',
121                         _('End Date') => 'DATEENDM',
122                         _('Supplier') => 'SUPPLIERS_NO_FILTER',
123                         _('Currency Filter') => 'CURRENCY',
124                         _('Comments') => 'TEXTBOX',
125                         _('Destination') => 'DESTINATION'));
126 $reports->addReport(RC_SUPPLIER, 202, _('&Aged Supplier Analyses'),
127         array(  _('End Date') => 'DATE',
128                         _('Supplier') => 'SUPPLIERS_NO_FILTER',
129                         _('Currency Filter') => 'CURRENCY',
130                         _('Summary Only') => 'YES_NO',
131                         _('Graphics') => 'GRAPHIC',
132                         _('Comments') => 'TEXTBOX',
133                         _('Destination') => 'DESTINATION'));
134 $reports->addReport(RC_SUPPLIER, 203, _('&Payment Report'),
135         array(  _('End Date') => 'DATE',
136                         _('Supplier') => 'SUPPLIERS_NO_FILTER',
137                         _('Currency Filter') => 'CURRENCY',
138                         _('Comments') => 'TEXTBOX',
139                         _('Destination') => 'DESTINATION'));
140 $reports->addReport(RC_SUPPLIER, 204, _('Outstanding &GRNs Report'),
141         array(  _('Supplier') => 'SUPPLIERS_NO_FILTER',
142                         _('Comments') => 'TEXTBOX',
143                         _('Destination') => 'DESTINATION'));
144 $reports->addReport(RC_SUPPLIER, 209, _('Print Purchase &Orders'),
145         array(  _('From') => 'PO',
146                         _('To') => 'PO',
147                         _('Currency Filter') => 'CURRENCY',
148                         _('Email Customers') => 'YES_NO',
149                         _('Comments') => 'TEXTBOX'));
150 $reports->addReport(RC_SUPPLIER, 210, _('Print Remittances'),
151         array(  _('From') => 'REMITTANCE',
152                         _('To') => 'REMITTANCE',
153                         _('Currency Filter') => 'CURRENCY',
154                         _('Email Customers') => 'YES_NO',
155                         _('Comments') => 'TEXTBOX'));
156
157 $reports->addReportClass(_('Inventory'), RC_INVENTORY);
158
159 $reports->addReport(RC_INVENTORY,  301, _('Inventory &Valuation Report'),
160         array(  _('Inventory Category') => 'CATEGORIES',
161                         _('Location') => 'LOCATIONS',
162                         _('Summary Only') => 'YES_NO',
163                         _('Comments') => 'TEXTBOX',
164                         _('Destination') => 'DESTINATION'));
165 $reports->addReport(RC_INVENTORY,  302, _('Inventory &Planning Report'),
166         array(  _('Inventory Category') => 'CATEGORIES',
167                         _('Location') => 'LOCATIONS',
168                         _('Comments') => 'TEXTBOX',
169                         _('Destination') => 'DESTINATION'));
170 $reports->addReport(RC_INVENTORY, 303, _('Stock &Check Sheets'),
171         array(  _('Inventory Category') => 'CATEGORIES',
172                         _('Location') => 'LOCATIONS',
173                         _('Show Pictures') => 'YES_NO',
174                         _('Inventory Column') => 'YES_NO',
175                         _('Show Shortage') => 'YES_NO',
176                         _('Comments') => 'TEXTBOX',
177                         _('Destination') => 'DESTINATION'));
178 $reports->addReport(RC_INVENTORY, 304, _('Inventory &Sales Report'),
179         array(  _('Start Date') => 'DATEBEGINM',
180                         _('End Date') => 'DATEENDM',
181                         _('Inventory Category') => 'CATEGORIES',
182                         _('Location') => 'LOCATIONS',
183                         _('Customer') => 'CUSTOMERS_NO_FILTER',
184                         _('Comments') => 'TEXTBOX',
185                         _('Destination') => 'DESTINATION'));
186 $reports->addReport(RC_INVENTORY, 305, _('&GRN Valuation Report'),
187         array(  _('Start Date') => 'DATEBEGINM',
188                         _('End Date') => 'DATEENDM',
189                         _('Comments') => 'TEXTBOX',
190                         _('Destination') => 'DESTINATION'));
191
192 $reports->addReportClass(_('Manufacturing'), RC_MANUFACTURE);
193 $reports->addReport(RC_MANUFACTURE, 401, _('&Bill of Material Listing'),
194         array(  _('From product') => 'ITEMS',
195                         _('To product') => 'ITEMS',
196                         _('Comments') => 'TEXTBOX',
197                         _('Destination') => 'DESTINATION'));
198 $reports->addReport(RC_MANUFACTURE, 409, _('Print &Work Orders'),
199         array(  _('From') => 'WORKORDER',
200                         _('To') => 'WORKORDER',
201                         _('Email Locations') => 'YES_NO',
202                         _('Comments') => 'TEXTBOX'));
203 $reports->addReportClass(_('Dimensions'), RC_DIMENSIONS);
204 if ($dim > 0)
205 {
206         $reports->addReport(RC_DIMENSIONS, 501, _('Dimension &Summary'),
207         array(  _('From Dimension') => 'DIMENSION',
208                         _('To Dimension') => 'DIMENSION',
209                         _('Show Balance') => 'YES_NO',
210                         _('Comments') => 'TEXTBOX',
211                         _('Destination') => 'DESTINATION'));
212         //$reports->addReport(_('Dimensions'),502, _('Dimension Details'),
213         //array(        _('Dimension'),'DIMENSIONS'),
214         //              _('Comments'),'TEXTBOX')));
215 }
216 $reports->addReportClass(_('Banking'), RC_BANKING);
217         $reports->addReport(RC_BANKING,  601, _('Bank &Statement'),
218         array(  _('Bank Accounts') => 'BANK_ACCOUNTS',
219                         _('Start Date') => 'DATEBEGINM',
220                         _('End Date') => 'DATEENDM',
221                         _('Comments') => 'TEXTBOX',
222                         _('Destination') => 'DESTINATION'));
223
224 $reports->addReportClass(_('General Ledger'), RC_GL);
225 $reports->addReport(RC_GL, 701, _('Chart of &Accounts'),
226         array(  _('Show Balances') => 'YES_NO',
227                         _('Comments') => 'TEXTBOX',
228                         _('Destination') => 'DESTINATION'));
229 $reports->addReport(RC_GL, 702, _('List of &Journal Entries'),
230         array(  _('Start Date') => 'DATEBEGINM',
231                         _('End Date') => 'DATEENDM',
232                         _('Type') => 'SYS_TYPES',
233                         _('Comments') => 'TEXTBOX',
234                         _('Destination') => 'DESTINATION'));
235 //$reports->addReport(RC_GL, 703, _('GL Account Group Summary'),
236 //      array(  _('Comments'),'TEXTBOX')));
237
238 if ($dim == 2)
239 {
240         $reports->addReport(RC_GL, 704, _('GL Account &Transactions'),
241         array(  _('Start Date') => 'DATEBEGINM',
242                         _('End Date') => 'DATEENDM',
243                         _('From Account') => 'GL_ACCOUNTS',
244                         _('To Account') => 'GL_ACCOUNTS',
245                         _('Dimension')." 1" =>  'DIMENSIONS1',
246                         _('Dimension')." 2" =>  'DIMENSIONS2',
247                         _('Comments') => 'TEXTBOX',
248                         _('Destination') => 'DESTINATION'));
249         $reports->addReport(RC_GL, 705, _('Annual &Expense Breakdown'),
250         array(  _('Year') => 'TRANS_YEARS',
251                         _('Dimension')." 1" =>  'DIMENSIONS1',
252                         _('Dimension')." 2" =>  'DIMENSIONS2',
253                         _('Account Tags') =>  'ACCOUNTTAGS',
254                         _('Comments') => 'TEXTBOX',
255                         _('Destination') => 'DESTINATION'));
256         $reports->addReport(RC_GL, 706, _('&Balance Sheet'),
257         array(  _('Start Date') => 'DATEBEGIN',
258                         _('End Date') => 'DATEENDM',
259                         _('Dimension')." 1" => 'DIMENSIONS1',
260                         _('Dimension')." 2" => 'DIMENSIONS2',
261                         _('Account Tags') =>  'ACCOUNTTAGS',
262                         _('Decimal values') => 'YES_NO',
263                         _('Graphics') => 'GRAPHIC',
264                         _('Comments') => 'TEXTBOX',
265                         _('Destination') => 'DESTINATION'));
266         $reports->addReport(RC_GL, 707, _('&Profit and Loss Statement'),
267         array(  _('Start Date') => 'DATEBEGINM',
268                         _('End Date') => 'DATEENDM',
269                         _('Compare to') => 'COMPARE',
270                         _('Dimension')." 1" =>  'DIMENSIONS1',
271                         _('Dimension')." 2" =>  'DIMENSIONS2',
272                         _('Account Tags') =>  'ACCOUNTTAGS',
273                         _('Decimal values') => 'YES_NO',
274                         _('Graphics') => 'GRAPHIC',
275                         _('Comments') => 'TEXTBOX',
276                         _('Destination') => 'DESTINATION'));
277         $reports->addReport(RC_GL, 708, _('Trial &Balance'),
278         array(  _('Start Date') => 'DATEBEGINM',
279                         _('End Date') => 'DATEENDM',
280                         _('Zero values') => 'YES_NO',
281                         _('Only balances') => 'YES_NO',
282                         _('Dimension')." 1" =>  'DIMENSIONS1',
283                         _('Dimension')." 2" =>  'DIMENSIONS2',
284                         _('Comments') => 'TEXTBOX',
285                         _('Destination') => 'DESTINATION'));
286 }
287 else if ($dim == 1)
288 {
289         $reports->addReport(RC_GL, 704, _('GL Account &Transactions'),
290         array(  _('Start Date') => 'DATEBEGINM',
291                         _('End Date') => 'DATEENDM',
292                         _('From Account') => 'GL_ACCOUNTS',
293                         _('To Account') => 'GL_ACCOUNTS',
294                         _('Dimension') =>  'DIMENSIONS1',
295                         _('Comments') => 'TEXTBOX',
296                         _('Destination') => 'DESTINATION'));
297         $reports->addReport(RC_GL, 705, _('Annual &Expense Breakdown'),
298         array(  _('Year') => 'TRANS_YEARS',
299                         _('Dimension') =>  'DIMENSIONS1',
300                         _('Account Tags') =>  'ACCOUNTTAGS',
301                         _('Comments') => 'TEXTBOX',
302                         _('Destination') => 'DESTINATION'));
303         $reports->addReport(RC_GL, 706, _('&Balance Sheet'),
304         array(  _('Start Date') => 'DATEBEGIN',
305                         _('End Date') => 'DATEENDM',
306                         _('Dimension') => 'DIMENSIONS1',
307                         _('Account Tags') =>  'ACCOUNTTAGS',
308                         _('Decimal values') => 'YES_NO',
309                         _('Graphics') => 'GRAPHIC',
310                         _('Comments') => 'TEXTBOX',
311                         _('Destination') => 'DESTINATION'));
312         $reports->addReport(RC_GL, 707, _('&Profit and Loss Statement'),
313         array(  _('Start Date') => 'DATEBEGINM',
314                         _('End Date') => 'DATEENDM',
315                         _('Compare to') => 'COMPARE',
316                         _('Dimension') => 'DIMENSIONS1',
317                         _('Account Tags') =>  'ACCOUNTTAGS',
318                         _('Decimal values') => 'YES_NO',
319                         _('Graphics') => 'GRAPHIC',
320                         _('Comments') => 'TEXTBOX',
321                         _('Destination') => 'DESTINATION'));
322         $reports->addReport(RC_GL, 708, _('Trial &Balance'),
323         array(  _('Start Date') => 'DATEBEGINM',
324                         _('End Date') => 'DATEENDM',
325                         _('Zero values') => 'YES_NO',
326                         _('Only balances') => 'YES_NO',
327                         _('Dimension') => 'DIMENSIONS1',
328                         _('Comments') => 'TEXTBOX',
329                         _('Destination') => 'DESTINATION'));
330 }
331 else
332 {
333         $reports->addReport(RC_GL, 704, _('GL Account &Transactions'),
334         array(  _('Start Date') => 'DATEBEGINM',
335                         _('End Date') => 'DATEENDM',
336                         _('From Account') => 'GL_ACCOUNTS',
337                         _('To Account') => 'GL_ACCOUNTS',
338                         _('Comments') => 'TEXTBOX',
339                         _('Destination') => 'DESTINATION'));
340         $reports->addReport(RC_GL, 705, _('Annual &Expense Breakdown'),
341         array(  _('Year') => 'TRANS_YEARS',
342                         _('Account Tags') =>  'ACCOUNTTAGS',
343                         _('Comments') => 'TEXTBOX',
344                         _('Destination') => 'DESTINATION'));
345         $reports->addReport(RC_GL, 706, _('&Balance Sheet'),
346         array(  _('Start Date') => 'DATEBEGIN',
347                         _('End Date') => 'DATEENDM',
348                         _('Account Tags') =>  'ACCOUNTTAGS',
349                         _('Decimal values') => 'YES_NO',
350                         _('Graphics') => 'GRAPHIC',
351                         _('Comments') => 'TEXTBOX',
352                         _('Destination') => 'DESTINATION'));
353         $reports->addReport(RC_GL, 707, _('&Profit and Loss Statement'),
354         array(  _('Start Date') => 'DATEBEGINM',
355                         _('End Date') => 'DATEENDM',
356                         _('Compare to') => 'COMPARE',
357                         _('Account Tags') =>  'ACCOUNTTAGS',
358                         _('Decimal values') => 'YES_NO',
359                         _('Graphics') => 'GRAPHIC',
360                         _('Comments') => 'TEXTBOX',
361                         _('Destination') => 'DESTINATION'));
362         $reports->addReport(RC_GL, 708, _('Trial &Balance'),
363         array(  _('Start Date') => 'DATEBEGINM',
364                         _('End Date') => 'DATEENDM',
365                         _('Zero values') => 'YES_NO',
366                         _('Only balances') => 'YES_NO',
367                         _('Comments') => 'TEXTBOX',
368                         _('Destination') => 'DESTINATION'));
369 }
370 $reports->addReport(RC_GL, 709, _('Ta&x Report'),
371         array(  _('Start Date') => 'DATEBEGINTAX',
372                         _('End Date') => 'DATEENDTAX',
373                         _('Summary Only') => 'YES_NO',
374                         _('Comments') => 'TEXTBOX'));
375 $reports->addReport(RC_GL, 710, _('Audit Trail'),
376         array(  _('Start Date') => 'DATEBEGINM',
377                         _('End Date') => 'DATEENDM',
378                         _('Type') => 'SYS_TYPES_ALL',
379                         _('User') => 'USERS',
380                         _('Comments') => 'TEXTBOX',
381                         _('Destination') => 'DESTINATION'));
382
383 add_custom_reports($reports);
384
385 echo "<script language='javascript'>
386                 function onWindowLoad() {
387                         showClass(" . $_GET['Class'] . ")
388                 }
389         Behaviour.addLoadEvent(onWindowLoad);
390         </script>
391 ";
392 echo $reports->getDisplay();
393
394 end_page();
395 ?>