Flex reports: add classes from report section

This fixes the problem with predefined reports, like the quarterly
narrative report, that run multiple reports on one page. Group collapse
and expand was broken in these cases.

Also, improved whitespace and added some comments.