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

PMT, COLUMNS, ROWS

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@47444 954022d7-b5bf-4e40-9824-e11837661b57
parent 1f03e2fd
...@@ -906,4 +906,34 @@ ...@@ -906,4 +906,34 @@
}) })
test("Test: \"PMT\"",function(){
function pmt( rate, nper, pv, fv, type ){
var res;
if( type === undefined || type === null )
type = 0;
if( fv === undefined || fv === null )
fv = 0;
if( rate != 0 ){
res = -1*( pv * Math.pow( 1 + rate, nper ) + fv ) /
( ( 1 + rate * type ) * ( Math.pow( 1 + rate, nper ) - 1 ) / rate );
}
else{
res = -1*( pv + fv )/ nper;
}
return res;
}
oParser = new parserFormula("PMT(0.08/12,10,10000)","A2",ws);
ok(oParser.parse());
ok( Math.abs(oParser.calculate().getValue() - pmt(0.08/12,10,10000)) < dif );
oParser = new parserFormula("PMT(0.08/12,10,10000,0,1)","A2",ws);
ok(oParser.parse());
ok( Math.abs(oParser.calculate().getValue() - pmt(0.08/12,10,10000,0,1)) < dif );
})
}); });
...@@ -4455,6 +4455,20 @@ Range.prototype._foreach=function(action){ ...@@ -4455,6 +4455,20 @@ Range.prototype._foreach=function(action){
} }
} }
}; };
Range.prototype._foreach2=function(action){
if(null != action)
{
var oBBox = this.bbox, minC = Math.min( this.worksheet.getColsCount(), oBBox.c2 ), minR = Math.min( this.worksheet.getRowsCount(), oBBox.r2 );
for(var i = oBBox.r1; i <= minR; i++){
for(var j = oBBox.c1; j <= minC; j++){
var oCurCell = this.worksheet._getCellNoEmpty(i, j);
var oRes = action(oCurCell, i, j, oBBox.r1, oBBox.c1);
if(null != oRes)
return oRes;
}
}
}
};
Range.prototype._foreachNoEmpty=function(action){ Range.prototype._foreachNoEmpty=function(action){
if(null != action) if(null != action)
{ {
......
This diff is collapsed.
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