--quarterly option

This commit is contained in:
Simon Michael 2009-04-03 11:55:48 +00:00
parent 533c753a46
commit 8ba2163ccd
2 changed files with 7 additions and 1 deletions

View File

@ -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"

View File

@ -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"