Child pages
  • AmortizationCalculation

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Div
styledisplay:none

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.

Div
iddescription



HTML Table
id
classservoy sSummary
Colgroup Tag
Col
width80px
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Constants Summary
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
NUMBER_UNLIMITED
The numeric constant used to identify an unlimited number of repeated events.
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
PERIOD_ANNUALY
The numeric constant used to identify an annual period.
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
PERIOD_BI_ANNUALLY
The numeric constant used to identify a bi-annual period (twice every year).
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
PERIOD_BI_MONTHLY
The numeric constant used to identify a bi-monthly period (twice every month).
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
PERIOD_DAILY
The numeric constant used to identify a daily period.
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
PERIOD_FOUR_MONTHLY
The numeric constant used to identify a four-monthly period (once every four months).
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
PERIOD_FOUR_WEEKLY
The numeric constant used to identify a four-weekly period (once every four weeks).
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
PERIOD_MONTHLY
The numeric constant used to identify a monthly period.
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
PERIOD_NONE
The numeric constant used to identify that there is no period.
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
PERIOD_QUARTERLY
The numeric constant used to identify a quarterly period (once every three months).
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
PERIOD_TWO_MONTHLY
The numeric constant used to identify a two-monthly period (once every two months).
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
PERIOD_TWO_WEEKLY
The numeric constant used to identify a two-weekly period (once every two weeks).
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
PERIOD_WEEKLY
The numeric constant used to identify a weekly period.
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
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.



HTML Table
id
classservoy sSummary
Colgroup Tag
Col
width80px
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Summary
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
addCompoundPeriodChange(newPeriod, date)
Adds a compound period change.
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
addLoan(amount, date)
Adds a loan.
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
addLoan(amount, firstDate, lastDate, period)
Adds a loan.
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
addLoan(amount, firstDate, lastDate, period, number)
Adds a loan.
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
addLoan(amount, firstDate, lastDate, period, number, startday)
Adds a loan.
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
addPayment(amount, date)
Adds a payment.
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
addPayment(amount, firstDate, lastDate, period)
Adds a payment.
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
addPayment(amount, firstDate, lastDate, period, number)
Adds a payment.
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
addPayment(amount, firstDate, lastDate, period, number, startday)
Adds a payment.
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
addRateChange(newRate, date)
Sets a new interest rate.
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
calculateAmortizationSchedule()
Calculates the amortization schedule.
Table Row (tr)
Table Cell (td)
JSDataSet
Table Cell (td)
getAmortizationSchedule()
Gets the amortization schedule as a JSDataSet.
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
getError()
Returns the error that remains when solving for the unknown.
Table Row (tr)
Table Cell (td)
JSDataSet
Table Cell (td)
getEvents()
Returns all the amortization events - such as rate changes, loan events, payment events, compounding period changes.
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
getRestBalance()
Gets the rest balance after the amortization schedule.
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
getUnknown()
Returns the solveForUnknown value.
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
isValidPeriod(period)
Returns true if the period is valid, or false if the period is not valid.
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
roundMoney(amount)
Rounds a number up to the nearest cents.
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
solveForUnknown()
Returns true if successful or false if the call failed.
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
sortEvents()
Sorts the amortization events ascending by date.



HTML Table
idconstant
classservoy sDetail
Colgroup Tag
Col
colspan2
width100%
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Constants Details
Table Body (tbody)
idNUMBER_UNLIMITED
Table Row (tr)
idname
Table Cell (td)

NUMBER_UNLIMITED

Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
The numeric constant used to identify an unlimited number of repeated events.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
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);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idPERIOD_ANNUALY
Table Row (tr)
idname
Table Cell (td)

PERIOD_ANNUALY

Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
The numeric constant used to identify an annual period.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
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);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idPERIOD_BI_ANNUALLY
Table Row (tr)
idname
Table Cell (td)

