Adde integration of custom/extended reports; optimizations.
[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'));
30 $reports->addReport(_('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(_('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(_('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(_('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(_('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(_('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(_('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(_('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(_('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(_('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(_('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
107 $reports->addReportClass(_('Supplier'));
108 $reports->addReport(_('Supplier'),201,_('Supplier &Balances'),
109         array(  _('Start Date') => 'DATEBEGIN',
110                         _('End Date') => 'DATEENDM',
111                         _('Supplier') => 'SUPPLIERS_NO_FILTER',
112                         _('Currency Filter') => 'CURRENCY',
113                         _('Comments') => 'TEXTBOX',
114                         _('Destination') => 'DESTINATION'));
115 $reports->addReport(_('Supplier'),202,_('&Aged Supplier Analyses'),
116         array(  _('End Date') => 'DATE',
117                         _('Supplier') => 'SUPPLIERS_NO_FILTER',
118                         _('Currency Filter') => 'CURRENCY',
119                         _('Summary Only') => 'YES_NO',
120                         _('Graphics') => 'GRAPHIC',
121                         _('Comments') => 'TEXTBOX',
122                         _('Destination') => 'DESTINATION'));
123 $reports->addReport(_('Supplier'),203,_('&Payment Report'),
124         array(  _('End Date') => 'DATE',
125                         _('Supplier') => 'SUPPLIERS_NO_FILTER',
126                         _('Currency Filter') => 'CURRENCY',
127                         _('Comments') => 'TEXTBOX',
128                         _('Destination') => 'DESTINATION'));
129 $reports->addReport(_('Supplier'),204,_('Outstanding &GRNs Report'),
130         array(  _('Supplier') => 'SUPPLIERS_NO_FILTER',
131                         _('Comments') => 'TEXTBOX',
132                         _('Destination') => 'DESTINATION'));
133 $reports->addReport(_('Supplier'),209,_('Print Purchase &Orders'),
134         array(  _('From') => 'PO',
135                         _('To') => 'PO',
136                         _('Currency Filter') => 'CURRENCY',
137                         _('Email Customers') => 'YES_NO',
138                         _('Comments') => 'TEXTBOX'));
139
140 $reports->addReportClass(_('Inventory'));
141 $reports->addReport(_('Inventory'),301,_('Inventory &Valuation Report'),
142         array(  _('Inventory Category') => 'CATEGORIES',
143                         _('Location') => 'LOCATIONS',
144                         _('Summary Only') => 'YES_NO',
145                         _('Comments') => 'TEXTBOX',
146                         _('Destination') => 'DESTINATION'));
147 $reports->addReport(_('Inventory'),302,_('Inventory &Planning Report'),
148         array(  _('Inventory Category') => 'CATEGORIES',
149                         _('Location') => 'LOCATIONS',
150                         _('Comments') => 'TEXTBOX',
151                         _('Destination') => 'DESTINATION'));
152 $reports->addReport(_('Inventory'),303,_('Stock &Check Sheets'),
153         array(  _('Inventory Category') => 'CATEGORIES',
154                         _('Location') => 'LOCATIONS',
155                         _('Show Pictures') => 'YES_NO',
156                         _('Inventory Column') => 'YES_NO',
157                         _('Show Shortage') => 'YES_NO',
158                         _('Comments') => 'TEXTBOX',
159                         _('Destination') => 'DESTINATION'));
160 $reports->addReport(_('Inventory'),304,_('Inventory &Sales Report'),
161         array(  _('Start Date') => 'DATEBEGINM',
162                         _('End Date') => 'DATEENDM',
163                         _('Inventory Category') => 'CATEGORIES',
164                         _('Location') => 'LOCATIONS',
165                         _('Customer') => 'CUSTOMERS_NO_FILTER',
166                         _('Comments') => 'TEXTBOX',
167                         _('Destination') => 'DESTINATION'));
168 $reports->addReport(_('Inventory'),305,_('&GRN Valuation Report'),
169         array(  _('Start Date') => 'DATEBEGINM',
170                         _('End Date') => 'DATEENDM',
171                         _('Comments') => 'TEXTBOX',
172                         _('Destination') => 'DESTINATION'));
173
174 $reports->addReportClass(_('Manufacturing'));
175 $reports->addReport(_('Manufacturing'),401,_('&Bill of Material Listing'),
176         array(  _('From product') => 'ITEMS',
177                         _('To product') => 'ITEMS',
178                         _('Comments') => 'TEXTBOX',
179                         _('Destination') => 'DESTINATION'));
180 $reports->addReport(_('Manufacturing'),409,_('Print &Work Orders'),
181         array(  _('From') => 'WORKORDER',
182                         _('To') => 'WORKORDER',
183                         _('Email Locations') => 'YES_NO',
184                         _('Comments') => 'TEXTBOX'));
185 $reports->addReportClass(_('Dimensions'));
186 if ($dim > 0)
187 {
188         $reports->addReport(_('Dimensions'),501,_('Dimension &Summary'),
189         array(  _('From Dimension') => 'DIMENSION',
190                         _('To Dimension') => 'DIMENSION',
191                         _('Show Balance') => 'YES_NO',
192                         _('Comments') => 'TEXTBOX',
193                         _('Destination') => 'DESTINATION'));
194         //$reports->addReport(_('Dimensions'),502,_('Dimension Details'),
195         //array(        _('Dimension'),'DIMENSIONS'),
196         //              _('Comments'),'TEXTBOX')));
197 }
198 $reports->addReportClass(_('Banking'));
199         $reports->addReport(_('Banking'),601,_('Bank &Statement'),
200         array(  _('Bank Accounts') => 'BANK_ACCOUNTS',
201                         _('Start Date') => 'DATEBEGINM',
202                         _('End Date') => 'DATEENDM',
203                         _('Comments') => 'TEXTBOX',
204                         _('Destination') => 'DESTINATION'));
205
206 $reports->addReportClass(_('General Ledger'));
207 $reports->addReport(_('General Ledger'),701,_('Chart of &Accounts'),
208         array(  _('Show Balances') => 'YES_NO',
209                         _('Comments') => 'TEXTBOX',
210                         _('Destination') => 'DESTINATION'));
211 $reports->addReport(_('General Ledger'),702,_('List of &Journal Entries'),
212         array(  _('Start Date') => 'DATEBEGINM',
213                         _('End Date') => 'DATEENDM',
214                         _('Type') => 'SYS_TYPES',
215                         _('Comments') => 'TEXTBOX',
216                         _('Destination') => 'DESTINATION'));
217 //$reports->addReport(_('General Ledger'),703,_('GL Account Group Summary'),
218 //      array(  _('Comments'),'TEXTBOX')));
219
220 if ($dim == 2)
221 {
222         $reports->addReport(_('General Ledger'),704,_('GL Account &Transactions'),
223         array(  _('Start Date') => 'DATEBEGINM',
224                         _('End Date') => 'DATEENDM',
225                         _('From Account') => 'GL_ACCOUNTS',
226                         _('To Account') => 'GL_ACCOUNTS',
227                         _('Dimension')." 1" =>  'DIMENSIONS1',
228                         _('Dimension')." 2" =>  'DIMENSIONS2',
229                         _('Comments') => 'TEXTBOX',
230                         _('Destination') => 'DESTINATION'));
231         $reports->addReport(_('General Ledger'),705,_('Annual &Expense Breakdown'),
232         array(  _('Year') => 'TRANS_YEARS',
233                         _('Dimension')." 1" =>  'DIMENSIONS1',
234                         _('Dimension')." 2" =>  'DIMENSIONS2',
235                         _('Comments') => 'TEXTBOX',
236                         _('Destination') => 'DESTINATION'));
237         $reports->addReport(_('General Ledger'),706,_('&Balance Sheet'),
238         array(  _('Start Date') => 'DATEBEGIN',
239                         _('End Date') => 'DATEENDM',
240                         _('Dimension')." 1" => 'DIMENSIONS1',
241                         _('Dimension')." 2" => 'DIMENSIONS2',
242                         _('Graphics') => 'GRAPHIC',
243                         _('Comments') => 'TEXTBOX',
244                         _('Destination') => 'DESTINATION'));
245         $reports->addReport(_('General Ledger'),707,_('&Profit and Loss Statement'),
246         array(  _('Start Date') => 'DATEBEGINM',
247                         _('End Date') => 'DATEENDM',
248                         _('Compare to') => 'COMPARE',
249                         _('Dimension')." 1" =>  'DIMENSIONS1',
250                         _('Dimension')." 2" =>  'DIMENSIONS2',
251                         _('Graphics') => 'GRAPHIC',
252                         _('Comments') => 'TEXTBOX',
253                         _('Destination') => 'DESTINATION'));
254         $reports->addReport(_('General Ledger'),708,_('Trial &Balance'),
255         array(  _('Start Date') => 'DATEBEGINM',
256                         _('End Date') => 'DATEENDM',
257                         _('Zero values') => 'YES_NO',
258                         _('Only balances') => 'YES_NO',
259                         _('Dimension')." 1" =>  'DIMENSIONS1',
260                         _('Dimension')." 2" =>  'DIMENSIONS2',
261                         _('Comments') => 'TEXTBOX',
262                         _('Destination') => 'DESTINATION'));
263 }
264 else if ($dim == 1)
265 {
266         $reports->addReport(_('General Ledger'),704,_('GL Account &Transactions'),
267         array(  _('Start Date') => 'DATEBEGINM',
268                         _('End Date') => 'DATEENDM',
269                         _('From Account') => 'GL_ACCOUNTS',
270                         _('To Account') => 'GL_ACCOUNTS',
271                         _('Dimension') =>  'DIMENSIONS1',
272                         _('Comments') => 'TEXTBOX',
273                         _('Destination') => 'DESTINATION'));
274         $reports->addReport(_('General Ledger'),705,_('Annual &Expense Breakdown'),
275         array(  _('Year') => 'TRANS_YEARS',
276                         _('Dimension') =>  'DIMENSIONS1',
277                         _('Comments') => 'TEXTBOX',
278                         _('Destination') => 'DESTINATION'));
279         $reports->addReport(_('General Ledger'),706,_('&Balance Sheet'),
280         array(  _('Start Date') => 'DATEBEGIN',
281                         _('End Date') => 'DATEENDM',
282                         _('Dimension') => 'DIMENSIONS1',
283                         _('Graphics') => 'GRAPHIC',
284                         _('Comments') => 'TEXTBOX',
285                         _('Destination') => 'DESTINATION'));
286         $reports->addReport(_('General Ledger'),707,_('&Profit and Loss Statement'),
287         array(  _('Start Date') => 'DATEBEGINM',
288                         _('End Date') => 'DATEENDM',
289                         _('Compare to') => 'COMPARE',
290                         _('Dimension') => 'DIMENSIONS1',
291                         _('Graphics') => 'GRAPHIC',
292                         _('Comments') => 'TEXTBOX',
293                         _('Destination') => 'DESTINATION'));
294         $reports->addReport(_('General Ledger'),708,_('Trial &Balance'),
295         array(  _('Start Date') => 'DATEBEGINM',
296                         _('End Date') => 'DATEENDM',
297                         _('Zero values') => 'YES_NO',
298                         _('Only balances') => 'YES_NO',
299                         _('Dimension') => 'DIMENSIONS1',
300                         _('Comments') => 'TEXTBOX',
301                         _('Destination') => 'DESTINATION'));
302 }
303 else
304 {
305         $reports->addReport(_('General Ledger'),704,_('GL Account &Transactions'),
306         array(  _('Start Date') => 'DATEBEGINM',
307                         _('End Date') => 'DATEENDM',
308                         _('From Account') => 'GL_ACCOUNTS',
309                         _('To Account') => 'GL_ACCOUNTS',
310                         _('Comments') => 'TEXTBOX',
311                         _('Destination') => 'DESTINATION'));
312         $reports->addReport(_('General Ledger'),705,_('Annual &Expense Breakdown'),
313         array(  _('Year') => 'TRANS_YEARS',
314                         _('Comments') => 'TEXTBOX',
315                         _('Destination') => 'DESTINATION'));
316         $reports->addReport(_('General Ledger'),706,_('&Balance Sheet'),
317         array(  _('Start Date') => 'DATEBEGIN',
318                         _('End Date') => 'DATEENDM',
319                         _('Graphics') => 'GRAPHIC',
320                         _('Comments') => 'TEXTBOX',
321                         _('Destination') => 'DESTINATION'));
322         $reports->addReport(_('General Ledger'),707,_('&Profit and Loss Statement'),
323         array(  _('Start Date') => 'DATEBEGINM',
324                         _('End Date') => 'DATEENDM',
325                         _('Compare to') => 'COMPARE',
326                         _('Graphics') => 'GRAPHIC',
327                         _('Comments') => 'TEXTBOX',
328                         _('Destination') => 'DESTINATION'));
329         $reports->addReport(_('General Ledger'),708,_('Trial &Balance'),
330         array(  _('Start Date') => 'DATEBEGINM',
331                         _('End Date') => 'DATEENDM',
332                         _('Zero values') => 'YES_NO',
333                         _('Only balances') => 'YES_NO',
334                         _('Comments') => 'TEXTBOX',
335                         _('Destination') => 'DESTINATION'));
336 }
337 $reports->addReport(_('General Ledger'),709,_('Ta&x Report'),
338         array(  _('Start Date') => 'DATEBEGINTAX',
339                         _('End Date') => 'DATEENDTAX',
340                         _('Summary Only') => 'YES_NO',
341                         _('Comments') => 'TEXTBOX'));
342 $reports->addReport(_('General Ledger'),710,_('Audit Trail'),
343         array(  _('Start Date') => 'DATEBEGINM',
344                         _('End Date') => 'DATEENDM',
345                         _('Type') => 'SYS_TYPES_ALL',
346                         _('User') => 'USERS',
347                         _('Comments') => 'TEXTBOX',
348                         _('Destination') => 'DESTINATION'));
349
350 add_custom_reports($reports);
351
352 echo "<script language='javascript'>
353                 function onWindowLoad() {
354                         showClass(" . $_GET['Class'] . ")
355                 }
356         Behaviour.addLoadEvent(onWindowLoad);
357         </script>
358 ";
359 echo $reports->getDisplay();
360
361 end_page();
362 ?>