imp!: value: For register reports with no reporting interval and
--value=end, historical reports should be valued at journal/report end date.
This commit is contained in:
		
							parent
							
								
									14c19c398b
								
							
						
					
					
						commit
						ce4fcfae84
					
				| @ -524,7 +524,9 @@ journalApplyValuationFromOptsWith rspec@ReportSpec{_rsReportOpts=ropts} j priceo | |||||||
| 
 | 
 | ||||||
|     -- 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 . postingDate | ||||||
|     mPeriodEnd = spanEnd <=< latestSpanContaining (historical : spans) |     mPeriodEnd = case interval_ ropts of | ||||||
|  |         NoInterval -> const . spanEnd $ reportSpan j rspec | ||||||
|  |         _          -> spanEnd <=< latestSpanContaining (historical : spans) | ||||||
|     historical = DateSpan Nothing $ spanStart =<< headMay spans |     historical = DateSpan Nothing $ spanStart =<< headMay spans | ||||||
|     spans = splitSpan (interval_ ropts) $ reportSpanBothDates j rspec |     spans = splitSpan (interval_ ropts) $ reportSpanBothDates j rspec | ||||||
|     styles = journalCommodityStyles j |     styles = journalCommodityStyles j | ||||||
|  | |||||||
| @ -1261,8 +1261,9 @@ Related: | |||||||
| | balance assertions/assignments                      | unchanged                                                        | unchanged                                                         | unchanged                                                                                      | unchanged                                                         | unchanged                               | | | balance assertions/assignments                      | unchanged                                                        | unchanged                                                         | unchanged                                                                                      | unchanged                                                         | unchanged                               | | ||||||
| | <br>                                                |                                                                  |                                                                   |                                                                                                |                                                                   |                                         | | | <br>                                                |                                                                  |                                                                   |                                                                                                |                                                                   |                                         | | ||||||
| | **register**                                        |                                                                  |                                                                   |                                                                                                |                                                                   |                                         | | | **register**                                        |                                                                  |                                                                   |                                                                                                |                                                                   |                                         | | ||||||
| | starting balance (-H)                               | cost                                                             | value at day before report or journal start                       | valued at day each historical posting was made                                                 | value at day before report or journal start                       | value at DATE/today                     | | | starting balance (-H)                               | cost                                                             | value at report or journal end                                    | valued at day each historical posting was made                                                 | value at report or journal end                                    | value at DATE/today                     | | ||||||
| | posting amounts                                     | cost                                                             | value at report end or today                                      | value at posting date                                                                          | value at report or journal end                                    | value at DATE/today                     | | | starting balance (-H) with report interval          | cost                                                             | value at day before report or journal start                       | valued at day each historical posting was made                                                 | value at day before report or journal start                       | value at DATE/today                     | | ||||||
|  | | posting amounts                                     | cost                                                             | value at report or journal end                                    | value at posting date                                                                          | value at report or journal end                                    | value at DATE/today                     | | ||||||
| | summary posting amounts with report interval        | summarised cost                                                  | value at period ends                                              | sum of postings in interval, valued at interval start                                          | value at period ends                                              | value at DATE/today                     | | | summary posting amounts with report interval        | summarised cost                                                  | value at period ends                                              | sum of postings in interval, valued at interval start                                          | value at period ends                                              | value at DATE/today                     | | ||||||
| | running total/average                               | sum/average of displayed values                                  | sum/average of displayed values                                   | sum/average of displayed values                                                                | sum/average of displayed values                                   | sum/average of displayed values         | | | running total/average                               | sum/average of displayed values                                  | sum/average of displayed values                                   | sum/average of displayed values                                                                | sum/average of displayed values                                   | sum/average of displayed values         | | ||||||
| | <br>                                                |                                                                  |                                                                   |                                                                                                |                                                                   |                                         | | | <br>                                                |                                                                  |                                                                   |                                                                                                |                                                                   |                                         | | ||||||
|  | |||||||
| @ -265,10 +265,10 @@ $ hledger -f- reg --value=cost -b 200002 -H | |||||||
| # 23. register with starting balance, valued at period end. | # 23. register with starting balance, valued at period end. | ||||||
| # That is unspecified so the last posting date (or price directive date) is used, | # That is unspecified so the last posting date (or price directive date) is used, | ||||||
| # ie 2000/4/1, so the price is 4 B. | # ie 2000/4/1, so the price is 4 B. | ||||||
| # Starting balance is 5 B as above. | # Starting balance is 1 A, which is valued at 4 B. | ||||||
| $ hledger -f- reg --value=end -b 200002 -H | $ hledger -f- reg --value=end -b 200002 -H | ||||||
| 2000-02-01                      (a)                            4 B           9 B | 2000-02-01                      (a)                            4 B           8 B | ||||||
| 2000-03-01                      (a)                            4 B          13 B | 2000-03-01                      (a)                            4 B          12 B | ||||||
| 
 | 
 | ||||||
| # 24. register with starting balance, valued at specified date (when the price is 5 B). | # 24. register with starting balance, valued at specified date (when the price is 5 B). | ||||||
| # Starting balance is 5 B as above. | # Starting balance is 5 B as above. | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user