Solved

Creating this in VBscript

Posted on 2004-04-11
11
463 Views
Last Modified: 2009-12-16
IF someone could be nice enough. I need a calculator made in VBscript that can calculate the amount of a loan a payment can take.


For example, if you can pay for a mortgage $850.00US a month with a 30 year 7.5% interest rate your loan should be the amount of $107,263.22

So I need a formula that can find out how far a payment can go for a loan  (like the above example) but from there I need to subtract condo fees, PMI, and monthly taxes and then determine the amount of the loan.

Below I pasted my html code so the experts can take a look at it.

<html>

<head>
<title>New Page 2</title>
</head>

<body>

<form method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" U-File="file:///C:/My Documents/My Webs/_private/form_results.csv" S-Format="TEXT/CSV" S-Label-Fields="TRUE" --><table border="1" cellpadding="2" style="border-collapse: collapse" bordercolor="#111111" width="759">
<tr>
<td width="50%" colspan="2">
<p align="center">Input Information </td>
<td width="50%" colspan="2">
<p align="center">Out put Information </td>
</tr>
<tr>
<td width="25%">
<p align="right">Term of the loan:</td>
<td width="25%"><input type="text" name="T1" size="20"></td>
<td width="25%">
<p align="right">Monthly Payment on Loan:</td>
<td width="25%"><input type="text" name="T8" size="20"></td>
</tr>
<tr>
<td width="25%">
<p align="right">Interest Rate:</td>
<td width="25%"><input type="text" name="T2" size="20"></td>
<td width="25%">
<p align="right">Monthly Taxes:</td>
<td width="25%"><input type="text" name="T9" size="20"></td>
</tr>
<tr>
<td width="25%">
<p align="right">Yearly tax:</td>
<td width="25%"><input type="text" name="T3" size="20"></td>
<td width="25%">
<p align="right">Monthly Condo Fees:</td>
<td width="25%"><input type="text" name="T10" size="20"></td>
</tr>
<tr>
<td width="25%">
<p align="right">Monthly Condo fees:</td>
<td width="25%"><input type="text" name="T4" size="20"></td>
<td width="25%">
<p align="right">PMI Payments:</td>
<td width="25%"><input type="text" name="T11" size="20"></td>
</tr>
<tr>
<td width="25%">
<p align="right">PMI Payments:</td>
<td width="25%"><input type="text" name="T7" size="20"></td>
<td width="25%" bgcolor="#FF9999">
<p align="right">Total monthly Payment:</td>
<td width="25%" bgcolor="#FF9999"><input type="text" name="T12" size="20"></td>
</tr>
<tr>
<td width="25%">
<p align="right">Down Payment:</td>
<td width="25%"><input type="text" name="T13" size="20"></td>
<td width="25%">
<p align="right">Loan Amount:</td>
<td width="25%"><input type="text" name="T14" size="20"></td>
</tr>
<tr>
<td width="25%">
<p align="right">Desirable payment:</td>
<td width="25%"><input type="text" name="T6" size="20"></td>
<td width="25%">
<p align="right">Property Amount:</td>
<td width="25%"><input type="text" name="T15" size="20"></td>
</tr>
<tr>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%">&nbsp;</td>
<td width="50%" colspan="2">
<p align="center"><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></td>
<td width="25%">&nbsp;</td>
</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
</form>

</body>

</html>

0
Comment
Question by:eteran
  • 5
  • 5
11 Comments
 
LVL 2

Expert Comment

by:rqs
Comment Utility
Correct me if I am wrong, but it seems that aside from requesting for a vbscript
to calculate how far a payment can go for a loan, you also request the experts to suggest
a formula for calculating this value given monthly mortgage?

If I am wrong, then please post the formula for making the computations, as it
would be easier to map that logic into a VBscript function.
0
 

Author Comment

by:eteran
Comment Utility
That is what I usae in VBA
La = PV((rate * 0.01) / 12, term * 12, DP1 - (man + (tax / 12)))
0
 
