fix: Ensure date2 is used for journal valuation if requested. (#1851)
This commit is contained in:
		
							parent
							
								
									87052febf2
								
							
						
					
					
						commit
						8cc59df513
					
				| @ -594,7 +594,7 @@ journalApplyValuationFromOptsWith rspec@ReportSpec{_rsReportOpts=ropts} j priceo | |||||||
|     costing     = journalToCost (fromMaybe NoConversionOp $ conversionop_ ropts) |     costing     = journalToCost (fromMaybe NoConversionOp $ conversionop_ ropts) | ||||||
| 
 | 
 | ||||||
|     -- Find the end of the period containing this posting |     -- Find the end of the period containing this posting | ||||||
|     periodEnd  = addDays (-1) . fromMaybe err . mPeriodEnd . postingDate |     periodEnd  = addDays (-1) . fromMaybe err . mPeriodEnd . postingDateOrDate2 (whichDate ropts) | ||||||
|     mPeriodEnd = case interval_ ropts of |     mPeriodEnd = case interval_ ropts of | ||||||
|         NoInterval -> const . spanEnd . fst $ reportSpan j rspec |         NoInterval -> const . spanEnd . fst $ reportSpan j rspec | ||||||
|         _          -> spanEnd <=< latestSpanContaining (historical : spans) |         _          -> spanEnd <=< latestSpanContaining (historical : spans) | ||||||
|  | |||||||
| @ -340,3 +340,21 @@ P 2020-01-01 P 100Z | |||||||
| 
 | 
 | ||||||
| $ hledger -f- bal -N -X Z | $ hledger -f- bal -N -X Z | ||||||
|                 100Z  a |                 100Z  a | ||||||
|  | 
 | ||||||
|  | # 32. #1851 It should use posting date 2 if requested. | ||||||
|  | < | ||||||
|  | 2019-12-31 FOO | ||||||
|  |     Assets:A        $1.00 | ||||||
|  |     Income:B | ||||||
|  | 
 | ||||||
|  | 2020-01-01=2019-12-30 BAR | ||||||
|  |     Assets:A        $1.00 | ||||||
|  |     Income:B | ||||||
|  | 
 | ||||||
|  | $ hledger -f- bal -Y --date2 -V -N | ||||||
|  | Balance changes in 2019, valued at period ends: | ||||||
|  | 
 | ||||||
|  |           ||   2019  | ||||||
|  | ==========++======== | ||||||
|  |  Assets:A ||  $2.00  | ||||||
|  |  Income:B || $-2.00  | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user