Child pages
  • AmortizationCalculation

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Hidden
DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY, UNLESS YOU KNOW WHAT YOU'RE DOING.
		THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO EXTRACT CHANGES FROM THE PAGE AND MERGE THEM BACK INTO SERVOY SOURCE


HTML Table
classservoy sSummary
Colgroup Tag
Column
padding0px
width80px

Column

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Summary
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#addCompoundPeriodChange(newPeriod, date)
Adds a compound period change.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#addLoan(amount, firstDate, [lastDate], [period], [number], [startday])
Adds a loan.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#addPayment(amount, firstDate, [lastDate], [period], [number], [startday])
Adds a payment.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#addRateChange(newRate, date)
Sets a new interest rate.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#calculateAmortizationSchedule()
Calculates the amortization schedule.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
JSDataSet
Table Cell (td)
#getAmortizationSchedule()
Gets the amortization schedule as a JSDataSet.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#getError()
Returns the error that remains when solving for the unknown.
Table Body (tbody)
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 Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#getRestBalance()
Gets the rest balance after the amortization schedule.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#getUnknown()
Returns the solveForUnknown value.
Table Body (tbody)
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 Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#roundMoney(amount)
Rounds a number up to the nearest cents.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#solveForUnknown()
Returns true if successful or false if the call failed.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
#sortEvents()
Sorts the amortization events ascending by date.

HTML Table
idfunction
classservoy sDetail
Colgroup Tag
Column
padding0px
width100%

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan1
Method Details
Table Body (tbody)
idaddCompoundPeriodChange
classnode
Table Row (tr)
idname
Table Cell (td)
addCompoundPeriodChange
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
addCompoundPeriodChange
Span
stylefloat: left;
idiets
(newPeriod, date)
Table Row (tr)
iddes
Table Cell (td)
Adds a compound period change.
Table Row (tr)
idprs
Table Cell (td)
Parameters
newPeriod
date
Table Row (tr)
idret
Table Cell (td)
Returns
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
classnode
Table Row (tr)
idname
Table Cell (td)
addLoan
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
addLoan
Span
stylefloat: left;
idiets
(amount, firstDate, [lastDate], [period], [number], [startday])
Table Row (tr)
iddes
Table Cell (td)
Adds a loan.
Table Row (tr)
idprs
Table Cell (td)
Parameters
amount
firstDate
[lastDate]
[period]
[number]
[startday]
Table Row (tr)
idret
Table Cell (td)
Returns
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
classnode
Table Row (tr)
idname
Table Cell (td)
addPayment
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
addPayment
Span
stylefloat: left;
idiets
(amount, firstDate, [lastDate], [period], [number], [startday])
Table Row (tr)
iddes
Table Cell (td)
Adds a payment.
Table Row (tr)
idprs
Table Cell (td)
Parameters
amount
firstDate
[lastDate]
[period]
[number]
[startday]
Table Row (tr)
idret
Table Cell (td)
Returns
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
classnode
Table Row (tr)
idname
Table Cell (td)
addRateChange
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
addRateChange
Span
stylefloat: left;
idiets
(newRate, date)
Table Row (tr)
iddes
Table Cell (td)
Sets a new interest rate.
Table Row (tr)
idprs
Table Cell (td)
Parameters
newRate
date
Table Row (tr)
idret
Table Cell (td)
Returns
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
classnode
Table Row (tr)
idname
Table Cell (td)
calculateAmortizationSchedule
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
calculateAmortizationSchedule
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Calculates the amortization schedule.
Table Row (tr)
idret
Table Cell (td)
Returns
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
classnode
Table Row (tr)
idname
Table Cell (td)
getAmortizationSchedule
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
JSDataSet
Span
stylefloat: left; font-weight: bold;
idiets
getAmortizationSchedule
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Gets the amortization schedule as a JSDataSet.
Table Row (tr)
idret
Table Cell (td)
Returns
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
classnode
Table Row (tr)
idname
Table Cell (td)
getError
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Number
Span
stylefloat: left; font-weight: bold;
idiets
getError
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
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
Number
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//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.
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
classnode
Table Row (tr)
idname
Table Cell (td)
getEvents
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
JSDataSet
Span
stylefloat: left; font-weight: bold;
idiets
getEvents
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns all the amortization events - such as rate changes, loan events, payment events, compounding period changes.
Table Row (tr)
idret
Table Cell (td)
Returns
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
classnode
Table Row (tr)
idname
Table Cell (td)
getRestBalance
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Number
Span
stylefloat: left; font-weight: bold;
idiets
getRestBalance
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Gets the rest balance after the amortization schedule.
Table Row (tr)
idret
Table Cell (td)
Returns
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
classnode
Table Row (tr)
idname
Table Cell (td)
getUnknown
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Number
Span
stylefloat: left; font-weight: bold;
idiets
getUnknown
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns the solveForUnknown value.
Table Row (tr)
idret
Table Cell (td)
Returns
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
classnode
Table Row (tr)
idname
Table Cell (td)
isValidPeriod
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
isValidPeriod
Span
stylefloat: left;
idiets
(period)
Table Row (tr)
iddes
Table Cell (td)
Returns true if the period is valid, or false if the period is not valid.
Table Row (tr)
idprs
Table Cell (td)
Parameters
period
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//Returns true if the period is valid, or false if the period is not valid.

var v_period = plugins.amortization.isValidPeriod(12);
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idroundMoney
classnode
Table Row (tr)
idname
Table Cell (td)
roundMoney
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Number
Span
stylefloat: left; font-weight: bold;
idiets
roundMoney
Span
stylefloat: left;
idiets
(amount)
Table Row (tr)
iddes
Table Cell (td)
Rounds a number up to the nearest cents.
Table Row (tr)
idprs
Table Cell (td)
Parameters
amount
Table Row (tr)
idret
Table Cell (td)
Returns
Number
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//Rounds a number up to the nearest cents.

//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
classnode
Table Row (tr)
idname
Table Cell (td)
solveForUnknown
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
solveForUnknown
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns true if successful or false if the call failed.
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//Returns true if successful or false if the call failed.

plugins.amortization.solveForUnknown();
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsortEvents
classnode
Table Row (tr)
idname
Table Cell (td)
sortEvents
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
void
Span
stylefloat: left; font-weight: bold;
idiets
sortEvents
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Sorts the amortization events ascending by date.
Table Row (tr)
idret
Table Cell (td)
Returns
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//Sorts the amortization events ascending by date.

plugins.amortization.sortEvents();
Table Row (tr)
classlastDetailRow
Table Cell (td)