• Resolved UserDG

    (@tenkepadu)


    I have two questions,

    1) for formula, I have a formula like this:

    Round up(price-downpayment over 1- (1 over (1 + interest over 12)) over interest over 12

    I convert it to…
    Round up (fieldname1-fieldname2/1-(1/(1+fieldname3(which is dropdown)/12)) / fieldname3 /12

    is this correct? What is the correct formula?

    2) It is possible to compute if every amount have different interest range? E.g 5,000 to 12, 000 the interest is 20.18% while 12,001 to 30,000 the interest is 25.50%

    How can I do that? If the client is inputted 5,000 so the interest will be 20.18%. Should I use dropdown?

    https://ww.wp.xz.cn/plugins/calculated-fields-form/

Viewing 14 replies - 16 through 29 (of 29 total)
  • Thread Starter UserDG

    (@tenkepadu)

    Payment function is available in programmatically? Like in Excel?

    Thread Starter UserDG

    (@tenkepadu)

    Because I want to include it to my formula, like this

    CEIL(PMT(fieldname1-fieldname2 / (1- (1 / (1 + interest/12)*exp(fieldname3))) / interest/ 12))

    Thread Starter UserDG

    (@tenkepadu)

    I have a question…

    I said before there’s a price range, in every price range different interest, but how about the no. of terms? Every terms, different interest also.

    E.g.

    If the client input product amount with 7000 and the interest is .80 and he choose 18 months of terms (this terms has 64%)

    How can I compute this?

    Thread Starter UserDG

    (@tenkepadu)

    Is this correct?

    (function(){
    var interest = 0;
    if(5000<=fieldname1 && fieldname1<=12000) interest=0.994;
    if(12001<=fieldname1 && fieldname1<=30000) interest=0.9351;
    if(30001<=fieldname1 && fieldname1<=60000) interest=0.9351;

    PMT (ir, np, pv, fv ) {
    /*
    ir – interest rate per month
    np – number of periods (months)
    pv – present value
    fv – future value (residual value)
    */

    pmt = ( ir * ( fieldname1-fieldname2 * Math.pow ( (ir+1), fieldname3 ) + , ) ) / ( ( interest + 1 ) * ( Math.pow ( (interest+1), fieldname3) -1 ) );

    return pmt;
    }

    return CEIL(PMT(fieldname1-fieldname2 / (1- (1 / (1 + interest/12)*exp(fieldname3))) / interest/ 12);
    })()

    Plugin Author codepeople

    (@codepeople)

    Hi,

    I’m sorry but the equation is not correct. You can nest functions, but you need to use the keyword “function” in front of its name, and call the function in some place in the equation because you are only entering its definition.

    I can offer you our services of custom coding to develop your project. If you are interested in hire our services, please contact us through our support page:

    http://wordpress.dwbooster.com/support

    Best regards.

    Thread Starter UserDG

    (@tenkepadu)

    So do you mean I need to create two functions?

    Like this?

    (function(){
    var interest = 0;
    if(5000<=fieldname1 && fieldname1<=12000) interest=0.994;
    if(12001<=fieldname1 && fieldname1<=30000) interest=0.9351;
    if(30001<=fieldname1 && fieldname1<=60000) interest=0.9351;

    function PMT (ir, np, pv, fv ) {
    /*
    ir – interest rate per month
    np – number of periods (months)
    pv – present value
    fv – future value (residual value)
    */

    pmt = ( ir * ( fieldname1-fieldname2 * Math.pow ( (ir+1), fieldname3 ) + , ) ) / ( ( interest + 1 ) * ( Math.pow ( (interest+1), fieldname3) 0 ) );

    return pmt;
    }

    return CEIL(pmt(fieldname1-fieldname2 / (1- (1 / (1 + interest/12)*exp(fieldname3))) / interest/ 12);
    })()

    Plugin Author codepeople

    (@codepeople)

    Hi,

    Yes, that is, but to be consequent with the definition of the new function, you’re passing only one parameter, so the rest of parameters can be deleted, and the comments section too:

    /*
    ir – interest rate per month
    np – number of periods (months)
    pv – present value
    fv – future value (residual value)
    */

    Best regards.

    Thread Starter UserDG

    (@tenkepadu)

    See.

    I have now this script..

    (function(){
    var interest = 0;
    if(5000<=fieldname1 && fieldname1<=12000)
    {
    if(fieldname22 == 9) interest=0.994;
    else if(fieldname22 == 12) interest=0.9351;
    else interest=0.994;
    }
    if(12001<=fieldname1 && fieldname1<=30000)
    {
    if(fieldname22 == 9) interest=0.9383;
    else if(fieldname22 == 12) interest=0.917;
    else if(fieldname22 == 15) interest=0.8607;
    else interest=0.9351;
    }
    if(30001<=fieldname1 && fieldname1<=60000)
    {
    if(fieldname22 == 9) interest=0.9383;
    else if(fieldname22 == 12) interest=0.8988;
    else if(fieldname22 == 15) interest=0.8429;
    else if(fieldname22 == 15) interest=0.7901;
    else interest=0.9383;
    }

    function PMT () {
    var PMT;
    PMT = ( fieldname22 * ( fieldname1-fieldname2 * Math.pow ( (fieldname22+1), fieldname22 ) + , ) ) / ( ( interest + 1 ) * ( Math.pow ( (interest+1), fieldname22) 0 ) );

    return PMT;
    }

    return CEIL(PMT(fieldname1-fieldname2 / (1- (1 / (1 + interest/12)*exp(fieldname22))) / interest/ 12));
    })()

    but when I test it, its not working. The result is not displaying

    Thread Starter UserDG

    (@tenkepadu)

    I edit the script

    (function(){
    var interest = 0;
    if(5000<=fieldname1 && fieldname1<=12000)
    {
    if(fieldname22 == 9) interest=0.994;
    else if(fieldname22 == 12) interest=0.9351;
    else interest=0.994;
    }
    if(12001<=fieldname1 && fieldname1<=30000)
    {
    if(fieldname22 == 9) interest=0.9383;
    else if(fieldname22 == 12) interest=0.917;
    else if(fieldname22 == 15) interest=0.8607;
    else interest=0.9351;
    }
    if(30001<=fieldname1 && fieldname1<=60000)
    {
    if(fieldname22 == 9) interest=0.9383;
    else if(fieldname22 == 12) interest=0.8988;
    else if(fieldname22 == 15) interest=0.8429;
    else if(fieldname22 == 15) interest=0.7901;
    else interest=0.9383;
    }

    function PMT() {
    return PMT ( fieldname22 * ( fieldname1-fieldname2 * POW ( (fieldname22+1), fieldname22 ) + , )) ) / ( ( interest + 1 ) * POW ( (interest+1), fieldname22) 0 ) );
    }

    return CEIL(fieldname1-fieldname2 / (1- (1 / (1 + interest/12)*exp(fieldname22))) / interest/ 12);
    })()

    But still its not working

    Plugin Author codepeople

    (@codepeople)

    Hi,

    I’m sorry, but your equation has basic javascript errors. Pay attention to the snippet of code:

    function PMT() {
    return PMT ( fieldname22 * ( fieldname1-fieldname2 * POW ( (fieldname22+1), fieldname22 ) + , )) ) / ( ( interest + 1 ) * POW ( (interest+1), fieldname22) 0 ) );
    }

    The previous code has multiple errors:

    1. You are calling the function you are defining from the same function’s implementation.

    2. You have a zero inside the mathematical equation that is provoking a parsing error.

    3. The function PMT has not been called from other place in your equation.

    Best regards.

    Thread Starter UserDG

    (@tenkepadu)

    But I just rely on this

    ir – interest rate per month
    np – number of periods (months)
    pv – present value
    fv – future value (residual value)
    */
    return pmt( ir * ( pv * Math.pow ( (ir+1), np ) + fv ) ) / ( ( ir + 1 ) * ( Math.pow ( (ir+1), np) 1 ) );

    My script
    PMT ( fieldname22 * ( fieldname1-fieldname2 * POW ( (fieldname22+1), fieldname22 ) + , )) ) / ( ( interest + 1 ) * POW ( (interest+1), fieldname22) 0 ));

    So if there’s an np, i replace fieldname22 for no. of months, ir I replace as fieldname22 or interest?

    Seems I declare the interest. While the pv, i change it into fieldname1-fieldname2, because the result of f1 and f2 will supposed to be the value of pv

    Plugin Author codepeople

    (@codepeople)

    Hi,

    Could you indicate the source of the equation you are using, please?

    Best regards.

    Thread Starter UserDG

    (@tenkepadu)

    Plugin Author codepeople

    (@codepeople)

    Hi,

    Pay attention to the code of this function:

    function PMT (ir, np, pv, fv ) {
    pmt = ( ir * ( pv * Math.pow ( (ir+1), np ) + fv ) ) / ( ( ir + 1 ) * ( Math.pow ( (ir+1), np) -1 ) );
    return pmt;
    }

    The function name is in uppercase, and the function uses a variable in lowercase, that is returned when the function is called (the javascript code is case sensitive), and the mathematical equation has not any number without mathematical operator.

    Now, analyzes the function you are using:

    function PMT() {
    return PMT ( fieldname22 * ( fieldname1-fieldname2 * POW ( (fieldname22+1), fieldname22 ) + , )) ) / ( ( interest + 1 ) * POW ( (interest+1), fieldname22) 0 ) );
    }

    In your equation you are not using a variable in the function definition; you are calling the same function, and you have the number zero, without any mathematical operator.

    I’m sorry, but this ticket is not about our plugin, you are needing someone that can develop your equation. if you need extra help with your equation’s development you should contact us through our support page:

    http://wordpress.dwbooster.com/support

    Best regards.

Viewing 14 replies - 16 through 29 (of 29 total)

The topic ‘Right formula’ is closed to new replies.