optimize total query in receivables report. very significant speedup for large DBs