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, | ||||
|   transactionApplyAliases, | ||||
|   transactionMapPostings, | ||||
|   transactionMapPostingAmounts, | ||||
|   -- nonzerobalanceerror, | ||||
|   -- * date operations | ||||
|   transactionDate2, | ||||
| @ -623,6 +624,9 @@ transactionMapPostings :: (Posting -> Posting) -> Transaction -> Transaction | ||||
| transactionMapPostings f t@Transaction{tpostings=ps} = t{tpostings=map f ps} | ||||
| 
 | ||||
| -- | Apply a transformation to a transaction's posting amounts. | ||||
| transactionMapPostingAmounts :: (Amount -> Amount) -> Transaction -> Transaction | ||||
| transactionMapPostingAmounts f  = transactionMapPostings (postingTransformAmount (mapMixedAmount f)) | ||||
| 
 | ||||
| -- tests | ||||
| 
 | ||||
| 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{aopts=UIOpts{cliopts_=copts@CliOpts{reportspec_=rspec@ReportSpec{rsOpts=ropts}}} | ||||
|               ,ajournal=j | ||||
|               ,aScreen=TransactionScreen{tsTransaction=(i,t) | ||||
|               ,aScreen=TransactionScreen{tsTransaction=(i,t') | ||||
|                                         ,tsTransactions=nts | ||||
|                                         ,tsAccount=acct | ||||
|                                         } | ||||
| @ -71,6 +71,8 @@ tsDraw UIState{aopts=UIOpts{cliopts_=copts@CliOpts{reportspec_=rspec@ReportSpec{ | ||||
|     -- Minibuffer e -> [minibuffer e, maincontent] | ||||
|     _          -> [maincontent] | ||||
|   where | ||||
|     -- as with print, show amounts with all of their decimal places | ||||
|     t = transactionMapPostingAmounts setFullPrecision t' | ||||
|     maincontent = Widget Greedy Greedy $ do | ||||
|       let | ||||
|         prices = journalPriceOracle (infer_value_ ropts) j | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user