New core report, Inventory Purchasing Report in Items and Inventory.
[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 Remittances'),
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 $reports->addReport(RC_INVENTORY, 306, _('Inventory &Purchasing Report'),
212         array(  _('Start Date') => 'DATEBEGINM',
213                         _('End Date') => 'DATEENDM',
214                         _('Inventory Category') => 'CATEGORIES',
215                         _('Location') => 'LOCATIONS',
216                         _('Supplier') => 'SUPPLIERS_NO_FILTER',
217                         _('Items') => 'ITEMS_P',
218                         _('Comments') => 'TEXTBOX',
219                         _('Destination') => 'DESTINATION'));
220
221 $reports->addReportClass(_('Manufacturing'), RC_MANUFACTURE);
222 $reports->addReport(RC_MANUFACTURE, 401, _('&Bill of Material Listing'),
223         array(  _('From product') => 'ITEMS',
224                         _('To product') => 'ITEMS',
225                         _('Comments') => 'TEXTBOX',
226                         _('Destination') => 'DESTINATION'));
227 $reports->addReport(RC_MANUFACTURE, 409, _('Print &Work Orders'),
228         array(  _('From') => 'WORKORDER',
229                         _('To') => 'WORKORDER',
230                         _('Email Locations') => 'YES_NO',
231                         _('Comments') => 'TEXTBOX'));
232 $reports->addReportClass(_('Dimensions'), RC_DIMENSIONS);
233 if ($dim > 0)
234 {
235         $reports->addReport(RC_DIMENSIONS, 501, _('Dimension &Summary'),
236         array(  _('From Dimension') => 'DIMENSION',
237                         _('To Dimension') => 'DIMENSION',
238                         _('Show Balance') => 'YES_NO',
239                         _('Comments') => 'TEXTBOX',
240                         _('Destination') => 'DESTINATION'));
241         //$reports->addReport(_('Dimensions'),502, _('Dimension Details'),
242         //array(        _('Dimension'),'DIMENSIONS'),
243         //              _('Comments'),'TEXTBOX')));
244 }
245 $reports->addReportClass(_('Banking'), RC_BANKING);
246         $reports->addReport(RC_BANKING,  601, _('Bank &Statement'),
247         array(  _('Bank Accounts') => 'BANK_ACCOUNTS',
248                         _('Start Date') => 'DATEBEGINM',
249                         _('End Date') => 'DATEENDM',
250                         _('Zero values') => 'YES_NO',
251                         _('Comments') => 'TEXTBOX',
252                         _('Destination') => 'DESTINATION'));
253
254 $reports->addReportClass(_('General Ledger'), RC_GL);
255 $reports->addReport(RC_GL, 701, _('Chart of &Accounts'),
256         array(  _('Show Balances') => 'YES_NO',
257                         _('Comments') => 'TEXTBOX',
258                         _('Destination') => 'DESTINATION'));
259 $reports->addReport(RC_GL, 702, _('List of &Journal Entries'),
260         array(  _('Start Date') => 'DATEBEGINM',
261                         _('End Date') => 'DATEENDM',
262                         _('Type') => 'SYS_TYPES',
263                         _('Comments') => 'TEXTBOX',
264                         _('Destination') => 'DESTINATION'));
265 //$reports->addReport(RC_GL, 703, _('GL Account Group Summary'),
266 //      array(  _('Comments'),'TEXTBOX')));
267
268 if ($dim == 2)
269 {
270         $reports->addReport(RC_GL, 704, _('GL Account &Transactions'),
271         array(  _('Start Date') => 'DATEBEGINM',
272                         _('End Date') => 'DATEENDM',
273                         _('From Account') => 'GL_ACCOUNTS',
274                         _('To Account') => 'GL_ACCOUNTS',
275                         _('Dimension')." 1" =>  'DIMENSIONS1',
276                         _('Dimension')." 2" =>  'DIMENSIONS2',
277                         _('Comments') => 'TEXTBOX',
278                         _('Destination') => 'DESTINATION'));
279         $reports->addReport(RC_GL, 705, _('Annual &Expense Breakdown'),
280         array(  _('Year') => 'TRANS_YEARS',
281                         _('Dimension')." 1" =>  'DIMENSIONS1',
282                         _('Dimension')." 2" =>  'DIMENSIONS2',
283                         _('Account Tags') =>  'ACCOUNTTAGS',
284                         _('Comments') => 'TEXTBOX',
285                         _('Destination') => 'DESTINATION'));
286         $reports->addReport(RC_GL, 706, _('&Balance Sheet'),
287         array(  _('Start Date') => 'DATEBEGIN',
288                         _('End Date') => 'DATEENDM',
289                         _('Dimension')." 1" => 'DIMENSIONS1',
290                         _('Dimension')." 2" => 'DIMENSIONS2',
291                         _('Account Tags') =>  'ACCOUNTTAGS',
292                         _('Decimal values') => 'YES_NO',
293                         _('Graphics') => 'GRAPHIC',
294                         _('Comments') => 'TEXTBOX',
295                         _('Destination') => 'DESTINATION'));
296         $reports->addReport(RC_GL, 707, _('&Profit and Loss Statement'),
297         array(  _('Start Date') => 'DATEBEGINM',
298                         _('End Date') => 'DATEENDM',
299                         _('Compare to') => 'COMPARE',
300                         _('Dimension')." 1" =>  'DIMENSIONS1',
301                         _('Dimension')." 2" =>  'DIMENSIONS2',
302                         _('Account Tags') =>  'ACCOUNTTAGS',
303                         _('Decimal values') => 'YES_NO',
304                         _('Graphics') => 'GRAPHIC',
305                         _('Comments') => 'TEXTBOX',
306                         _('Destination') => 'DESTINATION'));
307         $reports->addReport(RC_GL, 708, _('Trial &Balance'),
308         array(  _('Start Date') => 'DATEBEGINM',
309                         _('End Date') => 'DATEENDM',
310                         _('Zero values') => 'YES_NO',
311                         _('Only balances') => 'YES_NO',
312                         _('Dimension')." 1" =>  'DIMENSIONS1',
313                         _('Dimension')." 2" =>  'DIMENSIONS2',
314                         _('Comments') => 'TEXTBOX',
315                         _('Destination') => 'DESTINATION'));
316 }
317 else if ($dim == 1)
318 {
319         $reports->addReport(RC_GL, 704, _('GL Account &Transactions'),
320         array(  _('Start Date') => 'DATEBEGINM',
321                         _('End Date') => 'DATEENDM',
322                         _('From Account') => 'GL_ACCOUNTS',
323                         _('To Account') => 'GL_ACCOUNTS',
324                         _('Dimension') =>  'DIMENSIONS1',
325                         _('Comments') => 'TEXTBOX',
326                         _('Destination') => 'DESTINATION'));
327         $reports->addReport(RC_GL, 705, _('Annual &Expense Breakdown'),
328         array(  _('Year') => 'TRANS_YEARS',
329                         _('Dimension') =>  'DIMENSIONS1',
330                         _('Account Tags') =>  'ACCOUNTTAGS',
331                         _('Comments') => 'TEXTBOX',
332                         _('Destination') => 'DESTINATION'));
333         $reports->addReport(RC_GL, 706, _('&Balance Sheet'),
334         array(  _('Start Date') => 'DATEBEGIN',
335                         _('End Date') => 'DATEENDM',
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, 707, _('&Profit and Loss Statement'),
343         array(  _('Start Date') => 'DATEBEGINM',
344                         _('End Date') => 'DATEENDM',
345                         _('Compare to') => 'COMPARE',
346                         _('Dimension') => 'DIMENSIONS1',
347                         _('Account Tags') =>  'ACCOUNTTAGS',
348                         _('Decimal values') => 'YES_NO',
349                         _('Graphics') => 'GRAPHIC',
350                         _('Comments') => 'TEXTBOX',
351                         _('Destination') => 'DESTINATION'));
352         $reports->addReport(RC_GL, 708, _('Trial &Balance'),
353         array(  _('Start Date') => 'DATEBEGINM',
354                         _('End Date') => 'DATEENDM',
355                         _('Zero values') => 'YES_NO',
356                         _('Only balances') => 'YES_NO',
357                         _('Dimension') => 'DIMENSIONS1',
358                         _('Comments') => 'TEXTBOX',
359                         _('Destination') => 'DESTINATION'));
360 }
361 else
362 {
363         $reports->addReport(RC_GL, 704, _('GL Account &Transactions'),
364         array(  _('Start Date') => 'DATEBEGINM',
365                         _('End Date') => 'DATEENDM',
366                         _('From Account') => 'GL_ACCOUNTS',
367                         _('To Account') => 'GL_ACCOUNTS',
368                         _('Comments') => 'TEXTBOX',
369                         _('Destination') => 'DESTINATION'));
370         $reports->addReport(RC_GL, 705, _('Annual &Expense Breakdown'),
371         array(  _('Year') => 'TRANS_YEARS',
372                         _('Account Tags') =>  'ACCOUNTTAGS',
373                         _('Comments') => 'TEXTBOX',
374                         _('Destination') => 'DESTINATION'));
375         $reports->addReport(RC_GL, 706, _('&Balance Sheet'),
376         array(  _('Start Date') => 'DATEBEGIN',
377                         _('End Date') => 'DATEENDM',
378                         _('Account Tags') =>  'ACCOUNTTAGS',
379                         _('Decimal values') => 'YES_NO',
380                         _('Graphics') => 'GRAPHIC',
381                         _('Comments') => 'TEXTBOX',
382                         _('Destination') => 'DESTINATION'));
383         $reports->addReport(RC_GL, 707, _('&Profit and Loss Statement'),
384         array(  _('Start Date') => 'DATEBEGINM',
385                         _('End Date') => 'DATEENDM',
386                         _('Compare to') => 'COMPARE',
387                         _('Account Tags') =>  'ACCOUNTTAGS',
388                         _('Decimal values') => 'YES_NO',
389                         _('Graphics') => 'GRAPHIC',
390                         _('Comments') => 'TEXTBOX',
391                         _('Destination') => 'DESTINATION'));
392         $reports->addReport(RC_GL, 708, _('Trial &Balance'),
393         array(  _('Start Date') => 'DATEBEGINM',
394                         _('End Date') => 'DATEENDM',
395                         _('Zero values') => 'YES_NO',
396                         _('Only balances') => 'YES_NO',
397                         _('Comments') => 'TEXTBOX',
398                         _('Destination') => 'DESTINATION'));
399 }
400 $reports->addReport(RC_GL, 709, _('Ta&x Report'),
401         array(  _('Start Date') => 'DATEBEGINTAX',
402                         _('End Date') => 'DATEENDTAX',
403                         _('Summary Only') => 'YES_NO',
404                         _('Comments') => 'TEXTBOX',
405                         _('Destination') => 'DESTINATION'));
406 $reports->addReport(RC_GL, 710, _('Audit Trail'),
407         array(  _('Start Date') => 'DATEBEGINM',
408                         _('End Date') => 'DATEENDM',
409                         _('Type') => 'SYS_TYPES_ALL',
410                         _('User') => 'USERS',
411                         _('Comments') => 'TEXTBOX',
412                         _('Destination') => 'DESTINATION'));
413
414 add_custom_reports($reports);
415
416 echo $reports->getDisplay();
417
418 end_page();
419 ?>