weesiong
asked on
Urgent: Looking Flash PMT() Command
In the visual basic and excel have a function call pmt(), it can calculator payment.
This is VB sample command:
lvTotInterest = Format(Pmt(0.0575 / 12, 300, 200000 * -1), "#########.00")
The answer will come out: 1258.21
So how about flash?
This is VB sample command:
lvTotInterest = Format(Pmt(0.0575 / 12, 300, 200000 * -1), "#########.00")
The answer will come out: 1258.21
So how about flash?
Do you mean you want to round the calculated number in flash? Or do you want to create a function that is a calculation in flash?
just tell me what mean each parameter:
Pmt(meaning??,meaning??,me aning??)
=0)
Pmt(meaning??,meaning??,me
=0)
ASKER
ivanmata,
I have found the thing i want, thanks. This is the function i found.
function pmt(r,np,pv,fv) {
r = r/1200;
if (!fv) fv = 0;
mypmt=-(r * (fv+Math.pow((1+r),np)*pv) /(-1+Math. pow((1+r), np)));
finalPmt=roundOff(mypmt,2) ;
trace(finalPmt);
return finalPmt;
}
function roundOff(value, dplaces){
value=value.toString()
if((value.indexOf(".")!=-1 )&&(value. length>(va lue.indexO f(".")+dpl aces))){
three=value.substring(valu e.indexOf( ".")+dplac es+1,value .indexOf(" .")+dplace s+2)
one=value.substring(0,valu e.indexOf( ".")+dplac es)
two=value.substring(value. indexOf(". ")+dplaces ,value.ind exOf(".")+ dplaces+1)
if(parseInt(three)>=5){val ue=one+(pa rseInt(two )+1);value =parseFloa t(value)}
else{value=one+two;value=p arseFloat( value)}
}
return value;
}
I will delete this question.
I have found the thing i want, thanks. This is the function i found.
function pmt(r,np,pv,fv) {
r = r/1200;
if (!fv) fv = 0;
mypmt=-(r * (fv+Math.pow((1+r),np)*pv)
finalPmt=roundOff(mypmt,2)
trace(finalPmt);
return finalPmt;
}
function roundOff(value, dplaces){
value=value.toString()
if((value.indexOf(".")!=-1
three=value.substring(valu
one=value.substring(0,valu
two=value.substring(value.
if(parseInt(three)>=5){val
else{value=one+two;value=p
}
return value;
}
I will delete this question.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.