<%
Browser=Request.servervariables( "HTTP_USER_AGENT" )
IP=Request.servervariables( "REMOTE_ADDR" )
strQueryMtg="select browserused from browserinfo where browserinfo='" & Browser & "'"
set rst_browser=nothing
on error resume next
'Page:
searchyearno=0
searchtextno=0
searchtext2no=0
searchno=0
selecttext1a=""
selecttext2a=""
searchyear=request.form("searchyear")
selecttext1=request.form("searchtext")
selecttext2=request.form("searchtext2")
dept=request.form("dept")
if searchyear>"0" then searchyearno=1
'if selecttext1>"0" then searchtextno=1
if dept>"0" then deptsrch=1
'Keyword 1:
if request.form("searchtext")>"0" then searchtextno=3
'Keyword 2:
if request.form("searchtext2")>"0" then searchtext2no=5
on error resume next
if searchyearno=1 then
text1search="((instr(agreementtitle, '" & selecttext1 & "')>0 or instr(agreementname, '" & selecttext1 & "'))>0 and (instr(agreementtitle, '" & selecttext2 & "')>0 or instr(agreementname, '" & selecttext2 & "')>0)) and instr(agreementname,'" & searchyear & "')>0 "
end if
if searchyearno=1 and deptsrch=1 then
text1search="((instr(agreementtitle, '" & selecttext1 & "')>0 or instr(agreementname, '" & selecttext1 & "'))>0 and (instr(agreementtitle, '" & selecttext2 & "')>0 or instr(agreementname, '" & selecttext2 & "')>0)) and departmentresponsible='" & dept & "' and instr(agreementname,'" & searchyear & "')>0 "
end if
if searchtextno=3 and searchyearno=0 then
text1search="(instr(agreementtitle, '" & selecttext1 & "')>0 or instr(agreementname, '" & selecttext1 & "')>0) "
end if
if searchtext2no=5 and searchyearno=0 then
text2search="(instr(agreementtitle, '" & selecttext2 & "')>0 or instr(agreementname, '" & selecttext2 & "')>0) "
end if
if deptsrch=1 then
text1search="((instr(agreementtitle, '" & selecttext1 & "')>0 or instr(agreementname, '" & selecttext1 & "'))>0 and (instr(agreementtitle, '" & selecttext2 & "')>0 or instr(agreementname, '" & selecttext2 & "')>0)) and departmentresponsible='" & dept & "' and instr(agreementname,'" & searchyear & "')>0 "
end if
if (request.form("searchyear")="*" or selecttext1="*") and searchyearno<>1 and searchtextno<>3 and deptsrch<>1 then searchno=99
if searchyearno<>1 and searchtextno<>3 and searchtext2no<>5 and deptsrch<>1 then searchno=99
if searchyearno=1 then searches=1
if deptsrch=1 then searches=2
if searchyearno=0 and searchtextno=3 and searchtext2no=5 then searches=4
if searchyearno=0 and searchtextno=3 and searchtext2no=0 then searches=5
if searchyearno=0 and searchtextno=0 and searchtext2no=5 then searches=7
if searchno=99 then searches=99
if selecttext1<"0" then
searchtext="*"
end if
'response.write "
"
'response.write searchyearno & " " & searchtextno & " " & searchtext2no & " " & searches & " "
'response.write "
"
wherestatement=""
'The following will automatically create the mustbe statement that is commented out above. The above has the form numbers hardcoded, whereas the forms_reader.asp reads the form number from a text
'file and builds the mandatory select criteria
'
%>
<%
'Here to 1) set up the text that prints at the top of the list and 2) sets up the specific query criteria
textsearch=""
Select Case searches
Case 1
if selecttext1>"0" and selecttext2>"0" then textsearch=textsearch & "Search Results for Year: "" & searchyear & "" and "" & selecttext1 & "" and "" & selecttext2 & "" "
if selecttext1="" and selecttext2>"0" then textsearch=textsearch & "Search Results for Year: "" & searchyear & "" and "" & selecttext2 & """
if selecttext1>"0" and selecttext2="" then textsearch=textsearch & "Search Results for Year: "" & searchyear & "" and "" & selecttext1 & """
if selecttext1="" and selecttext2="" then textsearch=textsearch & "Search Results for Year: "" & searchyear & """
if deptsrch=1 then textsearch=textsearch & " and Department='" & dept & "'"
if selecttext1a>"0" then textsearch=textsearch & "or "" & selecttext1a & "" "
if selecttext1a>"0" then
wherestatement=wherestatement & " (" & text1asearch & " or " & text1search & ")"
else
wherestatement=wherestatement & text1search
end if
wherestatement=text1search
Case 2
'if dept>"0" then textsearch=textsearch & "Search Results for: "" & dept & """
if selecttext1>"0" and selecttext2>"0" then textsearch=textsearch & "Search Results for Year: "" & searchyear & "" and "" & selecttext1 & "" and "" & selecttext2 & "" "
if selecttext1="" and selecttext2>"0" then textsearch=textsearch & "Search Results for Year: "" & searchyear & "" and "" & selecttext2 & """
if selecttext1>"0" and selecttext2="" then textsearch=textsearch & "Search Results for Year: "" & searchyear & "" and "" & selecttext1 & """
if selecttext1="" and selecttext2="" then textsearch=textsearch & "Search Results for Year: "" & searchyear & """
if deptsrch=1 then textsearch=textsearch & " and Department='" & dept & "'"
wherestatement=text1search
Case 4
textsearch="
Search Results for: "" & selecttext1 & "" "
if selecttext1a>"0" then textsearch=textsearch & "or "" & selecttext1a & "" "
textsearch=textsearch & "and "" & selecttext2 & "" "
if deptsrch=1 then textsearch=textsearch & " and Department='" & dept & "'"
if selecttext2a>"0" then textsearch=textsearch & "or "" & selecttext2a & "" "
if selecttext1a>"0" then
wherestatement=wherestatement & " (" & text1asearch & " or " & text1search & ") and "
else
wherestatement=wherestatement & text1search & " and "
end if
if selecttext2a>"0" then
wherestatement=wherestatement & " (" & text2asearch & " or " & text2search & ") "
else
wherestatement=wherestatement & " " & text2search & ""
end if
wherestatement=wherestatement
Case 5
textsearch="Search Results for: "" & selecttext1 & "" "
if deptsrch=1 then textsearch=textsearch & " and Department='" & dept & "'"
if selecttext1a>"0" then textsearch=textsearch & "or "" & selecttext1a & "" "
if selecttext1a>"0" then
wherestatement=wherestatement & " (" & text1asearch & " or " & text1search & ")"
else
wherestatement=wherestatement & text1search
end if
Case 7
textsearch="Search Results for: "" & selecttext2 & "" "
if deptsrch=1 then textsearch=textsearch & " and Department='" & dept & "'"
if selecttext2a>"0" then textsearch=textsearch & "or "" & selecttext2a & "" "
if selecttext2a>"0" then
wherestatement=wherestatement & " (" & text2asearch & " or " & text2search & ")"
else
wherestatement=wherestatement & text2search
end if
Case 99
textsearch="Search Results for 99: "Wildcard (
*) - Everything Chosen" "
end Select
'if wherestatement is null then
' wherestatement="agreementnumber>0"
'end if
response.write "
"
'response.write searches & " "
response.write textsearch
response.write "
"
'response.end
%>
<%
'if searches<>6 then
if wherestatement>" " then
strQueryMtg="SELECT * from pradata where " & wherestatement & " order by agreementnumber; "
else
strQueryMtg="SELECT * from pradata order by agreementnumber; "
end if
'response.write "Testing:
"
'response.write strQueryMtg
'response.write "
"
' response.end
err.clear
Set rst_content=nothing
Set rst_content=Server.CreateObject("ADODB.recordset")
rst_content.Open strQueryMtg, connectstr
if not rst_content.eof then
'Should there be an error, print out the select statement and the error message
if Err.number<>0 then
response.write "
" & connectstr
response.write "
" & strQueryMtg
response.write "
Error Number: 2 " & Err.number
response.write "
Error Source: " & Err.source
response.write "
Error: " & Err.description & "
"
response.end
end if
'The next two lines are for testing
'response.write "
" & strQueryMtg
'response.end
response.write ""
chkrow=2
rec_counter=0
do while not rst_content.eof
if (chkrow/2)-(int(chkrow/2))=0 then
bgcolor="#FFFFFF"
fontcolor="navy"
else
bgcolor="#CEF6F5"
bgcolor="#FFFFFF"
fontcolor="navy"
end if
bgcolor="#FFFFFF"
chkrow=chkrow+1
if Err.number<>0 then
response.write "
3 Error Number: " & Err.number
response.write "
Error Source: " & Err.source
response.write "
Error: " & Err.description & "
"
response.end
end if
rec_counter=rec_counter+1
if Err.number<>0 and Err.number<>424 then
response.write "
4 Error Number: " & Err.number
response.write "
Error Source: " & Err.source
response.write "
Error: " & Err.description & "
"
response.end
end if
response.write ""
if rst_content("agreementtitle")>"0" then
docname=rst_content("agreementtitle")
else
docname=rst_content("agreementname")
end if
response.write docname
'links go here
response.write " | "
if rst_content("weblinkdocid")>"0" then
response.write "Documents: " & rst_content("weblinkdocid") & " "
'else
' response.write " | "
end if
if rst_content("attachmentdoc")>" " then
'response.write " | "
'response.write "" & rst_content("attachmentdoc") & ""
response.write "" & rst_content("attachmentdoc") & ""
end if
rst_content.movenext
loop
response.write " |
Records Reported: " & rec_counter & " | "
'end if
else
response.write "
No Records were Reported. It is possible the requested documents simply are not available, or you can click your Browser BACK button and try again.
Please contact the City Clerk if you have any questions. The selection criteria used will be included (or your can remove it from the email prior to sending). | "
end if
%>
"
if Err.number<>0 then
response.write " 5 Error Number: " & Err.number
response.write " Error Source: " & Err.source
response.write " Error: " & Err.description & " "
response.end
end if
%>
|