journal: apply commodity styles to forecasted transactions (#1371)
This commit is contained in:
parent
831ec0dcf0
commit
2761324404
@ -148,11 +148,15 @@ journalAddForecast CliOpts{inputopts_=iopts, reportopts_=ropts} j = do
|
|||||||
either error' id $ journalBalanceTransactions assrt j -- PARTIAL:
|
either error' id $ journalBalanceTransactions assrt j -- PARTIAL:
|
||||||
where assrt = not . ignore_assertions_ $ iopts
|
where assrt = not . ignore_assertions_ $ iopts
|
||||||
|
|
||||||
let j' = case forecast_ ropts of
|
case forecast_ ropts of
|
||||||
Just _ -> journalBalanceTransactions' iopts j{ jtxns = concat [jtxns j, forecasttxns'] }
|
Nothing -> return j
|
||||||
Nothing -> j
|
Just _ -> do
|
||||||
|
let j' = journalBalanceTransactions' iopts j{ jtxns = concat [jtxns j, forecasttxns'] }
|
||||||
return j'
|
-- Display styles were applied early.. apply them again to ensure the forecasted
|
||||||
|
-- transactions are also styled. XXX Possible optimisation: style just the forecasttxns.
|
||||||
|
case journalApplyCommodityStyles j' of
|
||||||
|
Left e -> error' e -- PARTIAL:
|
||||||
|
Right j'' -> return j''
|
||||||
|
|
||||||
-- | Write some output to stdout or to a file selected by --output-file.
|
-- | Write some output to stdout or to a file selected by --output-file.
|
||||||
-- If the file exists it will be overwritten.
|
-- If the file exists it will be overwritten.
|
||||||
|
|||||||
@ -201,3 +201,20 @@ unexpected 'f'
|
|||||||
expecting end of input
|
expecting end of input
|
||||||
(use -h to see usage)
|
(use -h to see usage)
|
||||||
>>>=1
|
>>>=1
|
||||||
|
|
||||||
|
# 10. Amount display style is applied to forecasted transactions.
|
||||||
|
hledger -f - reg --forecast date:202001
|
||||||
|
<<<
|
||||||
|
commodity 1,000.00 USD
|
||||||
|
|
||||||
|
2020-01-01
|
||||||
|
(a) 1,000.00 USD
|
||||||
|
|
||||||
|
~ every 28th day
|
||||||
|
(a) 1000.00 USD
|
||||||
|
|
||||||
|
>>>
|
||||||
|
2020-01-01 (a) 1,000.00 USD 1,000.00 USD
|
||||||
|
2020-01-28 (a) 1,000.00 USD 2,000.00 USD
|
||||||
|
>>>2
|
||||||
|
>>>=0
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user