mirror of
https://github.com/simonmichael/hledger.git
synced 2024-09-20 02:37:12 +03:00
lib: Valuation has changed; and -V now acts like --value=end.
This commit is contained in:
parent
8981b3e196
commit
0c23619ae7
@ -145,7 +145,7 @@ compoundBalanceReportWith rspec' j priceoracle subreportspecs = cbr
|
||||
-- Queries, report/column dates.
|
||||
reportspan = dbg3 "reportspan" $ calculateReportSpan rspec' j
|
||||
rspec = dbg3 "reportopts" $ makeReportQuery rspec' reportspan
|
||||
valuation = makeValuation rspec' j priceoracle -- Must use ropts' instead of ropts,
|
||||
valuation = makeValuation rspec' j priceoracle -- Must use rspec' instead of rspec,
|
||||
-- so the reportspan isn't used for valuation
|
||||
|
||||
-- Group postings into their columns.
|
||||
@ -257,7 +257,7 @@ makeValuation rspec j priceoracle day = case value_ (rsOpts rspec) of
|
||||
where
|
||||
-- Some things needed if doing valuation.
|
||||
styles = journalCommodityStyles j
|
||||
mreportlast = reportPeriodLastDay rspec
|
||||
mreportlast = reportPeriodOrJournalLastDay rspec j
|
||||
multiperiod = interval_ (rsOpts rspec) /= NoInterval
|
||||
|
||||
-- | Group postings, grouped by their column
|
||||
|
@ -409,8 +409,8 @@ valuationTypeFromRawOpts = lastMay . collectopts valuationfromrawopt
|
||||
where
|
||||
valuationfromrawopt (n,v) -- option name, value
|
||||
| n == "B" = Just $ AtCost Nothing
|
||||
| n == "V" = Just $ AtDefault Nothing
|
||||
| n == "X" = Just $ AtDefault (Just $ T.pack v)
|
||||
| n == "V" = Just $ AtEnd Nothing
|
||||
| n == "X" = Just $ AtEnd (Just $ T.pack v)
|
||||
| n == "value" = Just $ valuation v
|
||||
| otherwise = Nothing
|
||||
valuation v
|
||||
|
@ -156,9 +156,8 @@ reportflags = [
|
||||
"show amounts converted to their cost/selling amount, using the transaction price. Equivalent to --value=cost."
|
||||
,flagNone ["V","market"] (setboolopt "V")
|
||||
(unwords
|
||||
["show amounts converted to current market value (single period reports)"
|
||||
,"or period-end market value (multiperiod reports) in their default valuation commodity."
|
||||
,"Equivalent to --value=now / --value=end."
|
||||
["show amounts converted to period-end market value in their default valuation commodity."
|
||||
,"Equivalent to --value=end."
|
||||
])
|
||||
,flagReq ["X","exchange"] (\s opts -> Right $ setopt "X" s opts) "COMM"
|
||||
(unwords
|
||||
|
@ -1206,7 +1206,7 @@ market prices will be used.
|
||||
|
||||
For single period reports, if an explicit
|
||||
[report end date](#report-start-end-date) is specified, that will be
|
||||
used as the valuation date; otherwise the valuation date is "today".
|
||||
used as the valuation date; otherwise the valuation date is the journal's end date.
|
||||
|
||||
For [multiperiod reports](#report-intervals), each column/period is
|
||||
valued on the last day of the period, by default.
|
||||
|
@ -46,7 +46,7 @@ $ hledger -f- bal -N -V a
|
||||
|
||||
|
||||
# 4. Market prices in the future are ignored when the valuation date
|
||||
# is today, which is the default with -V. #453, #683
|
||||
# is today. #453, #683
|
||||
<
|
||||
P 2000/1/1 $ €1.20
|
||||
P 3000/1/1 $ €1.30
|
||||
@ -54,7 +54,7 @@ P 3000/1/1 $ €1.30
|
||||
3000/01/01
|
||||
(a) $100
|
||||
|
||||
$ hledger -f- bal -N -V
|
||||
$ hledger -f- bal -N --value=now
|
||||
€120.00 a
|
||||
|
||||
|
||||
@ -360,7 +360,7 @@ $ hledger -f- bal -N --value=2000-01-15
|
||||
$ hledger -f- bal -N --value=now
|
||||
12 B a
|
||||
|
||||
# 33. single column balance report valued at default date (same as --value=now)
|
||||
# 33. single column balance report valued at default date (same as --value=end)
|
||||
$ hledger -f- bal -N -V
|
||||
12 B a
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user