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