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