Code Bank
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingCode Bank

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 2nd, 2004, 11:06 PM
Activexcode Activexcode is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 2 Activexcode User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Calculate sales tax and employee discount on form

I have a form called "cash register".

The fields are to be executed in the following, EXACT sequence:

1) Retail Price (user types in a price)
2) Use Employee Discount? (user checks it to apply a 25% discount to the retail price; leaves it unchecked if he is not entitled to a discount)
3) Location (drop-down box contains Delaware, New Jersey, PA and PA-Philadelphia) - user selects his state to generate respective state tax
4) Calculate Total (user clicks to generate total price)

I need help getting this code to calculate. Please review and correct my syntax. Thanks for your expertise!


<html>
<head>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<title>Cash Register</title>
</head>
<body>

<%
DIM retailprice, location, employeediscount, calculatetotal, runningtotal
retailprice = request.form("retailprice")
location = request.form("location")
employeediscount = request.form("employeediscount")'This is a checkbox variable.
calculatetotal = request.form("calculatetotal")
runningtotal = retailprice
'Use commands to view variables at top of page:
response.write("retail price is: " & retailprice & "<br/>")
response.write("location is: " & location & "<br/>")
response.write("runningtotal is: " & runningtotal & "<br/>")

if employeediscount = "on" then
runningtotal = retailprice * (1 - .25)
else runningtotal = retailprice
end if
calculatetotal = (location * retailprice)+ retailprice
response.write("Total amount due is $" & calculatetotal & "<br/>")

%>
<form method= "post" action= "CashRegister.asp">

<h4>Retail Price:</h4>
<input type="text" name="Retail Price" value="<% =retailprice%>"<br/>
<h4>Use Employee Discount?:</h4>
<input type ="checkbox" name="Employeediscount" value ="checkbox"/><br/>
<h4>Location (for sales tax):</h4>
<select name= "Location">
<option value="0">Delaware</option>
<option value=".06">New Jersey</option>
<option value=".06">Pennsylvania</option>
<option value=".07">PA - Philadelphia</option>
</select>
<p>
<input type= "submit" value="Calculate Total"/>
</form>

</body>
</html>

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingCode Bank > Calculate sales tax and employee discount on form


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT