我不认为是一个经典的ASP人,但有时你必须做你应该做的。我的问题是,这是一个通过ASP定制的报告,用户想要运行SubTotals和总计显示,老实说,我只是不知道该怎么去做。目前整个报告都是这样封装的,它的显示方式对于这个问题并不重要。ASP虽然循环总计和小计
<%do while (adoRsTrade.AbsolutePage = iPageCurrent) and (not adoRsTrade.EOF)
NewRep = adoRsTrade("calIncludedRep")
if CurRep <> NewRep or FirstTime="T" and (not adorsTrade.BOF) then %>
加起来的数值为CurRep并将其显示为“分类汇总”
<%
FirstTime="F"
CurRep = adoRsTrade("calIncludedRep")
adoRsTrade.MoveNext
loop %>
任何帮助,我能得到就正如我所说,我不是一个ASP大师以任何方式将不胜感激。 谢谢 NickG
更新小计的东西;总计已完成,因为我可以重新运行一个do while循环以外的循环显示所有数据并总计它,现在我碰到的是easy-peezy(不是真正的)是.MoveNext先前被命中我能够检查NewRep;这里是小计,以及支票共计如果它是一个newrep这意味着对前众议员
<%do while (adoRsTrade.AbsolutePage = iPageCurrent) and (not adoRsTrade.EOF)
NewRep = adoRsTrade("calIncludedRep")
if CurRep = NewRep then
curPrincipal = adoRsTrade("mPrincipal")
totPrincipal = totPrincipal + curPrincipal
curInterest = adoRsTrade("mInterest")
totInterest = totInterest + curInterest
curCommission = adoRsTrade("calCommission")
totCommission = totCommission + curCommission
curSECFee = adoRsTrade("mSECFee")
totSECFee = totSECFee + curSECFee
curSvcFee = adoRsTrade("mSvcCharge")
totSvcFee = totSvcFee + curSvcFee
curNet = adoRsTrade("mNetAmount")
totNet = totNet + curNet
end if
if CurRep <> NewRep or FirstTime="T" and (not adorsTrade.BOF) then
If FirstTime <> "T" then%>
<TR>
<td>
<table class='FontStandardMinus1' border=0 cellPadding=0 align='left' cellSpacing=0 width="100%" bgcolor='#ffffff'>
<TR>
<td width="59%" align="left"><b>SubTotals<!-- for <%Response.Write(CurRep) %>-->:</b></td>
<td width="10%" valign=top align=right><%=FormatNumber(totPrincipal,2)%></td>
<td width="7%" valign=top align=right><%=FormatNumber(totInterest,2)%></td>
<td width="7%" valign=top align=right><%=FormatNumber(totCommission,2)%></td>
<td width="5%" valign=top align=right><%=FormatNumber(totSECFee,2)%></td>
<td width="4%" valign=top align=right><%=FormatNumber(totSvcFee,2)%></td>
<td width="9%" valign=top align=right><%=FormatNumber(totNet,2)%></td>
</TR>
</table>
</td>
</TR>
<%end if
curPrincipal = 0
totPrincipal = 0
curInterest = 0
totInterest = 0
curCommission = 0
totCommission = 0
curSECFee = 0
totSECFee = 0
curSvcFee = 0
totSvcFee = 0
curNet = 0
totNet = 0 %>
<TR>
<TD width="100%">
<table class='FontStandardMinus1' border=0 cellPadding=0 align='left' cellSpacing=0 width="100%" bgcolor='#ffffff'>
<tr>
<td width=100%><b><%=adoRsTrade("calIncludedRep")%></b></td>
</tr>
</table>
</TD>
</TR>
<%end if%>
<%
FirstTime="F"
'CalCom = CalCom + adoRsTrade("calCommission")
CurRep = adoRsTrade("calIncludedRep")
adoRsTrade.MoveNext
loop%>
所以显示小计,你可以看到我试图展示他们之后的值重置为0在表中,但该表只在命中时命中.MoveNext后显示,这意味着即使我想显示记录1-5加起来,记录6已经被.MoveNext命中,并且正在被丢弃值集。对不起,这很长,但我讨厌评论不能包含更新的代码。 感谢您的任何帮助
感谢您的答复,我是能够得到上述检查,以确保我是在最后一页后,使用的MoveFirst环路以外正常工作的总计。所以这是一大步。然而,小计给我带来了问题,因为他们在我展示之后不断添加应该是下一组的第一个值。我甚至在显示后将所有变量重置为= 0,但将下一个值添加到这些变量中,不确定要去哪里,但感谢您的帮助! – 2013-03-18 16:09:50
看到我编辑的答案 – stare 2013-03-18 16:22:21
我不认为如果没有嵌套循环就可以做到这一点,grandtotals可以正常工作,因为它们在循环之外以显示数据,但小计正在杀死我,我更新了我的帖子并提供了更多信息如果你可以看看,我明白你很忙,并欣赏帮助超过我可以告诉你 – 2013-03-18 16:56:36