issue #19550: Switch to a more declaritive style of calculation that reduces number of query calls.
issue #19550: Add more quote line calculation detail.