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

fixed:

Bug 25054 - Некорректное поведение при расчете формулы DB/DDB если срок эксплуатации (Life) меньше срока амортизации (Period)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@57046 954022d7-b5bf-4e40-9824-e11837661b57
parent a161a8e2
......@@ -1908,8 +1908,8 @@ cDB.prototype.Calculate = function ( arg ) {
period = period.getValue();
month = month.getValue();
if ( month < 1 || month > 12 || salvage <= 0 || life < 0 || period < 0 || cost < 0 || cost < salvage ) {
return this.value = new cError( cErrorType.wrong_value_type );
if ( month < 1 || month > 12 || salvage <= 0 || life < 0 || period < 0 || life < period || cost < 0 || cost < salvage ) {
return this.value = new cError( cErrorType.not_numeric );
}
var rate = 1 - Math.pow( salvage / cost, 1 / life );
rate = Math.floor( (rate * 1000) + 0.5 ) / 1000;
......@@ -2020,8 +2020,8 @@ cDDB.prototype.Calculate = function ( arg ) {
period = period.getValue();
factor = factor.getValue();
if ( cost < salvage || cost <= 0 || salvage < 0 || factor <= 0 || life <= 0 || period <= 0 ) {
return this.value = new cError( cErrorType.wrong_value_type );
if ( cost < salvage || cost <= 0 || salvage < 0 || factor <= 0 || life <= 0 || period <= 0 || life < period ) {
return this.value = new cError( cErrorType.not_numeric );
}
this.value = new cNumber( getDDB( cost, salvage, life, period, factor ) );
......
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