These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

JavaScript for Tax & Total for invoice

Wild
Registered: Apr 18 2008
Posts: 12
Answered

I desperately need to complete this invoice form and require script to take a sub total add 5% tax and display a total.
The form is written in FormCalc but I cannot find a solution for the above and have read that JavaScript is easier to use, can someone please help me out with this?

My Product Information:
LiveCycle Designer, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
In the total field you can enter for the "Calculation" event the following FormCalc script:

Subtotal * 1.05

You will have to change the "Subtotal" to your field name for subtotal.

FormCalc is a scripting language used in LIveCycle Desinger forms. You could also use JavaScript, but the syntax is more complex.

You can find all the mathmatical operators in LiveCycle Designer's "Scripting Reference" under "Help". You may need to use the "Search" tab. But this is a refernce document and not a how to document.

George Kaiser

Wild
Registered: Apr 18 2008
Posts: 12
Thank you so very much Mr. Kaiser!
Your solution was rather embarrassingly simple yet you guided me to success in solving this issue after trying so hard and being intimidated with the FormCalc script.

I was able to insert Subtotal*.05 into the calculation for a separate Fed tax field and this works even better. The sad part is that Adobe support failed to help me on this issue.
bkang22
Registered: Dec 4 2007
Posts: 4
Is it possible to create a box that one could put a tax amount (our client has to charge a tax based on what city his client is in) so he has quite a few different tax rates, plus he sells in various states, he does not charge tax on everything, just rented hardware and additional services so I know I can create a subtotal box but I need a box that he can key in the tax amount that would then calculate a total amount into another box. Any help would be appreciated!
Wild
Registered: Apr 18 2008
Posts: 12
Yes it should be possible you could make a drop down or list box to populate a tax amount field and then calculate the tax from that field.
webmezzo
Registered: Aug 29 2010
Posts: 1
I'm sort of in the same boat, EXCEPT, with a need to test for different tax codes....

I'm having a very difficult time getting my data to go into the right 'bucket'....

Scenario:

Invoice has line items 00 thru 10...
Each line item has fields for an extended line item amount (Amount00 thru 10) and an associated tax flag (TaxBox00 thru 10)

line 1 - Amount.00 TaxBox.00
line 2 - Amount.01 TaxBox.01
etc.

I have set up a few hidden fields called: LodgingTxSubtotal, SalesTxSubtotal, and NoTxSubtotal.
So that if the tax flag field is 'L', the extended amount should be added to LodgingTxSubtotal,

where if the tax flag field is 'S', the extended amount should be added to SalesTxSubtotal,

and where if the tax flag field is 'X', the extended amount should be added to NoTxSubtotal.


I have already set up tax calculations on the various subtotals, but I can't seem to calculate the subtotals themselves.

I've tried 'IF' and 'Switch', but my JS skills are very rudimentary...

Please help?