Output in a GataGrid according to Grouping
Hi all, I have a question that is probably REALLY simple for someone out there but is escaping me!!!
Here is a scaled down version of my result set from the query I am working with:
Total Code Title Description PrintOrder
$38.44 50 Local Service Charges 9004572938 - Business Plus 1 - 05/01/04 to 05/31/04 5
$5.00 50 Local Service Charges 9004573144 - Additional Listing - Business - 05/01/04 to 05/31/04 5
$48.44 50 Local Service Charges 9004573144 - Business Advantage Plus - 05/01/04 to 05/31/04 5
$0.55 100 Federal, State & Local Taxes 9004572938 - Federal Universal Service Fund 10
$0.55 100 Federal, State & Local Taxes 9004573144 - Federal Universal Service Fund 10
$2.76 100 Federal, State & Local Taxes Federal Excise Tax - FEDERAL EXCISE TAX 10
$2.00 100 Federal, State & Local Taxes Local 911 Surcharge - KOSCIUSKO CO. 911 SURCHARGE 10
$5.52 100 Federal, State & Local Taxes State Sales Tax - STATE SALES TAX 10
$0.12 100 Federal, State & Local Taxes Telecomm Relay Systems Surcharge - IN TELECOM RELAY SYS SURCHARGE 10
(it's supposed to be tab delimiated, I don't know how to make it display like that though. There are 5 columns)
You'll notice that the results are grouped by the 'Code'
Here is how I need them to display:
<table cellspacing='1' cellpadding='3' border='0' width='596' align='center'>
<tr>
<td colspan='3'><B>Local Service Charges</B></td>
</tr>
<tr>
<td nowrap>Date</td>
<td nowrap>Description</td>
<td nowrap align='right'>Amount</td></tr>
<tr>
<td >4/19/2004</TD>
<td >9004572938 - Business Plus 1 - 05/01/04 to 05/31/04</TD>
<td align='right'>$38.44</TD>
</TR>
<TR>
<td >4/19/2004</TD>
<td >9004573144 - Additional Listing - Business - 05/01/04 to 05/31/04</TD>
<td align='right'>$5.00</TD>
</TR>
<TR>
<td >4/19/2004</TD>
<td >9004573144 - Business Advantage Plus - 05/01/04 to 05/31/04</TD>
<td align='right'>$48.44</TD>
</TR>
<TR>
<td ><B>Total</B></td>
<td ></td>
<td align='right'><B>$91.88</B></td></tr>
<tr>
<td colspan='3' >.</td>
</tr>
<tr>
<td colspan='3'><B>Federal, State & Local Taxes</B></td>
</tr>
<tr>
<td nowrap>Date</td>
<td nowrap>Description</td>
<td nowrap align='right'>Amount</td></tr>
<tr>
<td >4/19/2004</TD>
<td >9004572938 - Federal Universal Service Fund</TD>
<td align='right'>$0.55</TD>
</TR>
<TR>
<td >4/19/2004</TD>
<td >9004573144 - Federal Universal Service Fund</TD>
<td align='right'>$0.55</TD>
</TR>
<TR>
<td >4/19/2004</TD>
<td >Federal Excise Tax - FEDERAL EXCISE TAX </TD>
<td align='right'>$2.76</TD>
</TR>
<TR>
<td >4/19/2004</TD>
<td >Local 911 Surcharge - KOSCIUSKO CO. 911 SURCHARGE </TD>
<td align='right'>$2.00</TD>
</TR>
<TR>
<td >4/19/2004</TD>
<td >State Sales Tax - STATE SALES TAX </TD>
<td align='right'>$5.52</TD>
</TR>
<TR>
<td >4/19/2004</TD>
<td >Telecomm Relay Systems Surcharge - IN TELECOM RELAY SYS SURCHARGE</TD>
<td align='right'>$0.12</TD>
</TR>
<tr>
<td ><B>Total</B></td>
<td ></td>
<td align='right'><B>$11.50</B></td>
</tr>
</Table>
</td>
</tr>
</table>
(Just cut and paste the HTML code, I don't know how to display it here)
I have this 'feeling' that there is some way to make the DataGrid control display this result set correctly. Each time a new 'code' and 'title' come up it needs to make a 'header' line and then before the next new 'header' line I need a 'total' line.
It is currently using this huge block of 'if-then' statements to generate the table, I didn't write that and I need to streamline it for the new version. I am SOOOOOO stuck though.
Thanks for any help you can give!
Michelle
|