Support » Plugin: Calculated Fields Form » Basic % Calculation

  • Resolved smartnetnyc

    (@smartnetnyc)


    We just need a simple calculation for our website payment page…
    [Invoice Amount] + [0.03 Fee] = [Total Amount]

    Please advise the best way to achieve this. Thank you.

    • This topic was modified 1 month ago by  smartnetnyc.
Viewing 1 replies (of 1 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @smartnetnyc

    The description of your form is too general. So, I’ll try to describe the process with a hypothetical example.

    Assuming you have created a form with three checkbox fields: fieldname1, fieldname2, and fieldname3, respectively. Each of them for a different group of services.

    Every choice in the checkbox fields is composed of the service name (as the choice’s text) and its corresponding price (as the choice’s value).

    Furthermore, you want to increase the result into a 3% (as processing fee)

    For this hypothetical example, you simply should insert a calculated field in the form with the equation:

    
    (fieldname1+fieldname2+fieldname3)*1.03
    

    As the equation should return a currency value, you should round the result to two decimal places. I recommend you to use the PREC operation. PREC(X,Y) returns the number X rounded to Y decimals.

    Finally, the previous equation should be modified as follows:

    
    PREC((fieldname1+fieldname2+fieldname3)*1.03, 2)
    

    and that’s all.
    Best regards.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.