-n flag for balance command
This commit is contained in:
		
							parent
							
								
									42bfc4afd9
								
							
						
					
					
						commit
						6fc8cdfe3e
					
				| @ -119,7 +119,7 @@ balance opts args l = putStr $ showBalanceReport opts args l | ||||
| 
 | ||||
| -- | Generate balance report output for a ledger, based on options. | ||||
| showBalanceReport :: [Opt] -> [String] -> Ledger -> String | ||||
| showBalanceReport opts args l = acctsstr ++ totalstr | ||||
| showBalanceReport opts args l = acctsstr ++ (if collapse then "" else totalstr) | ||||
|     where  | ||||
|       acctsstr = concatMap showatree $ subs t | ||||
|       showatree t = showAccountTreeWithBalances matchedacctnames t | ||||
| @ -128,6 +128,7 @@ showBalanceReport opts args l = acctsstr ++ totalstr | ||||
|       apats = fst $ parseAccountDescriptionArgs args | ||||
|       sub = SubTotal `elem` opts | ||||
|       empty = Empty `elem` opts | ||||
|       collapse = Collapse `elem` opts | ||||
|       maxdepth = 9999 | ||||
|       totalstr = if isZeroMixedAmount total  | ||||
|                  then ""  | ||||
|  | ||||
							
								
								
									
										1
									
								
								NOTES
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								NOTES
									
									
									
									
									
								
							| @ -12,7 +12,6 @@ implementations were its consequences." --Niklaus Wirth | ||||
| *** parse commented lines at end of file  | ||||
| *** display mixed amounts vertically, not horizontally | ||||
| ** features | ||||
| *** -n to skip total, for compound reports | ||||
| *** flexible date expressions, for easier time reports | ||||
| *** commodity @ rate, for tracking client hours in main ledger | ||||
| *** actual/effective entry & txn dates, for ... | ||||
|  | ||||
| @ -29,6 +29,7 @@ options = [ | ||||
|  Option ['C'] ["cleared"]      (NoArg  Cleared)            "report only on cleared entries", | ||||
|  Option ['E'] ["empty"]        (NoArg  Empty)              "balance report: show accounts with zero balance", | ||||
|  Option ['R'] ["real"]         (NoArg  Real)               "report only on real (non-virtual) transactions", | ||||
|  Option ['n'] ["collapse"]     (NoArg  Collapse)           "balance report: no grand total", | ||||
|  Option ['s'] ["subtotal"]     (NoArg  SubTotal)           "balance report: show subaccounts", | ||||
|  Option ['h'] ["help","usage"] (NoArg  Help)               "show this help", | ||||
|  Option ['V'] ["version"]      (NoArg  Version)            "show version" | ||||
| @ -42,6 +43,7 @@ data Opt = | ||||
|     Cleared |  | ||||
|     Empty |  | ||||
|     Real |  | ||||
|     Collapse | | ||||
|     SubTotal | | ||||
|     Help | | ||||
|     Version | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user