Improvements to the query for generating Lodgement report.