dev: lib: clarify accountTransactionsReportItem
This commit is contained in:
parent
af38121442
commit
44400e840c
@ -179,20 +179,20 @@ accountTransactionsReportItems reportq thisacctq bal signfn accttypefn =
|
|||||||
accountTransactionsReportItem :: Query -> Query -> (MixedAmount -> MixedAmount)
|
accountTransactionsReportItem :: Query -> Query -> (MixedAmount -> MixedAmount)
|
||||||
-> (AccountName -> Maybe AccountType) -> MixedAmount -> (Day, Transaction)
|
-> (AccountName -> Maybe AccountType) -> MixedAmount -> (Day, Transaction)
|
||||||
-> (MixedAmount, Maybe AccountTransactionsReportItem)
|
-> (MixedAmount, Maybe AccountTransactionsReportItem)
|
||||||
accountTransactionsReportItem reportq thisacctq signfn accttypefn bal (d, torig)
|
accountTransactionsReportItem reportq thisacctq signfn accttypefn bal (d, t)
|
||||||
-- 201407: I've lost my grip on this, let's just hope for the best
|
-- 201407: I've lost my grip on this, let's just hope for the best
|
||||||
-- 201606: we now calculate change and balance from filtered postings, check this still works well for all callers XXX
|
-- 201606: we now calculate change and balance from filtered postings, check this still works well for all callers XXX
|
||||||
| null reportps = (bal, Nothing) -- no matched postings in this transaction, skip it
|
| null reportps = (bal, Nothing) -- no matched postings in this transaction, skip it
|
||||||
| otherwise = (b, Just (torig, tacct{tdate=d}, numotheraccts > 1, otheracctstr, a, b))
|
| otherwise = (bal', Just (t, tacct{tdate=d}, numotheraccts > 1, otheracctstr, amt, bal'))
|
||||||
where
|
where
|
||||||
tacct@Transaction{tpostings=reportps} = filterTransactionPostingsExtra accttypefn reportq torig -- TODO needs to consider --date2, #1731
|
tacct@Transaction{tpostings=reportps} = filterTransactionPostingsExtra accttypefn reportq t -- TODO needs to consider --date2, #1731
|
||||||
(thisacctps, otheracctps) = partition (matchesPosting thisacctq) reportps
|
(thisacctps, otheracctps) = partition (matchesPosting thisacctq) reportps
|
||||||
numotheraccts = length $ nub $ map paccount otheracctps
|
numotheraccts = length $ nub $ map paccount otheracctps
|
||||||
otheracctstr | thisacctq == None = summarisePostingAccounts reportps -- no current account ? summarise all matched postings
|
otheracctstr | thisacctq == None = summarisePostingAccounts reportps -- no current account ? summarise all matched postings
|
||||||
| numotheraccts == 0 = summarisePostingAccounts thisacctps -- only postings to current account ? summarise those
|
| numotheraccts == 0 = summarisePostingAccounts thisacctps -- only postings to current account ? summarise those
|
||||||
| otherwise = summarisePostingAccounts otheracctps -- summarise matched postings to other account(s)
|
| otherwise = summarisePostingAccounts otheracctps -- summarise matched postings to other account(s)
|
||||||
a = signfn . maNegate $ sumPostings thisacctps
|
amt = signfn . maNegate $ sumPostings thisacctps
|
||||||
b = bal `maPlus` a
|
bal' = bal `maPlus` amt
|
||||||
|
|
||||||
-- TODO needs checking, cf #1731
|
-- TODO needs checking, cf #1731
|
||||||
-- | What date should be shown for a transaction in an account register report ?
|
-- | What date should be shown for a transaction in an account register report ?
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user