report.php can now create CSV files from SQL

SQL needs some editing though to get the correct information for the csv file