Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.

# Thread: Looking for Instant price quote script for my site

1. ## Looking for Instant price quote script for my site

I have been searching the net for either and ASP, Java or ASP.net script that will allow me to put a form for customers to get an instant shipping quote.

We are a small Freight shipping company and would require the custoer to input the following fields:

Origin Zip code
Destination Zip code
Shipment wieght
Type of shipment

They the distance would need to be calculated between zip codes, and a math function would need to occur in the script to multiply the distance by a given \$ per mile to give the quoted price.

Anyone know where I can atleast fine a simular script that I can probably modify?

2. What is the calculation for it? ex. result = ((value1*value2-value3)/350)*value4.

3. BarrMan,

I think you got the idea... it would be somthing like
Distance * Cost Per Mile = Quoted amount.

But first the script must calculate the distance between two Zip codes.

I've had no luck trying to find anything close to this type of script.

All and any help is appriciated.

4. I'm not sure if i'm right, but i looked at w3schools and i got an idea for you:
Code:
function calDistance(zip1,zip2)
{
distance = zip1*zip2//Or whatever calculation needed.
}
function calQuotedPrice(distance,costPerMile)
{
quotedPrice = distance*costPerMile
Return quotedPrice
}
<%
response.write quotedPrice
%>
Hope that helped, if not, try posting this problem on the javascript forum or try looking at www.w3schools.com.

5. BarrMan

You have given me a place to start, thats better than I've gotten so far. I'll look at it and post back what I've gotten so far.

Thanks

6. I have found a free sample code for calculating distance between zip codes using lat and long's. I also have a zip code database which I can not attach dues to size. But the fields are ZIP, LAT, LON, CITY, STATE, COUNTRY.

at this pont I just need the script to take the "To" and "From" Zip code information from the form and calculate the distance. attached is the form, and Code.

FYI - At the bottom of this code already has a "Demo" out put response.write Need help in making this work, then later I can add additional functions to it.

Code:
<%

'  This routine calculates the distance between two points
' (given the  latitude/longitude of those points). It is being
'used to calculate  distance between two ZIP Codes or Postal
'Codes using our    ZIPCodeWorld(TM) and PostalCodeWorld(TM)
' products. IAM USING ACCESS DB - ZIPBASE.MDB
'Definitions
'    South latitudes are negative, east longitudes are
'positive

'  Passed to function
'lat1, lon1 = Latitude and Longitude of point 1
'(in decimal degrees)
'lat2, lon2 = Latitude and Longitude of point 2
'(in decimal degrees)
'unit = the unit you desire for results
'where 'M' is statute miles (default)
''K' is kilometers
'N' is nautical miles
''United States ZIP Code/ Canadian Postal Code databases with
'latitude & longitude are available at

'Hexa Software Development Center

Dim strInputSearch 'Variable for the search word
Dim strCon 'Holds the string to connect to the db
Dim adoCon 'Database Connection Variable Object
Dim strSQL 'Holds the SQL query for the database
Dim rsSearch 'Holds the search recordset

'This is the variable that has the search word
strInputSearch = Request.Form("txtSearch")

If len(strInputSearch) >= 4 Then
'This makes it so people cant inject SQL code and/or cause some unwanted

strInputSearch = Replace(strInputSearch,"'", "''", 1, -1, 1)

'This sets the connection

'This is the connection string
strCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ="   &Server.MapPath("zipbase.mdb")

'Open the connection

'Set the database connection

'This is the SQL statement for searching. You will need to change tblTable and Field to match your database (they are in red)
strSQL = "SELECT * FROM Zip_Code WHERE zip LIKE '%" & strInputSearch &"%';"

'Opens the database so we can get the results of the search
'

const pi = 3.14159265358979323846

Function distance(lat1, lon1, lat2, lon2, unit)
Dim theta, dist
theta = lon1 - lon2
dist = acos(dist)
distance = dist * 60 * 1.1515
Select Case ucase(unit)
Case "K"
distance = distance * 1.609344
Case "N"
distance = distance * 0.8684
End Select
End Function

'
'  This function get the arccos function from arctan function
'
acos = pi
End If
End function

'
'  This function converts decimal degrees to radians
'
deg2rad = cdbl(Deg * pi / 180)
End Function

'
'  This function converts radians to decimal degrees
'
End Function

'Demo
response.write distance(32.9697, -96.80322, 29.46786, -98.53506, "M") & " Miles<br>"
response.write distance(32.9697, -96.80322, 29.46786, -98.53506, "K") & " Kilometers<br>"
response.write distance(32.9697, -96.80322, 29.46786, -98.53506, "N") & " Nautical Miles<br>"

%>

7. I don't really know how to do it... but i can advice you that:
make a map of the world and define your location point and the destined locations, then everytime someone selects a country it'll match from your location straight with a line to the selected country (if it's a flight, if not tell me and i'll think of something else), and then you can set the line prices:
every 1 cm = 50\$(1 cm can be thousands of killometters).

Hope that helps you.

Maybe you can do it with javascript.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•