diff --git a/main/SS/Formula/Functions/PPMT.cs b/main/SS/Formula/Functions/PPMT.cs index 38c2f6c5f..ce1aa233a 100644 --- a/main/SS/Formula/Functions/PPMT.cs +++ b/main/SS/Formula/Functions/PPMT.cs @@ -37,6 +37,8 @@ protected override double Eval(ValueEval[] args, int srcCellRow, int srcCellCol) throw new EvaluationException(ErrorEval.VALUE_INVALID); double result; + ValueEval v5 =null; + ValueEval v6 =null; ValueEval v1 = OperandResolver.GetSingleValue(args[0], srcCellRow, srcCellCol); ValueEval v2 = OperandResolver.GetSingleValue(args[1], srcCellRow, srcCellCol); @@ -48,7 +50,24 @@ protected override double Eval(ValueEval[] args, int srcCellRow, int srcCellCol) int numberPayments = OperandResolver.CoerceValueToInt(v3); double PV = OperandResolver.CoerceValueToDouble(v4); - result = Finance.PPMT(interestRate, period, numberPayments, PV); + if(args.Length==4) + { + result = Finance.PPMT(interestRate, period, numberPayments, PV); + } + else if(args.Length==5) + { + v5=OperandResolver.GetSingleValue(args[4], srcCellRow, srcCellCol); + double FV = OperandResolver.CoerceValueToDouble(v5); + result = Finance.PPMT(interestRate, period, numberPayments, PV, FV); + } + else + { + v5=OperandResolver.GetSingleValue(args[4], srcCellRow, srcCellCol); + v6 = OperandResolver.GetSingleValue(args[5], srcCellRow, srcCellCol); + double FV = OperandResolver.CoerceValueToDouble(v5); + int type = OperandResolver.CoerceValueToInt(v6); + result = Finance.PPMT(interestRate, period, numberPayments, PV, FV,type); + } CheckValue(result);