I have to generate a report in a CSV file format depending on the settings saved by the user (stored in MySQL). Settings are: