<!--#INCLUDE FILE="../HXINCLUDE/HXINCLUDEHEAD.ASP"-->
<%if WS_S.MemberPriv("WS_SystemSettel")<>1 then HX_GoBack "对不起,您的权限不够!",""
action=request("action"):WS_Teid=request("WS_Teid"):searchtype=request("searchtype"):keywords=request("keywords"):searchmode=request("searchmode"):ColumnName="":Tablename="HX_Telsearch"
select case action
  case "del"
    conn.execute("delete from HX_Telsearch where WS_Teid="&WS_Teid)
	response.redirect "telsearch.asp"
	response.end
  case "search"
    Orderby=" where 1=1"
    if searchmode=1 then
	  if searchtype=1 then  Orderby=Orderby&" and WS_Companyname like '%"&keywords&"%'" else  Orderby=Orderby&" and WS_Telphone like '%"&keywords&"%'"
	else
	  if searchtype=1 then  Orderby=Orderby&" and WS_Companyname='"&keywords&"'" else  Orderby=Orderby&" and WS_Telphone='"&keywords&"'"
	end if
  case else Orderby=" ORDER BY WS_Teid DESC"
end select
set rs=WS_S.HX_SetRSD(ColumnName,Tablename,Orderby) 
response.Write "<head><meta http-equiv='Content-Type' content='text/html; charset=gb2312'><title>常用电话查询</title><link rel=stylesheet type=text/css href='../HXinclude/HX_Style.css'><script src='../hxinclude/HX_function.js'></script></head><body topmargin='20' leftmargin='0' bottommargin='25'><table width='596'  border='0' cellspacing='1' cellpadding='0' align=center bgcolor='#613c25'><tr><td colspan='2' bgcolor=FFFBE8><table width='100%'  border='0' cellspacing='0' cellpadding='0'><tr><td height='25' background='../hximages/titleline.gif'><font class='fontmenu'>常用电话查询</font></td></tr></table><table width='100%'  border='0' cellpadding='0' cellspacing='1' bgcolor=613c25><tr bgcolor='FFFBE8'><td height='24'><table width='100%'  border='0' cellspacing='1' cellpadding='2' bgcolor='#BF9B73'><tr bgcolor='#FFFBE8'><td width='8%'><div align='center'>序号</div></td><td width='38%' bgcolor='#FFFBE8'><div align='center'>单位名称</div></td><td width='28%' bgcolor='#FFFBE8'><div align='center'>电话号码</div></td><td width='26%' bgcolor='#FFFBE8'><div align='center'>操 作</div></td></tr>"
 if rs.recordcount<=0 then
	   response.Write "<tr><td colspan=4 height=25 bgcolor=FFFBE8 align=center><font color=red>暂 无 数 据!</font></td></tr>"
	else
    rs.PageSize =15 '每页记录条数
	iCount=rs.RecordCount '记录总数
	iPageSize=rs.PageSize
    	maxpage=rs.PageCount 
    	page=request("page")
    if Not IsNumeric(page) or page="" then
        page=1
    else
        page=cint(page)
    end if
    if page<1 then
        page=1
    elseif  page>maxpage then
        page=maxpage
    end if
    rs.AbsolutePage=Page
	if page=maxpage then
		x=iCount-(maxpage-1)*iPageSize
	else
		x=iPageSize
	end if
	ii=0
	do while not rs.EOF
	   response.Write "<tr "
	   if ii mod 2=0 then response.write "bgcolor='#FFFBE8'" else response.write "bgcolor='#FFFBE8'"
	   response.Write "><td align=center>"&rs("WS_Teid")&"</td><td>"&rs("WS_Companyname")&"</td><td>"&rs("WS_Telphone")&"</td><td align=center><input type='button' name='Submit3' value=' 修 改 ' onclick=""openwin(430,150,'telsearchedit.asp?WS_Teid="&rs("WS_Teid")&"')""> <input type='button' name='Submit3' value=' 删 除 ' onclick=""if(!confirm('是否要删除此信息')) return false;else location.href='?action=del&WS_Teid="&rs("WS_Teid")&"';""></td></tr>"
	   ii=ii+1
	  if ii>=rs.PageSize then Exit Do
	  rs.movenext
      loop
      call WS_S.PageControl(iCount,maxpage,page,"border=0 align=right","<p align=right>",4)
end if
call WS_S.HX_RSClose(rs) 
response.Write "<form name='form1' method='post' action='?action=search'><tr bgcolor='#FFFBE8'><td colspan='4'>查询：<select name='searchtype'><option value='1' selected>单位名称</option><option value='2'>电话号码</option></select><input name='keywords' type='text' size='25' maxlength='50'> <input type='radio' name='searchmode' value='1' id='mh' class='radio' checked><label for=mh>模糊</label> <input type='radio' name='searchmode' value='2' id='jq' class='radio'><label for=jq>精确</label> <input type='submit' name='Submit2' value=' 搜 索 '> <input type='button' name='Submit3' value=' 添 加 ' onclick=""openwin(430,150,'telsearchadd.asp')""></td></tr></form></table></td></tr><tr bgcolor='#FFFBE8'><td width='100%' height='24' align='right'><input type='button' name='Submit' value='打 印'></td></tr></table></td></tr></table>"  %>