--empty/-E flag
This commit is contained in:
parent
cafca9425d
commit
42bfc4afd9
@ -124,9 +124,10 @@ showBalanceReport opts args l = acctsstr ++ totalstr
|
||||
acctsstr = concatMap showatree $ subs t
|
||||
showatree t = showAccountTreeWithBalances matchedacctnames t
|
||||
matchedacctnames = balancereportacctnames l sub apats t
|
||||
t = pruneZeroBalanceLeaves $ ledgerAccountTree maxdepth l
|
||||
t = (if empty then id else pruneZeroBalanceLeaves) $ ledgerAccountTree maxdepth l
|
||||
apats = fst $ parseAccountDescriptionArgs args
|
||||
sub = SubTotal `elem` opts
|
||||
empty = Empty `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
|
||||
*** -E to show zero amounts, for reports and showing informational timelog entries
|
||||
*** -n to skip total, for compound reports
|
||||
*** flexible date expressions, for easier time reports
|
||||
*** commodity @ rate, for tracking client hours in main ledger
|
||||
|
||||
@ -27,6 +27,7 @@ options = [
|
||||
Option ['b'] ["begin"] (ReqArg Begin "YYYY/MM/DD") "report on entries on or after this date",
|
||||
Option ['e'] ["end"] (ReqArg End "YYYY/MM/DD") "report on entries prior to this date",
|
||||
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 ['s'] ["subtotal"] (NoArg SubTotal) "balance report: show subaccounts",
|
||||
Option ['h'] ["help","usage"] (NoArg Help) "show this help",
|
||||
@ -39,6 +40,7 @@ data Opt =
|
||||
Begin String |
|
||||
End String |
|
||||
Cleared |
|
||||
Empty |
|
||||
Real |
|
||||
SubTotal |
|
||||
Help |
|
||||
|
||||
10
Tests.hs
10
Tests.hs
@ -212,6 +212,16 @@ balancecommand_tests = TestList [
|
||||
"--------------------\n" ++
|
||||
" $1\n" ++
|
||||
"")
|
||||
,
|
||||
"balance report with -E shows zero-balance accounts" ~:
|
||||
([SubTotal,Empty], ["assets"]) `gives`
|
||||
(" $-1 assets\n" ++
|
||||
" $-2 cash\n" ++
|
||||
" $0 checking\n" ++
|
||||
" $1 saving\n" ++
|
||||
"--------------------\n" ++
|
||||
" $-1\n" ++
|
||||
"")
|
||||
] where
|
||||
gives (opts,pats) e = do
|
||||
l <- ledgerfromfile pats "sample.ledger"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user