fix entry balance checking by rounding to 8 places, for now

This commit is contained in:
Simon Michael 2007-07-11 09:32:43 +00:00
parent 06b376385b
commit d91977fbe6

View File

@ -25,8 +25,9 @@ showEntryDescription e = (showDate $ edate e) ++ " " ++ (showDescription $ edesc
showDate d = printf "%-10s" d showDate d = printf "%-10s" d
showDescription s = printf "%-20s" (elideRight 20 s) showDescription s = printf "%-20s" (elideRight 20 s)
-- quick & dirty: checks entry's 0 balance only to 8 places
isEntryBalanced :: LedgerEntry -> Bool isEntryBalanced :: LedgerEntry -> Bool
isEntryBalanced = (0==) . quantity . sumLedgerTransactions . etransactions isEntryBalanced = ((0::Double)==) . read . printf "%0.8f" . quantity . sumLedgerTransactions . etransactions
autofillEntry :: LedgerEntry -> LedgerEntry autofillEntry :: LedgerEntry -> LedgerEntry
autofillEntry e@(LedgerEntry _ _ _ _ _ ts) = autofillEntry e@(LedgerEntry _ _ _ _ _ ts) =