Commit e595497c authored by Dmitry.Shahtanov's avatar Dmitry.Shahtanov Committed by Alexander.Trofimov

дополнительное условие для Bug 24279 - Некорректная область определения...

дополнительное условие для Bug 24279 - Некорректная область определения аргументов при вычислении функций AMORDEGRC

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56271 954022d7-b5bf-4e40-9824-e11837661b57
parent 96bce91c
...@@ -809,14 +809,13 @@ cAMORDEGRC.prototype.Calculate = function ( arg ) { ...@@ -809,14 +809,13 @@ cAMORDEGRC.prototype.Calculate = function ( arg ) {
cost = cost.getValue(); cost = cost.getValue();
salvage = salvage.getValue(); salvage = salvage.getValue();
period = period.getValue(); period = period.getValue();
basis = basis.getValue();
if( cost < 0 || salvage < 0 || period < 0 || rate < 0 ){ if( cost < 0 || salvage < 0 || period < 0 || rate <= 0 || basis == 2 ){
return this.value = new cError( cErrorType.not_numeric ); return this.value = new cError( cErrorType.not_numeric );
} }
var per = 1 / rate, var per = 1 / rate, coeff;
coeff;
if( cost == salvage || period > per ){ if( cost == salvage || period > per ){
return this.value = new cNumber( 0 ); return this.value = new cNumber( 0 );
...@@ -833,13 +832,12 @@ cAMORDEGRC.prototype.Calculate = function ( arg ) { ...@@ -833,13 +832,12 @@ cAMORDEGRC.prototype.Calculate = function ( arg ) {
rate *= coeff; rate *= coeff;
var val0 = Date.prototype.getDateFromExcel( datePurch.getValue() ); var val0 = Date.prototype.getDateFromExcel( datePurch.getValue() ),
var val1 = Date.prototype.getDateFromExcel( firstPer.getValue() ); val1 = Date.prototype.getDateFromExcel( firstPer.getValue() );
var _rate = Math.round( yearFrac( val0, val1, basis.getValue() ) * rate * cost ); var _rate = Math.round( yearFrac( val0, val1, basis ) * rate * cost ), rest;
cost -= _rate; cost -= _rate;
var rest = cost - salvage; rest = cost - salvage;
for ( var n = 0; n < period; n++ ) { for ( var n = 0; n < period; n++ ) {
_rate = Math.round( rate * cost ); _rate = Math.round( rate * cost );
......
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