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