add filtering handling to base report and base template

@jgeskens and @nielsvanoch can you please review?
Sure I can do this but it'll look the same and ugliness level will be only a bit smaller ;)