--quarterly option
This commit is contained in:
		
							parent
							
								
									533c753a46
								
							
						
					
					
						commit
						8ba2163ccd
					
				| @ -78,6 +78,7 @@ options = [ | |||||||
| -- ,Option ['s'] ["subtotal"]     (NoArg  SubTotal)      "balance report: show subaccounts" | -- ,Option ['s'] ["subtotal"]     (NoArg  SubTotal)      "balance report: show subaccounts" | ||||||
|  ,Option ['W'] ["weekly"]       (NoArg  WeeklyOpt)     "register report: show weekly summary" |  ,Option ['W'] ["weekly"]       (NoArg  WeeklyOpt)     "register report: show weekly summary" | ||||||
|  ,Option ['M'] ["monthly"]      (NoArg  MonthlyOpt)    "register report: show monthly 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 ['Y'] ["yearly"]       (NoArg  YearlyOpt)     "register report: show yearly summary" | ||||||
|  ,Option ['h'] ["help"] (NoArg  Help)                  "show this help" |  ,Option ['h'] ["help"] (NoArg  Help)                  "show this help" | ||||||
|  ,Option ['V'] ["version"]      (NoArg  Version)       "show version information" |  ,Option ['V'] ["version"]      (NoArg  Version)       "show version information" | ||||||
| @ -103,6 +104,7 @@ data Opt = | |||||||
|     SubTotal | |     SubTotal | | ||||||
|     WeeklyOpt | |     WeeklyOpt | | ||||||
|     MonthlyOpt | |     MonthlyOpt | | ||||||
|  |     QuarterlyOpt | | ||||||
|     YearlyOpt | |     YearlyOpt | | ||||||
|     Help | |     Help | | ||||||
|     Verbose | |     Verbose | | ||||||
| @ -178,10 +180,11 @@ intervalFromOpts opts | |||||||
|     | otherwise = case last otheropts of |     | otherwise = case last otheropts of | ||||||
|                     WeeklyOpt  -> Weekly |                     WeeklyOpt  -> Weekly | ||||||
|                     MonthlyOpt -> Monthly |                     MonthlyOpt -> Monthly | ||||||
|  |                     QuarterlyOpt -> Quarterly | ||||||
|                     YearlyOpt  -> Yearly |                     YearlyOpt  -> Yearly | ||||||
|     where |     where | ||||||
|       popts = optValuesForConstructor Period opts |       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 |       -- doesn't affect the interval, but parsePeriodExpr needs something | ||||||
|       refdate = parsedate "0001/01/01" |       refdate = parsedate "0001/01/01" | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										3
									
								
								Tests.hs
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								Tests.hs
									
									
									
									
									
								
							| @ -490,9 +490,11 @@ tests = [ | |||||||
|     [] `gives` NoInterval |     [] `gives` NoInterval | ||||||
|     [WeeklyOpt] `gives` Weekly |     [WeeklyOpt] `gives` Weekly | ||||||
|     [MonthlyOpt] `gives` Monthly |     [MonthlyOpt] `gives` Monthly | ||||||
|  |     [QuarterlyOpt] `gives` Quarterly | ||||||
|     [YearlyOpt] `gives` Yearly |     [YearlyOpt] `gives` Yearly | ||||||
|     [Period "weekly"] `gives` Weekly |     [Period "weekly"] `gives` Weekly | ||||||
|     [Period "monthly"] `gives` Monthly |     [Period "monthly"] `gives` Monthly | ||||||
|  |     [Period "quarterly"] `gives` Quarterly | ||||||
|     [WeeklyOpt, Period "yearly"] `gives` Yearly |     [WeeklyOpt, Period "yearly"] `gives` Yearly | ||||||
| 
 | 
 | ||||||
|   ,"isAccountNamePrefixOf" ~: do |   ,"isAccountNamePrefixOf" ~: do | ||||||
| @ -731,6 +733,7 @@ tests = [ | |||||||
|     "2007" `gives` [] |     "2007" `gives` [] | ||||||
|     "june" `gives` ["2008/06/01","2008/06/02","2008/06/03"] |     "june" `gives` ["2008/06/01","2008/06/02","2008/06/03"] | ||||||
|     "monthly" `gives` ["2008/01/01","2008/06/01","2008/12/01"] |     "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 |     showRegisterReport [Period "yearly"] [] l `is` unlines | ||||||
|      ["2008/01/01 - 2008/12/31         assets:bank:saving               $1           $1" |      ["2008/01/01 - 2008/12/31         assets:bank:saving               $1           $1" | ||||||
|      ,"                                assets:cash                     $-2          $-1" |      ,"                                assets:cash                     $-2          $-1" | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user