The following is what i am trying to accomplish:
1. The person enters in their total gross from the prior year in the field. I.e. $15000.34
2. They then press the "Calculate" button and it should round the number they entered to the nearest thousand and the divide by 1000. Then the value should be passed to the calculated gross field (make this a display field only) and then click on the "Post" button to update the table in db
I.e. 15
This is what i have so far that does the rounding, but i am stuck on trasnferring the rounded value and passing it to the other input field so the person can click on the post button.
--------------------------
----------
----------
-------
<script language="javascript">
function myRound(num) {
return Math.round(num*1)/1000;
}
</script>
--------------------------
----------
----------
----
Code snippet from the page:
<form name=gross1 method=post action=gross_rec.aspx?bus_
id=<%=bus_
id%>&lic_s
eq=<%=lic_
seq%>>
<tr>
<td class="hd1_sep" colspan=4>Renewal Units</td>
</tr>
<tr>
<td class=field_label>License Number</td>
<td class=field_data><%=rslic.
rows(0)("l
icense")%>
</td>
<td class=field_label>License Fee Amount</td>
<td class=field_data><%=rslic.
rows(0)("f
ee")%></td
>
</tr>
<tr>
<td class=field_label>Category
</td>
<td class=field_data><%=rslic.
rows(0)("c
atdesc1")%
></td>
<td class=field_label>License Balance Due</td>
<td class=field_data><%=rslic.
rows(0)("f
ee")%></td
>
</tr>
<tr>
<td class=field_label><%=rslic
.rows(0)("
fee_desc")
%></td>
<td class=field_data><%=rslic.
rows(0)("g
ross_rec_a
mt")%></td
>
</tr>
<%
dim b_title, b_title2
if rslic.rows(0)("gross_rec_a
mt") > "0.00" then
b_title = "Reenter " & rslic.rows(0)("fee_desc")
else
b_title = "Enter " & rslic.rows(0)("fee_desc")
end if
b_title2 = "Total " & rslic.rows(0)("fee_desc")
'title was Enter New Amount
'title2 was New Amount
if rslic.rows(0)("stat") = "A" then
%>
<tr id=div1>
<td class=field_label colspan=4 align=left>
<!-- changed value="<%=b_title%>" to "Enter Gross" -->
<input type=button value="Enter Gross" onClick=ShowInput(1)>
</td>
</tr>
<tr id=div2 style="display:none">
<!-- Changed <%=b_title2%> to "Enter Gross" -->
<td class=field_label>Prior Year Gross Receipts:</td>
--------------------------
----------
----------
----------
----------
----------
----------
----------
----------
----------
-----
<td align="left" colspan="1">
<INPUT NAME="Number" TYPE="TEXT">
<INPUT TYPE="BUTTON" value="Calculate" ONCLICK="this.form.Number.
value=myRo
und(this.f
orm.Number
.value);"
</td>
<td class=field_label align="right">Calculated Gross</td>
<td align=left colspan=3>
<input name=gr_amt type=text size=9 style="text-align:right" value=<%=rslic.rows(0)("gr
oss_rec_am
t")%>>
<!-- I am trying to add an input field and a dipslay field so people can get their calcualtions correct
<input class="buttonsub" type="submit" value="Post"> -->
<input class="buttonsub" type="submit" value="Post" onClick="return PostInput()">
<input class="buttonsub" type=button value="Cancel" onClick=ShowInput(2)>
</td>
</tr>
--------------------------
----------
----------
----------
----------
----------
----------
----------
----------
----------
----------
---
<% end if %>
</form>
I am focusing on the code between the lines i placed above. When i click on the "calculate" button it does round and produces a number. Now i need to have it automatically put that same number from the input field to show up in the gr_amt input field. Plus the gr_amt should be a display only field so they cannot change it and some controls that makes the person input a numerical value that is not equal to 0. Any assistance is greatly apprciated. Thank you.
Start Free Trial