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

fixed: Bug 24578 - Аргумент Fraction при вычислении в формуле...

fixed: Bug 24578 - Аргумент Fraction при вычислении в формуле DOLLARDE/DOLLARFR не обрезается до целого

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56481 954022d7-b5bf-4e40-9824-e11837661b57
parent dcb57b6e
...@@ -629,11 +629,11 @@ cACCRINT.prototype.Calculate = function ( arg ) { ...@@ -629,11 +629,11 @@ cACCRINT.prototype.Calculate = function ( arg ) {
if(settl > fInter && calcMethod){ if(settl > fInter && calcMethod){
coupPCD = new Date( fInter ); coupPCD = new Date( fInter );
endDate = new Date( settl ); startDate = endDate = new Date( settl );
while ( !(numMonths > 0 ? coupPCD >= endDate : coupPCD <= endDate) ) { while ( !(numMonths > 0 ? coupPCD >= startDate : coupPCD <= startDate) ) {
endDate = coupPCD; endDate = coupPCD;
startDate = addMonth( coupPCD, numMonths, endMonth ); coupPCD = addMonth( coupPCD, numMonths, endMonth );
} }
} }
...@@ -641,11 +641,11 @@ cACCRINT.prototype.Calculate = function ( arg ) { ...@@ -641,11 +641,11 @@ cACCRINT.prototype.Calculate = function ( arg ) {
coupPCD = addMonth( fInter, numMonthsNeg, endMonth ); coupPCD = addMonth( fInter, numMonthsNeg, endMonth );
} }
firstDate = iss > coupPCD ? iss : coupPCD; firstDate = new Date( iss > coupPCD ? iss : coupPCD );
days = days360( firstDate, settl, basis ); days = days360( firstDate, settl, basis );
coupDays = getcoupdays( coupPCD, fInter, frequency, basis ).getValue(); coupDays = getcoupdays( coupPCD, fInter, frequency, basis ).getValue();
res = days / coupDays; res = days / coupDays;
startDate = coupPCD; startDate = new Date( coupPCD );
endDate = iss; endDate = iss;
while( !( numMonthsNeg > 0 ? startDate >= iss : startDate <= iss ) ) { while( !( numMonthsNeg > 0 ? startDate >= iss : startDate <= iss ) ) {
...@@ -2132,6 +2132,8 @@ cDOLLARDE.prototype.Calculate = function ( arg ) { ...@@ -2132,6 +2132,8 @@ cDOLLARDE.prototype.Calculate = function ( arg ) {
else if ( fraction == 0 ) else if ( fraction == 0 )
return this.value = new cError( cErrorType.division_by_zero ); return this.value = new cError( cErrorType.division_by_zero );
fraction = Math.floor(fraction);
var fInt = Math.floor( fractionalDollar ), res = fractionalDollar - fInt; var fInt = Math.floor( fractionalDollar ), res = fractionalDollar - fInt;
res /= fraction; res /= fraction;
...@@ -2200,6 +2202,8 @@ cDOLLARFR.prototype.Calculate = function ( arg ) { ...@@ -2200,6 +2202,8 @@ cDOLLARFR.prototype.Calculate = function ( arg ) {
else if ( fraction == 0 ) else if ( fraction == 0 )
return this.value = new cError( cErrorType.division_by_zero ); return this.value = new cError( cErrorType.division_by_zero );
fraction = Math.floor(fraction);
var fInt = Math.floor( decimalDollar ), res = decimalDollar - fInt; var fInt = Math.floor( decimalDollar ), res = decimalDollar - fInt;
res *= fraction; res *= fraction;
......
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