import DateHelper support for timeperiod last quarter.

refs #3718
SQL fixes in templates for PostgreSQL

Signed-off-by: Michael Friedrich <Michael.Friedrich@netways.de>

refs #1880