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