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