<%@Language=VBScript%> <%Option Explicit%> <%Response.Buffer = True%> <% on error resume next Dim i, p, y, M,pn, ctr,c,h,q,t, toth, totc,e13,e14,e15,rates ctr = 1 i = round(Request.QueryString("rates"),3) rates = i p = Request.QueryString("loanamount") y = Request.QueryString("years") pn = y * 12 Function PMT(pv,rate,term) dim top, bottom, together 'rate= ((rate/200)+1)^(1/6)-1 rate = (rate * 0.01)/12 top = rate * (1 + rate)^term bottom = (1 + rate)^term -1 together = top/bottom PMT= pv * together end function if (rates <> "" and y <> "" and p <> "") then e14 = Exp(2*Log(1+(rates*0.01/2)))-1 e15 = (Exp(Log(e14+1)/(y*12))-1)*y*12 M = PMT(p,i,pn) end if Function GenerateTable() Response.Write "

Schedule Interactivo de Amortización

" Response.Write "
" Response.Write "Pagos #Pago MensualInteres MensualPrincipal mensualBalance final" Response.Write "
" do while (ctr <= pn) h = p * ((rates * 0.01)/12) c = M - h q = p - c p = q if (q > 0) then Response.Write ""& ctr &""& FormatCurrency(M,2) &""& FormatCurrency(h,2) & ""& FormatCurrency(c,2) &""& FormatCurrency(q,2) &"" else q=0 Response.Write ""& ctr &""& FormatCurrency(M,2) &""& FormatCurrency(h,2) & ""& FormatCurrency(c,2) &""& FormatCurrency(q,2) &"" end if if (ctr Mod 12 = 0) then Response.Write "
" Response.Write "Año "& ctr/12 &" Totales: "& FormatCurrency(M * 12,2) &""& FormatCurrency(toth,2) & ""& FormatCurrency(totc,2) &""& FormatCurrency(q,2) &"" Response.Write "
" toth = 0 totc = 0 end if ctr = ctr + 1 toth = toth + h totc = totc + c loop Response.Write "* Los montos son dados solo como un ejemplo, no nos hacemos responsables de la exactitud de los calculos.
" end function function writeValue() Response.Write "" Response.Write "
" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "

Sumario de Hipoteca

Numero de años:" & y & "
Taza de interes:" & rates & " %
Principal:" & FormatCurrency(p,2)& "
Pago mensual:" & FormatCurrency(M,2) & "
Pago total:" & FormatCurrency(M * 12 * y,2) & "
Total de intereses:" & FormatCurrency((M * 12 * y) - p,2) & "
" Response.Write "
" end function if err.number = 11 or err.number=13 then session("message") = "Error in calculating! Please make sure all values are numbers and try again!!" end if %> Eddie Quindamo

Pre-califique cual podria ser su pago mensual

 
<% if ((i <> "") and (p <>"") and (y <> "") and (m <>"")) then %> <%else%>

<%end if%>
<% call writeValue()%>
<% call GenerateTable() %>

Monto total del prestamo  $ (sin coma)
Amortización Años
Taza anual de interes: %
Pagos mensuales
Pago total
Costo total del interes