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