Refactoring tbl_chart.php