add function for gen report from db