我想要做的是在最后一行得到总和。这是一个带有 2 组元素和总和的示例:
我有:
1000 (group number)
TitleUm TitleTres TitleQuatro
Apple 1 20
Pear 5 12
1001 (group number)
TV 1 20
Mobile 1 12
Car 1 15
Bicycle 1 5
TOTAL 10 84
我在寻找:
1000 (group number)
TitleUm TitleTres TitleQuatro
Apple 1 20
Pear 5 12
TOTAL 6 32
1001 (group number)
TV 1 20
Mobile 1 12
Car 1 15
Bicycle 1 5
TOTAL 4 52
下面的代码几乎做了所有事情,列出了每行的项目和每个值,但它现在确实显示了总和:
<table class="Itens">
<%
currentGroupName = ""
previousGroupName = ""
Do Until ItensList.EOF
currentGroupName = ItensList("oito")
Um= ItensList("um")
Tres= ItensList("tres")
Quatro= CCur(ItensList("quatro"))
If currentGroupName <> previousGroupName Then
%>
<tr>
<td><% Response.Write currentGroupName %></td>
</tr>
<tr>
<th><% Response.Write TituloUm %></th>
<th><% Response.Write TituloTres %></th>
<th><% Response.Write TituloQuatro %></th>
</tr>
<%
End If
%>
<%
Um= CCur(ItensList("um"))
Tres= CCur(ItensList("tres"))
Quatro= CCur(ItensList("quatro"))
%>
<tr>
<td><% Response.Write Um %></td>
<td><% Response.Write Tres %></td>
<td><% Response.Write Quatro %></td>
</tr>
<%
previousGroupName = currentGroupName
ItensList.MoveNext
Loop
ItensList.Close
%>
<tr class="Total">
<td>TOTAL</td>
<td><% Response.Write ShowSumTotalTresHere %></td>
<td><% Response.Write ShowSumTotalQuatroHere %></td>
</tr>
</table>
谢谢您的帮助