Adding sql and report generation