mirror of
https://github.com/simonmichael/hledger.git
synced 2025-01-07 11:19:32 +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
|
instance Eq Account where
|
||||||
(==) (Account n1 t1 b1) (Account n2 t2 b2) = n1 == n2 && t1 == t2 && b1 == b2
|
(==) (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
|
symbols = sort $ nub $ map (symbol . commodity) as
|
||||||
hassymbol s a = s == (symbol $ commodity a)
|
hassymbol s a = s == (symbol $ commodity a)
|
||||||
|
|
||||||
|
|
||||||
|
-- | The empty simple amount.
|
||||||
|
nullamt :: Amount
|
||||||
|
nullamt = Amount unknown 0 Nothing
|
||||||
|
|
||||||
-- | The empty mixed amount.
|
-- | The empty mixed amount.
|
||||||
nullamt :: MixedAmount
|
nullmixedamt :: MixedAmount
|
||||||
nullamt = Mixed []
|
nullmixedamt = Mixed []
|
||||||
|
|
||||||
-- | A temporary value for parsed transactions which had no amount specified.
|
-- | A temporary value for parsed transactions which had no amount specified.
|
||||||
missingamt :: MixedAmount
|
missingamt :: MixedAmount
|
||||||
|
@ -15,7 +15,7 @@ import Ledger.AccountName
|
|||||||
|
|
||||||
instance Show RawTransaction where show = showRawTransaction
|
instance Show RawTransaction where show = showRawTransaction
|
||||||
|
|
||||||
nullrawtxn = RawTransaction "" nullamt "" RegularTransaction
|
nullrawtxn = RawTransaction "" nullmixedamt "" RegularTransaction
|
||||||
|
|
||||||
showRawTransaction :: RawTransaction -> String
|
showRawTransaction :: RawTransaction -> String
|
||||||
showRawTransaction (RawTransaction a amt _ ttype) =
|
showRawTransaction (RawTransaction a amt _ ttype) =
|
||||||
|
@ -32,4 +32,4 @@ accountNamesFromTransactions ts = nub $ map account ts
|
|||||||
sumTransactions :: [Transaction] -> MixedAmount
|
sumTransactions :: [Transaction] -> MixedAmount
|
||||||
sumTransactions = sum . map amount
|
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 :: [Opt] -> [String] -> Ledger -> String
|
||||||
showRegisterReport opts args l = showtxns ts nulltxn nullamt
|
showRegisterReport opts args l = showtxns ts nulltxn nullmixedamt
|
||||||
where
|
where
|
||||||
ts = filter matchtxn $ ledgerTransactions l
|
ts = filter matchtxn $ ledgerTransactions l
|
||||||
matchtxn Transaction{account=a} = matchpats apats a
|
matchtxn Transaction{account=a} = matchpats apats a
|
||||||
|
Loading…
Reference in New Issue
Block a user