PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Amortization matrix
FinRedemption (Example)
Amortization matrix
The following code is used to return an amortization matrix. The type of amortization is selected by the user via a radio button (RADIO_AmortType). The amount, the rate and the duration of the loan are entered by the user in edit controls (EDT_Amount, EDT_Rate, EDT_Duration). The amortization matrix is displayed in a memory table (TABLE_MatrixTable).
// -- Click code on BTN_Amortization
// Declare the variables
ResAmortization is boolean
ResAmortType is int // Retrieves the type of amortization
ResAdd is boolean
Subscript is int
// Retrieve the type of amortization
SWITCH RADIO_AmortType
CASE 1: ResAmortType = finInFine
CASE 2: ResAmortType = finConstantRedemption
CASE 3: ResAmortType = finConstantAnnualPayment
END
// Calculate the amortization
ResAmortization = FinRedemption("AmortMatrix", ResAmortType, EDT_Amount, EDT_Rate, EDT_Duration)
// Calculation error?
IF ResAmortization = False THEN
// Display the error message
Error(ErrorInfo(errMessage))
ELSE
// Display the matrix in a memory table
FOR Subscript = 1 TO MatNbLine("AmortMatrix") THEN
ResAdd = TableAdd(TABLE_MatrixTable, MatReadLine("AmortMatrix", Subscript))
END
END
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment