Persistent sales history report generation 2

Adjusted code for psh report generation include the db