kahlua17
11-27-2003, 09:35 AM
How can I run a JavaScript code that will take information from an SQL table and make the appropriate calculations?
My SQL table looks like the following:
ID Acct Acct_No Tax1_calc Tax2_calc
----------------------------------------------------------------------
1 Option1 12345 0.0654 0.140
2 Option2 67890 0.0545 0.140
3 Option3 24680 0.0654 0.150
Users select the Acct from a dropdown box (pulls the ID number from the SQL table).
Users then select a Tax from a tax dropdown - which is not related to the SQL table - it's a seperate option statement in the html).
I have 3 fields that I would like populated automatically - based on the Invoice Amount that is already automatically populated. The fields appear as follows:
Invoice_Amt Tax_Selected Tax1_Amt Tax2_Amt Base_Amt
I have figured out that the If statements should be formed as :
If ID = request.getParameter("Acct") AND Tax_Selected = Tax1(from dropdown) then "Tax1_ Amt = Invoice_Amt * Tax1_Calc" AND "Tax2_Amt = 0"
If ID = request.getParameter("Acct") AND Tax_Selected = Tax2(from dropdown) then "Tax1_ Amt = Invoice_Amt * Tax2_Calc" AND "Tax1_Amt = 0"
This is as far as I can get. I am having difficulty putting these into a JavaScript statement that works. :(
Any help on this will be greatly appreciated !! :D
My SQL table looks like the following:
ID Acct Acct_No Tax1_calc Tax2_calc
----------------------------------------------------------------------
1 Option1 12345 0.0654 0.140
2 Option2 67890 0.0545 0.140
3 Option3 24680 0.0654 0.150
Users select the Acct from a dropdown box (pulls the ID number from the SQL table).
Users then select a Tax from a tax dropdown - which is not related to the SQL table - it's a seperate option statement in the html).
I have 3 fields that I would like populated automatically - based on the Invoice Amount that is already automatically populated. The fields appear as follows:
Invoice_Amt Tax_Selected Tax1_Amt Tax2_Amt Base_Amt
I have figured out that the If statements should be formed as :
If ID = request.getParameter("Acct") AND Tax_Selected = Tax1(from dropdown) then "Tax1_ Amt = Invoice_Amt * Tax1_Calc" AND "Tax2_Amt = 0"
If ID = request.getParameter("Acct") AND Tax_Selected = Tax2(from dropdown) then "Tax1_ Amt = Invoice_Amt * Tax2_Calc" AND "Tax1_Amt = 0"
This is as far as I can get. I am having difficulty putting these into a JavaScript statement that works. :(
Any help on this will be greatly appreciated !! :D