refactor and fix customer accounting summary report, #24112 and #40103