--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
|
acctsstr = concatMap showatree $ subs t
|
||||||
showatree t = showAccountTreeWithBalances matchedacctnames t
|
showatree t = showAccountTreeWithBalances matchedacctnames t
|
||||||
matchedacctnames = balancereportacctnames l sub apats 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
|
apats = fst $ parseAccountDescriptionArgs args
|
||||||
sub = SubTotal `elem` opts
|
sub = SubTotal `elem` opts
|
||||||
|
empty = Empty `elem` opts
|
||||||
maxdepth = 9999
|
maxdepth = 9999
|
||||||
totalstr = if isZeroMixedAmount total
|
totalstr = if isZeroMixedAmount total
|
||||||
then ""
|
then ""
|
||||||
|
|||||||
1
NOTES
1
NOTES
@ -12,7 +12,6 @@ implementations were its consequences." --Niklaus Wirth
|
|||||||
*** parse commented lines at end of file
|
*** parse commented lines at end of file
|
||||||
*** display mixed amounts vertically, not horizontally
|
*** display mixed amounts vertically, not horizontally
|
||||||
** features
|
** features
|
||||||
*** -E to show zero amounts, for reports and showing informational timelog entries
|
|
||||||
*** -n to skip total, for compound reports
|
*** -n to skip total, for compound reports
|
||||||
*** flexible date expressions, for easier time reports
|
*** flexible date expressions, for easier time reports
|
||||||
*** commodity @ rate, for tracking client hours in main ledger
|
*** 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 ['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 ['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 ['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 ['R'] ["real"] (NoArg Real) "report only on real (non-virtual) transactions",
|
||||||
Option ['s'] ["subtotal"] (NoArg SubTotal) "balance report: show subaccounts",
|
Option ['s'] ["subtotal"] (NoArg SubTotal) "balance report: show subaccounts",
|
||||||
Option ['h'] ["help","usage"] (NoArg Help) "show this help",
|
Option ['h'] ["help","usage"] (NoArg Help) "show this help",
|
||||||
@ -39,6 +40,7 @@ data Opt =
|
|||||||
Begin String |
|
Begin String |
|
||||||
End String |
|
End String |
|
||||||
Cleared |
|
Cleared |
|
||||||
|
Empty |
|
||||||
Real |
|
Real |
|
||||||
SubTotal |
|
SubTotal |
|
||||||
Help |
|
Help |
|
||||||
|
|||||||
10
Tests.hs
10
Tests.hs
@ -212,6 +212,16 @@ balancecommand_tests = TestList [
|
|||||||
"--------------------\n" ++
|
"--------------------\n" ++
|
||||||
" $1\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
|
] where
|
||||||
gives (opts,pats) e = do
|
gives (opts,pats) e = do
|
||||||
l <- ledgerfromfile pats "sample.ledger"
|
l <- ledgerfromfile pats "sample.ledger"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user