Table subtotals on every page
-
Hello Everyone,
I need to find best tool for report generating for my project. Main issue during searching is always with subtotals for table on every page.
Here using chrome-pdf and handlebars I can see I probably need to use double rendering mechanism. I know how to add data to every page like table row value but I don't have any idea how to calculate subtotal for particular page and fill that during second render.
I am trying smth like this:*<html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> </head> <body> <table style="border: 2px solid black;"> <thead> <tr> <th style="min-width: 350px;"> Item </th> <th style="min-width: 150px;"> Price </th> </tr> </thead> <tbody> {{#each items}} <tr class="item"> <td> {{name}} </td> <td style="text-align: center;"> {{price}} zł {{{pdfAddPageItem price}}} </td> </tr> {{/each}} </tbody> <tfoot> <tr> <td> Suma: </td> <td style="text-align: center;"> {{pageNumber}} zł </td> </tr> </tfoot> </table> </body> </html>*
Thanks in advance for every advice!
-
I've tried the idea with the second render.
In the first render, I add an emptytfoot
which will just hold the space.
In the second render I won't addtfoot
, but instead, add an extra plain row with a calculated sum value.Here is the demo
https://playground.jsreport.net/w/anon/B8L1tR4y