Huge sales module changes toward delivery and invoicing separation. Includes some...
[fa-stable.git] / reporting / reports_main.php
1 <?php
2
3 $path_to_root="..";
4 $page_security = 5;
5 include_once($path_to_root . "/includes/session.inc");
6
7 include_once($path_to_root . "/includes/date_functions.inc");
8 include_once($path_to_root . "/includes/data_checks.inc");
9 include_once($path_to_root . "/includes/ui.inc");
10 include_once($path_to_root . "/reporting/includes/reports_classes.inc");
11 $js = "";
12 if ($use_date_picker)
13         $js .= get_js_date_picker();
14 page(_("Reports and Analysis"), false, false, "", $js);
15
16 $reports = new BoxReports;
17
18 $dim = get_company_pref('use_dimension');
19
20 $reports->addReportClass(_('Customer'));
21 $reports->addReport(_('Customer'),101,_('Customer Balances'),
22         array(  new ReportParam(_('End Date'),'DATE'), 
23                         new ReportParam(_('Customer'),'CUSTOMERS_NO_FILTER'), 
24                         new ReportParam(_('Currency Filter'),'CURRENCY'), 
25                         new ReportParam(_('Comments'),'TEXTBOX')));
26 $reports->addReport(_('Customer'),102,_('Aged Customer Analysis'),
27         array(  new ReportParam(_('End Date'),'DATE'), 
28                         new ReportParam(_('Customer'),'CUSTOMERS_NO_FILTER'), 
29                         new ReportParam(_('Currency Filter'),'CURRENCY'), 
30                         new ReportParam(_('Summary Only'),'YES_NO'), 
31                         new ReportParam(_('Graphics'),'GRAPHIC'), 
32                         new ReportParam(_('Comments'),'TEXTBOX')));
33 $reports->addReport(_('Customer'),103,_('Customer Detail Listing'),
34         array(  new ReportParam(_('Activity Since'),'DATEBEGIN'), 
35                         new ReportParam(_('Sales Areas'),'AREAS'), 
36                         new ReportParam(_('Sales Folk'),'SALESMEN'), new ReportParam(_('Activity Greater Than'),'TEXT'), new ReportParam(_('Activity Less Than'),'TEXT'), new ReportParam(_('Comments'),'TEXTBOX')));
37 $reports->addReport(_('Customer'),104,_('Price Listing'),
38         array(  new ReportParam(_('Inventory Category'),'CATEGORIES'), 
39                         new ReportParam(_('Sales Types'),'SALESTYPES'), 
40                         new ReportParam(_('Show Pictures'),'YES_NO'), 
41                         new ReportParam(_('Show GP %'),'YES_NO'), 
42                         new ReportParam(_('Comments'),'TEXTBOX')));
43 $reports->addReport(_('Customer'),105,_('Order Status Listing'),
44         array(  new ReportParam(_('Start Date'),'DATEBEGINM'), 
45                         new ReportParam(_('End Date'),'DATEENDM'), 
46                         new ReportParam(_('Inventory Category'),'CATEGORIES'), 
47                         new ReportParam(_('Stock Location'),'LOCATIONS'), 
48                         new ReportParam(_('Back Orders Only'),'YES_NO'), 
49                         new ReportParam(_('Comments'),'TEXTBOX')));
50 $reports->addReport(_('Customer'),107,_('Print Invoices/Credit Notes'),
51         array(  new ReportParam(_('From'),'INVOICE'), 
52                         new ReportParam(_('To'),'INVOICE'), 
53                         new ReportParam(_('Currency Filter'),'CURRENCY'), 
54                         new ReportParam(_('Bank Account'),'BANK_ACCOUNTS'), 
55                         new ReportParam(_('email Customers'),'YES_NO'), 
56                         new ReportParam(_('Payment Link'),'PAYMENT_LINK'), 
57                         new ReportParam(_('Comments'),'TEXTBOX')));
58 $reports->addReport(_('Customer'),110,_('Print Deliveries'),
59         array(  new ReportParam(_('From'),'DELIVERY'), 
60                         new ReportParam(_('To'),'DELIVERY'), 
61                         new ReportParam(_('email Customers'),'YES_NO'), 
62                         new ReportParam(_('Comments'),'TEXTBOX')));
63 $reports->addReport(_('Customer'),108,_('Print Statements'),
64         array(  new ReportParam(_('Customer'),'CUSTOMERS_NO_FILTER'), 
65                         new ReportParam(_('Currency Filter'),'CURRENCY'), 
66                         new ReportParam(_('Bank Account'),'BANK_ACCOUNTS'), 
67                         new ReportParam(_('Email Customers'),'YES_NO'), 
68                         new ReportParam(_('Comments'),'TEXTBOX')));
69 $reports->addReport(_('Customer'),109,_('Print Sales Orders'),
70         array(  new ReportParam(_('From'),'ORDERS'), 
71                         new ReportParam(_('To'),'ORDERS'), 
72                         new ReportParam(_('Currency Filter'),'CURRENCY'), 
73                         new ReportParam(_('Bank Account'),'BANK_ACCOUNTS'), 
74                         new ReportParam(_('Email Customers'),'YES_NO'), 
75                         new ReportParam(_('Print as Quote'),'YES_NO'), 
76                         new ReportParam(_('Comments'),'TEXTBOX')));
77
78 $reports->addReportClass(_('Supplier'));
79 $reports->addReport(_('Supplier'),201,_('Supplier Balances'),
80         array(  new ReportParam(_('End Date'),'DATE'), 
81                         new ReportParam(_('Supplier'),'SUPPLIERS_NO_FILTER'), 
82                         new ReportParam(_('Currency Filter'),'CURRENCY'), 
83                         new ReportParam(_('Comments'),'TEXTBOX')));
84 $reports->addReport(_('Supplier'),202,_('Aged Supplier Analyses'),
85         array(  new ReportParam(_('End Date'),'DATE'), 
86                         new ReportParam(_('Supplier'),'SUPPLIERS_NO_FILTER'), 
87                         new ReportParam(_('Currency Filter'),'CURRENCY'), 
88                         new ReportParam(_('Summary Only'),'YES_NO'), 
89                         new ReportParam(_('Graphics'),'GRAPHIC'), 
90                         new ReportParam(_('Comments'),'TEXTBOX')));
91 $reports->addReport(_('Supplier'),203,_('Payment Report'),
92         array(  new ReportParam(_('End Date'),'DATE'), 
93                         new ReportParam(_('Supplier'),'SUPPLIERS_NO_FILTER'), 
94                         new ReportParam(_('Currency Filter'),'CURRENCY'), 
95                         new ReportParam(_('Comments'),'TEXTBOX')));
96 $reports->addReport(_('Supplier'),204,_('Outstanding GRNs Report'),
97         array(  new ReportParam(_('Supplier'),'SUPPLIERS_NO_FILTER'), 
98                         new ReportParam(_('Comments'),'TEXTBOX')));
99 $reports->addReport(_('Supplier'),209,_('Print Purchase Orders'),
100         array(  new ReportParam(_('From'),'PO'), 
101                         new ReportParam(_('To'),'PO'), 
102                         new ReportParam(_('Currency Filter'),'CURRENCY'), 
103                         new ReportParam(_('Bank Account'),'BANK_ACCOUNTS'), 
104                         new ReportParam(_('Email Customers'),'YES_NO'), 
105                         new ReportParam(_('Comments'),'TEXTBOX')));
106
107 $reports->addReportClass(_('Inventory'));
108 $reports->addReport(_('Inventory'),301,_('Inventory Valuation Report'),
109         array(  new ReportParam(_('Inventory Category'),'CATEGORIES'), 
110                         new ReportParam(_('Location'),'LOCATIONS'), 
111                         new ReportParam(_('Detailed Report'),'YES_NO'), 
112                         new ReportParam(_('Comments'),'TEXTBOX')));
113 $reports->addReport(_('Inventory'),302,_('Inventory Planning Report'),
114         array(  new ReportParam(_('Inventory Category'),'CATEGORIES'), 
115                         new ReportParam(_('Location'),'LOCATIONS'), 
116                         new ReportParam(_('Comments'),'TEXTBOX')));
117 $reports->addReport(_('Inventory'),303,_('Stock Check Sheets'),
118         array(  new ReportParam(_('Inventory Category'),'CATEGORIES'), 
119                         new ReportParam(_('Location'),'LOCATIONS'), 
120                         new ReportParam(_('Show Pictures'),'YES_NO'), 
121                         new ReportParam(_('Comments'),'TEXTBOX')));
122
123 $reports->addReportClass(_('Manufactoring'));
124 $reports->addReport(_('Manufactoring'),401,_('Bill of Material Listing'),
125         array(  new ReportParam(_('From component'),'ITEMS'), 
126                         new ReportParam(_('To component'),'ITEMS'), 
127                         new ReportParam(_('Comments'),'TEXTBOX')));
128         $reports->addReportClass(_('Dimensions'));
129 if ($dim > 0)
130 {
131         $reports->addReport(_('Dimensions'),501,_('Dimension Summary'),
132         array(  new ReportParam(_('From Dimension'),'DIMENSION'), 
133                         new ReportParam(_('To Dimension'),'DIMENSION'), 
134                         new ReportParam(_('Show Balance'),'YES_NO'), 
135                         new ReportParam(_('Comments'),'TEXTBOX')));
136         $reports->addReport(_('Dimensions'),502,_('Dimension Details'),
137         array(  new ReportParam(_('Dimension'),'DIMENSIONS'), 
138                         new ReportParam(_('Comments'),'TEXTBOX')));
139 }
140 $reports->addReportClass(_('Banking'));
141 //$reports->addReport(_('Banking'),601,_('Bank Account Transactions'),
142 //      array(  new ReportParam(_('Bank Accounts'),'BANK_ACCOUNTS'),
143 //                      new ReportParam(_('Start Date'),'DATE'), 
144 //                      new ReportParam(_('End Date'),'DATE'), 
145 //                      new ReportParam(_('Comments'),'TEXTBOX')));
146
147 $reports->addReportClass(_('General Ledger'));
148 $reports->addReport(_('General Ledger'),701,_('Chart of Accounts'),
149         array(  new ReportParam(_('Show Balances'),'YES_NO'), 
150                         new ReportParam(_('Comments'),'TEXTBOX')));
151 $reports->addReport(_('General Ledger'),702,_('List of Journal Entries'),
152         array(  new ReportParam(_('Start Date'),'DATEBEGINM'), 
153                         new ReportParam(_('End Date'),'DATEENDM'), 
154                         new ReportParam(_('Type'),'SYS_TYPES'), 
155                         new ReportParam(_('Comments'),'TEXTBOX')));
156 //$reports->addReport(_('General Ledger'),703,_('GL Account Group Summary'),
157 //      array(  new ReportParam(_('Comments'),'TEXTBOX')));
158 if ($dim == 2)  
159 {
160         $reports->addReport(_('General Ledger'),704,_('GL Account Transactions'),
161         array(  new ReportParam(_('Start Date'),'DATEBEGINM'), 
162                         new ReportParam(_('End Date'),'DATEENDM'), 
163                         new ReportParam(_('From Account'),'GL_ACCOUNTS'), 
164                         new ReportParam(_('To Account'),'GL_ACCOUNTS'), 
165                         new ReportParam(_('Dimension')." 1", 'DIMENSIONS1'), 
166                         new ReportParam(_('Dimension')." 2", 'DIMENSIONS2'), 
167                         new ReportParam(_('Comments'),'TEXTBOX')));
168         $reports->addReport(_('General Ledger'),705,_('Annual Expense Breakdown'),
169         array(  new ReportParam(_('Year'),'TRANS_YEARS'),
170                         new ReportParam(_('Dimension')." 1", 'DIMENSIONS1'),
171                         new ReportParam(_('Dimension')." 2", 'DIMENSIONS2'),
172                         new ReportParam(_('Comments'),'TEXTBOX')));
173         $reports->addReport(_('General Ledger'),706,_('Balance Sheet'),
174         array(  new ReportParam(_('Start Date'),'DATEBEGIN'), 
175                         new ReportParam(_('End Date'),'DATEENDM'), 
176                         new ReportParam(_('Dimension')." 1", 'DIMENSIONS1'), 
177                         new ReportParam(_('Dimension')." 2", 'DIMENSIONS2'), 
178                         new ReportParam(_('Graphics'),'GRAPHIC'), 
179                         new ReportParam(_('Comments'),'TEXTBOX')));
180         $reports->addReport(_('General Ledger'),707,_('Profit and Loss Statement'),
181         array(  new ReportParam(_('Start Date'),'DATEBEGINM'), 
182                         new ReportParam(_('End Date'),'DATEENDM'), 
183                         new ReportParam(_('Compare to'),'COMPARE'), 
184                         new ReportParam(_('Dimension')." 1", 'DIMENSIONS1'), 
185                         new ReportParam(_('Dimension')." 2", 'DIMENSIONS2'), 
186                         new ReportParam(_('Graphics'),'GRAPHIC'), 
187                         new ReportParam(_('Comments'),'TEXTBOX')));
188         $reports->addReport(_('General Ledger'),708,_('Trial Balance'),
189         array(  new ReportParam(_('Start Date'),'DATEBEGINM'), 
190                         new ReportParam(_('End Date'),'DATEENDM'), 
191                         new ReportParam(_('Zero values'),'YES_NO'), 
192                         new ReportParam(_('Dimension')." 1", 'DIMENSIONS1'), 
193                         new ReportParam(_('Dimension')." 2", 'DIMENSIONS2'), 
194                         new ReportParam(_('Comments'),'TEXTBOX')));
195 }
196 else if ($dim == 1)
197 {
198         $reports->addReport(_('General Ledger'),704,_('GL Account Transactions'),
199         array(  new ReportParam(_('Start Date'),'DATEBEGINM'), 
200                         new ReportParam(_('End Date'),'DATEENDM'), 
201                         new ReportParam(_('From Account'),'GL_ACCOUNTS'), 
202                         new ReportParam(_('To Account'),'GL_ACCOUNTS'), 
203                         new ReportParam(_('Dimension'), 'DIMENSIONS1'), 
204                         new ReportParam(_('Comments'),'TEXTBOX')));
205         $reports->addReport(_('General Ledger'),705,_('Annual Expense Breakdown'),
206         array(  new ReportParam(_('Year'),'TRANS_YEARS'),
207                         new ReportParam(_('Dimension'), 'DIMENSIONS1'),
208                         new ReportParam(_('Comments'),'TEXTBOX')));
209         $reports->addReport(_('General Ledger'),706,_('Balance Sheet'),
210         array(  new ReportParam(_('Start Date'),'DATEBEGIN'), 
211                         new ReportParam(_('End Date'),'DATEENDM'), 
212                         new ReportParam(_('Dimension'), 'DIMENSIONS1'), 
213                         new ReportParam(_('Graphics'),'GRAPHIC'), 
214                         new ReportParam(_('Comments'),'TEXTBOX')));
215         $reports->addReport(_('General Ledger'),707,_('Profit and Loss Statement'),
216         array(  new ReportParam(_('Start Date'),'DATEBEGINM'), 
217                         new ReportParam(_('End Date'),'DATEENDM'), 
218                         new ReportParam(_('Compare to'),'COMPARE'), 
219                         new ReportParam(_('Dimension'), 'DIMENSIONS1'), 
220                         new ReportParam(_('Graphics'),'GRAPHIC'), 
221                         new ReportParam(_('Comments'),'TEXTBOX')));
222         $reports->addReport(_('General Ledger'),708,_('Trial Balance'),
223         array(  new ReportParam(_('Start Date'),'DATEBEGINM'), 
224                         new ReportParam(_('End Date'),'DATEENDM'), 
225                         new ReportParam(_('Zero values'),'YES_NO'), 
226                         new ReportParam(_('Dimension'), 'DIMENSIONS1'), 
227                         new ReportParam(_('Comments'),'TEXTBOX')));
228 }
229 else
230 {
231         $reports->addReport(_('General Ledger'),704,_('GL Account Transactions'),
232         array(  new ReportParam(_('Start Date'),'DATEBEGINM'), 
233                         new ReportParam(_('End Date'),'DATEENDM'), 
234                         new ReportParam(_('From Account'),'GL_ACCOUNTS'), 
235                         new ReportParam(_('To Account'),'GL_ACCOUNTS'), 
236                         new ReportParam(_('Comments'),'TEXTBOX')));
237         $reports->addReport(_('General Ledger'),705,_('Annual Expense Breakdown'),
238         array(  new ReportParam(_('Year'),'TRANS_YEARS'),
239                         new ReportParam(_('Comments'),'TEXTBOX')));
240         $reports->addReport(_('General Ledger'),706,_('Balance Sheet'),
241         array(  new ReportParam(_('Start Date'),'DATEBEGIN'), 
242                         new ReportParam(_('End Date'),'DATEENDM'), 
243                         new ReportParam(_('Graphics'),'GRAPHIC'), 
244                         new ReportParam(_('Comments'),'TEXTBOX')));
245         $reports->addReport(_('General Ledger'),707,_('Profit and Loss Statement'),
246         array(  new ReportParam(_('Start Date'),'DATEBEGINM'), 
247                         new ReportParam(_('End Date'),'DATEENDM'), 
248                         new ReportParam(_('Compare to'),'COMPARE'), 
249                         new ReportParam(_('Graphics'),'GRAPHIC'), 
250                         new ReportParam(_('Comments'),'TEXTBOX')));
251         $reports->addReport(_('General Ledger'),708,_('Trial Balance'),
252         array(  new ReportParam(_('Start Date'),'DATEBEGINM'), 
253                         new ReportParam(_('End Date'),'DATEENDM'), 
254                         new ReportParam(_('Zero values'),'YES_NO'), 
255                         new ReportParam(_('Comments'),'TEXTBOX')));
256 }
257 $reports->addReport(_('General Ledger'),709,_('Tax Report'),
258         array(  new ReportParam(_('Start Date'),'DATEBEGINTAX'), 
259                         new ReportParam(_('End Date'),'DATEENDTAX'), 
260                         new ReportParam(_('Summary Only'),'YES_NO'), 
261                         new ReportParam(_('Comments'),'TEXTBOX')));
262
263 echo "
264 <form method=post>
265         <input type='hidden' name='REP_ID' value=''>
266         <input type='hidden' name='PARAM_COUNT' value=''>
267         <input type='hidden' name='PARAM_0' value=''>
268         <input type='hidden' name='PARAM_1' value=''>
269         <input type='hidden' name='PARAM_2' value=''>
270         <input type='hidden' name='PARAM_3' value=''>
271         <input type='hidden' name='PARAM_4' value=''>
272         <input type='hidden' name='PARAM_5' value=''>
273         <input type='hidden' name='PARAM_6' value=''>
274
275         <script language='javascript'>
276                 function onWindowLoad() {
277                         showClass(" . $_GET['Class'] . ")
278                 }
279                 window.onload=onWindowLoad;
280         </script>
281 ";
282 echo $reports->getDisplay();
283 echo "</form>";
284
285 end_page();
286 ?>