How to write a statement in ASP
Hi,
I need to take information from a form and do a calculation with it. Basicall It is a look up table, and I have it working with on variable (i.e. - How many colors do you want on the fron), however now I need to add 3 more variable just like the one before (i.e How many colors do you want on back, How many colors do you want on the left and so on). I have the working code and I will paste it below, along with the code of what I am trying to do.
Thanks,
Jen
Working Code:
<%
style = request("style")
numC = CLNG( request("numberOfColors") )
qty = CLNG( request("quantityOrdered") )
%>
<%
dim total
Dim colorPriceTable
colorPriceTable =Array(_
Array(6, 12, 24, 48, 72, 144, 288, 500, 1000, 2001, 999999),_
Array(4, 2.5, 1.6, 1.15, 1.1, .9, .75, .65, .6, .55, .5),_
Array(7, 3.1, 2.45, 1.9, 1.5, 1.35, 1, .85, .8, .7, .65),_
Array(8.5, 4, 3, 2.85, 1.95, 1.65, 1.45, 1.3, 1, .85, .8),_
Array(10.5, 4.7, 3.6, 3.45, 2.35, 1.9, 1.7, 1.6, 1.3, 1, .9),_
Array(12, 5.4, 4.25, 4.05, 2.75, 2.2, 1.95, 1.9, 1.5, 1.15, 1),_
Array(13, 6.3, 5.05, 4.75, 3.35, 2.7, 2.35, 2.2, 1.7, 1.3, 1.1)_
)
%>
<%
priceRow = colorPriceTable(numC)
qtyRow = colorPriceTable(0)
For col = 0 To UBound(qtyRow)
If qty < qtyRow(col) Then
unitPrice = priceRow(col)
Exit For
End If
Next
total = ((((unitPrice * qty) + (style * qty) + (.25 * qty))* 1.54) + (numC * 22))
if style = 1.98 then
styletemp = "Beefy-T"
elseif style = 1.99 then
styletemp = "T-Shirt 1"
end if
%>
What I am trying to do:
<%
style = request("style")
numC = CLNG( request("numberOfColors") )
numCb = CLNG( request("numberOfColorsb") )
numCr = CLNG( request("numberOfColorsr") )
numCl = CLNG( request("numberOfColorsl") )
qty = CLNG( request("quantityOrdered") )
%>
<%
dim total
Dim colorPriceTable
colorPriceTable =Array(_
Array(6, 12, 24, 48, 72, 144, 288, 500, 1000, 2001, 999999),_
Array(4, 2.5, 1.6, 1.15, 1.1, .9, .75, .65, .6, .55, .5),_
Array(7, 3.1, 2.45, 1.9, 1.5, 1.35, 1, .85, .8, .7, .65),_
Array(8.5, 4, 3, 2.85, 1.95, 1.65, 1.45, 1.3, 1, .85, .8),_
Array(10.5, 4.7, 3.6, 3.45, 2.35, 1.9, 1.7, 1.6, 1.3, 1, .9),_
Array(12, 5.4, 4.25, 4.05, 2.75, 2.2, 1.95, 1.9, 1.5, 1.15, 1),_
Array(13, 6.3, 5.05, 4.75, 3.35, 2.7, 2.35, 2.2, 1.7, 1.3, 1.1)_
)
%>
<%
priceRow = colorPriceTable(numC)
priceRowb = colorPriceTable(numCb)
priceRowr = colorPriceTable(numCr)
priceRowl = colorPriceTable(numCl)
qtyRow = colorPriceTable(0)
For col = 0 To UBound(qtyRow)
If qty < qtyRow(col) Then
unitPrice = priceRow(col)
unitPriceb = priceRowb(col)
unitPricer = priceRowr(col)
unitPricel = priceRowl(col)
Exit For
End If
Next
total = ((((unitPrice * qty) +(unitPriceb * qty) +(unitPricer * qty) + (unitPricel * qty) + (style * qty) + (.25 * qty))* 1.54) + (numC * 22))
if style = 1.98 then
styletemp = "Beefy-T"
elseif style = 1.99 then
styletemp = "T-Shirt 1"
end if
%>
Thanks for You Help :)
|