mirror of
https://github.com/simonmichael/hledger.git
synced 2025-01-06 02:23:46 +03:00
nullamt and nullmixedamt
This commit is contained in:
parent
d5a145f7e4
commit
54b164a7ab
@ -19,5 +19,5 @@ instance Show Account where
|
||||
instance Eq Account where
|
||||
(==) (Account n1 t1 b1) (Account n2 t2 b2) = n1 == n2 && t1 == t2 && b1 == b2
|
||||
|
||||
nullacct = Account "" [] nullamt
|
||||
nullacct = Account "" [] nullmixedamt
|
||||
|
||||
|
@ -137,9 +137,14 @@ normaliseMixedAmount (Mixed as) = Mixed $ map sum $ grouped
|
||||
symbols = sort $ nub $ map (symbol . commodity) as
|
||||
hassymbol s a = s == (symbol $ commodity a)
|
||||
|
||||
|
||||
-- | The empty simple amount.
|
||||
nullamt :: Amount
|
||||
nullamt = Amount unknown 0 Nothing
|
||||
|
||||
-- | The empty mixed amount.
|
||||
nullamt :: MixedAmount
|
||||
nullamt = Mixed []
|
||||
nullmixedamt :: MixedAmount
|
||||
nullmixedamt = Mixed []
|
||||
|
||||
-- | A temporary value for parsed transactions which had no amount specified.
|
||||
missingamt :: MixedAmount
|
||||
|
@ -15,7 +15,7 @@ import Ledger.AccountName
|
||||
|
||||
instance Show RawTransaction where show = showRawTransaction
|
||||
|
||||
nullrawtxn = RawTransaction "" nullamt "" RegularTransaction
|
||||
nullrawtxn = RawTransaction "" nullmixedamt "" RegularTransaction
|
||||
|
||||
showRawTransaction :: RawTransaction -> String
|
||||
showRawTransaction (RawTransaction a amt _ ttype) =
|
||||
|
@ -32,4 +32,4 @@ accountNamesFromTransactions ts = nub $ map account ts
|
||||
sumTransactions :: [Transaction] -> MixedAmount
|
||||
sumTransactions = sum . map amount
|
||||
|
||||
nulltxn = Transaction 0 (parsedate "1900/1/1") "" "" nullamt RegularTransaction
|
||||
nulltxn = Transaction 0 (parsedate "1900/1/1") "" "" nullmixedamt RegularTransaction
|
||||
|
@ -26,7 +26,7 @@ DDDDDDDDDD dddddddddddddddddddd aaaaaaaaaaaaaaaaaaaaaa AAAAAAAAAAA AAAAAAAAAAAA
|
||||
@
|
||||
-}
|
||||
showRegisterReport :: [Opt] -> [String] -> Ledger -> String
|
||||
showRegisterReport opts args l = showtxns ts nulltxn nullamt
|
||||
showRegisterReport opts args l = showtxns ts nulltxn nullmixedamt
|
||||
where
|
||||
ts = filter matchtxn $ ledgerTransactions l
|
||||
matchtxn Transaction{account=a} = matchpats apats a
|
||||
|
Loading…
Reference in New Issue
Block a user