Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 28th, 2007, 08:51 PM
Registered User
Join Date: Feb 2007
Location: elk grove, ca, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Calculation using if...then...else statement


I'm Trying to find out if ASP calculation can be used with if...then...else statement. Did few changes but when trying to open the file it would not let me. Trying to do is these "if (T) > (S-T) then (T) else (S-T)". T = transportation & S = shipping charge. I do not have experienced of this but I want to learn more as I go along with it.

Current Cart Value: $9.00
Shipping Charge: $
Total: $
Shipping Method Transportation Shipping Charge
UPS Ground USA $5.00 $5.81
UPS 3 Day Select $10.00 $11.62
UPS 2nd Day Air $25.00 $28.24
UPS 2nd Day Air AM $25.00 $28.24
UPS Next Day Air $55.00 $59.68

        <Title><%=sWebSiteName%> - Shipping Calculator</title>

    <body class="siteNav3TD">
        Shipping Calculator
        <table width="450" cellspacing="5" cellpadding="0" border="0">
                <td width="425">
                    <form name="frmShip" method="post" action="<%=sNonSecurePath%>shipcalculator.asp?Cart Id=<%=sCartId%>" onSubmit="return ZipCode_validate('<%=bUseDestZone%>');">
                        <table width=425>
                                <td width=125> Zipcode: </td>
                                <td width=300><input tabindex="1" type="text" size="15" maxlength="15" name="zipcode" value="<%=sZipCode%>" Class="Content"></td>
                            <%If bUseDestZone Then%>
                                    <td width=125> City: </td>
                                    <td width=300><input tabindex="2" type="text" size="15" maxlength="40" name="City" value="<%=sCity%>" Class="Content">(Only for United States)</td>
                                    <td width=125> State: </td>
                                    <td width=300><input tabindex="3" type="text" size="15" maxlength="25" name="State" value="<%=sState%>" Class="Content">(Only for United States)</td>
                                <%If Not rsCountries.Eof Then%>
                                    <td width=125>Country:</td>
                                    <td width=300>

                                        <select name="COUNTRY" size="1" tabindex="4" Class="Content"><%
                                            Do While Not rsCountries.Eof
                                                If rsCountries("COUNTRY_NAME") = sCountry Then
                                                    Response.Write "<option value='" & rsCountries("COUNTRY_NAME") & "' selected>" & rsCountries("COUNTRY_NAME") & "</option>"
                                                Elseif rsCountries("COUNTRY_NAME")="UNITED STATES" And sCountry="" Then
                                                    Response.Write "<option value='" & rsCountries("COUNTRY_NAME") & "' selected>" & rsCountries("COUNTRY_NAME") & "</option>"
                                                    Response.Write "<option value='" & rsCountries("COUNTRY_NAME") & "'>" & rsCountries("COUNTRY_NAME") & "</option>"
                                                End if

                                <%End if
                            End if%>
                                 <td width=125 >Address type:</td>

                                    <select name="RESI" tabindex="5" Class="Content">
                                         <option value = "0">Please select address type</option>
                                         <option value = "F" <%If sAddressinfo = "F" Then%>selected<%End If%>>Business</option>
                                         <option value = "T" <%If sAddressinfo = "T" Then%>selected<%End If%>>Residential</option>

                            <%If objShoppingCart.IsCODEnabled(sConnectionString,sCa rtId) Then%>
                                 <td width=125 >COD Fee:</td>
                                 <td><INPUT type="checkbox" name="ISCOD" tabindex="6" <% If bIsCOD Then %> checked <%End if%>>
                            <%End if%>
                            <tr><td>Â </td><td> <a tabindex="7" href="#" onClick="ZipCode_validate('<%=bUseDestZone%>');ret urn false;"> <img src="images/go.gif" border="0"></a></td></tr>
                        <br>To calculate your shipping charge, enter the ZipCode. Then, select the carrier of your choice.

        <%If (Trim(sCountry) <> "" OR Trim(sZipcode) <> "") Then
            If Not rsDeliveryMethod.Eof Then
                If rsDeliveryMethod("AMOUNT") > 0 OR rsDeliveryMethod("FREE_SHIPPING") = "T" Then
                    If sZipCode = "" Then%>
                            <b>Shipping methods available for the country "<%=Trim(sCountry)%>".</b>
                            <b>Shipping methods available for the zipcode "<%=Trim(sZipCode)%>".</b>
                    <%End if%>

                    <form name="frmCost">
                        <table border="0" cellspacing="0" width="600" cellpadding="5">
                                <td colspan="4">
                                    <table border="0" cellspacing="0" width="450" cellpadding="5">
                                            <td>Current Cart Value: </td>
                                            <td><%= sCurrSymbol & Formatnumber(sCartTotal,2)%><%If bAddCurrExists Then%> (<%=sAdditionalCurrencySymbol%><%=Formatnumber(sCa rtTotalInAddCurr,2)%>)<%End If%></td>
                                            <td>Shipping Charge:</td>
                                            <td><%=sCurrSymbol%><input type="text" name="shipprice" value=<%=FormatNumber(rsDeliveryMethod("AMOUNT"),2 )%> size="10" readonly onfocus = "this.blur()" class=content><%If bAddCurrExists Then%> <%=sAdditionalCurrencySymbol%>Â Â <input type="text" name="shipprice_add_curr" value=<%=FormatNumber(rsDeliveryMethod("ADD_CURR_A MOUNT"),2)%> size="10" readonly onfocus = "this.blur()" class=content><%End If%></td>
                                            <td><%=sCurrSymbol%><input type="text" name="total" size="10" value=<%=FormatNumber((cdbl(rsDeliveryMethod("AMOU NT"))) * (cdbl(sCartTotal),2))%> readonly onfocus = "this.blur()" class=content><%If bAddCurrExists Then%> <%=sAdditionalCurrencySymbol%>Â Â <input type="text" name="total_add_curr" size="10" value=<%=FormatNumber((cdbl(rsDeliveryMethod("ADD_ CURR_AMOUNT")) * cdbl(sCartTotalInAddCurr)),2)%> readonly onfocus = "this.blur()" class=content><%End If%></td>
                                <td>Shipping Method</td>
                                <%If bIsCOD Then%>
                                <td><span class="ContboldRd">COD Fee</span></span></td>
                                <%End if%>
                                <td>Shipping Charge</td>
                            <%iIndex = 1
                            Do While Not rsDeliveryMethod.Eof%>
                                        <input type="radio" name="radsel" value="<%=FormatNumber(rsDeliveryMethod("AMOUNT"), 2,,,0)%>*<%=FormatNumber(rsDeliveryMethod("ADD_CUR R_AMOUNT"),2,,,0)%>" <%If iIndex=1 Then%>Checked<%End If %> onClick="ShipCharge_Calculate(<%=Application("loca le")%>);">
                                    <td><span class="Contsmall"><%=sCurrSymbol & FormatNumber(rsDeliverymethod ("TRANSPORTATION"))%><%If bAddCurrExists Then%> (<%=sAdditionalCurrencySymbol & FormatNumber(rsDeliverymethod("ADD_CURR_TRANSPORTA TION"),2)%>)<%end if%></span></td>
                                    <%If bIsCOD Then%>
                                        <td><span class="Contsmall"><%=sCurrSymbol & FormatNumber(rsDeliverymethod ("CODFEE"))%><%If bAddCurrExists Then%> (<%=sAdditionalCurrencySymbol & FormatNumber(rsDeliverymethod("ADD_CURR_CODFEE"),2 )%>)<%end if%></span></td>
                                    <%End if%>
                                    <td><%=sCurrSymbol & FormatNumber(rsDeliveryMethod("AMOUNT"),2)%> <%If bAddCurr < bAddCurr-(rsDeliveryMethod("AMOUNT"),2) Then%> (<%=sAdditionalCurrencySymbol & FormatNumber(rsDeliverymethod("ADD_CURR_AMOUNT"),2 )%>)<% ELSE (bAddCurr-(rsDeliveryMethod("AMOUNT"),2)) = sAdditionalCurrencySymbol & FormatNumber(rsDeliverymethod("ADD_CURR_AMOUNT"),2 )%> <%end if%></td>
                                iIndex = iIndex + 1
                            <tr><td colspan="4">Note: The charges listed are estimates. Actual shipping charges will be calculated during the checkout process.</td></tr>
                    <Script language=javascript >
                    No shipping method is available for the selected criteria.
                <%End If
                No shipping method is available for the selected criteria.
            <%End If
        End If%>
        <a href="#" onClick="window.close();return false;"><img src="images/close.gif" border="0" tabindex="8" alt="Close"></a>

    <script language="javascript">
        if((navigator.userAgent.toUpperCase().indexOf("MAC ") != -1) && (navigator.userAgent.toUpperCase().indexOf("GECKO" ) == -1))

  #2 (permalink)  
