finished to refactor reports.php