ui: transaction: show all decimal places (like print, cf #931)
On the accounts screen and register screen we round amounts according to commodity styles, but when you drill down to a transaction you probably want to see the unrounded amounts.
This commit is contained in:
parent
f52117120b
commit
2a4170dd3b
@ -37,6 +37,7 @@ module Hledger.Data.Transaction (
|
|||||||
transactionToCost,
|
transactionToCost,
|
||||||
transactionApplyAliases,
|
transactionApplyAliases,
|
||||||
transactionMapPostings,
|
transactionMapPostings,
|
||||||
|
transactionMapPostingAmounts,
|
||||||
-- nonzerobalanceerror,
|
-- nonzerobalanceerror,
|
||||||
-- * date operations
|
-- * date operations
|
||||||
transactionDate2,
|
transactionDate2,
|
||||||
@ -623,6 +624,9 @@ transactionMapPostings :: (Posting -> Posting) -> Transaction -> Transaction
|
|||||||
transactionMapPostings f t@Transaction{tpostings=ps} = t{tpostings=map f ps}
|
transactionMapPostings f t@Transaction{tpostings=ps} = t{tpostings=map f ps}
|
||||||
|
|
||||||
-- | Apply a transformation to a transaction's posting amounts.
|
-- | Apply a transformation to a transaction's posting amounts.
|
||||||
|
transactionMapPostingAmounts :: (Amount -> Amount) -> Transaction -> Transaction
|
||||||
|
transactionMapPostingAmounts f = transactionMapPostings (postingTransformAmount (mapMixedAmount f))
|
||||||
|
|
||||||
-- tests
|
-- tests
|
||||||
|
|
||||||
tests_Transaction :: TestTree
|
tests_Transaction :: TestTree
|
||||||
|
|||||||
@ -60,7 +60,7 @@ tsInit _ _ _ = error "init function called with wrong screen type, should not ha
|
|||||||
tsDraw :: UIState -> [Widget Name]
|
tsDraw :: UIState -> [Widget Name]
|
||||||
tsDraw UIState{aopts=UIOpts{cliopts_=copts@CliOpts{reportspec_=rspec@ReportSpec{rsOpts=ropts}}}
|
tsDraw UIState{aopts=UIOpts{cliopts_=copts@CliOpts{reportspec_=rspec@ReportSpec{rsOpts=ropts}}}
|
||||||
,ajournal=j
|
,ajournal=j
|
||||||
,aScreen=TransactionScreen{tsTransaction=(i,t)
|
,aScreen=TransactionScreen{tsTransaction=(i,t')
|
||||||
,tsTransactions=nts
|
,tsTransactions=nts
|
||||||
,tsAccount=acct
|
,tsAccount=acct
|
||||||
}
|
}
|
||||||
@ -71,6 +71,8 @@ tsDraw UIState{aopts=UIOpts{cliopts_=copts@CliOpts{reportspec_=rspec@ReportSpec{
|
|||||||
-- Minibuffer e -> [minibuffer e, maincontent]
|
-- Minibuffer e -> [minibuffer e, maincontent]
|
||||||
_ -> [maincontent]
|
_ -> [maincontent]
|
||||||
where
|
where
|
||||||
|
-- as with print, show amounts with all of their decimal places
|
||||||
|
t = transactionMapPostingAmounts setFullPrecision t'
|
||||||
maincontent = Widget Greedy Greedy $ do
|
maincontent = Widget Greedy Greedy $ do
|
||||||
let
|
let
|
||||||
prices = journalPriceOracle (infer_value_ ropts) j
|
prices = journalPriceOracle (infer_value_ ropts) j
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user