Preparation for report destination PDF/Printer and Excel (and Open Office Calc)
[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 = 5;
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(_("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(  new ReportParam(_('End Date'),'DATE'),
32                         new ReportParam(_('Customer'),'CUSTOMERS_NO_FILTER'),
33                         new ReportParam(_('Currency Filter'),'CURRENCY'),
34                         new ReportParam(_('Comments'),'TEXTBOX'),
35                         new ReportParam(_('Destination'),'DESTINATION')));
36 $reports->addReport(_('Customer'),102,_('&Aged Customer Analysis'),
37         array(  new ReportParam(_('End Date'),'DATE'),
38                         new ReportParam(_('Customer'),'CUSTOMERS_NO_FILTER'),
39                         new ReportParam(_('Currency Filter'),'CURRENCY'),
40                         new ReportParam(_('Summary Only'),'YES_NO'),
41                         new ReportParam(_('Graphics'),'GRAPHIC'),
42                         new ReportParam(_('Comments'),'TEXTBOX'),
43                         new ReportParam(_('Destination'),'DESTINATION')));
44 $reports->addReport(_('Customer'),103,_('Customer &Detail Listing'),
45         array(  new ReportParam(_('Activity Since'),'DATEBEGIN'),
46                         new ReportParam(_('Sales Areas'),'AREAS'),
47                         new ReportParam(_('Sales Folk'),'SALESMEN'), 
48                         new ReportParam(_('Activity Greater Than'),'TEXT'), 
49                         new ReportParam(_('Activity Less Than'),'TEXT'), 
50                         new ReportParam(_('Comments'),'TEXTBOX'),
51                         new ReportParam(_('Destination'),'DESTINATION')));
52 $reports->addReport(_('Customer'),104,_('&Price Listing'),
53         array(  new ReportParam(_('Currency Filter'),'CURRENCY'),
54                         new ReportParam(_('Inventory Category'),'CATEGORIES'),
55                         new ReportParam(_('Sales Types'),'SALESTYPES'),
56                         new ReportParam(_('Show Pictures'),'YES_NO'),
57                         new ReportParam(_('Show GP %'),'YES_NO'),
58                         new ReportParam(_('Comments'),'TEXTBOX'),
59                         new ReportParam(_('Destination'),'DESTINATION')));
60 $reports->addReport(_('Customer'),105,_('&Order Status Listing'),
61         array(  new ReportParam(_('Start Date'),'DATEBEGINM'),
62                         new ReportParam(_('End Date'),'DATEENDM'),
63                         new ReportParam(_('Inventory Category'),'CATEGORIES'),
64                         new ReportParam(_('Stock Location'),'LOCATIONS'),
65                         new ReportParam(_('Back Orders Only'),'YES_NO'),
66                         new ReportParam(_('Comments'),'TEXTBOX'),
67                         new ReportParam(_('Destination'),'DESTINATION')));
68 $reports->addReport(_('Customer'),106,_('&Salesman Listing'),
69         array(  new ReportParam(_('Start Date'),'DATEBEGINM'),
70                         new ReportParam(_('End Date'),'DATEENDM'),
71                         new ReportParam(_('Summary Only'),'YES_NO'),
72                         new ReportParam(_('Comments'),'TEXTBOX'),
73                         new ReportParam(_('Destination'),'DESTINATION')));
74 $reports->addReport(_('Customer'),107,_('Print &Invoices/Credit Notes'),
75         array(  new ReportParam(_('From'),'INVOICE'),
76                         new ReportParam(_('To'),'INVOICE'),
77                         new ReportParam(_('Currency Filter'),'CURRENCY'),
78                         new ReportParam(_('Bank Account'),'BANK_ACCOUNTS'),
79                         new ReportParam(_('email Customers'),'YES_NO'),
80                         new ReportParam(_('Payment Link'),'PAYMENT_LINK'),
81                         new ReportParam(_('Comments'),'TEXTBOX')));
82 $reports->addReport(_('Customer'),110,_('Print &Deliveries'),
83         array(  new ReportParam(_('From'),'DELIVERY'),
84                         new ReportParam(_('To'),'DELIVERY'),
85                         new ReportParam(_('email Customers'),'YES_NO'),
86                         new ReportParam(_('Comments'),'TEXTBOX')));
87 $reports->addReport(_('Customer'),108,_('Print &Statements'),
88         array(  new ReportParam(_('Customer'),'CUSTOMERS_NO_FILTER'),
89                         new ReportParam(_('Currency Filter'),'CURRENCY'),
90                         new ReportParam(_('Bank Account'),'BANK_ACCOUNTS'),
91                         new ReportParam(_('Email Customers'),'YES_NO'),
92                         new ReportParam(_('Comments'),'TEXTBOX')));
93 $reports->addReport(_('Customer'),109,_('&Print Sales Orders'),
94         array(  new ReportParam(_('From'),'ORDERS'),
95                         new ReportParam(_('To'),'ORDERS'),
96                         new ReportParam(_('Currency Filter'),'CURRENCY'),
97                         new ReportParam(_('Bank Account'),'BANK_ACCOUNTS'),
98                         new ReportParam(_('Email Customers'),'YES_NO'),
99                         new ReportParam(_('Print as Quote'),'YES_NO'),
100                         new ReportParam(_('Comments'),'TEXTBOX')));
101
102 $reports->addReportClass(_('Supplier'));
103 $reports->addReport(_('Supplier'),201,_('Supplier &Balances'),
104         array(  new ReportParam(_('End Date'),'DATE'),
105                         new ReportParam(_('Supplier'),'SUPPLIERS_NO_FILTER'),
106                         new ReportParam(_('Currency Filter'),'CURRENCY'),
107                         new ReportParam(_('Comments'),'TEXTBOX'),
108                         new ReportParam(_('Destination'),'DESTINATION')));
109 $reports->addReport(_('Supplier'),202,_('&Aged Supplier Analyses'),
110         array(  new ReportParam(_('End Date'),'DATE'),
111                         new ReportParam(_('Supplier'),'SUPPLIERS_NO_FILTER'),
112                         new ReportParam(_('Currency Filter'),'CURRENCY'),
113                         new ReportParam(_('Summary Only'),'YES_NO'),
114                         new ReportParam(_('Graphics'),'GRAPHIC'),
115                         new ReportParam(_('Comments'),'TEXTBOX'),
116                         new ReportParam(_('Destination'),'DESTINATION')));
117 $reports->addReport(_('Supplier'),203,_('&Payment Report'),
118         array(  new ReportParam(_('End Date'),'DATE'),
119                         new ReportParam(_('Supplier'),'SUPPLIERS_NO_FILTER'),
120                         new ReportParam(_('Currency Filter'),'CURRENCY'),
121                         new ReportParam(_('Comments'),'TEXTBOX'),
122                         new ReportParam(_('Destination'),'DESTINATION')));
123 $reports->addReport(_('Supplier'),204,_('Outstanding &GRNs Report'),
124         array(  new ReportParam(_('Supplier'),'SUPPLIERS_NO_FILTER'),
125                         new ReportParam(_('Comments'),'TEXTBOX'),
126                         new ReportParam(_('Destination'),'DESTINATION')));
127 $reports->addReport(_('Supplier'),209,_('Print Purchase &Orders'),
128         array(  new ReportParam(_('From'),'PO'),
129                         new ReportParam(_('To'),'PO'),
130                         new ReportParam(_('Currency Filter'),'CURRENCY'),
131                         new ReportParam(_('Bank Account'),'BANK_ACCOUNTS'),
132                         new ReportParam(_('Email Customers'),'YES_NO'),
133                         new ReportParam(_('Comments'),'TEXTBOX')));
134
135 $reports->addReportClass(_('Inventory'));
136 $reports->addReport(_('Inventory'),301,_('Inventory &Valuation Report'),
137         array(  new ReportParam(_('Inventory Category'),'CATEGORIES'),
138                         new ReportParam(_('Location'),'LOCATIONS'),
139                         new ReportParam(_('Detailed Report'),'YES_NO'),
140                         new ReportParam(_('Comments'),'TEXTBOX'),
141                         new ReportParam(_('Destination'),'DESTINATION')));
142 $reports->addReport(_('Inventory'),302,_('Inventory &Planning Report'),
143         array(  new ReportParam(_('Inventory Category'),'CATEGORIES'),
144                         new ReportParam(_('Location'),'LOCATIONS'),
145                         new ReportParam(_('Comments'),'TEXTBOX'),
146                         new ReportParam(_('Destination'),'DESTINATION')));
147 $reports->addReport(_('Inventory'),303,_('Stock &Check Sheets'),
148         array(  new ReportParam(_('Inventory Category'),'CATEGORIES'),
149                         new ReportParam(_('Location'),'LOCATIONS'),
150                         new ReportParam(_('Show Pictures'),'YES_NO'),
151                         new ReportParam(_('Inventory Column'),'YES_NO'),
152                         new ReportParam(_('Comments'),'TEXTBOX'),
153                         new ReportParam(_('Destination'),'DESTINATION')));
154 $reports->addReport(_('Inventory'),304,_('Inventory &Sales Report'),
155         array(  new ReportParam(_('Start Date'),'DATEBEGINM'),
156                         new ReportParam(_('End Date'),'DATEENDM'),
157                         new ReportParam(_('Inventory Category'),'CATEGORIES'),
158                         new ReportParam(_('Location'),'LOCATIONS'),
159                         new ReportParam(_('Detailed Report'),'YES_NO'),
160                         new ReportParam(_('Comments'),'TEXTBOX'),
161                         new ReportParam(_('Destination'),'DESTINATION')));
162
163 $reports->addReportClass(_('Manufactoring'));
164 $reports->addReport(_('Manufactoring'),401,_('&Bill of Material Listing'),
165         array(  new ReportParam(_('From component'),'ITEMS'),
166                         new ReportParam(_('To component'),'ITEMS'),
167                         new ReportParam(_('Comments'),'TEXTBOX'),
168                         new ReportParam(_('Destination'),'DESTINATION')));
169         $reports->addReportClass(_('Dimensions'));
170 if ($dim > 0)
171 {
172         $reports->addReport(_('Dimensions'),501,_('Dimension &Summary'),
173         array(  new ReportParam(_('From Dimension'),'DIMENSION'),
174                         new ReportParam(_('To Dimension'),'DIMENSION'),
175                         new ReportParam(_('Show Balance'),'YES_NO'),
176                         new ReportParam(_('Comments'),'TEXTBOX'),
177                         new ReportParam(_('Destination'),'DESTINATION')));
178         //$reports->addReport(_('Dimensions'),502,_('Dimension Details'),
179         //array(        new ReportParam(_('Dimension'),'DIMENSIONS'),
180         //              new ReportParam(_('Comments'),'TEXTBOX')));
181 }
182 $reports->addReportClass(_('Banking'));
183         $reports->addReport(_('Banking'),601,_('Bank &Statement'),
184         array(  new ReportParam(_('Bank Accounts'),'BANK_ACCOUNTS'),
185                         new ReportParam(_('Start Date'),'DATEBEGINM'),
186                         new ReportParam(_('End Date'),'DATEENDM'),
187                         new ReportParam(_('Comments'),'TEXTBOX'),
188                         new ReportParam(_('Destination'),'DESTINATION')));
189
190 $reports->addReportClass(_('General Ledger'));
191 $reports->addReport(_('General Ledger'),701,_('Chart of &Accounts'),
192         array(  new ReportParam(_('Show Balances'),'YES_NO'),
193                         new ReportParam(_('Comments'),'TEXTBOX'),
194                         new ReportParam(_('Destination'),'DESTINATION')));
195 $reports->addReport(_('General Ledger'),702,_('List of &Journal Entries'),
196         array(  new ReportParam(_('Start Date'),'DATEBEGINM'),
197                         new ReportParam(_('End Date'),'DATEENDM'),
198                         new ReportParam(_('Type'),'SYS_TYPES'),
199                         new ReportParam(_('Comments'),'TEXTBOX'),
200                         new ReportParam(_('Destination'),'DESTINATION')));
201 //$reports->addReport(_('General Ledger'),703,_('GL Account Group Summary'),
202 //      array(  new ReportParam(_('Comments'),'TEXTBOX')));
203 if ($dim == 2)
204 {
205         $reports->addReport(_('General Ledger'),704,_('GL Account &Transactions'),
206         array(  new ReportParam(_('Start Date'),'DATEBEGINM'),
207                         new ReportParam(_('End Date'),'DATEENDM'),
208                         new ReportParam(_('From Account'),'GL_ACCOUNTS'),
209                         new ReportParam(_('To Account'),'GL_ACCOUNTS'),
210                         new ReportParam(_('Dimension')." 1", 'DIMENSIONS1'),
211                         new ReportParam(_('Dimension')." 2", 'DIMENSIONS2'),
212                         new ReportParam(_('Comments'),'TEXTBOX'),
213                         new ReportParam(_('Destination'),'DESTINATION')));
214         $reports->addReport(_('General Ledger'),705,_('Annual &Expense Breakdown'),
215         array(  new ReportParam(_('Year'),'TRANS_YEARS'),
216                         new ReportParam(_('Dimension')." 1", 'DIMENSIONS1'),
217                         new ReportParam(_('Dimension')." 2", 'DIMENSIONS2'),
218                         new ReportParam(_('Comments'),'TEXTBOX'),
219                         new ReportParam(_('Destination'),'DESTINATION')));
220         $reports->addReport(_('General Ledger'),706,_('&Balance Sheet'),
221         array(  new ReportParam(_('Start Date'),'DATEBEGIN'),
222                         new ReportParam(_('End Date'),'DATEENDM'),
223                         new ReportParam(_('Dimension')." 1", 'DIMENSIONS1'),
224                         new ReportParam(_('Dimension')." 2", 'DIMENSIONS2'),
225                         new ReportParam(_('Graphics'),'GRAPHIC'),
226                         new ReportParam(_('Comments'),'TEXTBOX'),
227                         new ReportParam(_('Destination'),'DESTINATION')));
228         $reports->addReport(_('General Ledger'),707,_('&Profit and Loss Statement'),
229         array(  new ReportParam(_('Start Date'),'DATEBEGINM'),
230                         new ReportParam(_('End Date'),'DATEENDM'),
231                         new ReportParam(_('Compare to'),'COMPARE'),
232                         new ReportParam(_('Dimension')." 1", 'DIMENSIONS1'),
233                         new ReportParam(_('Dimension')." 2", 'DIMENSIONS2'),
234                         new ReportParam(_('Graphics'),'GRAPHIC'),
235                         new ReportParam(_('Comments'),'TEXTBOX'),
236                         new ReportParam(_('Destination'),'DESTINATION')));
237         $reports->addReport(_('General Ledger'),708,_('Trial &Balance'),
238         array(  new ReportParam(_('Start Date'),'DATEBEGINM'),
239                         new ReportParam(_('End Date'),'DATEENDM'),
240                         new ReportParam(_('Zero values'),'YES_NO'),
241                         new ReportParam(_('Only balances'),'YES_NO'),
242                         new ReportParam(_('Dimension')." 1", 'DIMENSIONS1'),
243                         new ReportParam(_('Dimension')." 2", 'DIMENSIONS2'),
244                         new ReportParam(_('Comments'),'TEXTBOX'),
245                         new ReportParam(_('Destination'),'DESTINATION')));
246 }
247 else if ($dim == 1)
248 {
249         $reports->addReport(_('General Ledger'),704,_('GL Account &Transactions'),
250         array(  new ReportParam(_('Start Date'),'DATEBEGINM'),
251                         new ReportParam(_('End Date'),'DATEENDM'),
252                         new ReportParam(_('From Account'),'GL_ACCOUNTS'),
253                         new ReportParam(_('To Account'),'GL_ACCOUNTS'),
254                         new ReportParam(_('Dimension'), 'DIMENSIONS1'),
255                         new ReportParam(_('Comments'),'TEXTBOX'),
256                         new ReportParam(_('Destination'),'DESTINATION')));
257         $reports->addReport(_('General Ledger'),705,_('Annual &Expense Breakdown'),
258         array(  new ReportParam(_('Year'),'TRANS_YEARS'),
259                         new ReportParam(_('Dimension'), 'DIMENSIONS1'),
260                         new ReportParam(_('Comments'),'TEXTBOX'),
261                         new ReportParam(_('Destination'),'DESTINATION')));
262         $reports->addReport(_('General Ledger'),706,_('&Balance Sheet'),
263         array(  new ReportParam(_('Start Date'),'DATEBEGIN'),
264                         new ReportParam(_('End Date'),'DATEENDM'),
265                         new ReportParam(_('Dimension'), 'DIMENSIONS1'),
266                         new ReportParam(_('Graphics'),'GRAPHIC'),
267                         new ReportParam(_('Comments'),'TEXTBOX'),
268                         new ReportParam(_('Destination'),'DESTINATION')));
269         $reports->addReport(_('General Ledger'),707,_('&Profit and Loss Statement'),
270         array(  new ReportParam(_('Start Date'),'DATEBEGINM'),
271                         new ReportParam(_('End Date'),'DATEENDM'),
272                         new ReportParam(_('Compare to'),'COMPARE'),
273                         new ReportParam(_('Dimension'), 'DIMENSIONS1'),
274                         new ReportParam(_('Graphics'),'GRAPHIC'),
275                         new ReportParam(_('Comments'),'TEXTBOX'),
276                         new ReportParam(_('Destination'),'DESTINATION')));
277         $reports->addReport(_('General Ledger'),708,_('Trial &Balance'),
278         array(  new ReportParam(_('Start Date'),'DATEBEGINM'),
279                         new ReportParam(_('End Date'),'DATEENDM'),
280                         new ReportParam(_('Zero values'),'YES_NO'),
281                         new ReportParam(_('Only balances'),'YES_NO'),
282                         new ReportParam(_('Dimension'), 'DIMENSIONS1'),
283                         new ReportParam(_('Comments'),'TEXTBOX'),
284                         new ReportParam(_('Destination'),'DESTINATION')));
285 }
286 else
287 {
288         $reports->addReport(_('General Ledger'),704,_('GL Account &Transactions'),
289         array(  new ReportParam(_('Start Date'),'DATEBEGINM'),
290                         new ReportParam(_('End Date'),'DATEENDM'),
291                         new ReportParam(_('From Account'),'GL_ACCOUNTS'),
292                         new ReportParam(_('To Account'),'GL_ACCOUNTS'),
293                         new ReportParam(_('Comments'),'TEXTBOX'),
294                         new ReportParam(_('Destination'),'DESTINATION')));
295         $reports->addReport(_('General Ledger'),705,_('Annual &Expense Breakdown'),
296         array(  new ReportParam(_('Year'),'TRANS_YEARS'),
297                         new ReportParam(_('Comments'),'TEXTBOX'),
298                         new ReportParam(_('Destination'),'DESTINATION')));
299         $reports->addReport(_('General Ledger'),706,_('&Balance Sheet'),
300         array(  new ReportParam(_('Start Date'),'DATEBEGIN'),
301                         new ReportParam(_('End Date'),'DATEENDM'),
302                         new ReportParam(_('Graphics'),'GRAPHIC'),
303                         new ReportParam(_('Comments'),'TEXTBOX'),
304                         new ReportParam(_('Destination'),'DESTINATION'),
305                         new ReportParam(_('Destination'),'DESTINATION')));
306         $reports->addReport(_('General Ledger'),707,_('&Profit and Loss Statement'),
307         array(  new ReportParam(_('Start Date'),'DATEBEGINM'),
308                         new ReportParam(_('End Date'),'DATEENDM'),
309                         new ReportParam(_('Compare to'),'COMPARE'),
310                         new ReportParam(_('Graphics'),'GRAPHIC'),
311                         new ReportParam(_('Comments'),'TEXTBOX'),
312                         new ReportParam(_('Destination'),'DESTINATION')));
313         $reports->addReport(_('General Ledger'),708,_('Trial &Balance'),
314         array(  new ReportParam(_('Start Date'),'DATEBEGINM'),
315                         new ReportParam(_('End Date'),'DATEENDM'),
316                         new ReportParam(_('Zero values'),'YES_NO'),
317                         new ReportParam(_('Only balances'),'YES_NO'),
318                         new ReportParam(_('Comments'),'TEXTBOX'),
319                         new ReportParam(_('Destination'),'DESTINATION')));
320 }
321 $reports->addReport(_('General Ledger'),709,_('Ta&x Report'),
322         array(  new ReportParam(_('Start Date'),'DATEBEGINTAX'),
323                         new ReportParam(_('End Date'),'DATEENDTAX'),
324                         new ReportParam(_('Summary Only'),'YES_NO'),
325                         new ReportParam(_('Comments'),'TEXTBOX'),
326                         new ReportParam(_('Destination'),'DESTINATION')));
327
328 echo "<script language='javascript'>
329                 function onWindowLoad() {
330                         showClass(" . $_GET['Class'] . ")
331                 }
332         Behaviour.addLoadEvent(onWindowLoad);
333         </script>
334 ";
335 echo $reports->getDisplay();
336
337 end_page();
338 ?>