Link to home
Start Free TrialLog in
Avatar of weesiong
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?
Avatar of dutchfoxer
dutchfoxer
Flag of Netherlands image

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?
Avatar of ivanmata
ivanmata

just tell me what mean each parameter:

Pmt(meaning??,meaning??,meaning??)

=0)
Avatar of weesiong

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>(value.indexOf(".")+dplaces))){
   three=value.substring(value.indexOf(".")+dplaces+1,value.indexOf(".")+dplaces+2)
   one=value.substring(0,value.indexOf(".")+dplaces)
   two=value.substring(value.indexOf(".")+dplaces,value.indexOf(".")+dplaces+1)
   if(parseInt(three)>=5){value=one+(parseInt(two)+1);value=parseFloat(value)}
   else{value=one+two;value=parseFloat(value)}
}
      return value;
}

I will delete this question.
ASKER CERTIFIED SOLUTION
Avatar of Netminder
Netminder

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial