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