Copy link to clipboard
Copied
Hi
I asked sometiem back about how to calculate TAX on a PDF invoice.
My accountant states that there is some issues, which is basically under €300 the tax rate is 0% and above is 9%.
Is there a way to have it write a calculation to take the field (let's say it's called 'subtotal' and the tax field is called 'tax') and to have it calculate and display the options based on the if it is above or below 300?
So, something like:
if subtotal<300 tax=0 else tax=subtotal*0.9 or something like that?
Thanks in advance
Rob
Sorry, I am not mathematically minded 🙂
If I understand you right, use this as custom calculation of "tax" field:
if(this.getField("subtotal").value >= 300)
event.value = this.getField("subtotal").value*0.9;
else event.value = 0;
Copy link to clipboard
Copied
You want to show result in 'tax' field or some other field like 'total'?
Copy link to clipboard
Copied
I believe Nesa may have hit it on the nail.
Rob
Copy link to clipboard
Copied
If I understand you right, use this as custom calculation of "tax" field:
if(this.getField("subtotal").value >= 300)
event.value = this.getField("subtotal").value*0.9;
else event.value = 0;
Copy link to clipboard
Copied
I will check this out and let you know. Thanks.
Copy link to clipboard
Copied
OK, it seems to be showing the subtotal minus the tax. I need it to show the amount of 9% as an addition to the subtotal. So, 9% of the subtotal, which will then be added in the grand total field.
If that makes sense.
Rob
Copy link to clipboard
Copied
The code above is wrong, anyway. If you multiply by 0.9 you get the result of 90% tax, not 9%. You need to multiply by 0.09 for that. If you want to show the total plus tax then multiply by 1.09.
Copy link to clipboard
Copied
My mistake I need it to be 0.09 and that works fine.
Rob
Copy link to clipboard
Copied
You should also find out the rules for rounding tax, and make sure you follow them. Accountants get very picking about fractions of a cent.