SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    Life is not a malfunction gold trophysilver trophybronze trophy
    TechnoBear's Avatar
    Join Date
    Jun 2011
    Location
    Argyll, Scotland
    Posts
    6,421
    Mentioned
    273 Post(s)
    Tagged
    5 Thread(s)

    Loan Calculator Script Required

    I'm looking for a loan calculator script to use on a site. I've come across a few, but I need this to work the opposite way round to a typical calculator. On the ones I've seen, you input the amount you want to borrow and the repayment period, and it calculates the total interest and the amount of the weekly or monthly instalments. What I need is one which allows you to input the amount of the weekly or monthly instalment, specify whether that's including or excluding interest, and the script calculates the period of the loan and the total interest payable. (Having two calculators - one for amount including interest and one for amount excluding interest would be fine, if that's easier. )

    Any ideas?

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,319
    Mentioned
    462 Post(s)
    Tagged
    8 Thread(s)
    It may be better to get someone to write a script that does specifically what you want. Presumably this is for a client that will be paying?

  3. #3
    Life is not a malfunction gold trophysilver trophybronze trophy
    TechnoBear's Avatar
    Join Date
    Jun 2011
    Location
    Argyll, Scotland
    Posts
    6,421
    Mentioned
    273 Post(s)
    Tagged
    5 Thread(s)
    Quote Originally Posted by ralph.m View Post
    It may be better to get someone to write a script that does specifically what you want.
    I rather thought that might be the case.
    Quote Originally Posted by ralph.m View Post
    Presumably this is for a client that will be paying?
    Unfortunately, no. It's for a very small non-profit, and I'm working on the site pro bono, as they can't afford to pay me, never mind somebody to write a script. Hence my question.

  4. #4
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,869
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Interest calculations involve five things - amount borrowed, repayment amount, repayment frequency, repayment period and interest rate. To calculate any one you need to have the other four. From your original post it sounds like you want it to be able to calculate two of them given the other three which isn't possible.

    I already have two different loan calculators at http://www.felgall.com/jstip100.htm and so could probably add a third without too much trouble provided that it is clearly defined as to which four of the five need to be entered and which of the five is to be calculated.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  5. #5
    Life is not a malfunction gold trophysilver trophybronze trophy
    TechnoBear's Avatar
    Join Date
    Jun 2011
    Location
    Argyll, Scotland
    Posts
    6,421
    Mentioned
    273 Post(s)
    Tagged
    5 Thread(s)
    Thanks for the reply, Stephen. There are basically four options people can choose. In order of popularity, these are:
    1. Borrow X, repay (Y+interest) each week e.g. Borrow 200, repay 5 + interest per week.
    2. Borrow X, repay Y (including interest) per month e.g. Borrow 500, repay 50 total principal and interest each month
    3. Borrow X, repay (Y+interest) per month
    4. Borrow X, repay Y (including interest) per week

    In 1 and 3, the period of the loan is easy to calculate - X/Y weeks/months. In 2 and 4, it's more problematic. The interest rate is 1% per 30 day month, APR 12.68%.

    The purpose of having the calculator on the website is to give people an indication of how much interest they would pay over the period of a loan, to show how affordable these rates are by comparison with others. Even having a calculator that only deals with option 1 would be a significant improvement on what we have now.

  6. #6
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,869
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    I have just uploaded a loan period calculator (PHP and JavaScript) to http://www.felgall.com/scripts/loanpay.php

    If you make the interest rate a hidden field with value="12.68" and just have two radio buttons for monthly (with value="12.167") and weekly (with value="52.143") then you would have your options 2 and 4 covered.

    If you set the interest rate to zero it would calculate the periods for options 1 and 3 but would not calculate the additional amounts required to be paid to cover the interest.

    The full code (including my other two loan calculators) can be downloaded from http://www.felgall.com/scripts/loan.zip

    Each of these calculators uses JavaScript for the calculation if JavaScript is enabled and reloads the page using PHP to do the calculation if JavaScript is disabled.

    Hope that this helps.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  7. #7
    Life is not a malfunction gold trophysilver trophybronze trophy
    TechnoBear's Avatar
    Join Date
    Jun 2011
    Location
    Argyll, Scotland
    Posts
    6,421
    Mentioned
    273 Post(s)
    Tagged
    5 Thread(s)
    Thank you very much - that's great.

  8. #8
    SitePoint Member
    Join Date
    Sep 2013
    Location
    NY USA
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post

    Iam A Owner of a financial site. I will suggest you to use Microsoft Excel for Loan & interest rate calculation. Its very easy, Use the Basic Laws of Financial Calculation like Annuity Calculation ruls or interest rate calculation. Than You can easily Find out the results. Its Realy Effective Than using other Software, Its My Personal Suggestion.

    <snip>
    Last edited by ralph.m; Sep 12, 2013 at 16:09. Reason: removed promotional link


Bookmarks

Posting Permissions

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