 	exp_Date,
 	permit_Num,
 	permit_Type,
-	permit_remarks 
-from 
+	permit_remarks
+from
 	permit,
 	preferred_agent_name issuedToPref,
 	preferred_agent_name issuedByPref,
 	agent_name issuedTo,
-	agent_name issuedBy 
-where 
+	agent_name issuedBy
+where
 	permit.issued_by_agent_id = issuedBy.agent_id and
 	permit.issued_to_agent_id = issuedTo.agent_id and
 		permit.issued_by_agent_id = issuedByPref.agent_id and

<cfoutput>

Search for permits. Any part of dates and names accepted, case isn't important.<br>
<cfform name="findPermit" action="PermitPick.cfm" method="post">
	<input type="hidden" name="Action" value="search">
	<input type="hidden" name="transaction_id" value="#transaction_id#">
	<table>
		<tr>
			<td>Issued By</td>
			<td><input type="text" name="IssuedByAgent"></td>
			<td>Issued To</td>
			<td><input type="text" name="IssuedToAgent"></td>
			
			
		</tr>
		<tr>
			<td>Issued Date</td>
			<td><input type="text" name="issued_Date"></td>
			<td>Renewed Date</td>
			<td><input type="text" name="renewed_Date"></td>
		</tr>
		<tr>
			<td>Expiration Date</td>
			<td><input type="text" name="exp_Date"></td>
			<td>Permit Number</td>
			<td><input type="text" name="permit_Num"></td>
		</tr>
		<tr>
			<td>Permit Type</td>
			<td>
				<select name="permit_Type" size="1">
					<option value=""></option>
					<cfloop query="ctPermitType">
						<option value = "#ctPermitType.permit_type#">#ctPermitType.permit_type#</option>
					</cfloop>
				
				</select>
			</td>
			<td>Remarks</td>
			<td><input type="text" name="permit_remarks"></td>
		</tr>
		<tr>
			<td colspan="4" align="center">
			<input type="submit" 
				value="Search" 
				class="schBtn">	
   
   <img src="../images/nada.gif" width="30">
   			<input type="reset" 
				value="Clear" 
				class="clrBtn">
				</td>
		</tr>
	</table>
	
	
	
</cfform>
</cfoutput>
<cfif Action is "search">

<!--- set dateformat --->


	<cfset sql = "#sql# AND permit_Num = '#permit_Num#'">
</cfif>
<cfif len(#permit_Type#) gt 0>

		<cfset permit_Type = #replace(permit_type,"'","''","All")#>


	<cfset sql = "#sql# AND permit_Type = '#permit_Type#'">
</cfif>
<cfif len(#permit_remarks#) gt 0>
