Webforumz's RSS FeedRSS Webforumz RegistrationRegister Contact Webforumz StaffContact

subtotals and totals

This is a discussion on "subtotals and totals" within the Classic ASP section. This forum, and the thread "subtotals and totals are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Jul 25th, 2006, 15:35
New Member
Join Date: Jul 2006
Location: Toronto
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
subtotals and totals

Hi:

I have the following variables which I would like to get a sub total for. How do I create a variable for subtotal and store the result in the sub total.

SystemAccessFee+ActivationFee+NineOneOneEmergencyF ee+<%=(sGST_HSTRate/100)*7%>+<%=(sPSTRate/100)*7%>

thanks,
aspkid123
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2  
Old Jul 26th, 2006, 11:33
Rob's Avatar
Rob Rob is offline
Webforumz Founder

SuperMember
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,189
Blog Entries: 7
Thanks: 28
Thanked 22 Times in 19 Posts
Re: subtotals and totals

just use this:-
<%
Subtotal = (sGST_HSTRate/100)*7%>+<%=(sPSTRate/100)*7
%>
__________________
Rob - Webforumz Founder

I am currently NOT available for SEO consultancy work

My Sites: Student Midwife Forum
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Jul 26th, 2006, 23:16
New Member
Join Date: Jul 2006
Location: Toronto
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Re: subtotals and totals

Thanks for your quick reply.

Another question I have.

I have a drop down menu with both id and name tags in the html. I would like to grab the quantity (which are numbers) in the list and display the result on to the next page. Ideally I would like to store the quantity selected in a variable. There is more than one item on the page with multiple drop down menus.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Jul 27th, 2006, 00:06
Rob's Avatar
Rob Rob is offline
Webforumz Founder

SuperMember
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,189
Blog Entries: 7
Thanks: 28
Thanked 22 Times in 19 Posts
Re: subtotals and totals

use:-

<% quantity = Request.form("quantity") %>

obviously change that to the name values and repeat for the others.

This really is very very very basic ASP and should be the first thing you learn...

I would definitly recommend grabbing a good book.
__________________
Rob - Webforumz Founder

I am currently NOT available for SEO consultancy work

My Sites: Student Midwife Forum
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Jul 27th, 2006, 02:36
New Member
Join Date: Jul 2006
Location: Toronto
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Re: subtotals and totals

Thanks again for your help.

On the next page I use the below to retrieve the result? Do I have to define any variables on the results page?

<% phoneqty = Request.form("phoneqty") %>
Below is an example of the drop down menu on the selection page:
<select size="1" id="phoneqty" name="phoneqty">
<option value="phone1">1</option>
<option value="phone2">1</option>
</select>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Jul 27th, 2006, 03:05
Rob's Avatar
Rob Rob is offline
Webforumz Founder

SuperMember
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,189
Blog Entries: 7
Thanks: 28
Thanked 22 Times in 19 Posts
Re: subtotals and totals

This:-
<% phoneqty = Request.form("phoneqty") %>

That IS for the results page
__________________
Rob - Webforumz Founder

I am currently NOT available for SEO consultancy work

My Sites: Student Midwife Forum
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Jul 27th, 2006, 14:35
New Member
Join Date: Jul 2006
Location: Toronto
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Re: subtotals and totals

the items in the drop down menu are randomally generated by a variable.

i tried this code:

<% phoneQty<%=item%> = Request.form("phoneQty<%=item%>") %>

But it gave me an error page could not be displayed. Is there something wrong in the syntax.

<tr>
<td colspan=2 nowrap id="phoneSec<%=item%>" name="phoneSec<%=item%>">
<font class="smallBody">Select Quantity:</font>
<select name="phoneQty<%=item%>">
<% for i=0 to AllowedPhones%>
<option value="<%=i%>" <%if phoneQty(item)=i then%>selected<%end if%>><%=i%></option>
<%next%>
</select>
</td>
</tr>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Jul 27th, 2006, 15:15
Rob's Avatar
Rob Rob is offline
Webforumz Founder

SuperMember
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,189
Blog Entries: 7
Thanks: 28
Thanked 22 Times in 19 Posts
Re: subtotals and totals

<% execute("phoneQty" + item + " = Request.form(""phoneQty" + item +""")") %>
__________________
Rob - Webforumz Founder

I am currently NOT available for SEO consultancy work

My Sites: Student Midwife Forum

Last edited by Rob; Jul 27th, 2006 at 15:19.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Jul 27th, 2006, 16:18
New Member
Join Date: Jul 2006
Location: Toronto
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Re: subtotals and totals

I would like to take the PhoneQty variable and multiply it with the below variable which contains the price for each phone selected on the previous page. The result should be stored in a variable called PayNow for each phone selection.
$<%=CDbl(phoneSecPrice(i))*0.01%>

Could you please debug the below syntax for me:
<% PayNow = PhoneQty(item) * $<%=CDbl(phoneSecPrice(i))*0.01%> %>

How would I calculate all the PayNow values for a subtotal. Each phone may have a different price associated to it.

I would than like to calculate the tax for the pay now subtotal using the below variables.
<%=(sGST_HSTRate/100)*7%>
<%=(sPSTRate/100)*7%>

A variable for the grand total should also be displayed. PayNow Grand Total should have the sub total for all the phones, gst (tax), and pst (tax).

PayNowGrandtotal = cint(PayNow) + cint(gst) + cint(pst)
Am I close?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
subtotals, totals

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculated Totals ekendricks Databases 7 Oct 30th, 2003 15:17


All times are GMT. The time now is 09:46.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8