ui: make --real/-R affect register/txn screens (#354)
This commit is contained in:
parent
a961988a88
commit
788021f5a4
@ -24,6 +24,7 @@ module Hledger.Query (
|
|||||||
queryIsDateOrDate2,
|
queryIsDateOrDate2,
|
||||||
queryIsStartDateOnly,
|
queryIsStartDateOnly,
|
||||||
queryIsSym,
|
queryIsSym,
|
||||||
|
queryIsReal,
|
||||||
queryStartDate,
|
queryStartDate,
|
||||||
queryEndDate,
|
queryEndDate,
|
||||||
queryDateSpan,
|
queryDateSpan,
|
||||||
@ -455,6 +456,10 @@ queryIsSym :: Query -> Bool
|
|||||||
queryIsSym (Sym _) = True
|
queryIsSym (Sym _) = True
|
||||||
queryIsSym _ = False
|
queryIsSym _ = False
|
||||||
|
|
||||||
|
queryIsReal :: Query -> Bool
|
||||||
|
queryIsReal (Real _) = True
|
||||||
|
queryIsReal _ = False
|
||||||
|
|
||||||
-- | Does this query specify a start date and nothing else (that would
|
-- | Does this query specify a start date and nothing else (that would
|
||||||
-- filter postings prior to the date) ?
|
-- filter postings prior to the date) ?
|
||||||
-- When the flag is true, look for a starting secondary date instead.
|
-- When the flag is true, look for a starting secondary date instead.
|
||||||
|
|||||||
@ -37,6 +37,7 @@ import qualified Data.Text as T
|
|||||||
import Hledger.Data
|
import Hledger.Data
|
||||||
import Hledger.Query
|
import Hledger.Query
|
||||||
import Hledger.Reports.ReportOptions
|
import Hledger.Reports.ReportOptions
|
||||||
|
-- import Hledger.Utils.Debug
|
||||||
|
|
||||||
|
|
||||||
-- | A transactions report includes a list of transactions
|
-- | A transactions report includes a list of transactions
|
||||||
@ -114,10 +115,15 @@ type AccountTransactionsReportItem =
|
|||||||
accountTransactionsReport :: ReportOpts -> Journal -> Query -> Query -> AccountTransactionsReport
|
accountTransactionsReport :: ReportOpts -> Journal -> Query -> Query -> AccountTransactionsReport
|
||||||
accountTransactionsReport opts j q thisacctquery = (label, items)
|
accountTransactionsReport opts j q thisacctquery = (label, items)
|
||||||
where
|
where
|
||||||
-- transactions with excluded currencies removed
|
-- transactions with excluded currencies and excluded virtual postings removed
|
||||||
ts1 = jtxns $
|
ts1 = jtxns $
|
||||||
filterJournalAmounts (filterQuery queryIsSym q) $
|
(if queryIsNull realq then id else filterJournalPostings realq) $ -- apply Real filter if it's in q
|
||||||
journalSelectingAmountFromOpts opts j
|
(if queryIsNull symq then id else filterJournalAmounts symq) $ -- apply any cur:SYM filters in q
|
||||||
|
journalSelectingAmountFromOpts opts j -- convert amounts to cost basis if -B
|
||||||
|
where
|
||||||
|
realq = filterQuery queryIsReal q
|
||||||
|
symq = filterQuery queryIsSym q
|
||||||
|
|
||||||
-- affecting this account
|
-- affecting this account
|
||||||
ts2 = filter (matchesTransaction thisacctquery) ts1
|
ts2 = filter (matchesTransaction thisacctquery) ts1
|
||||||
-- with dates adjusted for account transactions report
|
-- with dates adjusted for account transactions report
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user