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