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