DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY (EXCEPT INSIDE THE DIV BELOW WITH ID=DESCRIPTION), UNLESS YOU KNOW WHAT YOU'RE DOING.
THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO AUTO UPDATE THE CONTENT THROUGH THE DOC GENERATOR.
Enter additional information related to this 'class' inside the {div} macro with 'id=description'
{column:width=80px|padding=0px}{column}{column}{column}
Constants Summary
NUMBER_UNLIMITED
The numeric constant used to identify an unlimited number of repeated events.
PERIOD_ANNUALY
The numeric constant used to identify an annual period.
PERIOD_BI_ANNUALLY
The numeric constant used to identify a bi-annual period (twice every year).
PERIOD_BI_MONTHLY
The numeric constant used to identify a bi-monthly period (twice every month).
PERIOD_DAILY
The numeric constant used to identify a daily period.
PERIOD_FOUR_MONTHLY
The numeric constant used to identify a four-monthly period (once every four months).
PERIOD_FOUR_WEEKLY
The numeric constant used to identify a four-weekly period (once every four weeks).
PERIOD_MONTHLY
The numeric constant used to identify a monthly period.
PERIOD_NONE
The numeric constant used to identify that there is no period.
PERIOD_QUARTERLY
The numeric constant used to identify a quarterly period (once every three months).
PERIOD_TWO_MONTHLY
The numeric constant used to identify a two-monthly period (once every two months).
PERIOD_TWO_WEEKLY
The numeric constant used to identify a two-weekly period (once every two weeks).
PERIOD_WEEKLY
The numeric constant used to identify a weekly period.
STARTDAY_NORMAL
The numeric constant used to identify that the same start day should be used as
the day of the month of the starting date of the event.
{column:width=80px|padding=0px}{column}{column}{column}
Method Summary
addCompoundPeriodChange(newPeriod, date)
Adds a compound period change.
addPayment(amount, date)
Adds a payment.
addPayment(amount, firstDate, lastDate, period)
Adds a payment.
addPayment(amount, firstDate, lastDate, period, number)
Adds a payment.
addPayment(amount, firstDate, lastDate, period, number, startday)
Adds a payment.
addRateChange(newRate, date)
Sets a new interest rate.
calculateAmortizationSchedule()
Calculates the amortization schedule.
getAmortizationSchedule()
Gets the amortization schedule as a JSDataSet.
getRestBalance()
Gets the rest balance after the amortization schedule.
getUnknown()
Returns the solveForUnknown value.
isValidPeriod(period)
Returns true if the period is valid, or false if the period is not valid.
roundMoney(amount)
Rounds a number up to the nearest cents.
solveForUnknown()
Returns true if successful or false if the call failed.
void
sortEvents()
Sorts the amortization events ascending by date.
{column:width=100%|padding=0px}{column}
Constants Details
The numeric constant used to identify an unlimited number of repeated events.
Sample
var c = plugins.amortization.newCalculation(); c.addPayment(500, new Date(2005, 1, 28), null, plugins.amortization.AmortizationCalculation.PERIOD_DAILY, 5, plugins.amortization.AmortizationCalculation.STARTDAY_NORMAL); var c2 = plugins.amortization.newCalculation(); c2.addPayment(300, new Date(2006, 11, 24), new Date(2006, 12, 24), plugins.amortization.AmortizationCalculation.PERIOD_BI_MONTHLY, plugins.amortization.AmortizationCalculation.NUMBER_UNLIMITED, 30);
The numeric constant used to identify an annual period.
Sample
var c = plugins.amortization.newCalculation(); c.addPayment(500, new Date(2005, 1, 28), null, plugins.amortization.AmortizationCalculation.PERIOD_DAILY, 5, plugins.amortization.AmortizationCalculation.STARTDAY_NORMAL); var c2 = plugins.amortization.newCalculation(); c2.addPayment(300, new Date(2006, 11, 24), new Date(2006, 12, 24), plugins.amortization.AmortizationCalculation.PERIOD_BI_MONTHLY, plugins.amortization.AmortizationCalculation.NUMBER_UNLIMITED, 30);
The numeric constant used to identify a bi-annual period (twice every year).
Sample
var c = plugins.amortization.newCalculation(); c.addPayment(500, new Date(2005, 1, 28), null, plugins.amortization.AmortizationCalculation.PERIOD_DAILY, 5, plugins.amortization.AmortizationCalculation.STARTDAY_NORMAL); var c2 = plugins.amortization.newCalculation(); c2.addPayment(300, new Date(2006, 11, 24), new Date(2006, 12, 24), plugins.amortization.AmortizationCalculation.PERIOD_BI_MONTHLY, plugins.amortization.AmortizationCalculation.NUMBER_UNLIMITED, 30);
The numeric constant used to identify a bi-monthly period (twice every month).
TODO: this period is not supported yet.
Sample
var c = plugins.amortization.newCalculation(); c.addPayment(500, new Date(2005, 1, 28), null, plugins.amortization.AmortizationCalculation.PERIOD_DAILY, 5, plugins.amortization.AmortizationCalculation.STARTDAY_NORMAL); var c2 = plugins.amortization.newCalculation(); c2.addPayment(300, new Date(2006, 11, 24), new Date(2006, 12, 24), plugins.amortization.AmortizationCalculation.PERIOD_BI_MONTHLY, plugins.amortization.AmortizationCalculation.NUMBER_UNLIMITED, 30);
The numeric constant used to identify a daily period.
Sample
var c = plugins.amortization.newCalculation(); c.addPayment(500, new Date(2005, 1, 28), null, plugins.amortization.AmortizationCalculation.PERIOD_DAILY, 5, plugins.amortization.AmortizationCalculation.STARTDAY_NORMAL); var c2 = plugins.amortization.newCalculation(); c2.addPayment(300, new Date(2006, 11, 24), new Date(2006, 12, 24), plugins.amortization.AmortizationCalculation.PERIOD_BI_MONTHLY, plugins.amortization.AmortizationCalculation.NUMBER_UNLIMITED, 30);
The numeric constant used to identify a four-monthly period (once every four months).
Sample
var c = plugins.amortization.newCalculation(); c.addPayment(500, new Date(2005, 1, 28), null, plugins.amortization.AmortizationCalculation.PERIOD_DAILY, 5, plugins.amortization.AmortizationCalculation.STARTDAY_NORMAL); var c2 = plugins.amortization.newCalculation(); c2.addPayment(300, new Date(2006, 11, 24), new Date(2006, 12, 24), plugins.amortization.AmortizationCalculation.PERIOD_BI_MONTHLY, plugins.amortization.AmortizationCalculation.NUMBER_UNLIMITED, 30);
The numeric constant used to identify a four-weekly period (once every four weeks).
Sample
var c = plugins.amortization.newCalculation(); c.addPayment(500, new Date(2005, 1, 28), null, plugins.amortization.AmortizationCalculation.PERIOD_DAILY, 5, plugins.amortization.AmortizationCalculation.STARTDAY_NORMAL); var c2 = plugins.amortization.newCalculation(); c2.addPayment(300, new Date(2006, 11, 24), new Date(2006, 12, 24), plugins.amortization.AmortizationCalculation.PERIOD_BI_MONTHLY, plugins.amortization.AmortizationCalculation.NUMBER_UNLIMITED, 30);
The numeric constant used to identify a monthly period.
Sample
var c = plugins.amortization.newCalculation(); c.addPayment(500, new Date(2005, 1, 28), null, plugins.amortization.AmortizationCalculation.PERIOD_DAILY, 5, plugins.amortization.AmortizationCalculation.STARTDAY_NORMAL); var c2 = plugins.amortization.newCalculation(); c2.addPayment(300, new Date(2006, 11, 24), new Date(2006, 12, 24), plugins.amortization.AmortizationCalculation.PERIOD_BI_MONTHLY, plugins.amortization.AmortizationCalculation.NUMBER_UNLIMITED, 30);
The numeric constant used to identify that there is no period.
Sample
var c = plugins.amortization.newCalculation(); c.addPayment(500, new Date(2005, 1, 28), null, plugins.amortization.AmortizationCalculation.PERIOD_DAILY, 5, plugins.amortization.AmortizationCalculation.STARTDAY_NORMAL); var c2 = plugins.amortization.newCalculation(); c2.addPayment(300, new Date(2006, 11, 24), new Date(2006, 12, 24), plugins.amortization.AmortizationCalculation.PERIOD_BI_MONTHLY, plugins.amortization.AmortizationCalculation.NUMBER_UNLIMITED, 30);
The numeric constant used to identify a quarterly period (once every three months).
Sample
var c = plugins.amortization.newCalculation(); c.addPayment(500, new Date(2005, 1, 28), null, plugins.amortization.AmortizationCalculation.PERIOD_DAILY, 5, plugins.amortization.AmortizationCalculation.STARTDAY_NORMAL); var c2 = plugins.amortization.newCalculation(); c2.addPayment(300, new Date(2006, 11, 24), new Date(2006, 12, 24), plugins.amortization.AmortizationCalculation.PERIOD_BI_MONTHLY, plugins.amortization.AmortizationCalculation.NUMBER_UNLIMITED, 30);
The numeric constant used to identify a two-monthly period (once every two months).
Sample
var c = plugins.amortization.newCalculation(); c.addPayment(500, new Date(2005, 1, 28), null, plugins.amortization.AmortizationCalculation.PERIOD_DAILY, 5, plugins.amortization.AmortizationCalculation.STARTDAY_NORMAL); var c2 = plugins.amortization.newCalculation(); c2.addPayment(300, new Date(2006, 11, 24), new Date(2006, 12, 24), plugins.amortization.AmortizationCalculation.PERIOD_BI_MONTHLY, plugins.amortization.AmortizationCalculation.NUMBER_UNLIMITED, 30);
The numeric constant used to identify a two-weekly period (once every two weeks).
Sample
var c = plugins.amortization.newCalculation(); c.addPayment(500, new Date(2005, 1, 28), null, plugins.amortization.AmortizationCalculation.PERIOD_DAILY, 5, plugins.amortization.AmortizationCalculation.STARTDAY_NORMAL); var c2 = plugins.amortization.newCalculation(); c2.addPayment(300, new Date(2006, 11, 24), new Date(2006, 12, 24), plugins.amortization.AmortizationCalculation.PERIOD_BI_MONTHLY, plugins.amortization.AmortizationCalculation.NUMBER_UNLIMITED, 30);
The numeric constant used to identify a weekly period.
Sample
var c = plugins.amortization.newCalculation(); c.addPayment(500, new Date(2005, 1, 28), null, plugins.amortization.AmortizationCalculation.PERIOD_DAILY, 5, plugins.amortization.AmortizationCalculation.STARTDAY_NORMAL); var c2 = plugins.amortization.newCalculation(); c2.addPayment(300, new Date(2006, 11, 24), new Date(2006, 12, 24), plugins.amortization.AmortizationCalculation.PERIOD_BI_MONTHLY, plugins.amortization.AmortizationCalculation.NUMBER_UNLIMITED, 30);
The numeric constant used to identify that the same start day should be used as
the day of the month of the starting date of the event.
Sample
var c = plugins.amortization.newCalculation(); c.addPayment(500, new Date(2005, 1, 28), null, plugins.amortization.AmortizationCalculation.PERIOD_DAILY, 5, plugins.amortization.AmortizationCalculation.STARTDAY_NORMAL); var c2 = plugins.amortization.newCalculation(); c2.addPayment(300, new Date(2006, 11, 24), new Date(2006, 12, 24), plugins.amortization.AmortizationCalculation.PERIOD_BI_MONTHLY, plugins.amortization.AmortizationCalculation.NUMBER_UNLIMITED, 30);
{column:width=100%|padding=0px}{column}
Method Details
addCompoundPeriodChange
(newPeriod, date)
Adds a compound period change.
Sample
var c = plugins.amortization.newCalculation(); c.addRateChange(r, new Date(2005, 0, 1)); c.addCompoundPeriodChange(12, new Date(2005, 0, 1)); c.addLoan(2000, new Date(2005, 0, 1)); c.addPayment(500, new Date(2005, 1, 28), null, 12, 5, 31);
addLoan
(amount, date)
Adds a loan.
Sample
var c = plugins.amortization.newCalculation(); c.addRateChange(r, new Date(2005, 0, 1)); c.addCompoundPeriodChange(12, new Date(2005, 0, 1)); c.addLoan(2000, new Date(2005, 0, 1)); c.addPayment(500, new Date(2005, 1, 28), null, 12, 5, 31);
addLoan
(amount, firstDate, lastDate, period)
Adds a loan.
Sample
var c = plugins.amortization.newCalculation(); c.addRateChange(r, new Date(2005, 0, 1)); c.addCompoundPeriodChange(12, new Date(2005, 0, 1)); c.addLoan(2000, new Date(2005, 0, 1)); c.addPayment(500, new Date(2005, 1, 28), null, 12, 5, 31);
addLoan
(amount, firstDate, lastDate, period, number)
Adds a loan.
Sample
var c = plugins.amortization.newCalculation(); c.addRateChange(r, new Date(2005, 0, 1)); c.addCompoundPeriodChange(12, new Date(2005, 0, 1)); c.addLoan(2000, new Date(2005, 0, 1)); c.addPayment(500, new Date(2005, 1, 28), null, 12, 5, 31);
addLoan
(amount, firstDate, lastDate, period, number, startday)
Adds a loan.
Sample
var c = plugins.amortization.newCalculation(); c.addRateChange(r, new Date(2005, 0, 1)); c.addCompoundPeriodChange(12, new Date(2005, 0, 1)); c.addLoan(2000, new Date(2005, 0, 1)); c.addPayment(500, new Date(2005, 1, 28), null, 12, 5, 31);
addPayment
(amount, date)
Adds a payment.
Sample
var c = plugins.amortization.newCalculation(); c.addRateChange(r, new Date(2005, 0, 1)); c.addCompoundPeriodChange(12, new Date(2005, 0, 1)); c.addLoan(2000, new Date(2005, 0, 1)); c.addPayment(500, new Date(2005, 1, 28), null, 12, 5, 31);
addPayment
(amount, firstDate, lastDate, period)
Adds a payment.
Sample
var c = plugins.amortization.newCalculation(); c.addRateChange(r, new Date(2005, 0, 1)); c.addCompoundPeriodChange(12, new Date(2005, 0, 1)); c.addLoan(2000, new Date(2005, 0, 1)); c.addPayment(500, new Date(2005, 1, 28), null, 12, 5, 31);
addPayment
(amount, firstDate, lastDate, period, number)
Adds a payment.
Sample
var c = plugins.amortization.newCalculation(); c.addRateChange(r, new Date(2005, 0, 1)); c.addCompoundPeriodChange(12, new Date(2005, 0, 1)); c.addLoan(2000, new Date(2005, 0, 1)); c.addPayment(500, new Date(2005, 1, 28), null, 12, 5, 31);
addPayment
(amount, firstDate, lastDate, period, number, startday)
Adds a payment.
Sample
var c = plugins.amortization.newCalculation(); c.addRateChange(r, new Date(2005, 0, 1)); c.addCompoundPeriodChange(12, new Date(2005, 0, 1)); c.addLoan(2000, new Date(2005, 0, 1)); c.addPayment(500, new Date(2005, 1, 28), null, 12, 5, 31);
addRateChange
(newRate, date)
Sets a new interest rate.
Sample
var c = plugins.amortization.newCalculation(); c.addRateChange(r, new Date(2005, 0, 1)); c.addCompoundPeriodChange(12, new Date(2005, 0, 1)); c.addLoan(2000, new Date(2005, 0, 1)); c.addPayment(500, new Date(2005, 1, 28), null, 12, 5, 31);
calculateAmortizationSchedule
()
Calculates the amortization schedule.
Sample
plugins.amortization.calculateAmortizationSchedule();
getAmortizationSchedule
()
Gets the amortization schedule as a JSDataSet.
Sample
plugins.amortization.getAmortizationSchedule();
getError
()
Returns the error that remains when solving for the unknown.
Please note that the error should be less or equal to 1E-8 - otherwise, the solveForUnknown value is incorrect.
Sample
var c = plugins.amortization.newCalculation(); // sets the rate to -1 for unknown. c.addRateChange(-1, new Date(2005, 0, 1)); c.addCompoundPeriodChange(12, new Date(2005, 0, 1)); c.addLoan(2000, new Date(2005, 0, 1)); var lastDate = null; var period = 12; var number_count = 5; var startday = 31; c.addPayment(500, new Date(2005, 1, 28), lastDate, period,number_count, startday); // solves for the interest rate. c.solveForUnknown(); // gets the interest rate and the error in the calculation. // which should be small (otherwise the calculation did // not converge for some reason. var r = c.getUnknown(); var e = c.getError();
getEvents
()
Returns all the amortization events - such as rate changes, loan events, payment events, compounding period changes.
Sample
plugins.amortization.getEvents();
getRestBalance
()
Gets the rest balance after the amortization schedule.
Sample
var rb = plugins.amortization.getRestBalance();
getUnknown
()
Returns the solveForUnknown value.
Sample
plugins.amortization.getUnknown();
isValidPeriod
(period)
Returns true if the period is valid, or false if the period is not valid.
Sample
var v_period = plugins.amortization.isValidPeriod(12);
roundMoney
(amount)
Rounds a number up to the nearest cents.
Sample
//rounds the number up to 34.35 var rm = plugins.amortization.roundMoney(34.349384);
solveForUnknown
()
Returns true if successful or false if the call failed.
Sample
plugins.amortization.solveForUnknown();
void
sortEvents
()
Sorts the amortization events ascending by date.
Returns
void
Sample
plugins.amortization.sortEvents();