There are different ways you can achieve this.
Create a page and set the source table as temporary and then on the page add the function to populate your temporary table and your calculation for billing. Call the page function to populate ur temp table and then call the run function of the page.
Or populate the temporary table and then pass that to the page in the PAGE.RUN function