date automatically fast-forwards to the end of the current quarter
where datediff(day,enc.encounterdate,(dateadd(qq,datediff(qq,0,getdate())+1,0))) between 0 and 365