Rerun. Backport of fixing vertical alignment on date picker icon
[fa-stable.git] / reporting / includes / reports_classes.inc
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
13 // Standard report classess
14 define('RC_CUSTOMER', 0);
15 define('RC_SUPPLIER', 1);
16 define('RC_INVENTORY', 2);
17 define('RC_MANUFACTURE', 3);
18 define('RC_DIMENSIONS', 4);
19 define('RC_BANKING', 5);
20 define('RC_GL', 6);
21
22 class BoxReports
23 {
24         var $ar_classes; // report class names
25         var $ar_reports;
26         var $ctrl_handlers = array();
27
28         function ReportClasses()
29         {
30                 $this->ar_classes = array();
31         }
32
33         function addReportClass($class_name, $class_id=null)
34         {
35                 if (!$class_id)
36                         $class_id = count($this->ar_classes);
37                 $this->ar_classes[$class_id] = $class_name;
38
39                 return $class_id;
40         }
41
42         function addReport($class, $id, $rep_name, $params=null)
43         {
44                 unset($this->ar_reports[$class][$id]); // unset std report if any
45                 $this->ar_reports[$class][$id] = new Report($id, $rep_name, $params);
46         }
47
48         function getDisplay($class=null)
49         {
50                 global $path_to_root, $pdf_debug, $Ajax;
51
52                 if (find_submit('Rep') != -1) {
53                         include($path_to_root.'/reporting/prn_redirect.php');
54                         return;
55                 }
56
57                 $temp = array_values($this->ar_classes);
58                 $display_class = $class==null ? $temp[0] : $this->ar_classes[$class];
59                 $st_reports = "";
60                 $st_params = "";
61                 $st_classes = "<b>" . _("Report Classes:") . "</b><br>";
62
63                 if (isset($_GET['Class']))
64                         set_focus('class'.$_GET['Class']);
65
66                 $cur_class = $_REQUEST['Class'];
67
68                 foreach($this->ar_classes as $class_id => $name)
69                 {
70                         if (!isset($this->ar_reports[$class_id]))
71                                 continue; // e.g. no dimensions
72
73                         $acc = access_string($name);
74                         $st_classes .= "<a href='"
75                                 .$_SERVER['PHP_SELF']."?Class=$class_id'"
76                                 ." style='font-weight:". ($cur_class == $class_id ? 'bold' : 'normal')."'"
77                                 ." class='repclass_link' id='".'class'.$class_id."'"
78                                 ."$acc[1]>$acc[0]</a> <br>";
79
80                         $style = $class_id==$cur_class ? '' : "style='display:none'";
81                         $st_reports .= "<table class='repclass' id='TAB_" . $class_id ."' $style cellpadding='0' cellspacing='0' border='0' width='100%'><tr><td><b>" . _("Reports For Class: ") . "&nbsp;$name</b></td></tr>\n";
82                         foreach($this->ar_reports[$class_id] as $rep_id => $report)
83                         {
84                                 $acc = access_string($report->name);
85                                 $st_reports .= "<tr><td><a class='repopts_link'"
86                                         ." href='".$_SERVER['PHP_SELF']."?Class=$class_id&REP_ID=$report->id'"
87                                         ." style='font-weight:". (@$_REQUEST['REP_ID'] == $report->id ? 'bold' : 'normal')."'"
88                                         ." id='".$id = default_focus()."'"
89                                         ."$acc[1]>$acc[0]</a><tr><td>\n";
90
91                                 if (@$_REQUEST['REP_ID'] == $report->id) {
92                                         $Ajax->activate($id);
93                                 }
94
95                                 if (isset($_REQUEST['REP_ID']) && $_REQUEST['REP_ID']==$report->id) {
96                                         // parameters form
97                                         $action = $_SERVER['PHP_SELF'];
98                                         $st_params = "<table><tr><td>\n"
99                                                 . "<form method='POST' action='$action' target='_blank'>\n";
100                                         $st_params .= submit('Rep'.$report->id,  
101                                                 _("Display: ") . access_string($report->name, true),
102                                                 false, '', $pdf_debug ? false : 'default process') . hidden('REP_ID', $report->id, false).'<br><br>';
103                                         $st_params .= $this->getOptions($report->get_controls(), $report->id);
104                                         $st_params .= "\n<input type=hidden name='Class' value=".$cur_class.">"
105                                                 ."\n</form></td></tr></table>\n";
106                                         set_focus('Rep'.$report->id);
107                                         $Ajax->addUpdate(true, 'rep_form', $st_params);
108                                 }
109                         }
110                         $st_reports .= "</table>";
111                 }
112
113                 $st_params = "<div id='rep_form'>".
114                         "$st_params</div>";
115                 
116                 $st = "<table align='center' width='80%' style='border:1px solid #cccccc;'><tr valign='top'>";
117                 $st .= "<td width='30%'>$st_classes</td>";
118                 $st .= "<td width='35%' style='border-left:1px solid #cccccc;border-right:1px solid #cccccc;padding-left:3px;'>$st_reports</td>";
119                 $st .= "<td width='35%'>$st_params</td>";
120                 $st .= "</tr></table><br>";
121
122                 return $st;
123         }
124
125         function getOptions($controls, $id = 0)
126         {
127                 $st = '';
128                 if ($controls == null)
129                         return "";
130
131                 $cnt = 0;
132                 foreach($controls as $title => $type)
133                 {
134                         $ctrl = '';
135                         foreach($this->ctrl_handlers as $fun) { // first check for non-standard controls
136                                 $ctrl = $fun('PARAM_'.$cnt, $type);
137                                 if ($ctrl) break;
138                         }
139                         if ($ctrl == '') {
140                                 if (($id == 102 || $id == 202) && $cnt == 3) // set default Show Also Allocated to Yes in aged reports 2014-09-19 Joe Hunt
141                                         $_POST['PARAM_'.$cnt] = 1;
142                                 
143                                 if (isset($_COOKIE['select'][$id][$cnt])) // saved parameters 2010-10-06 Joe Hunt
144                                         $_POST['PARAM_'.$cnt] = $_COOKIE['select'][$id][$cnt];
145                                 $ctrl = $this->get_ctrl('PARAM_'.$cnt, $type);
146                         }
147                         if ($ctrl != '')  {
148                                 $st .= $title . ':<br>';
149                                 $st .= $ctrl;
150                                 $st .= "<br><br>";
151                         } else {
152                                 display_error(_('Unknown report parameter type:').$type);
153                         }
154                         $cnt++;
155                 }
156                 return $st;
157         }
158
159         //
160         //      Register additional control handler
161         // $handle - name of global function f($name, $type) returning html code for control
162         function register_controls($handler) {
163                 $this->ctrl_handlers[] = $handler;
164         }
165         //
166         //      Returns html code for input control $name of type $type 
167         //
168         function get_ctrl($name, $type)
169         {
170                 global $path_to_root, $use_date_picker, $pdf_debug, $print_invoice_no,
171                         $def_print_destination, $def_print_orientation, $type_shortcuts;
172
173                 $st = '';
174                         switch ($type)
175                         {
176                                 case 'CURRENCY':
177                                         $sql = "SELECT curr_abrev, concat(curr_abrev,' - ', currency) AS name FROM ".TB_PREF."currencies";
178                                         return combo_input($name, '', $sql, 'curr_abrev', 'name',array('spec_option'=>_("No Currency Filter"),'spec_id'=>ALL_TEXT,'order'=>false));
179
180                                 case 'DATE':
181                                 case 'DATEBEGIN':
182                                 case 'DATEEND':
183                                 case 'DATEBEGINM':
184                                 case 'DATEENDM':
185                                 case 'DATEBEGINTAX':
186                                 case 'DATEENDTAX':
187                                         if (!isset($_POST[$name]))
188                                         {
189                                                 if ($type == 'DATEBEGIN')
190                                                         $date = begin_fiscalyear();
191                                                 elseif ($type == 'DATEEND')
192                                                         $date = end_fiscalyear();
193                                                 else
194                                                         $date = Today();
195                                                 if ($type == 'DATEBEGINM')
196                                                         $date = begin_month($date);
197                                                 elseif ($type == 'DATEENDM')
198                                                         $date = end_month($date);
199                                                 elseif ($type == 'DATEBEGINTAX' || $type == 'DATEENDTAX')
200                                                 {
201                                                         $row = get_company_prefs();
202                                                         $edate = add_months($date, -$row['tax_last']);
203                                                         $edate = end_month($edate);
204                                                         if ($type == 'DATEENDTAX')
205                                                                 $date = $edate;
206                                                         else
207                                                         {
208                                                                 $bdate = begin_month($edate);
209                                                                 $bdate = add_months($bdate, -$row['tax_prd'] + 1);
210                                                                 $date = $bdate;
211                                                         }
212                                                 }
213                                         }
214                                         else // saved parameters 2010-10-16 Joe Hunt
215                                                 $date = $_POST[$name];
216                                         $st = "<input type='text' name='$name' value='$date'>";
217                                         if ($use_date_picker)
218                                         {
219                                                 $calc_image = (file_exists("$path_to_root/themes/".user_theme()."/images/cal.gif")) ? 
220                                                         "$path_to_root/themes/".user_theme()."/images/cal.gif" : "$path_to_root/themes/default/images/cal.gif";
221                                                 $st .= "<a href=\"javascript:date_picker(document.forms[0].$name);\">"
222                                                 . "     <img src='$calc_image' style='vertical-align:middle;padding-bottom:4px;width:16px;height:16px;border:0;' alt='"._('Click Here to Pick up the date')."'></a>\n";
223                                         }       
224                                         return $st;
225                                         break;
226
227                                 case 'YES_NO':
228                                         return yesno_list($name);
229
230                                 case 'PAYMENT_LINK':
231                                         return payment_services($name, null);
232
233                                 case 'DESTINATION':
234                                         $sel = array(_("PDF/Printer"), "Excel");
235                                         $def = 0;
236                                         if (isset($def_print_destination) && $def_print_destination == 1)
237                                                 $def = 1;
238                                         return array_selector($name, $def, $sel);
239
240                                 case 'ORIENTATION':
241                                         $sel = array(_("Portrait"), _("Landscape"));
242                                         $def = 0;
243                                         if (isset($def_print_orientation) && $def_print_orientation == 1)
244                                                 $def = 1;
245                                         return array_selector($name, $def, $sel);
246
247                                 case 'COMPARE':
248                                         $sel = array(_("Accumulated"), _("Period Y-1"), _("Budget"));
249                                         return array_selector($name, null, $sel);
250
251                                 case 'GRAPHIC':
252                                         $sel = array(_("No Graphics"), _("Vertical bars"), _("Horizontal bars"), 
253                                                                 _("Dots"), _("Lines"), _("Pie"), _("Donut"));
254                                         return array_selector($name, null, $sel);
255
256                                 case 'SYS_TYPES':
257                                         return gl_systypes_list($name, null, _("No Type Filter"));
258
259                                 case 'SYS_TYPES_ALL':
260                                         return systypes_list($name, null, _("No Type Filter"));
261
262                                 case 'TEXT':
263                                         return "<input type='text' name='$name'>";
264
265                                 case 'TEXTBOX':
266                                         $value = (isset($_POST[$name]) ? $_POST[$name] : "");
267                                         return "<textarea rows=4 cols=30 name='$name'>$value</textarea>";
268
269                                 case 'ACCOUNTS': // not used
270                                         return gl_account_types_list($name, null, _("No Account Group Filter"), true);
271
272                                 case 'ACCOUNTS_NO_FILTER': // not used
273                                         return gl_account_types_list($name);
274
275                                 case 'GL_ACCOUNTS':
276                                         return gl_all_accounts_list($name);
277
278                                 case 'BANK_ACCOUNTS':
279                                         return bank_accounts_list($name);
280                                         
281                                 case 'DIMENSION':
282                                         return dimensions_list($name, null, false, ' ', false, true, 0);
283                                         
284                                 case 'DIMENSIONS':
285                                         return dimensions_list($name, null, true, _("No Dimension Filter"), false, true, 0);
286
287                                 case 'DIMENSION1':
288                                         return dimensions_list($name, null, false, ' ', false, true, 1);
289
290                                 case 'DIMENSIONS1':
291                                         return dimensions_list($name, null, true, _("No Dimension Filter"), false, true, 1);
292
293                                 case 'DIMENSION2':
294                                         return dimensions_list($name, null, false, ' ', false, true, 2);
295
296                                 case 'DIMENSIONS2':
297                                         return dimensions_list($name, null, true, _("No Dimension Filter"), false, true, 2);
298
299                                 case 'CUSTOMERS_NO_FILTER':
300                                 case 'CUSTOMERS':
301                                         $sql = "SELECT debtor_no, name FROM ".TB_PREF."debtors_master";
302                                         if ($type == 'CUSTOMERS_NO_FILTER')
303                                                 return customer_list($name, null, _("No Customer Filter"));
304                                         else
305                                                 return customer_list($name);
306
307                                 case 'SUPPLIERS_NO_FILTER':
308                                 case 'SUPPLIERS':
309                                         $sql = "SELECT supplier_id, supp_name FROM ".TB_PREF."suppliers";
310                                         if ($type == 'SUPPLIERS_NO_FILTER')
311                                                 return supplier_list($name, null, _("No Supplier Filter"));
312                                         else
313                                                 return supplier_list($name);
314
315                                 case 'INVOICE':
316                                         $IV = $type_shortcuts[ST_SALESINVOICE];
317                                         $ref = ($print_invoice_no == 1 ? "trans_no" : "reference");
318                                         $sql = "SELECT concat(".TB_PREF."debtor_trans.trans_no, '-',
319                                                 ".TB_PREF."debtor_trans.type) AS TNO, concat('$IV ', ".TB_PREF."debtor_trans.$ref,' ', ".TB_PREF."debtors_master.name) as IName
320                                                 FROM ".TB_PREF."debtors_master, ".TB_PREF."debtor_trans WHERE type=".ST_SALESINVOICE." AND ".TB_PREF."debtors_master.debtor_no=".TB_PREF."debtor_trans.debtor_no ORDER BY ".TB_PREF."debtor_trans.trans_no DESC";
321                                         return combo_input($name, '', $sql, 'TNO', 'IName',array('order'=>false));
322
323                                 case 'CREDIT':
324                                         $CN = $type_shortcuts[ST_CUSTCREDIT];
325                                         $ref = ($print_invoice_no == 1 ? "trans_no" : "reference");
326                                         $sql = "SELECT concat(".TB_PREF."debtor_trans.trans_no, '-',
327                                                 ".TB_PREF."debtor_trans.type) AS TNO, concat('$CN ', ".TB_PREF."debtor_trans.$ref,' ', ".TB_PREF."debtors_master.name) as IName
328                                                 FROM ".TB_PREF."debtors_master, ".TB_PREF."debtor_trans WHERE type=".ST_CUSTCREDIT." AND ".TB_PREF."debtors_master.debtor_no=".TB_PREF."debtor_trans.debtor_no ORDER BY ".TB_PREF."debtor_trans.trans_no DESC";
329                                         return combo_input($name, '', $sql, 'TNO', 'IName',array('order'=>false));
330
331                                 case 'DELIVERY':
332                                         $DN = $type_shortcuts[ST_CUSTDELIVERY];
333                                         $sql = "SELECT
334                                         concat(".TB_PREF."debtor_trans.trans_no, '-', ".TB_PREF."debtor_trans.type) AS TNO, concat(".TB_PREF."debtor_trans.trans_no, ' $DN ',
335                                          ".TB_PREF."debtors_master.name) as IName
336                                                 FROM ".TB_PREF."debtors_master, ".TB_PREF."debtor_trans
337                                                 WHERE type=".ST_CUSTDELIVERY." AND ".TB_PREF."debtors_master.debtor_no=".
338                                                 TB_PREF."debtor_trans.debtor_no ORDER BY ".TB_PREF."debtor_trans.trans_no DESC";
339                                         return combo_input($name, '', $sql, 'TNO', 'IName',array('order'=>false));
340
341                                 case 'ORDERS':
342                                         $ref = ($print_invoice_no == 1 ? "order_no" : "reference");
343                                         $sql = "SELECT ".TB_PREF."sales_orders.order_no, concat(".TB_PREF."sales_orders.$ref, '-',
344                                                 ".TB_PREF."debtors_master.name) as IName
345                                                 FROM ".TB_PREF."debtors_master, ".TB_PREF."sales_orders WHERE ".TB_PREF."debtors_master.debtor_no=".TB_PREF."sales_orders.debtor_no 
346                                                 AND ".TB_PREF."sales_orders.trans_type=".ST_SALESORDER." ORDER BY ".TB_PREF."sales_orders.order_no DESC";
347                                         return combo_input($name, '', $sql, 'order_no', 'IName',array('order'=>false));
348
349                                 case 'QUOTATIONS':
350                                         $ref = ($print_invoice_no == 1 ? "order_no" : "reference");
351                                         $sql = "SELECT ".TB_PREF."sales_orders.order_no, concat(".TB_PREF."sales_orders.$ref, '-',
352                                                 ".TB_PREF."debtors_master.name) as IName
353                                                 FROM ".TB_PREF."debtors_master, ".TB_PREF."sales_orders WHERE ".TB_PREF."debtors_master.debtor_no=".TB_PREF."sales_orders.debtor_no 
354                                                 AND ".TB_PREF."sales_orders.trans_type=".ST_SALESQUOTE." ORDER BY ".TB_PREF."sales_orders.order_no DESC";
355                                         return combo_input($name, '', $sql, 'order_no', 'IName',array('order'=>false));
356
357                                 case 'PO':
358                                         $ref = ($print_invoice_no == 1 ? "order_no" : "reference");
359                                         $sql = "SELECT ".TB_PREF."purch_orders.order_no, concat(".TB_PREF."purch_orders.$ref, '-',
360                                                 ".TB_PREF."suppliers.supp_name) as IName
361                                                 FROM ".TB_PREF."suppliers, ".TB_PREF."purch_orders WHERE ".TB_PREF."suppliers.supplier_id=".TB_PREF."purch_orders.supplier_id ORDER BY ".TB_PREF."purch_orders.order_no DESC";
362                                         return combo_input($name, '', $sql, 'order_no', 'IName',array('order'=>false));
363
364                                 case 'REMITTANCE':
365                                         $BP = $type_shortcuts[ST_BANKPAYMENT];
366                                         $SP = $type_shortcuts[ST_SUPPAYMENT];
367                                         $CN = $type_shortcuts[ST_SUPPCREDIT];
368                                         $ref = ($print_invoice_no == 1 ? "trans_no" : "reference");
369                                         $sql = "SELECT concat(".TB_PREF."supp_trans.trans_no, '-',
370                                                 ".TB_PREF."supp_trans.type) AS TNO, concat(".TB_PREF."supp_trans.$ref, if (type=".ST_BANKPAYMENT.", ' $BP ', if (type=".ST_SUPPAYMENT.", ' $SP ', ' $CN ')), ".TB_PREF."suppliers.supp_name) as IName
371                                                 FROM ".TB_PREF."suppliers, ".TB_PREF."supp_trans WHERE (type=".ST_BANKPAYMENT." OR type=".ST_SUPPAYMENT." OR type=".ST_SUPPCREDIT.") AND ".TB_PREF."suppliers.supplier_id=".TB_PREF."supp_trans.supplier_id ORDER BY ".TB_PREF."supp_trans.trans_no DESC";
372                                         return combo_input($name, '', $sql, 'TNO', 'IName',array('order'=>false));
373
374                                 case 'RECEIPT':
375                                         $BD = $type_shortcuts[ST_BANKDEPOSIT];
376                                         $CP = $type_shortcuts[ST_CUSTPAYMENT];
377                                         $ref = ($print_invoice_no == 1 ? "trans_no" : "reference");
378                                         $sql = "SELECT concat(".TB_PREF."debtor_trans.trans_no, '-',
379                                                 ".TB_PREF."debtor_trans.type) AS TNO, concat(".TB_PREF."debtor_trans.$ref, if (type=".ST_BANKDEPOSIT.", ' $BD ', ' $CP '), ".TB_PREF."debtors_master.name) as IName
380                                                 FROM ".TB_PREF."debtors_master, ".TB_PREF."debtor_trans WHERE (type=".ST_BANKDEPOSIT." OR type=".ST_CUSTPAYMENT." OR type=".ST_CUSTCREDIT.") AND ".TB_PREF."debtors_master.debtor_no=".TB_PREF."debtor_trans.debtor_no ORDER BY ".TB_PREF."debtor_trans.trans_no DESC";
381                                         return combo_input($name, '', $sql, 'TNO', 'IName',array('order'=>false));
382
383                                 case 'ITEMS':
384                                         return stock_manufactured_items_list($name);
385
386                                 case 'ITEMS_ALL':
387                                         return stock_manufactured_items_list($name, null, true);
388
389                                 case 'ITEMS_P':
390                                         return stock_purchasable_items_list($name, null, true);
391                                 
392                                 case 'WORKORDER':
393                                         $sql = "SELECT ".TB_PREF."workorders.id, concat(".TB_PREF."workorders.id, '-',
394                                                 ".TB_PREF."stock_master.description) as IName
395                                                 FROM ".TB_PREF."stock_master, ".TB_PREF."workorders WHERE ".TB_PREF."stock_master.stock_id=".TB_PREF."workorders.stock_id ORDER BY ".TB_PREF."workorders.id DESC";
396                                         return combo_input($name, '', $sql, 'id', 'IName',array('order'=>false));
397
398                                 case 'LOCATIONS':
399                                         return  locations_list($name, null, _("No Location Filter"));
400
401                                 case 'CATEGORIES':
402                                         return stock_categories_list($name, null, _("No Category Filter"));
403
404                                 case 'SALESTYPES':
405                                         return sales_types_list($name);
406
407                                 case 'AREAS':
408                                         return sales_areas_list($name);
409
410                                 case 'SALESMEN':
411                                         return sales_persons_list($name, null, _("No Sales Folk Filter"));
412                                         
413                                 case 'TRANS_YEARS':
414                                         return fiscalyears_list($name);
415
416                                 case 'USERS':
417                                         $sql = "SELECT id, user_id FROM ".TB_PREF."users";
418                                         return combo_input($name, '', $sql, 'id', 'user_id',array('spec_option'=>_("No Users Filter"),'spec_id'=>ALL_NUMERIC));
419
420                                 case 'ACCOUNTTAGS':
421                                 case 'DIMENSIONTAGS':
422                                         if ($type == 'ACCOUNTTAGS')
423                                                 $tag_type = TAG_ACCOUNT;
424                                         else
425                                                 $tag_type = TAG_DIMENSION;
426                                         //return tag_list($name, 5, $tag_type, true, false, _("No tags"));
427                                         return tag_list($name, 5, $tag_type, true);
428
429                         }
430                 return '';
431         }
432 }
433
434 class Report
435 {
436         var $id;
437         var $name;
438         var $ar_params;
439         var $controls;
440         
441         function Report($id, $name, $ar_params = null)
442         {
443                 $this->id = $id;
444                 $this->name = $name;
445                 if ($ar_params) $this->set_controls($ar_params);
446         }
447         
448         function set_controls($ar_params) {
449                 $this->controls = $ar_params;
450         }
451         
452         function get_controls() {
453                 return $this->controls;
454         }
455         
456 }
457
458 //------------------------------------------------------------------------------------------------
459 function gl_systypes_list($name, $value=null, $spec_opt=false)
460 {
461         global $systypes_array;
462         
463         $types = $systypes_array;
464         
465         foreach(array(ST_LOCTRANSFER, ST_PURCHORDER, ST_SUPPRECEIVE, ST_MANUISSUE,
466                                 ST_MANURECEIVE, ST_SALESORDER, ST_SALESQUOTE, ST_DIMENSION) as $type)
467                 unset($types[$type]);
468
469         return array_selector($name, $value, $types, 
470                 array( 
471                         'spec_option'=> $spec_opt,
472                         'spec_id' => ALL_NUMERIC,
473                         'async' => false,
474                         )
475         );
476 }
477 /*
478         Add extension/custom reports to report manager.
479 */
480 function add_custom_reports(&$reports)
481 {
482         global $installed_extensions, $path_to_root;
483         
484         // include reports installed inside extension modules
485         if (count($installed_extensions) > 0)
486         {
487                 $extensions = $installed_extensions;
488                 foreach ($extensions as $ext)
489                         if (($ext['active'] && $ext['type'] == 'extension')) {
490                                 $file = $path_to_root.'/'.$ext['path']."/reporting/reports_custom.php";
491                                 if (file_exists($file)) {
492                                         set_ext_domain($ext['path']);
493                                         include_once($file);
494                                         set_ext_domain();
495                                 }
496                         }
497         }
498         $file = company_path()."/reporting/reports_custom.php";
499         if (file_exists($file))
500                 include_once($file);
501 }
502
503 ?>