Old February 28th, 2007, 09:07 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons

This is the wrong forum, you should be posting in the classic forum. Likewise posting that much code isn't bound to get you much help as none of use are going to copy it, paste it, and see what happens. Paste your problemmatic code that is pertienent to your question.

To answer your question though, if you do something like

If (2 + 3) < (2 + 4) then

End if

Yes that will work.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
================================================== =========
Why can't Programmers, program??
================================================== =========
  #3 (permalink)  
Old March 7th, 2007, 07:29 PM
Authorized User
Join Date: Mar 2007
Location: , , .
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts

if (T) > (S-T) then (T) else (S-T)".
T = transportation & S = shipping charge.

sub doIt()
  dim myReturnValue as integer
  myReturnValue = getHigher(shippingCost,Transportation)
end sub

private function getHigher(s as integer,t as integer) as integer
  if t > (s - t) then
     return t
     return s - t
  end if
end function


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculation dillemma.... cuzintone SQL Language 0 April 7th, 2005 03:59 PM
Calculation Grantm Access 3 February 16th, 2004 10:14 AM
Calculation in Report lryckman Access 2 February 10th, 2004 08:44 AM
Skewness calculation in SQL statement akmhasan Oracle 0 July 13th, 2003 04:27 AM

All times are GMT -4. The time now is 10:32 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.