I am trying to get a grand total from a shopping cart page and am not sure how to do that. I have the total that loops through each section but I want to display the grand total from all of those sections at the bottom of the page. Can someone offer assistance on how to do this. Here is my code:
dim totalPrice(20) //The total price on any given subform //CONFIG - change this to the maximum number of product types you ever expect to have.
dim iQtys(20, 50) //CONFIG - Change this to the maximum number of items you ever expect to have on one order form.
dim emailTo, emailFrom, emailSubject
dim grandTotal(20)
if Request.Form("btnCalculate.x") <> 0 or Request.Form("btnCalculate.y") <> 0 then
isPostback = 1 'cInt(Request.Form("btnCalculate"))
for iCntr2 = 1 to Request.Form("NumForms")
for iCntr = 1 to Request.Form("NumElements" & iCntr2)
iQtys(iCntr2, iCntr) = CInt(Request.Form("Qty" & iCntr2 & "_" & iCntr))
totalPrice(iCntr2) = totalPrice(iCntr2) + (Ccur(Request.Form("UnitPrice" & iCntr2 & "_" & iCntr)) * CInt(Request.Form("Qty" & iCntr2 & "_" & iCntr)))
next
next
end if
totalPrice(iCntr2) = totalPrice(iCntr2) + (Ccur(Request.Form("UnitPrice" & iCntr2 & "_" & iCntr)) * CInt(Request.Form("Qty" & iCntr2 & "_" & iCntr)))
Response.write "<TR><TD align=left colspan=" & oProdInstances.Fields.Count - 2 & ">Grand Total: " & FormatCurrency(grandTotal(iForm), 2) & "</TD>"