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

Using Javascript in an interactive Quote PDF

New Here ,
Nov 15, 2022 Nov 15, 2022

Hi there! 

 

This is probably going to be a super simple one to fix so apologies in advance but I am a total novice in the world of adding calculations in PDF forms. I was supplied an existing excel "Quotation" form which the team in the field use currently to create quotes for customers. It has both "list price" and "contract rate" columns which are populated as soon as the quantity for each line item is added. 

 

I can't add the sheet due to client confidentiality but have added a screen grab of the columns in question so I hope this helps to explain...

Essentially I need to populate the List price column based on a set price multiplied by whatever has been entered into the Qty column for that product... and then the same for the Contract price.

 

So Qty 1 x 5,500 = List Price 1 and Qty 1 x 2,250 = Contract Price 1

 

I'm not afraid to say I am an utter muppet and just can't seem to get my head around this! Please help!

 

At the bottom of the form there is then the "sub total", "GST" (which is tax of 10% on cost of products here in Oz), "sub total + GST" and finally "Amount Due" I gather I can do simple calculations for these but it is the List price and Contract Price calculations that are stumping me....

 

Many thanks in advance for helping me.....

 

CHeers,

 

Suz 

 

 

TOPICS
JavaScript
1.7K
Translate
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
2 ACCEPTED SOLUTIONS
Community Expert ,
Nov 15, 2022 Nov 15, 2022

Custom calculation script for "List Price 1":
event.value = Number(this.getField("Qty 1").valueAsString) * 5500;

 

Custom calculation script for "Contract Price 1":
event.value = Number(this.getField("Qty 1").valueAsString) * 2250;

View solution in original post

Translate
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 ,
Nov 15, 2022 Nov 15, 2022

You can also do it without using a script, via the Simplified Field Notation option, like this:

Qty\ 1 * 5500

Note the space in the field name needs to be escaped (by adding a back-slash before it).

View solution in original post

Translate
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 ,
Nov 15, 2022 Nov 15, 2022

Custom calculation script for "List Price 1":
event.value = Number(this.getField("Qty 1").valueAsString) * 5500;

 

Custom calculation script for "Contract Price 1":
event.value = Number(this.getField("Qty 1").valueAsString) * 2250;

Translate
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 ,
Nov 15, 2022 Nov 15, 2022

You can also do it without using a script, via the Simplified Field Notation option, like this:

Qty\ 1 * 5500

Note the space in the field name needs to be escaped (by adding a back-slash before it).

Translate
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
New Here ,
Nov 15, 2022 Nov 15, 2022

You are AMAZING! Thank you - not only for taking the time to respond to what was clearly (embarrassingly) such a simple thing - but for giving me 2 ways of doing it.... that backslash tip explains why it wasn't working when I was trying to do what I thought was a rational calculation....

Translate
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 ,
Nov 16, 2022 Nov 16, 2022

You're welcome! Unfortunately, the back-slash thing is not documented anywhere official (as far as I know), or at least it's buried deep in some help page, so figuring out how it should work on your own is nearly impossible...

Translate
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
LEGEND ,
Nov 16, 2022 Nov 16, 2022
LATEST

Tip: if those in the field aren't going to be using PCs - for example they are using iPads -- check everything very carefully. A lot of things don't work and can't work on iPads. You also need to be sure they use the app you test with, rather than one they prefer.

Translate
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