Answered
How to page break at each department and calculate department totals
I have a stored procedure that queries our sql db and returns
Employee name, their Department, and a few other calculations. I
use CFDocument to create a table and display the results. Here's
the code that does that (see below) What I need to do is figure out
how to create a page break after I display a total for each column
for each department. So my questions are
1. How do I insert a page break after the end of each department
2. Just above the page break, how do I calculate the totals for that the department and display them?
<cfdocument format="pdf">
<table width="650" border="1">
<cfoutput query="getResults">
<tr>
<td>#EmpName#</td>
<td>#Dept#</td>
<td>#JobType#</td>
<td>#NonBill#</td>
<td>#NonBillMeter#</td>
<td>#NumberFormat((NonBillPercent*100),.00)#</td>
<td>#Bill#</td>
<td>#BillMeter#</td>
<td>#NumberFormat((BillPercent*100),.00)#</td>
</tr>
</cfoutput>
</table>
</cfdocument>
1. How do I insert a page break after the end of each department
2. Just above the page break, how do I calculate the totals for that the department and display them?
<cfdocument format="pdf">
<table width="650" border="1">
<cfoutput query="getResults">
<tr>
<td>#EmpName#</td>
<td>#Dept#</td>
<td>#JobType#</td>
<td>#NonBill#</td>
<td>#NonBillMeter#</td>
<td>#NumberFormat((NonBillPercent*100),.00)#</td>
<td>#Bill#</td>
<td>#BillMeter#</td>
<td>#NumberFormat((BillPercent*100),.00)#</td>
</tr>
</cfoutput>
</table>
</cfdocument>