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

fixed:

Bug 25055 - Ошибка при расчете формулы DB если аргументы Cost/Salvage пустые
Bug 25059 - Ошибка #VALUE! при расчете формулы DDB если аргумент Cost пустой
Bug 25063 - Ошибка #NUM! при расчете формулы SLN если аргумент Время эксплуатации (Life) пустой (нулевой)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@57068 954022d7-b5bf-4e40-9824-e11837661b57
parent 83c8aaae
......@@ -1908,7 +1908,11 @@ cDB.prototype.Calculate = function ( arg ) {
period = period.getValue();
month = month.getValue();
if ( month < 1 || month > 12 || salvage <= 0 || life < 0 || period < 0 || life < period || cost < 0 || cost < salvage ) {
if( cost == 0 || salvage == 0 ){
return this.value = new cNumber( 0 );
}
if ( month < 1 || month > 12 || salvage <= 0 || life <= 0 || period < 0 || life + 1 < period || cost < 0 || cost < salvage ) {
return this.value = new cError( cErrorType.not_numeric );
}
var rate = 1 - Math.pow( salvage / cost, 1 / life );
......@@ -2020,6 +2024,10 @@ cDDB.prototype.Calculate = function ( arg ) {
period = period.getValue();
factor = factor.getValue();
if( cost == 0 || salvage == 0 ){
return this.value = new cNumber( 0 );
}
if ( cost < salvage || cost <= 0 || salvage < 0 || factor <= 0 || life <= 0 || period <= 0 || life < period ) {
return this.value = new cError( cErrorType.not_numeric );
}
......@@ -5036,7 +5044,7 @@ cSLN.prototype.Calculate = function ( arg ) {
life = life.getValue();
if ( life == 0 )
return this.value = new cError( cErrorType.not_numeric );
return this.value = new cError( cErrorType.division_by_zero );
this.value = new cNumber( ( cost - salvage ) / life );
return this.value;
......
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