Commit e9a204ab authored by Alexander.Trofimov's avatar Alexander.Trofimov

cell/model/FormulaObjects/financialFunctions to function-closure

parent f1734977
...@@ -265,9 +265,9 @@ $( function () { ...@@ -265,9 +265,9 @@ $( function () {
function _getprice( nSettle, nMat, fRate, fYield, fRedemp, nFreq, nBase ){ function _getprice( nSettle, nMat, fRate, fYield, fRedemp, nFreq, nBase ){
var fdays = getcoupdays( new Date(nSettle), new Date(nMat), nFreq, nBase ), var fdays = AscCommonExcel.getcoupdays( new Date(nSettle), new Date(nMat), nFreq, nBase ),
fdaybs = getcoupdaybs( new Date(nSettle), new Date(nMat), nFreq, nBase ), fdaybs = AscCommonExcel.getcoupdaybs( new Date(nSettle), new Date(nMat), nFreq, nBase ),
fnum = getcoupnum( new Date(nSettle), (nMat), nFreq, nBase ), fnum = AscCommonExcel.getcoupnum( new Date(nSettle), (nMat), nFreq, nBase ),
fdaysnc = ( fdays - fdaybs ) / fdays, fdaysnc = ( fdays - fdaybs ) / fdays,
fT1 = 100 * fRate / nFreq, fT1 = 100 * fRate / nFreq,
fT2 = 1 + fYield / nFreq, fT2 = 1 + fYield / nFreq,
...@@ -371,9 +371,9 @@ $( function () { ...@@ -371,9 +371,9 @@ $( function () {
} }
function _duration( settlement, maturity, coupon, yld, frequency, basis ){ function _duration( settlement, maturity, coupon, yld, frequency, basis ){
var dbc = getcoupdaybs(new Date( settlement ),new Date( maturity ),frequency,basis), var dbc = AscCommonExcel.getcoupdaybs(new Date( settlement ),new Date( maturity ),frequency,basis),
coupD = getcoupdays(new Date( settlement ),new Date( maturity ),frequency,basis), coupD = AscCommonExcel.getcoupdays(new Date( settlement ),new Date( maturity ),frequency,basis),
numCoup = getcoupnum(new Date( settlement ),new Date( maturity ),frequency); numCoup = AscCommonExcel.getcoupnum(new Date( settlement ),new Date( maturity ),frequency);
if ( settlement >= maturity || basis < 0 || basis > 4 || ( frequency != 1 && frequency != 2 && frequency != 4 ) || yld < 0 || coupon < 0 ){ if ( settlement >= maturity || basis < 0 || basis > 4 || ( frequency != 1 && frequency != 2 && frequency != 4 ) || yld < 0 || coupon < 0 ){
return "#NUM!"; return "#NUM!";
...@@ -4533,8 +4533,8 @@ $( function () { ...@@ -4533,8 +4533,8 @@ $( function () {
if( fv == undefined ) fv = 0; if( fv == undefined ) fv = 0;
if( type == undefined ) type = 0; if( type == undefined ) type = 0;
var res = getPMT(rate, nper, pv, fv, type); var res = AscCommonExcel.getPMT(rate, nper, pv, fv, type);
res = getIPMT(rate, per, pv, type, res); res = AscCommonExcel.getIPMT(rate, per, pv, type, res);
return res; return res;
......
...@@ -24,6 +24,12 @@ ...@@ -24,6 +24,12 @@
*/ */
"use strict"; "use strict";
(
/**
* @param {Window} window
* @param {undefined} undefined
*/
function (window, undefined) {
var startRangeCurrentDateSystem = 1; var startRangeCurrentDateSystem = 1;
function getPMT( rate, nper, pv, fv, flag ) { function getPMT( rate, nper, pv, fv, flag ) {
...@@ -6434,3 +6440,11 @@ cYIELDMAT.prototype.getInfo = function () { ...@@ -6434,3 +6440,11 @@ cYIELDMAT.prototype.getInfo = function () {
}; };
}; };
//----------------------------------------------------------export----------------------------------------------------
window['AscCommonExcel'] = window['AscCommonExcel'] || {};
window['AscCommonExcel'].getPMT = getPMT;
window['AscCommonExcel'].getIPMT = getIPMT;
window['AscCommonExcel'].getcoupdaybs = getcoupdaybs;getcoupdays
window['AscCommonExcel'].getcoupdays = getcoupdays;getcoupnum
window['AscCommonExcel'].getcoupnum = getcoupnum;
})(window);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment