<%@ LANGUAGE="VBSCRIPT" %> <% Option Explicit '############################################################################## '## Module: Dealer CMS Finance calculators ## '## Version info: 1.0.0 ## '## Build date: 3:47pm Wed 20th Nov 2002 ## '## Copyright (C) 2002 T-Bone Productions ## '## ## '## Contact: http://www.t-bone.com.au ## '############################################################################## %><% dim cmdSubmit, MonthlyTermPayment dim LeaseAmount, ResidualValue, InterestRate, Years, PaymentsPerYear, PROAF dim blnErr, eobj, strMsg, strPOR '#### CONSTANTS AND INTIALISATION ################################### cmdSubmit = request("cmdSubmit") PaymentsPerYear = 12 blnErr = FALSE '# Intialise our error dictionary object set eobj = CreateObject("Scripting.Dictionary") eobj.Add "msg", "There were errors in your form, please see fields marked with *." '#### PAGE LOGIC #################################################### if cmdSubmit = "Calculate" then GetFormData() if (LeaseAmount > 0 AND ResidualValue > 0) then PROAF = (ResidualValue/LeaseAmount) ErrorCheck() if blnErr then strMsg = GetErrors(eobj) else MonthlyTermPayment = CalculateLeasePayment(LeaseAmount, InterestRate, ResidualValue, Years, PaymentsPerYear) end if end if '#### FUNCTIONS ##################################################### Sub GetFormData() LeaseAmount = CLong(request("amount")) InterestRate = CLong(request("interestrate")) Years = CLong(request("years")) ResidualValue = CLong(request("residual")) End Sub Sub ErrorCheck() if (LeaseAmount < 10000 OR LeaseAmount > 1000000) then eobj.Add "leaseamount", strArw & "The lease amount must be between $10,000 and $1,000,000" if (InterestRate < 1 OR InterestRate > 51) then eobj.Add "interestrate", strArw & "The interest rate must be between 1% and 51%" if ResidualValue < 1 then eobj.Add "residual", strArw & "Please enter a Residual amount that is greater than zero" else If (Years <= 1 AND PROAF < 0.4 OR PROAF > 0.6) then strPOR = strArw & "the RESIDUAL => 40% and <= 60% of the AMOUNT FINANCED" If (Years > 1 AND Years <= 2 AND (PROAF < 0.35 OR PROAF > 0.55)) then strPOR = strArw & "the Balloon payment => 35% and <= 55% of the AMOUNT FINANCED" & "
" If (Years > 2 AND Years <= 3 AND (PROAF < 0.2 OR PROAF > 0.45)) then strPOR = strArw & "the Balloon payment => 20% and <= 45% of the AMOUNT FINANCED" & "
" If (Years > 3 AND Years <= 4 AND (PROAF < 0.15 OR PROAF > 0.35)) then strPOR = strArw & "the Balloon payment => 15% and <= 35% of the AMOUNT FINANCED" & "
" If (Years > 4 AND Years <= 5 AND (PROAF < 0.1 OR PROAF > 0.3)) then strPOR = strArw & "the Balloon payment => 10% and <= 30% of the AMOUNT FINANCED" & "
" if strPOR <> "" then eobj.Add "residual", strPOR end if '# raise our error flag if we have error to report if eobj.Count > 1 then blnErr = TRUE End Sub '# From toyota's Spreadsheet: Pay in adv_month payment Function CalculateLeasePayment(ByRef Amount, ByRef InterestRate, ByRef ResidualValue, ByRef Years, ByRef PaymentsPerYear) dim i, arr, answer, NumberOfPayments, dollars, cents NumberOfPayments = Years * PaymentsPerYear i = InterestRate/100/12 answer = (Amount-(ResidualValue*(1+i)^-NumberOfPayments))/(((1-(1+i)^-NumberOfPayments)/i)*(1+i)) arr = split(answer, ".") dollars = arr(0) cents = left(arr(1), 2) CalculateLeasePayment = dollars & "." & cents End Function '####################################################################%>
" METHOD="POST">

Finance Calculator - Leasing

 <%=strMsg%>

Amount financed:

<%=CE("leaseamount", eobj)%>

$

Balloon Final Payment:

<%=CE("residual", eobj)%>

$

Interest Rate:

<%=CE("interestrate", eobj)%>   

%

Lease term :

<%=CE("years", eobj)%>   Year/s
 

Estimated Monthly payment:

 

$

* Denotes required field.
** Disclaimer: This calculator displays an indicative Monthly Amount Payable which does not include taxes, fees or charges which may also be payable. The interest rate you select is indicative only and not binding on Pacific Toyota. Similarly, this is not a quote or an offer for finance. Pacific Toyota accepts no responsibility for any loss arising from the use or reliance upon the calculation or information provided.
<% set eobj = nothing %>