-$rep_file = $comp_path.'/'.user_company()."/reporting/rep$rep.php";
-if (!file_exists($rep_file)) {
- $rep_file = $path_to_root ."/reporting/rep$rep.php";
-}
-require($rep_file);
+
+$rep_file = find_custom_file("/reporting/rep$rep.php");
+
+if ($rep_file) {
+ chdir(dirname($rep_file));
+ require(basename($rep_file));
+} else
+ display_error("Cannot find report file '$rep'");