• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Invoice with user entered Tax Rate

Contributor ,
Aug 31, 2020 Aug 31, 2020

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!

 

TOPICS
PDF forms

Views

742

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Expert , Aug 31, 2020 Aug 31, 2020

Check fix2 now: test doc.pdf(Fix2) 

Votes

Translate

Translate
Community Expert , Aug 31, 2020 Aug 31, 2020

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 . 

Votes

Translate

Translate
Enthusiast ,
Aug 31, 2020 Aug 31, 2020

Copy link to clipboard

Copied

It's probably an issue with percentage calculation somwhere. can you post your code or even better your file?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 31, 2020 Aug 31, 2020

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 31, 2020 Aug 31, 2020

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));

 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 31, 2020 Aug 31, 2020

Copy link to clipboard

Copied

gives a 'the value entered does not match the format of the field" error.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 31, 2020 Aug 31, 2020

Copy link to clipboard

Copied

You can move this script to the format tab -->> and use it as custom format script

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 31, 2020 Aug 31, 2020

Copy link to clipboard

Copied

Are you using Simplified Field Notation in all other fields?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 31, 2020 Aug 31, 2020

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 31, 2020 Aug 31, 2020

Copy link to clipboard

Copied

Ok check your shared file now: test doc.pdf(Fix) 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 31, 2020 Aug 31, 2020

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 31, 2020 Aug 31, 2020

Copy link to clipboard

Copied

Check fix2 now: test doc.pdf(Fix2) 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 31, 2020 Aug 31, 2020

Copy link to clipboard

Copied

looks good!!!  TY,   i will review the fields to see the changes.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 31, 2020 Aug 31, 2020

Copy link to clipboard

Copied

LATEST

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 . 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 31, 2020 Aug 31, 2020

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

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines