Assuming user enters the input report run date as @ReportDate and you need to generate the report for previous month and previous quarter, below is how I have calculated the Previous Month Begin Date & End date and Previous Qtr Begin Date & End Dates:
----Set the last month end and last month beginning for the monthly report
DECLARE @LAST_MONTH_BEG DATETIME
DECLARE @LAST_MONTH_END DATETIME
SET @LAST_MONTH_END = DATEADD(D, 0, DATEDIFF(D, 0, DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,@ReportDate),0))))
SET @LAST_MONTH_BEG = DATEADD(DD, 1 - DAY(@LAST_MONTH_END), @LAST_MONTH_END)
----Set the Last Quarter End (for calendar year) and Last Quarter beginning for the Quaterly report
DECLARE @LAST_Q_BEG DATETIME
DECLARE @LAST_Q_END DATETIME
SET @LAST_Q_BEG = DATEADD(q,DATEDIFF(q,0,@ED)-1,0)
SET @LAST_Q_END = DATEADD(D, 0, DATEDIFF(D, 0, dateadd(s,-1,DATEADD(q,1,@LAST_Q_BEG))))