Skip to main content
Participant
November 3, 2021
Question

Custom calculation

  • November 3, 2021
  • 2 replies
  • 299 views

Hi, I would like to add a custm calculation in my tax box. 

I want the user to check off either of the following: 

No tax

13% tax

15% tax

Once checked, I want the percentage amount to calculate with the subtal.

 

What would be my script?

 

This topic has been closed for replies.

2 replies

Participant
November 3, 2021

Thank you very much for your time!!! 

Nesa Nurani
Community Expert
Community Expert
November 3, 2021

As custom calculation of tax field use this:

var notax = this.getField("taxnone").value;
var t13 = this.getField("tax13").value;
var t15 = this.getField("tax15").value;
var sub = Number(this.getField("subtotal").value);
if(notax != "Off")
event.value = 0;
else if(t13 != "Off")
event.value = .13*sub;
else if(t15 != "Off")
event.value = .15*sub;
else event.value = "";

 

Check if field names are correct, if not, change them to your actual field names.