Copy link to clipboard
Copied
So I have been thru the forum and seen responses to similiar questions but I am not script savvy so Im copying and pasting with any needed changes I can identify.
In my case I am working with these fields and failing with the tax rate.
[subtotal] - Sums all items
[freight] - User entered value
[taxrate] - User entered value). Looking to have this in percentage format so a .0825 I want the users to enter as 8.25%
[tax] - Calculates (subtotal+freight)*taxrate
[total] - Calculates (subtotal+freight+tax)
what seems to be happening is my taxrate is 10000% more than what I enter. I think i can solve this my using decimals instead of percentage but im trying to make this visually easier for the end users. Any suggestions? TY in advanced!
Check fix2 now: test doc.pdf(Fix2)
Using custom format script in "TaxRate" field :
if (event.value =="") event.value ="";
else event.value = util.printf("%.2f%", (event.target.value));
Using this simplified field notation in the "TAX" field:
((SUBTOTAL+FREIGHT)*TaxRate)/100
And I readjusted the field calculation order for the "EXT PRICETOTAL" field .
Copy link to clipboard
Copied
It's probably an issue with percentage calculation somwhere. can you post your code or even better your file?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
multiply .0825 by 100 and use the util.printf() method to assign the format.
you can try this as custom calculation script of the taxrate field; something like this:
if (event.target.value =="") event.value ="";
else event.value = util.printf("%.2f", (event.target.value*100));
Copy link to clipboard
Copied
gives a 'the value entered does not match the format of the field" error.
Copy link to clipboard
Copied
You can move this script to the format tab -->> and use it as custom format script
Copy link to clipboard
Copied
Are you using Simplified Field Notation in all other fields?
Copy link to clipboard
Copied
yes I am. In the [tax] field and in the [total] field. i can change to whatever would make all of these calcs work.
Copy link to clipboard
Copied
Ok check your shared file now: test doc.pdf(Fix)
Copy link to clipboard
Copied
a few things
1 - for the tax rate I would like for the users to enter whole numbers for the percentage. Is that possible?
2 - the numbers don't seem to add properly. If i for 5k in freight and sub that is a 10k total and 10% of the is 1000. It is tallying 1,000.10 as the ax and the total with everything is now 110,010,00
Copy link to clipboard
Copied
Check fix2 now: test doc.pdf(Fix2)
Copy link to clipboard
Copied
looks good!!! TY, i will review the fields to see the changes.
Copy link to clipboard
Copied
Using custom format script in "TaxRate" field :
if (event.value =="") event.value ="";
else event.value = util.printf("%.2f%", (event.target.value));
Using this simplified field notation in the "TAX" field:
((SUBTOTAL+FREIGHT)*TaxRate)/100
And I readjusted the field calculation order for the "EXT PRICETOTAL" field .
Copy link to clipboard
Copied
This is what I did:
In the "TaxRate" field I placed the following code as custom format script
if (event.value =="") event.value ="";
else event.value = util.printf("%.2f%", (event.target.value*100));
Then in the "TAX" field use the following Simplified Field Notation:
((SUBTOTAL+FREIGHT)*TaxRate)+TaxRate
And in the "EXT PRICETOTAL" field like this:
SUBTOTAL + FREIGHT + TAX