yoshismokey
Programmer
I have a problem with a form that has 3 possible submit buttons. One button is on the bottom of the form to calculate the fields and submit them to the database. The other 2 buttons switch the mode (1 allows the one column to be updateable, the other allows the other field to be updateable.) Thay are mutually exclusive - only one shows up at a time. If the user doesn't hit any of the submit buttons and just hits the enter key, ColdFusion automatically switches the mode back to the opposite one that was in effect at the time.
Is there any way to trap for the Enter key being pushed?
Here is the code to help clear this up:
The code in red is the submit button code.
Thanks in advance.
Robin
<cfinclude template="Connections/connOSTEOupr.cfm">
<cfparam default="$$none" name="form.UDP">
<cfparam default="$$none" name="form.UEP">
<cfparam default="$$none" name="form.submit">
<!-- The following queries are used to populate the top of the form with the agency and customer info
Note this code is called from the previous screen (addfamily.cfm)
-->
<!--- Get Transaction contract information --->
<cfquery name="gettranscontractinfo" datasource=#MM_connproducts_DSN# username=#MM_connproducts_USERNAME# password=#MM_connproducts_PASSWORD# debug="yes" >
SELECT * FROM TRANSACTION_CONTRACT_INFO
WHERE Transaction_Number = #form.Transaction_Number#
</cfquery>
<cfoutput query="gettranscontractinfo">
<!--- Get customer information --->
<cfquery name="getcustomer" datasource=#MM_connproducts_DSN# username=#MM_connproducts_USERNAME# password=#MM_connproducts_PASSWORD# debug="yes">
SELECT * FROM CUSTOMER
WHERE Customer.Customer_Number = '#gettranscontractinfo.Customer_Number#'
</cfquery>
</cfoutput>
<cfoutput query="getcustomer">
<!--- Get Agency information --->
<cfquery name="getagency" datasource=#MM_connproducts_DSN# username=#MM_connproducts_USERNAME# password=#MM_connproducts_PASSWORD# debug="yes" >
SELECT * FROM AGENCY
WHERE Agency_Name = '#getcustomer.Agency_Name#'
</cfquery>
</cfoutput>
<!--- Set all the total variables to 0 --->
<cfset GrandTotal_Discount_Price = 0>
<cfset GrandTotal_List_Price = 0>
<cfset GrandUnit_Discount_Price = 0>
<cfset GrandException_Price = 0>
<!--- If coming from the addfamily.cfm then pull out the families needed for the select. --->
<cfif IsDefined("Form.AddFamily")>
<cfoutput>I am coming from the add family page!!</cfoutput>
<cfset Form.Prod_Family = "">
<cfset Client.calctype = "Exception"> <!---This is the default - exception price will be unprotected --->
<!--- loop through the form fieldnames to pull out the family ids. --->
<CFLOOP INDEX="index" LIST="#form.fieldnames#">
<cfif FindNoCase("qty_",index) gt 0>
<cfset temp_id = Right(index,Len(index)-4)>
<cfif IsNumeric(Evaluate("Form.discount_#temp_id#")) AND IsNumeric(Evaluate("Form.qty_#temp_id#"))>
<!--- add the product family to the list. --->
<cfoutput>Temp_ID:#temp_ID# index:#index# Discount:#Evaluate("form.discount_#temp_id#")# Quantity#Evaluate("form.qty_#temp_id#")#</cfoutput>
<cfset Form.Prod_Family = ListAppend(FORM.Prod_Family,temp_id)>
</cfif>
</cfif>
</CFLOOP>
</cfif>
<!---The following sets calctype (type of calculation) depending on which of the two buttons was pushed - Update Discount Percent Column will set the calctype to
discount, Update Unit Exeption Price Column (the default) will set the calctype to "Exception" --->
<cfif Not IsDefined ("Client.calctype")> <!---if it is not defined yet, set it to the default of Exception--->
<cfoutput>No calctype is defined so I'm setting it to Exception</cfoutput>
<cfset Client.calctype = "Exception">
</cfif>
<cfoutput>Form.UDP:#form.UDP#<br>
form.UEP:#form.UEP#<br>
form.Submit:#form.Submit#<br></cfoutput>
<cfif form.UDP NEQ "$$none">
<cfoutput>I'm changing to discount now</cfoutput>
<cfset Client.calctype = "Discount">
</cfif>
<cfif form.UEP NEQ "$$none">
<cfoutput>I'm changing to exception now</cfoutput>
<cfset Client.calctype = "Exception">
</cfif>
<cfif form.Submit NEQ "$$none">
<cfoutput>The submit button was pushed!</cfoutput>
<cfoutput>The Calctype is #Client.calctype#</cfoutput>
</cfif>
<cfif Client.calctype EQ "Exception"> <!---Note this is the default - the old way when the Unit Exception Price is updateable and used to calculate
the percent discount --->
<cfif (form.UEP NEQ "$$none") or (form.Submit NEQ "$$none")>
<cfset message="Your transaction has been calculated.">
<cfoutput>We're inside the exception code...The Client.calctype is:#Client.calctype#</cfoutput>
<!--- loop through the form fields to pull out the product ids.--->
<CFLOOP INDEX="index" LIST="#form.fieldnames#">
<!--- if form field is quantity then calculate the Total List price --->
<cfif FindNoCase("quantity_",index) gt 0>
<!--- pull out product id --->
<cfset temp_id = Right(index,Len(index)-9)>
<cfif IsNumeric(Evaluate(index))>
<cfset "List_Price_#temp_id#" = Evaluate(index) * evaluate("form.unit_cost_#temp_id#")>
</cfif>
<!--- if form field is exception price then calculate Discount precentage, Unit Discount and Total Discount--->
<cfelseif FindNoCase("exception_price_",index) gt 0>
<!--- pull out product id --->
<cfset temp_id = Right(index,Len(index)-16)>
<!--- Strip out Dollar signs and commas. Doesn't play well with calculations. --->
<cfset Exception_Price = evaluate("form.exception_price_#temp_id#")>
<cfset Exception_Price = Replace(Exception_Price,"$","","All")>
<cfset Exception_Price = Replace(Exception_Price,",","","All")>
<!--- If valid Exception Price then do the calculations. --->
<cfif IsNumeric(Exception_Price) and Exception_Price neq 0>
<cfset "form.exception_price_#temp_id#" = Exception_Price>
<cfset "Discount_Percent_#temp_id#" = Round(((Evaluate("form.unit_cost_#temp_id#") - Exception_Price)/ Evaluate("form.unit_cost_#temp_id#")* 100))>
<cfset "Unit_Discount_Price_#temp_id#" = evaluate("form.unit_cost_#temp_id#") - Exception_Price>
<cfif Evaluate("form.quantity_#temp_id#") gt 0>
<cfset "Total_Discount_Price_#temp_id#" = Evaluate("Unit_Discount_Price_#temp_id#") * Evaluate("form.quantity_#temp_id#")>
<cfelse>
<cfset "Total_Discount_Price_#temp_id#" = "">
</cfif>
</cfif>
<!---Debugging stuff--->
<!---<br><cfoutput><font color="##ff0000">Temp ID:#temp_id#</font>
Exception_Price:#Evaluate("form.Exception_Price_#temp_id#")#
Discount_Percent:#evaluate("Discount_Percent_#temp_id#")#
Client.calctype:#Client.calctype#</cfoutput> --->
</cfif>
</CFLOOP>
</cfif>
</cfif>
<cfif Client.calctype EQ "Discount"> <!---note here the discount percentage field is opened for updating and used to calculate the Unit Exception Price --->
<cfif (form.UDP NEQ "$$none") or (form.Submit NEQ "$$none")>
<cfset message="Your transaction has been calculated.">
<cfoutput>We're inside the discount code.. The Client.calctype is:#Client.calctype#</cfoutput>
<!--- loop through the form fields to pull out the product ids.--->
<CFLOOP INDEX="index" LIST="#form.fieldnames#">
<!--- if form field is quantity then calculate the Total List price. Note unit cost is unit list price on form--->
<cfif FindNoCase("quantity_",index) gt 0>
<!--- pull out product id --->
<cfset temp_id = Right(index,Len(index)-9)>
<cfif IsNumeric(Evaluate(index))>
<cfset "List_Price_#temp_id#" = Evaluate(index) * evaluate("form.unit_cost_#temp_id#")>
</cfif>
<!--- if form field is discount percent then calculate Unit Exception Price, Unit Discount and Total Discount--->
<cfelseif FindNoCase("Discount_Percent_",index) gt 0>
<!--- pull out product id --->
<cfset temp_id = Right(index,Len(index)-17)>
<!--- If valid Discount Percent then do the calculations. --->
<cfif IsDefined ("form.Discount_Percent_#temp_id#")>
<cfset Discount_Percent = evaluate("form.Discount_Percent_#temp_id#")>
</cfif>
<cfif Not IsDefined ("form.Discount_Percent_#temp_id#")>
<cfset Discount_Percent = evaluate("Discount_Percent_#temp_id#")>
</cfif>
<cfif IsNumeric(Discount_Percent) and Discount_Percent neq 0>
<cfset "form.Discount_Percent_#temp_id#" = Discount_Percent>
<cfset "Exception_Price_#temp_id#" = (Evaluate("form.unit_cost_#temp_id#") - (Evaluate("form.unit_cost_#temp_id#") * (Discount_Percent/100)) )>
<!---<cfoutput>The new exception price is #Evaluate("Exception_Price_#temp_id#")#</cfoutput>--->
<cfset "form.Exception_Price_#temp_id#" = #Evaluate("Exception_Price_#temp_id#")#>
<cfset Exception_Price = evaluate("form.exception_price_#temp_id#")>
<cfset "Unit_Discount_Price_#temp_id#" = evaluate("form.unit_cost_#temp_id#") - Evaluate("Exception_Price_#temp_id#")>
<cfif Evaluate("form.quantity_#temp_id#") gt 0>
<cfset "Total_Discount_Price_#temp_id#" = Evaluate("Unit_Discount_Price_#temp_id#") * Evaluate("form.quantity_#temp_id#")>
<cfelse>
<cfset "Total_Discount_Price_#temp_id#" = "">
</cfif>
</cfif>
<!---Debugging stuff--->
<!--- <br><cfoutput><font color="##ff0000">THIS IS THE NEW STUFF:::: WHen discount percent field is updated :::Temp ID:#temp_id#</font>
Exception_Price:#Evaluate("form.Exception_Price_#temp_id#")#
Discount_Percent:#evaluate("Discount_Percent_#temp_id#")#
Client.calctype:#Client.calctype#
</cfoutput> --->
</cfif>
</CFLOOP>
</cfif>
</cfif>
<cfif (form.submit EQ "$$none") AND (form.UDP EQ "$$none") and (form.UEP EQ "$$none")>
<cfoutput>The user entered the ENTER key.</cfoutput>
</cfif>
<cfif (form.Submit NEQ "$$none")>
<CFLOOP INDEX="index" LIST="#form.fieldnames#">
<cfif FindNoCase("quantity_",index) gt 0>
<!--- pull out product id --->
<cfset temp_id = Right(index,Len(index)-9)>
<!--- Strip out Dollar signs and commas. Doesn't play well with calculations. --->
<cfset Exception_Price = evaluate("form.exception_price_#temp_id#")>
<cfset Exception_Price = Replace(Exception_Price,"$","","All")>
<cfset Exception_Price = Replace(Exception_Price,",","","All")>
<cfset "form.exception_price_#temp_id#" = Exception_Price>
<!--- If valid quantity and Exception Price then commit all calculations. --->
<cfif index gt 0 and IsDefined("form.exception_price_#temp_id#") and Exception_Price gt 0>
<cfquery name="getinfo" datasource=#MM_connproducts_DSN# username=#MM_connproducts_USERNAME# password=#MM_connproducts_PASSWORD# debug="yes">
Select * from Transaction WHERE Prod_ID='#temp_id#' and Transaction_Number='#form.Transaction_Number#'
</cfquery>
<!--- If transaction doesn't exist for this customer and product then add --->
<cfif getinfo.recordcount eq 0>
<cfquery name="getinfo" datasource=#MM_connproducts_DSN# username=#MM_connproducts_USERNAME# password=#MM_connproducts_PASSWORD# debug="yes">
Insert into Transaction (Prod_Quantity, Prod_Discount_Percent, Prod_Total_Std_Cost,
Prod_Unit_Exception_Price, Prod_Unit_Discount, Prod_Total_Discount,Prod_ID,Transaction_Number)
Values (#evaluate(index)#, #evaluate("FORM.Discount_Percent_#temp_id#")#
, #evaluate("FORM.List_Price_#temp_id#")# , #Exception_Price#,
#evaluate("FORM.Unit_Discount_Price_#temp_id#")#, #evaluate("FORM.Total_Discount_Price_#temp_id#")#,'#temp_id#','#form.Transaction_Number#')
</cfquery>
<cfelse>
<!--- If transaction exist for this customer and product then overwrite --->
<cfquery name="updateform" datasource=#MM_connproducts_DSN# username=#MM_connproducts_USERNAME# password=#MM_connproducts_PASSWORD# debug="yes">
UPDATE TRANSACTION SET Prod_Quantity=#evaluate(index)#, Prod_Discount_Percent=#evaluate("FORM.Discount_Percent_#temp_id#")#
, Prod_Total_Std_Cost=#evaluate("FORM.List_Price_#temp_id#")# , Prod_Unit_Exception_Price = #Exception_Price#, Prod_Unit_Discount =
#evaluate("FORM.Unit_Discount_Price_#temp_id#")#, Prod_Total_Discount
= #evaluate("FORM.Total_Discount_Price_#temp_id#")# WHERE Prod_ID='#temp_id#'
and Transaction_Number='#form.Transaction_Number#'
</cfquery>
</cfif>
</cfif>
<!--- just debugging stuff <br><cfoutput>#index# #temp_id# #evaluate("Discount_Percent_#temp_id#")# #Evaluate("Unit_Discount_Price_#temp_id#")# #Evaluate("Total_Discount_Price_#temp_id#")#</cfoutput> --->
</cfif>
</CFLOOP>
<cfset message="Your transaction has been submitted.">
</cfif>
<CFQUERY name="UPRForm" datasource=#MM_connproducts_DSN# username=#MM_connproducts_USERNAME# password=#MM_connproducts_PASSWORD#>
SELECT P.Prod_ID,P.Prod_Desc,P.Prod_Unit_Cost,P.Prod_Family_ID FROM Product P
<cfif IsDefined("Form.Prod_Family")>
Where 1=2
<CFLOOP INDEX="i" LIST="#Form.Prod_Family#">
Or P.Prod_Family_ID = #i#
</cfloop>
</cfif>
ORDER BY P.Prod_Family_ID, P.Prod_ID ASC
</CFQUERY>
<cfoutput query="gettranscontractinfo">
<cfset TransDate = #Trans_date_created#>
</cfoutput>
<cfset CreateDate = DateFormat(TransDate,"m/dd/yyyy")>
<!--- <cfabort> --->
<html>
<head><title>Add Upr Form</title>
<link href="osteoUPR.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="700" border="0" cellpadding="0">
<tr>
<td height="61"><img src="images/OSTEOuprBanner.jpg" alt="" name="index_r1_c1" width="697" height="60" border="0"></td>
</tr>
<tr>
<td height="41" class="FormTitle"><div align="center">UPR Form</div></td></tr>
<tr>
<td height="80" bgcolor="#FFFFCC" class="Instructions"><div align="center">Please
enter information below to calculate and submit your transaction.
<table bgcolor="#FFFFCC" width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<cfif IsDefined("message") and message neq "">
<td align="center" class="URLmessage" height="40"><cfoutput><span style="Message">#message#</span></cfoutput></td>
</cfif>
</tr>
<tr>
<td align="center" class="Display" height="40">Date Created: <cfoutput>#CreateDate#</cfoutput></td>
</tr>
<CFFORM name="AddUPR" ACTION="AddUprForm1.cfm" METHOD="post">
<!--This code was added to format the top of the form to include the agency and customer info --->
<tr>
<td><table width="600" border="0" cellpadding="0" cellspacing="2" bgcolor="#FFFFCC">
<tr class="Display">
<td width="100">Agency:</td>
<td width="200"><cfoutput query="getagency">#agency_name#</cfoutput></td>
<td width="100">Hospital:</td>
<td width="200"><cfoutput query="getcustomer">#Hospital_name#</cfoutput></td>
</tr>
<tr class="Display">
<td width="100" >Address 1:</td><td width="200"><cfoutput query="getagency">#address1#</cfoutput></td>
<td width="100">Address 1:</td><td width="200"><cfoutput query="getcustomer">#Address1#</cfoutput></td>
</tr>
<tr class="Display">
<td width="100" >Address 2:</td><td width="200"><cfoutput query="getagency">#address2#</cfoutput></td>
<td width="100">Address 2:</td><td width="200"><cfoutput query="getcustomer">#Address2#</cfoutput></td>
</tr>
<tr class="Display" >
<td width="100">City:</td><td width="200"><cfoutput query="getagency">#city#</cfoutput></td>
<td width="100">City:</td><td width="200"><cfoutput query="getcustomer">#City#</cfoutput></td>
</tr>
<tr class="Display">
<td width="100" >State:</td><td width="200"><cfoutput query="getagency">#State#</cfoutput></td>
<td width="100">State:</td><td width="200"><cfoutput query="getcustomer">#State#</cfoutput></td>
</tr>
</table><tr>
<td><table width="600" border="5" cellpadding="2" cellspacing="2" bgcolor="#FFFFCC">
<tr class="UPRFormFieldName">
<td colspan="3">Transaction Number: <input type="text" name="Transaction_Number" readonly="yes" value="<cfoutput query="gettranscontractinfo">#Transaction_Number#</cfoutput>" size="5"></td>
<cfif Client.calctype EQ "Exception">
<td colspan="6" align="center"> <input type="submit" value="Update Discount Percent Column" name="UDP"></td>
</cfif>
<cfif Client.calctype EQ "Discount">
<td colspan="6" align="center"> <input type="submit" value="Update Unit Exception Price Column" name="UEP"></td>
</cfif>
</tr>
<tr>
<td width="5" align="center" class="RedFormTitleFieldName">Annual
Quantity</td>
<td width="5" align="center" class="UPRFormFieldName">Code
Number</td>
<td width="30" align="center" class="UPRFormFieldName">Description</td>
<td width="10" align="center" class="UPRFormFieldName">Unit
List Price</td>
<td width="10" align="center" class="UPRFormFieldName">Total
List Price</td>
<cfif Client.calctype EQ "Exception">
<td width="10" align="center" class="UPRFormFieldName">%
Discount</td>
<td width="5" align="center" class="RedFormTitleFieldName">Unit
Exception Price</td>
</cfif>
<cfif Client.calctype EQ "Discount">
<td width="10" align="center" class="RedFormTitleFieldName">%
Discount</td>
<td width="5" align="center" class="UPRFormFieldName">Unit
Exception Price</td>
</cfif>
<td width="10" align="center" class="UPRFormFieldName">Unit
Discount</td>
<td width="10" align="center" class="UPRFormFieldName">Total
Discount</td>
</tr>
<cfset last_Prod_Family = UPRForm.Prod_Family_ID>
<cfoutput query="UPRForm">
<!--- We are starting fresh. Coming straight from the addfamily.cfm --->
<cfif (form.submit EQ "$$none") and (form.UDP EQ "$$none") and (form.UEP EQ "$$none") >
<cfset quantity = evaluate("form.qty_#Prod_Family_ID#")>
<cfset List_Price = UPRForm.Prod_Unit_Cost * quantity>
<cfset Discount_Percent = evaluate("form.discount_#Prod_Family_ID#")>
<cfset Unit_Discount_Price = UPRForm.Prod_Unit_Cost * (Discount_Percent * 1/100)>
<cfset Exception_Price = UPRForm.Prod_Unit_Cost - Unit_Discount_Price>
<cfset Total_Discount_Price = Unit_Discount_Price * quantity>
<cfelse>
<cfif Client.calctype EQ "Exception">
<!--- Let's set those variables so we don't have to have so much code. --->
<cfset quantity = evaluate("form.quantity_#UPRForm.Prod_ID#")>
<cfset List_Price = evaluate("List_Price_#UPRForm.Prod_ID#")>
<cfset Discount_Percent = evaluate("Discount_Percent_#UPRForm.Prod_ID#")>
<cfset Unit_Discount_Price = Evaluate("Unit_Discount_Price_#UPRForm.Prod_ID#")>
<cfset Exception_Price = evaluate("form.exception_price_#UPRForm.Prod_ID#")>
<cfset Total_Discount_Price = Evaluate("Total_Discount_Price_#UPRForm.Prod_ID#")>
</cfif>
<cfif Client.calctype EQ "Discount">
<!--- Let's set those variables so we don't have to have so much code. --->
<cfset quantity = evaluate("form.quantity_#UPRForm.Prod_ID#")>
<cfset List_Price = evaluate("List_Price_#UPRForm.Prod_ID#")>
<cfset Discount_Percent = evaluate("form.Discount_Percent_#UPRForm.Prod_ID#")>
<cfset Unit_Discount_Price = Evaluate("Unit_Discount_Price_#UPRForm.Prod_ID#")>
<cfset Exception_Price = evaluate("form.Exception_Price_#UPRForm.Prod_ID#")>
<cfset Total_Discount_Price = Evaluate("Total_Discount_Price_#UPRForm.Prod_ID#")>
</cfif>
</cfif>
<cfif last_Prod_Family neq UPRForm.Prod_Family_ID>
<tr>
<td colspan="9"> </td>
</tr>
<cfset last_Prod_Family = UPRForm.Prod_Family_ID>
</cfif>
<tr>
<td width="5" align="right" class="BODYTEXT"> <cfinput type="Text" name="quantity_#UPRForm.Prod_ID#" value="#Int(quantity)#" size="3" maxlength="5" style="text-align:right" validate="integer" range="1,99999" message="You must enter an integer greater than 0 in the quantity field"></td>
<td class="BODYTEXT">#UPRForm.Prod_ID#</td>
<td class="BODYTEXT">#UPRForm.Prod_Desc#</td>
<input type="Hidden" value="#UPRForm.Prod_Unit_Cost#" name="Unit_Cost_#UPRForm.Prod_ID#">
<td align="right" class="BODYTEXT">#DollarFormat(UPRForm.Prod_Unit_Cost)#</td>
<td align="right" class="BODYTEXT"> <cfif IsNumeric(List_Price)>
#DollarFormat(List_Price)#
<cfelse>
</cfif> </td>
<input type="Hidden" name="List_Price_#UPRForm.Prod_ID#" value="#List_Price#">
<!--- sub the totals --->
<cfif IsNumeric(List_Price)>
<cfset GrandTotal_List_Price = GrandTotal_List_Price + List_Price>
</cfif>
<cfif Client.calctype EQ "Exception">
<td align="right" class="BODYTEXT"> <cfif IsNumeric(Discount_Percent)>
#Discount_Percent# %
<cfelse>
</cfif> </td>
<input type="Hidden" name="Discount_Percent_#UPRForm.Prod_ID#" value="#Discount_Percent#">
<td class="BODYTEXT">$
<cfinput type="Text" name="exception_price_#UPRForm.Prod_ID#" value="#Exception_Price#" size="8" maxlength="8" style="text-align:right" validate="float" range=".01,9999999" message="You must enter a valid price in the Unit Exception Price field"></td>
</cfif>
<cfif Client.calctype EQ "Discount">
<td align="right" class="BODYTEXT"> <cfinput type="Text" name="Discount_Percent_#UPRForm.Prod_ID#" value="#Discount_Percent#" size="3" maxlength="3" style="text-align:right" validate="integer" range="1,100" message="You must enter a valid discount percent in the % Discount field"></td>
<td align="right" class="BODYTEXT">
<cfif IsNumeric(Exception_Price)>
#DollarFormat(Exception_Price)#
<cfelse>
</cfif> </td>
<input type="Hidden" name="Exception_Price_#UPRForm.Prod_ID#" value="#Exception_Price#">
</cfif>
<!--- sub the totals --->
<cfif IsNumeric(Exception_Price)>
<cfset GrandException_Price = GrandException_Price + Exception_Price>
</cfif>
<td align="right" class="BODYTEXT"> <cfif IsNumeric(Unit_Discount_Price)>
#DollarFormat(Unit_Discount_Price)#
<cfelse>
</cfif> </td>
<input type="Hidden" name="Unit_Discount_Price_#UPRForm.Prod_ID#" value="#Unit_Discount_Price#">
<!--- sub the totals --->
<cfif IsNumeric(Unit_Discount_Price)>
<cfset GrandUnit_Discount_Price = GrandUnit_Discount_Price + Unit_Discount_Price>
</cfif>
<td align="right" class="BODYTEXT"> <cfif IsNumeric(Total_Discount_Price)>
#DollarFormat(Total_Discount_Price)#
<cfelse>
</cfif> </td>
<input type="Hidden" name="Total_Discount_Price_#UPRForm.Prod_ID#" value="#Total_Discount_Price#">
<!--- sub the totals --->
<cfif IsNumeric(Total_Discount_Price)>
<cfset GrandTotal_Discount_Price = GrandTotal_Discount_Price + Total_Discount_Price>
</cfif>
</tr>
</cfoutput> <cfoutput>
<input type="Hidden" value="#Form.Prod_Family#" name="Prod_Family">
</cfoutput>
<tr> <cfoutput>
<!--- List out the totals --->
<cfif GrandException_Price gt 0>
<cfset GrandDiscount = Round((GrandTotal_Discount_Price/GrandTotal_List_Price) * 100)>
<cfelse>
<cfset GrandDiscount = 0>
</cfif>
<td colspan="4"> </td>
<td align="right" class="BODYTEXT">#DollarFormat(GrandTotal_List_Price)#</td>
<td align="right" class="BODYTEXT">#GrandDiscount# %</td>
<td align="right" class="BODYTEXT">#DollarFormat(GrandException_Price)#</td>
<td align="right" class="BODYTEXT">#DollarFormat(GrandUnit_Discount_Price)#</td>
<td align="right" class="BODYTEXT">#DollarFormat(GrandTotal_Discount_Price)#</td>
</cfoutput> </tr>
<tr>
<td colspan="9" align="center"> <input type="Submit" value="Calculate/Submit" name="submit">
</td>
</tr>
</table></tr>
</CFFORM>
</table>
<cfif Client.Usertype EQ "User">
<table width="700" height="36" cellpadding="5" cellspacing="5">
<tr>
<td align="center" class="ClickHere">Click <a href="index.cfm">here</a>
to return to the welcome page.</td>
</tr>
</table>
<cfelse>
<table width="700" height="36" cellpadding="5" cellspacing="5">
<tr>
<td align="center" class="ClickHere">Click <a href="admin.htm">here</a>
to return to the administration menu.</td>
</tr>
</table>
</cfif>
<table width="700" height="36" cellpadding="5" cellspacing="5">
<tr>
<td class="ClickHereRed" align="center">Make sure you click the <em>Calculate/submit</em>
button to save your data before exiting. </td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</body>
</html>
Is there any way to trap for the Enter key being pushed?
Here is the code to help clear this up:
The code in red is the submit button code.
Thanks in advance.
Robin
<cfinclude template="Connections/connOSTEOupr.cfm">
<cfparam default="$$none" name="form.UDP">
<cfparam default="$$none" name="form.UEP">
<cfparam default="$$none" name="form.submit">
<!-- The following queries are used to populate the top of the form with the agency and customer info
Note this code is called from the previous screen (addfamily.cfm)
-->
<!--- Get Transaction contract information --->
<cfquery name="gettranscontractinfo" datasource=#MM_connproducts_DSN# username=#MM_connproducts_USERNAME# password=#MM_connproducts_PASSWORD# debug="yes" >
SELECT * FROM TRANSACTION_CONTRACT_INFO
WHERE Transaction_Number = #form.Transaction_Number#
</cfquery>
<cfoutput query="gettranscontractinfo">
<!--- Get customer information --->
<cfquery name="getcustomer" datasource=#MM_connproducts_DSN# username=#MM_connproducts_USERNAME# password=#MM_connproducts_PASSWORD# debug="yes">
SELECT * FROM CUSTOMER
WHERE Customer.Customer_Number = '#gettranscontractinfo.Customer_Number#'
</cfquery>
</cfoutput>
<cfoutput query="getcustomer">
<!--- Get Agency information --->
<cfquery name="getagency" datasource=#MM_connproducts_DSN# username=#MM_connproducts_USERNAME# password=#MM_connproducts_PASSWORD# debug="yes" >
SELECT * FROM AGENCY
WHERE Agency_Name = '#getcustomer.Agency_Name#'
</cfquery>
</cfoutput>
<!--- Set all the total variables to 0 --->
<cfset GrandTotal_Discount_Price = 0>
<cfset GrandTotal_List_Price = 0>
<cfset GrandUnit_Discount_Price = 0>
<cfset GrandException_Price = 0>
<!--- If coming from the addfamily.cfm then pull out the families needed for the select. --->
<cfif IsDefined("Form.AddFamily")>
<cfoutput>I am coming from the add family page!!</cfoutput>
<cfset Form.Prod_Family = "">
<cfset Client.calctype = "Exception"> <!---This is the default - exception price will be unprotected --->
<!--- loop through the form fieldnames to pull out the family ids. --->
<CFLOOP INDEX="index" LIST="#form.fieldnames#">
<cfif FindNoCase("qty_",index) gt 0>
<cfset temp_id = Right(index,Len(index)-4)>
<cfif IsNumeric(Evaluate("Form.discount_#temp_id#")) AND IsNumeric(Evaluate("Form.qty_#temp_id#"))>
<!--- add the product family to the list. --->
<cfoutput>Temp_ID:#temp_ID# index:#index# Discount:#Evaluate("form.discount_#temp_id#")# Quantity#Evaluate("form.qty_#temp_id#")#</cfoutput>
<cfset Form.Prod_Family = ListAppend(FORM.Prod_Family,temp_id)>
</cfif>
</cfif>
</CFLOOP>
</cfif>
<!---The following sets calctype (type of calculation) depending on which of the two buttons was pushed - Update Discount Percent Column will set the calctype to
discount, Update Unit Exeption Price Column (the default) will set the calctype to "Exception" --->
<cfif Not IsDefined ("Client.calctype")> <!---if it is not defined yet, set it to the default of Exception--->
<cfoutput>No calctype is defined so I'm setting it to Exception</cfoutput>
<cfset Client.calctype = "Exception">
</cfif>
<cfoutput>Form.UDP:#form.UDP#<br>
form.UEP:#form.UEP#<br>
form.Submit:#form.Submit#<br></cfoutput>
<cfif form.UDP NEQ "$$none">
<cfoutput>I'm changing to discount now</cfoutput>
<cfset Client.calctype = "Discount">
</cfif>
<cfif form.UEP NEQ "$$none">
<cfoutput>I'm changing to exception now</cfoutput>
<cfset Client.calctype = "Exception">
</cfif>
<cfif form.Submit NEQ "$$none">
<cfoutput>The submit button was pushed!</cfoutput>
<cfoutput>The Calctype is #Client.calctype#</cfoutput>
</cfif>
<cfif Client.calctype EQ "Exception"> <!---Note this is the default - the old way when the Unit Exception Price is updateable and used to calculate
the percent discount --->
<cfif (form.UEP NEQ "$$none") or (form.Submit NEQ "$$none")>
<cfset message="Your transaction has been calculated.">
<cfoutput>We're inside the exception code...The Client.calctype is:#Client.calctype#</cfoutput>
<!--- loop through the form fields to pull out the product ids.--->
<CFLOOP INDEX="index" LIST="#form.fieldnames#">
<!--- if form field is quantity then calculate the Total List price --->
<cfif FindNoCase("quantity_",index) gt 0>
<!--- pull out product id --->
<cfset temp_id = Right(index,Len(index)-9)>
<cfif IsNumeric(Evaluate(index))>
<cfset "List_Price_#temp_id#" = Evaluate(index) * evaluate("form.unit_cost_#temp_id#")>
</cfif>
<!--- if form field is exception price then calculate Discount precentage, Unit Discount and Total Discount--->
<cfelseif FindNoCase("exception_price_",index) gt 0>
<!--- pull out product id --->
<cfset temp_id = Right(index,Len(index)-16)>
<!--- Strip out Dollar signs and commas. Doesn't play well with calculations. --->
<cfset Exception_Price = evaluate("form.exception_price_#temp_id#")>
<cfset Exception_Price = Replace(Exception_Price,"$","","All")>
<cfset Exception_Price = Replace(Exception_Price,",","","All")>
<!--- If valid Exception Price then do the calculations. --->
<cfif IsNumeric(Exception_Price) and Exception_Price neq 0>
<cfset "form.exception_price_#temp_id#" = Exception_Price>
<cfset "Discount_Percent_#temp_id#" = Round(((Evaluate("form.unit_cost_#temp_id#") - Exception_Price)/ Evaluate("form.unit_cost_#temp_id#")* 100))>
<cfset "Unit_Discount_Price_#temp_id#" = evaluate("form.unit_cost_#temp_id#") - Exception_Price>
<cfif Evaluate("form.quantity_#temp_id#") gt 0>
<cfset "Total_Discount_Price_#temp_id#" = Evaluate("Unit_Discount_Price_#temp_id#") * Evaluate("form.quantity_#temp_id#")>
<cfelse>
<cfset "Total_Discount_Price_#temp_id#" = "">
</cfif>
</cfif>
<!---Debugging stuff--->
<!---<br><cfoutput><font color="##ff0000">Temp ID:#temp_id#</font>
Exception_Price:#Evaluate("form.Exception_Price_#temp_id#")#
Discount_Percent:#evaluate("Discount_Percent_#temp_id#")#
Client.calctype:#Client.calctype#</cfoutput> --->
</cfif>
</CFLOOP>
</cfif>
</cfif>
<cfif Client.calctype EQ "Discount"> <!---note here the discount percentage field is opened for updating and used to calculate the Unit Exception Price --->
<cfif (form.UDP NEQ "$$none") or (form.Submit NEQ "$$none")>
<cfset message="Your transaction has been calculated.">
<cfoutput>We're inside the discount code.. The Client.calctype is:#Client.calctype#</cfoutput>
<!--- loop through the form fields to pull out the product ids.--->
<CFLOOP INDEX="index" LIST="#form.fieldnames#">
<!--- if form field is quantity then calculate the Total List price. Note unit cost is unit list price on form--->
<cfif FindNoCase("quantity_",index) gt 0>
<!--- pull out product id --->
<cfset temp_id = Right(index,Len(index)-9)>
<cfif IsNumeric(Evaluate(index))>
<cfset "List_Price_#temp_id#" = Evaluate(index) * evaluate("form.unit_cost_#temp_id#")>
</cfif>
<!--- if form field is discount percent then calculate Unit Exception Price, Unit Discount and Total Discount--->
<cfelseif FindNoCase("Discount_Percent_",index) gt 0>
<!--- pull out product id --->
<cfset temp_id = Right(index,Len(index)-17)>
<!--- If valid Discount Percent then do the calculations. --->
<cfif IsDefined ("form.Discount_Percent_#temp_id#")>
<cfset Discount_Percent = evaluate("form.Discount_Percent_#temp_id#")>
</cfif>
<cfif Not IsDefined ("form.Discount_Percent_#temp_id#")>
<cfset Discount_Percent = evaluate("Discount_Percent_#temp_id#")>
</cfif>
<cfif IsNumeric(Discount_Percent) and Discount_Percent neq 0>
<cfset "form.Discount_Percent_#temp_id#" = Discount_Percent>
<cfset "Exception_Price_#temp_id#" = (Evaluate("form.unit_cost_#temp_id#") - (Evaluate("form.unit_cost_#temp_id#") * (Discount_Percent/100)) )>
<!---<cfoutput>The new exception price is #Evaluate("Exception_Price_#temp_id#")#</cfoutput>--->
<cfset "form.Exception_Price_#temp_id#" = #Evaluate("Exception_Price_#temp_id#")#>
<cfset Exception_Price = evaluate("form.exception_price_#temp_id#")>
<cfset "Unit_Discount_Price_#temp_id#" = evaluate("form.unit_cost_#temp_id#") - Evaluate("Exception_Price_#temp_id#")>
<cfif Evaluate("form.quantity_#temp_id#") gt 0>
<cfset "Total_Discount_Price_#temp_id#" = Evaluate("Unit_Discount_Price_#temp_id#") * Evaluate("form.quantity_#temp_id#")>
<cfelse>
<cfset "Total_Discount_Price_#temp_id#" = "">
</cfif>
</cfif>
<!---Debugging stuff--->
<!--- <br><cfoutput><font color="##ff0000">THIS IS THE NEW STUFF:::: WHen discount percent field is updated :::Temp ID:#temp_id#</font>
Exception_Price:#Evaluate("form.Exception_Price_#temp_id#")#
Discount_Percent:#evaluate("Discount_Percent_#temp_id#")#
Client.calctype:#Client.calctype#
</cfoutput> --->
</cfif>
</CFLOOP>
</cfif>
</cfif>
<cfif (form.submit EQ "$$none") AND (form.UDP EQ "$$none") and (form.UEP EQ "$$none")>
<cfoutput>The user entered the ENTER key.</cfoutput>
</cfif>
<cfif (form.Submit NEQ "$$none")>
<CFLOOP INDEX="index" LIST="#form.fieldnames#">
<cfif FindNoCase("quantity_",index) gt 0>
<!--- pull out product id --->
<cfset temp_id = Right(index,Len(index)-9)>
<!--- Strip out Dollar signs and commas. Doesn't play well with calculations. --->
<cfset Exception_Price = evaluate("form.exception_price_#temp_id#")>
<cfset Exception_Price = Replace(Exception_Price,"$","","All")>
<cfset Exception_Price = Replace(Exception_Price,",","","All")>
<cfset "form.exception_price_#temp_id#" = Exception_Price>
<!--- If valid quantity and Exception Price then commit all calculations. --->
<cfif index gt 0 and IsDefined("form.exception_price_#temp_id#") and Exception_Price gt 0>
<cfquery name="getinfo" datasource=#MM_connproducts_DSN# username=#MM_connproducts_USERNAME# password=#MM_connproducts_PASSWORD# debug="yes">
Select * from Transaction WHERE Prod_ID='#temp_id#' and Transaction_Number='#form.Transaction_Number#'
</cfquery>
<!--- If transaction doesn't exist for this customer and product then add --->
<cfif getinfo.recordcount eq 0>
<cfquery name="getinfo" datasource=#MM_connproducts_DSN# username=#MM_connproducts_USERNAME# password=#MM_connproducts_PASSWORD# debug="yes">
Insert into Transaction (Prod_Quantity, Prod_Discount_Percent, Prod_Total_Std_Cost,
Prod_Unit_Exception_Price, Prod_Unit_Discount, Prod_Total_Discount,Prod_ID,Transaction_Number)
Values (#evaluate(index)#, #evaluate("FORM.Discount_Percent_#temp_id#")#
, #evaluate("FORM.List_Price_#temp_id#")# , #Exception_Price#,
#evaluate("FORM.Unit_Discount_Price_#temp_id#")#, #evaluate("FORM.Total_Discount_Price_#temp_id#")#,'#temp_id#','#form.Transaction_Number#')
</cfquery>
<cfelse>
<!--- If transaction exist for this customer and product then overwrite --->
<cfquery name="updateform" datasource=#MM_connproducts_DSN# username=#MM_connproducts_USERNAME# password=#MM_connproducts_PASSWORD# debug="yes">
UPDATE TRANSACTION SET Prod_Quantity=#evaluate(index)#, Prod_Discount_Percent=#evaluate("FORM.Discount_Percent_#temp_id#")#
, Prod_Total_Std_Cost=#evaluate("FORM.List_Price_#temp_id#")# , Prod_Unit_Exception_Price = #Exception_Price#, Prod_Unit_Discount =
#evaluate("FORM.Unit_Discount_Price_#temp_id#")#, Prod_Total_Discount
= #evaluate("FORM.Total_Discount_Price_#temp_id#")# WHERE Prod_ID='#temp_id#'
and Transaction_Number='#form.Transaction_Number#'
</cfquery>
</cfif>
</cfif>
<!--- just debugging stuff <br><cfoutput>#index# #temp_id# #evaluate("Discount_Percent_#temp_id#")# #Evaluate("Unit_Discount_Price_#temp_id#")# #Evaluate("Total_Discount_Price_#temp_id#")#</cfoutput> --->
</cfif>
</CFLOOP>
<cfset message="Your transaction has been submitted.">
</cfif>
<CFQUERY name="UPRForm" datasource=#MM_connproducts_DSN# username=#MM_connproducts_USERNAME# password=#MM_connproducts_PASSWORD#>
SELECT P.Prod_ID,P.Prod_Desc,P.Prod_Unit_Cost,P.Prod_Family_ID FROM Product P
<cfif IsDefined("Form.Prod_Family")>
Where 1=2
<CFLOOP INDEX="i" LIST="#Form.Prod_Family#">
Or P.Prod_Family_ID = #i#
</cfloop>
</cfif>
ORDER BY P.Prod_Family_ID, P.Prod_ID ASC
</CFQUERY>
<cfoutput query="gettranscontractinfo">
<cfset TransDate = #Trans_date_created#>
</cfoutput>
<cfset CreateDate = DateFormat(TransDate,"m/dd/yyyy")>
<!--- <cfabort> --->
<html>
<head><title>Add Upr Form</title>
<link href="osteoUPR.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="700" border="0" cellpadding="0">
<tr>
<td height="61"><img src="images/OSTEOuprBanner.jpg" alt="" name="index_r1_c1" width="697" height="60" border="0"></td>
</tr>
<tr>
<td height="41" class="FormTitle"><div align="center">UPR Form</div></td></tr>
<tr>
<td height="80" bgcolor="#FFFFCC" class="Instructions"><div align="center">Please
enter information below to calculate and submit your transaction.
<table bgcolor="#FFFFCC" width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<cfif IsDefined("message") and message neq "">
<td align="center" class="URLmessage" height="40"><cfoutput><span style="Message">#message#</span></cfoutput></td>
</cfif>
</tr>
<tr>
<td align="center" class="Display" height="40">Date Created: <cfoutput>#CreateDate#</cfoutput></td>
</tr>
<CFFORM name="AddUPR" ACTION="AddUprForm1.cfm" METHOD="post">
<!--This code was added to format the top of the form to include the agency and customer info --->
<tr>
<td><table width="600" border="0" cellpadding="0" cellspacing="2" bgcolor="#FFFFCC">
<tr class="Display">
<td width="100">Agency:</td>
<td width="200"><cfoutput query="getagency">#agency_name#</cfoutput></td>
<td width="100">Hospital:</td>
<td width="200"><cfoutput query="getcustomer">#Hospital_name#</cfoutput></td>
</tr>
<tr class="Display">
<td width="100" >Address 1:</td><td width="200"><cfoutput query="getagency">#address1#</cfoutput></td>
<td width="100">Address 1:</td><td width="200"><cfoutput query="getcustomer">#Address1#</cfoutput></td>
</tr>
<tr class="Display">
<td width="100" >Address 2:</td><td width="200"><cfoutput query="getagency">#address2#</cfoutput></td>
<td width="100">Address 2:</td><td width="200"><cfoutput query="getcustomer">#Address2#</cfoutput></td>
</tr>
<tr class="Display" >
<td width="100">City:</td><td width="200"><cfoutput query="getagency">#city#</cfoutput></td>
<td width="100">City:</td><td width="200"><cfoutput query="getcustomer">#City#</cfoutput></td>
</tr>
<tr class="Display">
<td width="100" >State:</td><td width="200"><cfoutput query="getagency">#State#</cfoutput></td>
<td width="100">State:</td><td width="200"><cfoutput query="getcustomer">#State#</cfoutput></td>
</tr>
</table><tr>
<td><table width="600" border="5" cellpadding="2" cellspacing="2" bgcolor="#FFFFCC">
<tr class="UPRFormFieldName">
<td colspan="3">Transaction Number: <input type="text" name="Transaction_Number" readonly="yes" value="<cfoutput query="gettranscontractinfo">#Transaction_Number#</cfoutput>" size="5"></td>
<cfif Client.calctype EQ "Exception">
<td colspan="6" align="center"> <input type="submit" value="Update Discount Percent Column" name="UDP"></td>
</cfif>
<cfif Client.calctype EQ "Discount">
<td colspan="6" align="center"> <input type="submit" value="Update Unit Exception Price Column" name="UEP"></td>
</cfif>
</tr>
<tr>
<td width="5" align="center" class="RedFormTitleFieldName">Annual
Quantity</td>
<td width="5" align="center" class="UPRFormFieldName">Code
Number</td>
<td width="30" align="center" class="UPRFormFieldName">Description</td>
<td width="10" align="center" class="UPRFormFieldName">Unit
List Price</td>
<td width="10" align="center" class="UPRFormFieldName">Total
List Price</td>
<cfif Client.calctype EQ "Exception">
<td width="10" align="center" class="UPRFormFieldName">%
Discount</td>
<td width="5" align="center" class="RedFormTitleFieldName">Unit
Exception Price</td>
</cfif>
<cfif Client.calctype EQ "Discount">
<td width="10" align="center" class="RedFormTitleFieldName">%
Discount</td>
<td width="5" align="center" class="UPRFormFieldName">Unit
Exception Price</td>
</cfif>
<td width="10" align="center" class="UPRFormFieldName">Unit
Discount</td>
<td width="10" align="center" class="UPRFormFieldName">Total
Discount</td>
</tr>
<cfset last_Prod_Family = UPRForm.Prod_Family_ID>
<cfoutput query="UPRForm">
<!--- We are starting fresh. Coming straight from the addfamily.cfm --->
<cfif (form.submit EQ "$$none") and (form.UDP EQ "$$none") and (form.UEP EQ "$$none") >
<cfset quantity = evaluate("form.qty_#Prod_Family_ID#")>
<cfset List_Price = UPRForm.Prod_Unit_Cost * quantity>
<cfset Discount_Percent = evaluate("form.discount_#Prod_Family_ID#")>
<cfset Unit_Discount_Price = UPRForm.Prod_Unit_Cost * (Discount_Percent * 1/100)>
<cfset Exception_Price = UPRForm.Prod_Unit_Cost - Unit_Discount_Price>
<cfset Total_Discount_Price = Unit_Discount_Price * quantity>
<cfelse>
<cfif Client.calctype EQ "Exception">
<!--- Let's set those variables so we don't have to have so much code. --->
<cfset quantity = evaluate("form.quantity_#UPRForm.Prod_ID#")>
<cfset List_Price = evaluate("List_Price_#UPRForm.Prod_ID#")>
<cfset Discount_Percent = evaluate("Discount_Percent_#UPRForm.Prod_ID#")>
<cfset Unit_Discount_Price = Evaluate("Unit_Discount_Price_#UPRForm.Prod_ID#")>
<cfset Exception_Price = evaluate("form.exception_price_#UPRForm.Prod_ID#")>
<cfset Total_Discount_Price = Evaluate("Total_Discount_Price_#UPRForm.Prod_ID#")>
</cfif>
<cfif Client.calctype EQ "Discount">
<!--- Let's set those variables so we don't have to have so much code. --->
<cfset quantity = evaluate("form.quantity_#UPRForm.Prod_ID#")>
<cfset List_Price = evaluate("List_Price_#UPRForm.Prod_ID#")>
<cfset Discount_Percent = evaluate("form.Discount_Percent_#UPRForm.Prod_ID#")>
<cfset Unit_Discount_Price = Evaluate("Unit_Discount_Price_#UPRForm.Prod_ID#")>
<cfset Exception_Price = evaluate("form.Exception_Price_#UPRForm.Prod_ID#")>
<cfset Total_Discount_Price = Evaluate("Total_Discount_Price_#UPRForm.Prod_ID#")>
</cfif>
</cfif>
<cfif last_Prod_Family neq UPRForm.Prod_Family_ID>
<tr>
<td colspan="9"> </td>
</tr>
<cfset last_Prod_Family = UPRForm.Prod_Family_ID>
</cfif>
<tr>
<td width="5" align="right" class="BODYTEXT"> <cfinput type="Text" name="quantity_#UPRForm.Prod_ID#" value="#Int(quantity)#" size="3" maxlength="5" style="text-align:right" validate="integer" range="1,99999" message="You must enter an integer greater than 0 in the quantity field"></td>
<td class="BODYTEXT">#UPRForm.Prod_ID#</td>
<td class="BODYTEXT">#UPRForm.Prod_Desc#</td>
<input type="Hidden" value="#UPRForm.Prod_Unit_Cost#" name="Unit_Cost_#UPRForm.Prod_ID#">
<td align="right" class="BODYTEXT">#DollarFormat(UPRForm.Prod_Unit_Cost)#</td>
<td align="right" class="BODYTEXT"> <cfif IsNumeric(List_Price)>
#DollarFormat(List_Price)#
<cfelse>
</cfif> </td>
<input type="Hidden" name="List_Price_#UPRForm.Prod_ID#" value="#List_Price#">
<!--- sub the totals --->
<cfif IsNumeric(List_Price)>
<cfset GrandTotal_List_Price = GrandTotal_List_Price + List_Price>
</cfif>
<cfif Client.calctype EQ "Exception">
<td align="right" class="BODYTEXT"> <cfif IsNumeric(Discount_Percent)>
#Discount_Percent# %
<cfelse>
</cfif> </td>
<input type="Hidden" name="Discount_Percent_#UPRForm.Prod_ID#" value="#Discount_Percent#">
<td class="BODYTEXT">$
<cfinput type="Text" name="exception_price_#UPRForm.Prod_ID#" value="#Exception_Price#" size="8" maxlength="8" style="text-align:right" validate="float" range=".01,9999999" message="You must enter a valid price in the Unit Exception Price field"></td>
</cfif>
<cfif Client.calctype EQ "Discount">
<td align="right" class="BODYTEXT"> <cfinput type="Text" name="Discount_Percent_#UPRForm.Prod_ID#" value="#Discount_Percent#" size="3" maxlength="3" style="text-align:right" validate="integer" range="1,100" message="You must enter a valid discount percent in the % Discount field"></td>
<td align="right" class="BODYTEXT">
<cfif IsNumeric(Exception_Price)>
#DollarFormat(Exception_Price)#
<cfelse>
</cfif> </td>
<input type="Hidden" name="Exception_Price_#UPRForm.Prod_ID#" value="#Exception_Price#">
</cfif>
<!--- sub the totals --->
<cfif IsNumeric(Exception_Price)>
<cfset GrandException_Price = GrandException_Price + Exception_Price>
</cfif>
<td align="right" class="BODYTEXT"> <cfif IsNumeric(Unit_Discount_Price)>
#DollarFormat(Unit_Discount_Price)#
<cfelse>
</cfif> </td>
<input type="Hidden" name="Unit_Discount_Price_#UPRForm.Prod_ID#" value="#Unit_Discount_Price#">
<!--- sub the totals --->
<cfif IsNumeric(Unit_Discount_Price)>
<cfset GrandUnit_Discount_Price = GrandUnit_Discount_Price + Unit_Discount_Price>
</cfif>
<td align="right" class="BODYTEXT"> <cfif IsNumeric(Total_Discount_Price)>
#DollarFormat(Total_Discount_Price)#
<cfelse>
</cfif> </td>
<input type="Hidden" name="Total_Discount_Price_#UPRForm.Prod_ID#" value="#Total_Discount_Price#">
<!--- sub the totals --->
<cfif IsNumeric(Total_Discount_Price)>
<cfset GrandTotal_Discount_Price = GrandTotal_Discount_Price + Total_Discount_Price>
</cfif>
</tr>
</cfoutput> <cfoutput>
<input type="Hidden" value="#Form.Prod_Family#" name="Prod_Family">
</cfoutput>
<tr> <cfoutput>
<!--- List out the totals --->
<cfif GrandException_Price gt 0>
<cfset GrandDiscount = Round((GrandTotal_Discount_Price/GrandTotal_List_Price) * 100)>
<cfelse>
<cfset GrandDiscount = 0>
</cfif>
<td colspan="4"> </td>
<td align="right" class="BODYTEXT">#DollarFormat(GrandTotal_List_Price)#</td>
<td align="right" class="BODYTEXT">#GrandDiscount# %</td>
<td align="right" class="BODYTEXT">#DollarFormat(GrandException_Price)#</td>
<td align="right" class="BODYTEXT">#DollarFormat(GrandUnit_Discount_Price)#</td>
<td align="right" class="BODYTEXT">#DollarFormat(GrandTotal_Discount_Price)#</td>
</cfoutput> </tr>
<tr>
<td colspan="9" align="center"> <input type="Submit" value="Calculate/Submit" name="submit">
</td>
</tr>
</table></tr>
</CFFORM>
</table>
<cfif Client.Usertype EQ "User">
<table width="700" height="36" cellpadding="5" cellspacing="5">
<tr>
<td align="center" class="ClickHere">Click <a href="index.cfm">here</a>
to return to the welcome page.</td>
</tr>
</table>
<cfelse>
<table width="700" height="36" cellpadding="5" cellspacing="5">
<tr>
<td align="center" class="ClickHere">Click <a href="admin.htm">here</a>
to return to the administration menu.</td>
</tr>
</table>
</cfif>
<table width="700" height="36" cellpadding="5" cellspacing="5">
<tr>
<td class="ClickHereRed" align="center">Make sure you click the <em>Calculate/submit</em>
button to save your data before exiting. </td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</body>
</html>