fix recent compilation breakage
This commit is contained in:
parent
3aa8613fa5
commit
9f565157e0
@ -8,6 +8,7 @@ A ledger-compatible @register@ command.
|
|||||||
module Commands.Register (
|
module Commands.Register (
|
||||||
register
|
register
|
||||||
,showRegisterReport
|
,showRegisterReport
|
||||||
|
,showPostingWithBalance
|
||||||
,tests_Register
|
,tests_Register
|
||||||
) where
|
) where
|
||||||
|
|
||||||
@ -29,7 +30,7 @@ register opts args l = do
|
|||||||
-- | Generate the register report, which is a list of postings with transaction
|
-- | Generate the register report, which is a list of postings with transaction
|
||||||
-- info and a running balance.
|
-- info and a running balance.
|
||||||
showRegisterReport :: [Opt] -> FilterSpec -> Ledger -> String
|
showRegisterReport :: [Opt] -> FilterSpec -> Ledger -> String
|
||||||
showRegisterReport opts filterspec l = showpostings ps nullposting startbal
|
showRegisterReport opts filterspec l = showPostingsWithBalance ps nullposting startbal
|
||||||
where
|
where
|
||||||
ps | interval == NoInterval = displayableps
|
ps | interval == NoInterval = displayableps
|
||||||
| otherwise = summarisePostings interval depth empty filterspan displayableps
|
| otherwise = summarisePostings interval depth empty filterspan displayableps
|
||||||
@ -116,17 +117,17 @@ DDDDDDDDDD dddddddddddddddddddd aaaaaaaaaaaaaaaaaaaaaa AAAAAAAAAAA AAAAAAAAAAAA
|
|||||||
aaaaaaaaaaaaaaaaaaaaaa AAAAAAAAAAA AAAAAAAAAAAA
|
aaaaaaaaaaaaaaaaaaaaaa AAAAAAAAAAA AAAAAAAAAAAA
|
||||||
@
|
@
|
||||||
-}
|
-}
|
||||||
showpostings :: [Posting] -> Posting -> MixedAmount -> String
|
showPostingsWithBalance :: [Posting] -> Posting -> MixedAmount -> String
|
||||||
showpostings [] _ _ = ""
|
showPostingsWithBalance [] _ _ = ""
|
||||||
showpostings (p:ps) pprev bal = this ++ showpostings ps p bal'
|
showPostingsWithBalance (p:ps) pprev bal = this ++ showPostingsWithBalance ps p bal'
|
||||||
where
|
where
|
||||||
this = showposting isfirst p bal'
|
this = showPostingWithBalance isfirst p bal'
|
||||||
isfirst = ptransaction p /= ptransaction pprev
|
isfirst = ptransaction p /= ptransaction pprev
|
||||||
bal' = bal + pamount p
|
bal' = bal + pamount p
|
||||||
|
|
||||||
-- | Show one posting and running balance, with or without transaction info.
|
-- | Show one posting and running balance, with or without transaction info.
|
||||||
showposting :: Bool -> Posting -> MixedAmount -> String
|
showPostingWithBalance :: Bool -> Posting -> MixedAmount -> String
|
||||||
showposting withtxninfo p b = concatBottomPadded [txninfo ++ pstr ++ " ", bal] ++ "\n"
|
showPostingWithBalance withtxninfo p b = concatBottomPadded [txninfo ++ pstr ++ " ", bal] ++ "\n"
|
||||||
where
|
where
|
||||||
ledger3ishlayout = False
|
ledger3ishlayout = False
|
||||||
datedescwidth = if ledger3ishlayout then 34 else 32
|
datedescwidth = if ledger3ishlayout then 34 else 32
|
||||||
|
|||||||
@ -280,7 +280,7 @@ currentTransaction a@AppState{aledger=l,abuf=buf} = ptransaction p
|
|||||||
where
|
where
|
||||||
p = safehead nullposting $ filter ismatch $ ledgerPostings l
|
p = safehead nullposting $ filter ismatch $ ledgerPostings l
|
||||||
ismatch p = postingDate p == parsedate (take 10 datedesc)
|
ismatch p = postingDate p == parsedate (take 10 datedesc)
|
||||||
&& take 70 (showposting False p nullmixedamt) == (datedesc ++ acctamt)
|
&& take 70 (showPostingWithBalance False p nullmixedamt) == (datedesc ++ acctamt)
|
||||||
datedesc = take 32 $ fromMaybe "" $ find (not . (" " `isPrefixOf`)) $ safehead "" rest : reverse above
|
datedesc = take 32 $ fromMaybe "" $ find (not . (" " `isPrefixOf`)) $ safehead "" rest : reverse above
|
||||||
acctamt = drop 32 $ safehead "" rest
|
acctamt = drop 32 $ safehead "" rest
|
||||||
safehead d ls = if null ls then d else head ls
|
safehead d ls = if null ls then d else head ls
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user