PERIOD_BI_ANNUALLY

Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
The numeric constant used to identify a bi-annual period (twice every year).
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
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);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idPERIOD_BI_MONTHLY
Table Row (tr)
idname
Table Cell (td)

PERIOD_BI_MONTHLY

Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
The numeric constant used to identify a bi-monthly period (twice every month).
TODO: this period is not supported yet.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
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);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idPERIOD_DAILY
Table Row (tr)
idname
Table Cell (td)

PERIOD_DAILY

Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
The numeric constant used to identify a daily period.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
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);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idPERIOD_FOUR_MONTHLY
Table Row (tr)
idname
Table Cell (td)

PERIOD_FOUR_MONTHLY

Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
The numeric constant used to identify a four-monthly period (once every four months).
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
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);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idPERIOD_FOUR_WEEKLY
Table Row (tr)
idname
Table Cell (td)

PERIOD_FOUR_WEEKLY

Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
The numeric constant used to identify a four-weekly period (once every four weeks).
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
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);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idPERIOD_MONTHLY
Table Row (tr)
idname
Table Cell (td)

PERIOD_MONTHLY

Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
The numeric constant used to identify a monthly period.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
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);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idPERIOD_NONE
Table Row (tr)
idname
Table Cell (td)

PERIOD_NONE

Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
The numeric constant used to identify that there is no period.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
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);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idPERIOD_QUARTERLY
Table Row (tr)
idname
Table Cell (td)

PERIOD_QUARTERLY

Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
The numeric constant used to identify a quarterly period (once every three months).
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
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);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idPERIOD_TWO_MONTHLY
Table Row (tr)
idname
Table Cell (td)

PERIOD_TWO_MONTHLY

Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
The numeric constant used to identify a two-monthly period (once every two months).
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
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);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idPERIOD_TWO_WEEKLY
Table Row (tr)
idname
Table Cell (td)

PERIOD_TWO_WEEKLY

Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
The numeric constant used to identify a two-weekly period (once every two weeks).
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
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);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idPERIOD_WEEKLY
Table Row (tr)
idname
Table Cell (td)

PERIOD_WEEKLY

Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
The numeric constant used to identify a weekly period.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
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);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idSTARTDAY_NORMAL
Table Row (tr)
idname
Table Cell (td)

STARTDAY_NORMAL

Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
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.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
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);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 



HTML Table
idfunction
classservoy sDetail
Colgroup Tag
Col
colspan2
width100%
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Details
Table Body (tbody)
idaddCompoundPeriodChange-Number_Date
Table Row (tr)
idname
Table Cell (td)

addCompoundPeriodChange

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
addCompoundPeriodChange
Span
(newPeriod, date)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Adds a compound period change.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Number} newPeriod
{Date} date
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
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);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idaddLoan-Number_Date
Table Row (tr)
idname
Table Cell (td)

addLoan

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
addLoan
Span
(amount, date)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Adds a loan.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Number} amount
{Date} date
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
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);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idaddLoan-Number_Date_Date_Number
Table Row (tr)
idname
Table Cell (td)

addLoan

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
addLoan
Span
(amount, firstDate, lastDate, period)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Adds a loan.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Number} amount
{Date} firstDate
{Date} lastDate
{Number} period
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
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);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idaddLoan-Number_Date_Date_Number_Number
Table Row (tr)
idname
Table Cell (td)

addLoan

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
addLoan
Span
(amount, firstDate, lastDate, period, number)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Adds a loan.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Number} amount
{Date} firstDate
{Date} lastDate
{Number} period
{Number} number
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
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);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idaddLoan-Number_Date_Date_Number_Number_Number
Table Row (tr)
idname
Table Cell (td)

addLoan

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
addLoan
Span
(amount, firstDate, lastDate, period, number, startday)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Adds a loan.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Number} amount
{Date} firstDate
{Date} lastDate
{Number} period
{Number} number
{Number} startday
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
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);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idaddPayment-Number_Date
Table Row (tr)
idname
Table Cell (td)

