mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-26 03:42:25 +03:00
lib,ui: For hledger-ui, do valuation for all valuation types, not just
AtCost and AtDefault. Remove unused valuationTypeIs* functions.
This commit is contained in:
parent
cdec0f9382
commit
46093b8de7
@ -284,7 +284,9 @@ budgetReportAsText ropts@ReportOpts{..} budgetr =
|
||||
_ -> -- trace (pshow $ (maybecost actual, maybecost budget)) -- debug missing percentage
|
||||
Nothing
|
||||
where
|
||||
maybecost = if valuationTypeIsCost ropts then mixedAmountCost else id
|
||||
maybecost = case value_ of
|
||||
Just (AtCost _) -> mixedAmountCost
|
||||
_ -> id
|
||||
|
||||
maybetranspose | transpose_ = \(Table rh ch vals) -> Table ch rh (transpose vals)
|
||||
| otherwise = id
|
||||
|
@ -39,8 +39,6 @@ module Hledger.Reports.ReportOptions (
|
||||
reportPeriodOrJournalStart,
|
||||
reportPeriodLastDay,
|
||||
reportPeriodOrJournalLastDay,
|
||||
valuationTypeIsCost,
|
||||
valuationTypeIsDefaultValue,
|
||||
)
|
||||
where
|
||||
|
||||
@ -429,18 +427,6 @@ valuationTypeFromRawOpts = lastMay . collectopts valuationfromrawopt
|
||||
"" -> Nothing
|
||||
c -> Just $ T.pack c
|
||||
|
||||
valuationTypeIsCost :: ReportOpts -> Bool
|
||||
valuationTypeIsCost ropts =
|
||||
case value_ ropts of
|
||||
Just (AtCost _) -> True
|
||||
_ -> False
|
||||
|
||||
valuationTypeIsDefaultValue :: ReportOpts -> Bool
|
||||
valuationTypeIsDefaultValue ropts =
|
||||
case value_ ropts of
|
||||
Just (AtDefault _) -> True
|
||||
_ -> False
|
||||
|
||||
-- | Select the Transaction date accessor based on --date2.
|
||||
transactionDateFn :: ReportOpts -> (Transaction -> Day)
|
||||
transactionDateFn ReportOpts{..} = if date2_ then transactionDate2 else tdate
|
||||
|
@ -81,10 +81,8 @@ tsDraw UIState{aopts=UIOpts{cliopts_=copts@CliOpts{reportspec_=rspec@ReportSpec{
|
||||
|
||||
render $ defaultLayout toplabel bottomlabel $ str $
|
||||
showTransactionOneLineAmounts $
|
||||
(if valuationTypeIsCost ropts then transactionToCost (journalCommodityStyles j) else id) $
|
||||
(if valuationTypeIsDefaultValue ropts then (\t -> transactionApplyValuation prices styles periodlast (rsToday rspec) t (AtDefault Nothing)) else id) $
|
||||
maybe t (transactionApplyValuation prices styles periodlast (rsToday rspec) t) $ value_ ropts
|
||||
-- (if real_ ropts then filterTransactionPostings (Real True) else id) -- filter postings by --real
|
||||
t
|
||||
where
|
||||
toplabel =
|
||||
str "Transaction "
|
||||
|
Loading…
Reference in New Issue
Block a user