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

Custom calculation script for percentage calculation

haley
Registered: Jul 15 2010
Posts: 38

I have been getting useful information on this topic but being a new user of the adobe 9 pro I am having difficulty doing a calculation script for calculating percentages. I have a sample below of what I would require:

1. Gross DIRECT premiums in respect of PROPERTY
Insurance (less return premiums and cancellations) $
2.DEDUCTIONS:
(a) Credits Allowed to subscribers $
(b) Creditor involuntary unemployment insurance $
(c) Other (please detail) ………………………… $
TOTAL deductions: $

3. TOTAL taxable premiums (Deduct item 2 from item 1) $
4. Tax payable at 1.25% of item 3 $

I would need to calculate the 1.25% of item 3 since I have already done a script for deducting item 3 from item 1.

I am thinking that somebody has already provided me with the information I need but I am just not grasping it. I think I am missing something somewhere.

Please bear with me.

My Product Information:
Acrobat Pro 9.0, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
I believe [url=http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=26916]Percentages in javascript[/url] is your original post.

Unlike Excel Acrobat forms calculate fields in the order created, and not left to right and then down like a spreadsheet. Are the fields calculating in the expected order?

It appears you are having a problem with cutting and pasting the script, and then trying to edit the script to match your form. If you are trying to change the name of field, the field name needs to be between quotation marks and they must be a matched pair of the same type of quotation marks. Also they need to be the very plain ones from NotePad or other simple text editor. Not MS Word's smart quotation marks.

George Kaiser

haley
Registered: Jul 15 2010
Posts: 38
Here is what I have done for a calculation script.

var ctotalpayable = totalpayable;
var ntaxpayable = this.getfield(ctotaltaxable).value;
var ntaxpayable = 0.0125;
event.value = ntaxpayable * total taxable

I tried my best to try to figure it out. I can just imagine what it looks like to you.

I didn't have any trouble doing the script for the gross premiums subtracting the total deductions to to equal the total taxable premiums.

This one is just way out of my league.
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
All text text strings, even those used for a field name, must be within quotation marks!
Quote:
If you are trying to change the name of field, the field name needs to be between quotation marks and they must be a matched pair of the same type of quotation marks.
var ctotalpayable = "totalpayable";var ntaxpayable = this.getfield(ctotaltaxable).value;var ntaxpayable = 0.0125;event.value = ntaxpayable * total taxable

George Kaiser

haley
Registered: Jul 15 2010
Posts: 38
I am getting an error - missing ; before statement 4: at line 5 - HELP
haley
Registered: Jul 15 2010
Posts: 38
I found out what I did wrong. Now I will try the calculations and will keep you posted
haley
Registered: Jul 15 2010
Posts: 38
There was an extra space I found but now that I have the script put in properly it doesn't seem to want to calculate.