Important alert: (current site time 7/16/2013 6:51:47 AM EDT)
 

VB icon

Vehicle Lease Overage Calculator

Email
Submitted on: 7/11/2001 12:31:51 PM
By: Tony Weeg 
Level: Beginner
User Rating: By 2 Users
Compatibility: Cold Fusion 4.5
Views: 11804
author picture
(About the author)
 
     It gives the user the amount of money it will cost if the lease on his/her vehicle were up today, how much it would cost for miles over the yearly limit.

 
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
//**************************************
// for :Vehicle Lease Overage Calculator
//**************************************
Please email me and let me know if you use this code, or any portion of it on any website. Please be nice :)
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
//**************************************
// Name: Vehicle Lease Overage Calculator
// Description:It gives the user the amount of money it will cost if the lease on his/her vehicle were up today, how much it would cost for miles over the yearly limit.
// By: Tony Weeg
//
// Inputs:Date of purchase, Miles driven, Allowable miles per year, Cost per mile over limit
//
// Returns:Days since purchase, allowable miles per day, miles your car should be on, miles over the limit, cost you would incur if lease were up today
//
//This code is copyrighted and has// limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=13&lngWId=9//for details.//**************************************

<html>
<!--- This code was written to test some of CF's Math Capabilities --->
<!--- by Tony Weeg of Navtrak.Net - A Wireless Vehicle Location and Mobile Data Company --->
<!--- Its really not that interesting or cool, but may be useful for a client
or on some website somewhere. Hey if you use it, or any portion of it, just
send me an email and let me know where. thanks.....tony 
my email address is tony@navtrak.net--->
<head>
	<TITLE>tonys lease overage cost calculator</TITLE>
</head>
<body bgcolor="#000000">
<cfparam name="step" default="none">
<span style="font-family:Tahoma;font-size:18px;color:silver">
<b>tony's lease mile overage cost calculator.</b>
<br>
<cfif isDefined("error")><cfoutput><b style="color:Yellow">#error#!</b></cfoutput></cfif>
<form method="post" action="mileage.html">
date of purchase: (mm-dd-yyyy)<br>
<input type="text" name="startDate" size="15" value="01-26-2001" onFocus="this.value='';"><BR>
enter miles driven here:<br>
<input type="text" name="miles" size="15" tabindex="1"><BR>
miles per year:<br>
<select name="MilesPerYear" tabindex="2">
<option value="15000" SELECTED>15,000
<option value="12000">12,000
<option value="10000">10,000
</select><br>
cost per mile over:<br>
<select name="CostPerMile" tabindex="3">
<option value=".08" SELECTED>.08 cents
<option value=".07">.07 cents
<option value=".06">.06 cents
<option value=".05">.05 cents
<option value=".04">.04 cents
<option value=".03">.03 cents
<option value=".02">.02 cents
<option value=".01">.01 cent
</select><P>
<input type="submit" value="Begin Calculation" tabindex="4"><P>
<input type="hidden" name="step" value="2">
</form>
<cfif step EQ 2>
<cfset MilesPerDay=#MilesPerYear# / 365>
<cfset costPerMileOver="#CostPerMile#">
<cfif NOT isDate(#startDate#)>
<cflocation url="mileage.html?step=none&Error=You Must Specify A Date">
</cfif>
<cfif NOT isNumeric(#miles#)>
<cflocation url="mileage.html?step=none&Error=You Must Specify Miles Driven">
</cfif>
<cfset todaysDate="#DateFormat(Now(),'mm-dd-yyyy')#">
<cfset DaysSincePurchase="#DateDiff('d','#startDate#','#todaysDate#')#">
<cfset MilesDifference=#Miles# - (#MilesPerDay# * #DaysSincePurchase#)>
<cfset Cost=#MilesDifference# * #costPerMileOver#>
<cfset ShouldBeHowManyMiles=#DaysSincePurchase# * #MilesPerDay#>
<cfoutput>
<table width="400" cellpadding="3" cellspacing="0" border="1" bordercolor="##0080FF">
<tr>
<td bgcolor="white"><b style="font-family:Tahoma;font-size:12px;color:RoyalBlue">Days Since Purchase:</b></td>
<td bgcolor="DodgerBlue"><b style="font-family:Tahoma;font-size:12px;color:White">#DaysSincePurchase# days</td>
</tr>
<tr>
<td bgcolor="white"><b style="font-family:Tahoma;font-size:12px;color:RoyalBlue">Allowable Miles Per Day:</b> </td>
<td bgcolor="DodgerBlue"><b style="font-family:Tahoma;font-size:12px;color:White">#MilesPerDay# miles</td>
</tr>
<tr>
<td bgcolor="white"><b style="font-family:Tahoma;font-size:12px;color:RoyalBlue">Should Be On:</b></td>
<td bgcolor="DodgerBlue"><b style="font-family:Tahoma;font-size:12px;color:White"> #ShouldBeHowManyMiles# miles</td>
</tr>
<tr>
<td bgcolor="white"><b style="font-family:Tahoma;font-size:12px;color:RoyalBlue">Miles Over:</b></td>
<td bgcolor="DodgerBlue"><b style="font-family:Tahoma;font-size:12px;color:White"> #MilesDifference# miles</td>
</tr>
<tr>
<td bgcolor="white"><b style="font-family:Tahoma;font-size:12px;color:RoyalBlue">Cost Today:</b></td>
<td bgcolor="DodgerBlue"><b style="font-family:Tahoma;font-size:12px;color:White"> #DollarFormat(Cost)#</td>
</tr>
</table>
</cfoutput>
</cfif>
</span>
</body>	
</html>


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.