addPayment

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
addPayment
Span
(amount, date)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Adds a payment.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Number} amount
{Date} date
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
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);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idaddPayment-Number_Date_Date_Number
Table Row (tr)
idname
Table Cell (td)

addPayment

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
addPayment
Span
(amount, firstDate, lastDate, period)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Adds a payment.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Number} amount
{Date} firstDate
{Date} lastDate
{Number} period
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
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);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idaddPayment-Number_Date_Date_Number_Number
Table Row (tr)
idname
Table Cell (td)

addPayment

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
addPayment
Span
(amount, firstDate, lastDate, period, number)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Adds a payment.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Number} amount
{Date} firstDate
{Date} lastDate
{Number} period
{Number} number
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
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);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idaddPayment-Number_Date_Date_Number_Number_Number
Table Row (tr)
idname
Table Cell (td)

addPayment

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
addPayment
Span
(amount, firstDate, lastDate, period, number, startday)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Adds a payment.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Number} amount
{Date} firstDate
{Date} lastDate
{Number} period
{Number} number
{Number} startday
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
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);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idaddRateChange-Number_Date
Table Row (tr)
idname
Table Cell (td)

addRateChange

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
addRateChange
Span
(newRate, date)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Sets a new interest rate.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Number} newRate
{Date} date
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
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);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idcalculateAmortizationSchedule
Table Row (tr)
idname
Table Cell (td)

calculateAmortizationSchedule

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
calculateAmortizationSchedule
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Calculates the amortization schedule.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
plugins.amortization.calculateAmortizationSchedule();
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idgetAmortizationSchedule
Table Row (tr)
idname
Table Cell (td)

getAmortizationSchedule

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
JSDataSet
Span
stylefont-weight: bold;
getAmortizationSchedule
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Gets the amortization schedule as a JSDataSet.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
JSDataSet
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
plugins.amortization.getAmortizationSchedule();
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idgetError
Table Row (tr)
idname
Table Cell (td)

getError

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Number
Span
stylefont-weight: bold;
getError
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
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.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
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();
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idgetEvents
Table Row (tr)
idname
Table Cell (td)

getEvents

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
JSDataSet
Span
stylefont-weight: bold;
getEvents
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns all the amortization events - such as rate changes, loan events, payment events, compounding period changes.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
JSDataSet
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
plugins.amortization.getEvents();
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idgetRestBalance
Table Row (tr)
idname
Table Cell (td)

getRestBalance

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Number
Span
stylefont-weight: bold;
getRestBalance
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Gets the rest balance after the amortization schedule.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
var rb = plugins.amortization.getRestBalance();
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idgetUnknown
Table Row (tr)
idname
Table Cell (td)

getUnknown

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Number
Span
stylefont-weight: bold;
getUnknown
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the solveForUnknown value.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
plugins.amortization.getUnknown();
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idisValidPeriod-Number
Table Row (tr)
idname
Table Cell (td)

isValidPeriod

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
isValidPeriod
Span
(period)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns true if the period is valid, or false if the period is not valid.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Number} period
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
var v_period = plugins.amortization.isValidPeriod(12);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idroundMoney-Number
Table Row (tr)
idname
Table Cell (td)

roundMoney

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Number
Span
stylefont-weight: bold;
roundMoney
Span
(amount)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Rounds a number up to the nearest cents.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Number} amount
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
//rounds the number up to 34.35
var rm = plugins.amortization.roundMoney(34.349384);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idsolveForUnknown
Table Row (tr)
idname
Table Cell (td)

solveForUnknown

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
solveForUnknown
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns true if successful or false if the call failed.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
plugins.amortization.solveForUnknown();
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idsortEvents
Table Row (tr)
idname
Table Cell (td)

sortEvents

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
sortEvents
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Sorts the amortization events ascending by date.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
plugins.amortization.sortEvents();
Table Row (tr)
classlastDetailRow
Table Cell (td)