LVL 2

Expert Comment

by:rqs
Comment Utility
Ok, you have VBA code for computing the value already.
That would be quick to translate to VBScript.

However, from the line of code you posted, the logic for computing
the loanable amount is still hidden in the function PV,
the parameters of which are:
a) (rate *0.001)/12   --> (i.e rate = 7.5%)
b) term *12              --> (i.e. term = 30 years)
c) DP1 - (man + (tax/12))               --->(what does DP1 stand for, downpayment 1?
--> (so this is monthly amortization amount, like $ 850.00)
-->
0
 
LVL 2

Expert Comment

by:rqs
Comment Utility
Ok, you have VBA code for computing the value already. That can be translated for use in VBScript.
However, from the line of code you posted, the logic for computing the loanable amount is still hidden
in the function PV. Please also post the code of this function.

Regarding the parameters of PV, i have some clarifications:
a) (rate *0.001)/12   --> (i.e rate = 7.5%)
b) term *12              --> (i.e. term = 30 years)
c) DP1 - (man + (tax/12))               -->(what does 'DP1' stand for, downpayment 1 or desirable payment?
                                                    -->(so 'man' stands for monthly amortization amount, like $ 850.00)
                                                    -->('tax' isn't the tax rate, right? it's the amount in dollars of tax to be paid every year?)

you mentioned about condo fees, PMI and monthly taxes. How do those get into the picture? They don't seem to
be integrated with the call to the function PV. From your HTML form my guess is they're simply added together
with the monthly loan payment (to get an idea of wether the applicant can actually pay considering other
fees he has to pay monthly).

If you can give me a clearer idea of the flow and processing of data on the HTML form, I believe I
can help you with this.





0
 

Author Comment

by:eteran
Comment Utility
Here is a link to how PV works. I hope it can help.
Also, About the PMI. if you download the Html I pasted you will see the PMI and condo fee info.
So lets say someone tells you I can only pay $1,200.00 for my condo... From there I would have to deduct the condo fees, PMI and  taxes. Let say con fee where 150 and taxes 100 and PMI 60 then the amoiunt that would go into the PV would be  $890.00 for just my loan. I hope this helps and thanks guys.

http://vms.cc.wmich.edu/~harikb/econ319/319CHAP06/sld017.htm
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:eteran
Comment Utility
Anyone
0
 
LVL 6

Accepted Solution

by:
DominicCronin earned 500 total points
Comment Utility
Do you have Excel on the machine in question? If so, it's fairly simple to write a VBS that uses Excel to do the heavy lifting. Heck - the only reason anyone would write this sort of calculation in "longhand" is if it's been handed out as a college assignment.
0
 

Author Comment

by:eteran
Comment Utility
No, and the language would be VBscript
0
 
LVL 2

Expert Comment

by:rqs
Comment Utility
Hi eteran,
Hmmmm.... I checked on the link you gave, they appear to be lecture notes. I hope it's not indeed an assignment.
Please be reminded that Experts are not allowed to answer assigments for students.

However, if you had already done this sort of program in VBA or VB in another application, and just
wish to create an online version (perhaps to allow agent to access the loan calculator from the web and save it
to a central database, for whatever purposes), it would not be that complex a problem. The Experts can guide you
on how to do the "translation" of your existing code to VBScript so that it will work with a web browser.
0
 

Author Comment

by:eteran
Comment Utility
No it isw not a school chrage.
0
 
LVL 2

Expert Comment

by:rqs
Comment Utility
Hi eteran,

I hope you don't mind me asking. You accepted DominicCronin which was an Excel/VBS solution
when in the first place, what you have stated to be seeking is a VBScript/HTML solution?
Ofcourse, that path would be an easy alternative if the only objective was simply
how to find a way to automatically compute your PV values.




0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

A short article about a problem I had getting the GPS LocationListener working.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now