diff --git a/Options.hs b/Options.hs index 544ed10f9..1fc4fb88a 100644 --- a/Options.hs +++ b/Options.hs @@ -78,6 +78,7 @@ options = [ -- ,Option ['s'] ["subtotal"] (NoArg SubTotal) "balance report: show subaccounts" ,Option ['W'] ["weekly"] (NoArg WeeklyOpt) "register report: show weekly summary" ,Option ['M'] ["monthly"] (NoArg MonthlyOpt) "register report: show monthly summary" + ,Option ['Q'] ["quarterly"] (NoArg QuarterlyOpt) "register report: show quarterly summary" ,Option ['Y'] ["yearly"] (NoArg YearlyOpt) "register report: show yearly summary" ,Option ['h'] ["help"] (NoArg Help) "show this help" ,Option ['V'] ["version"] (NoArg Version) "show version information" @@ -103,6 +104,7 @@ data Opt = SubTotal | WeeklyOpt | MonthlyOpt | + QuarterlyOpt | YearlyOpt | Help | Verbose | @@ -178,10 +180,11 @@ intervalFromOpts opts | otherwise = case last otheropts of WeeklyOpt -> Weekly MonthlyOpt -> Monthly + QuarterlyOpt -> Quarterly YearlyOpt -> Yearly where popts = optValuesForConstructor Period opts - otheropts = filter (`elem` [WeeklyOpt,MonthlyOpt,YearlyOpt]) opts + otheropts = filter (`elem` [WeeklyOpt,MonthlyOpt,QuarterlyOpt,YearlyOpt]) opts -- doesn't affect the interval, but parsePeriodExpr needs something refdate = parsedate "0001/01/01" diff --git a/Tests.hs b/Tests.hs index fde0486c0..1b125c79a 100644 --- a/Tests.hs +++ b/Tests.hs @@ -490,9 +490,11 @@ tests = [ [] `gives` NoInterval [WeeklyOpt] `gives` Weekly [MonthlyOpt] `gives` Monthly + [QuarterlyOpt] `gives` Quarterly [YearlyOpt] `gives` Yearly [Period "weekly"] `gives` Weekly [Period "monthly"] `gives` Monthly + [Period "quarterly"] `gives` Quarterly [WeeklyOpt, Period "yearly"] `gives` Yearly ,"isAccountNamePrefixOf" ~: do @@ -731,6 +733,7 @@ tests = [ "2007" `gives` [] "june" `gives` ["2008/06/01","2008/06/02","2008/06/03"] "monthly" `gives` ["2008/01/01","2008/06/01","2008/12/01"] + "quarterly" `gives` ["2008/01/01","2008/04/01","2008/10/01"] showRegisterReport [Period "yearly"] [] l `is` unlines ["2008/01/01 - 2008/12/31 assets:bank:saving $1 $1" ," assets:cash $-2 $-1"