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.
|
-- Queries, report/column dates.
|
||||||
reportspan = dbg3 "reportspan" $ calculateReportSpan rspec' j
|
reportspan = dbg3 "reportspan" $ calculateReportSpan rspec' j
|
||||||
rspec = dbg3 "reportopts" $ makeReportQuery rspec' reportspan
|
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
|
-- so the reportspan isn't used for valuation
|
||||||
|
|
||||||
-- Group postings into their columns.
|
-- Group postings into their columns.
|
||||||
@ -257,7 +257,7 @@ makeValuation rspec j priceoracle day = case value_ (rsOpts rspec) of
|
|||||||
where
|
where
|
||||||
-- Some things needed if doing valuation.
|
-- Some things needed if doing valuation.
|
||||||
styles = journalCommodityStyles j
|
styles = journalCommodityStyles j
|
||||||
mreportlast = reportPeriodLastDay rspec
|
mreportlast = reportPeriodOrJournalLastDay rspec j
|
||||||
multiperiod = interval_ (rsOpts rspec) /= NoInterval
|
multiperiod = interval_ (rsOpts rspec) /= NoInterval
|
||||||
|
|
||||||
-- | Group postings, grouped by their column
|
-- | Group postings, grouped by their column
|
||||||
|
|||||||
@ -409,8 +409,8 @@ valuationTypeFromRawOpts = lastMay . collectopts valuationfromrawopt
|
|||||||
where
|
where
|
||||||
valuationfromrawopt (n,v) -- option name, value
|
valuationfromrawopt (n,v) -- option name, value
|
||||||
| n == "B" = Just $ AtCost Nothing
|
| n == "B" = Just $ AtCost Nothing
|
||||||
| n == "V" = Just $ AtDefault Nothing
|
| n == "V" = Just $ AtEnd Nothing
|
||||||
| n == "X" = Just $ AtDefault (Just $ T.pack v)
|
| n == "X" = Just $ AtEnd (Just $ T.pack v)
|
||||||
| n == "value" = Just $ valuation v
|
| n == "value" = Just $ valuation v
|
||||||
| otherwise = Nothing
|
| otherwise = Nothing
|
||||||
valuation v
|
valuation v
|
||||||
|
|||||||
@ -156,9 +156,8 @@ reportflags = [
|
|||||||
"show amounts converted to their cost/selling amount, using the transaction price. Equivalent to --value=cost."
|
"show amounts converted to their cost/selling amount, using the transaction price. Equivalent to --value=cost."
|
||||||
,flagNone ["V","market"] (setboolopt "V")
|
,flagNone ["V","market"] (setboolopt "V")
|
||||||
(unwords
|
(unwords
|
||||||
["show amounts converted to current market value (single period reports)"
|
["show amounts converted to period-end market value in their default valuation commodity."
|
||||||
,"or period-end market value (multiperiod reports) in their default valuation commodity."
|
,"Equivalent to --value=end."
|
||||||
,"Equivalent to --value=now / --value=end."
|
|
||||||
])
|
])
|
||||||
,flagReq ["X","exchange"] (\s opts -> Right $ setopt "X" s opts) "COMM"
|
,flagReq ["X","exchange"] (\s opts -> Right $ setopt "X" s opts) "COMM"
|
||||||
(unwords
|
(unwords
|
||||||
|
|||||||
@ -1206,7 +1206,7 @@ market prices will be used.
|
|||||||
|
|
||||||
For single period reports, if an explicit
|
For single period reports, if an explicit
|
||||||
[report end date](#report-start-end-date) is specified, that will be
|
[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
|
For [multiperiod reports](#report-intervals), each column/period is
|
||||||
valued on the last day of the period, by default.
|
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
|
# 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 2000/1/1 $ €1.20
|
||||||
P 3000/1/1 $ €1.30
|
P 3000/1/1 $ €1.30
|
||||||
@ -54,7 +54,7 @@ P 3000/1/1 $ €1.30
|
|||||||
3000/01/01
|
3000/01/01
|
||||||
(a) $100
|
(a) $100
|
||||||
|
|
||||||
$ hledger -f- bal -N -V
|
$ hledger -f- bal -N --value=now
|
||||||
€120.00 a
|
€120.00 a
|
||||||
|
|
||||||
|
|
||||||
@ -360,7 +360,7 @@ $ hledger -f- bal -N --value=2000-01-15
|
|||||||
$ hledger -f- bal -N --value=now
|
$ hledger -f- bal -N --value=now
|
||||||
12 B a
|
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
|
$ hledger -f- bal -N -V
|
||||||
12 B a
|
12 B a
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user