<% lvl=validate(0) '//// Receive Search Criteria //// name=request("name")&"" sname=replace(name,"'","''") topic=request("topic")&"" stopic=replace(topic,"'","''") repname=request("repname")&"" srepname=replace(repname,"'","''") ref=request("ref")&"" rating=request("rating") requestid=request("requestid") datecriteria=request("datecriteria") date1=request("date1") if not(isdate(date1)) then date1=request("year1")&"/"&request("month1")&"/"&request("day1") date2=request("date2") if not(isdate(date2)) then date2=request("year2")&"/"&request("month2")&"/"&request("day2") orderby=request("orderby") deptid=request("deptid") psql="SELECT * FROM xlaALSCustomers INNER JOIN xlaALSRequests ON xlaALSCustomers.customerid = xlaALSRequests.customerid " if isnumeric(name) then psql=psql & " where xlaALSRequests.customerid="&name else psql=psql &" where (name like '%"&sname&"%' or email like '%"&sname&"%')" end if psql=psql&" and (topic like '%"&stopic&"%' or transcript like '%"&stopic&"%') and (ref like '%"&ref&"%')" if isnumeric(srepname) then psql=psql & " and userid="&srepname elseif srename<>"" then psql=psql & " and userid in (select userid from xlaALSusers where name like '%"&srepname&"%' or alias like '%"&srepname&"%' or email like '%"&srepname&"%')" end if if rating<>"" and isnumeric(rating) then psql=psql & " and rating="&rating if deptid<>"" then if deptid="m" then psql=psql &" and deptid in (select deptid from xlaALSiUsersDepts where userid="&getusrid&")" else psql=psql & " and deptid="&deptid end if end if if requestid<>"" then psql=psql & " and requestid in ("&replace(requestid," ","")&")" if datecriteria<>"" and isdate(date1) and isdate(date2) then psql=psql & " and (requestdate>='"&date1&"' and requestdate<='"&date2&"z')" end if if not(isdate(date1)) then date1=date if not(isdate(date2)) then date2=date deletesql=psql if orderby="" then psql=psql & " order by requestdate desc" else psql=psql & " order by "&orderby end if searchsql=psql mypage=request("whichpage") if mypage="" then mypage=1 mypagesize=10 scriptname="search.asp?name="&server.urlencode(name)&"&topic="&server.urlencode(topic)&"&repname="&server.urlencode(repname)&"&ref="&server.urlencode(ref)&"&deptid="&deptid&"&rating="&rating&"&requestid="&requestid&"&datecriteria="&datecriteria&"&date1="&server.urlencode(date1)&"&date2="&server.urlencode(date2) set conn=server.createobject("ADODB.Connection") conn.open connection '/// Delete a request //// kill=request("kill") if kill<>"" and lvl=1 then '/// Delete request //// psql="delete from xlaALSrequests where requestid="&kill conn.execute(psql) end if '/// Delete Results /// killresults=request("killresults") if killresults<>"" and lvl=1 then tokill=request("deletesql") tokill=replace(tokill,"select * from","select requestid from") psql="delete from xlaALSrequests where requestid in ("&tokill&")" conn.execute(psql) end if %>
Search / View Requests :
Use this option to browse through the submited requests by defining any search criteria. If you don't define any criteria, all the requests will be returned.
Customer Name, E-mail or ID :
Keywords :
Representative Assigned / ID :
Requested From Page :
Assigned To Department :
With Rating :
Request ID #
> Made Between : (MM/DD/YYYY) : / / And / /
<% set rs=server.createobject("ADODB.Recordset") rs.open searchsql,conn,1 if not(rs.eof) then maxval=rs.recordcount rs.movefirst rs.pagesize=mypagesize maxcount=cint(rs.pagecount) rs.absolutepage=mypage howmanyrecs=0 howmanyfields=rs.fields.count-1 %> <%else%> <%end if%>
Requests Found : <%=maxval%>
Page <%=mypage%> of <%=maxcount%>
<%if lvl=1 then%> <%end if%>
<% cc=(mypagesize*mypage)-mypagesize do until rs.eof or howmanyrecs>=rs.pagesize cc=cc+1 requestid=rs("requestid") topic=rs("topic")&"" if topic="" then topic="Undefined" ref=rs("ref") rating=rs("rating") stars="" if rating>0 then for x=1 to rating stars=stars & "" next rating=rating&"
"&stars else rating="Not Rated" end if requestdate=rs("requestdate") deptid=rs("deptid") deptname=d.item(deptid) name=rs("name") if lvl=1 then deleteable="javascript:deleterequest("&requestid&");" img="" else deleteable="javascript:notallowed();" img="0" end if %> <% rs.movenext howmanyrecs=howmanyrecs+1 loop %>
# Request Topic


View  Delete
<%=cc%>. <%=topic%>
- Dept : <%=deptname%>
- Referer : <%=left(ref,50)%>
<%=name%> <%=requestdate%> <%=rating%> <%=requestid%> View request Delete Request
Go to Page : <%if cint(mypage)>1 then response.write "<< " if cint(mypage)>>"%>

No requests were found for the specified criteria

<% rs.close set rs=nothing set d=nothing conn.close set conn=nothing %>