<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> 
<%Session.CodePage=936%> 
<!--#include file="../../conn/conn.asp" -->
<!--#include file="../../Inc/Commoncode.asp" -->
<!--#include file="../checkvalid.asp" -->
<%If Not FRAdminLevel(303) Then Call ErrorMsg()
Response.Expires = 0 
Response.CacheControl = "no-cache" 
Response.ExpiresAbsolute = Now() - 1 
keyword=CheckStr(trim(request("search"))) 
if trim(request("segment"))<>"" then segment=trim(request("segment"))
if trim(request("keywordtype"))<>"" then
	segment=trim(request("keywordtype"))
	if segment<>"" And IsNumeric(segment) then
		segment=Clng(segment)
	else
		segment=3
	end if
end if
if trim(request("keyword"))<>"" then
	keyword=Replace(trim(request("keyword")),"'","")
	if keyword="关键字搜索..." then
		keyword=""
	end if
end if
operate=trim(request("operate"))
usergroup=Replace(trim(request("usergroup")),"'","")
trade=Replace(trim(request("trade")),"'","")
position=Replace(trim(request("position")),"'","")
workadd=Replace(trim(request("workadd")),"'","")
datetime=Replace(trim(request("datetime")),"'","")
profession=Replace(trim(request("profession")),"'","")
edu1=Replace(trim(request("edu1")),"'","")
edu2=Replace(trim(request("edu2")),"'","")
experience1=Replace(trim(request("experience1")),"'","")
experience2=Replace(trim(request("experience2")),"'","")
sex=Replace(trim(request("sex")),"'","")
age=Replace(trim(request("age")),"'","")

Dim Action
Dim page,i
Dim totalPut
const MaxPerpage=20
strFileName="hire_searchlist.asp?segment="&segment&"&search="&search&"&operate="&operate&"&usergroup="&usergroup&"&trade="&trade&"&position="&position&"&workadd="&workadd&"&datetime="&datetime&"&datetimes="&datetimes&"&keyword="&keyword&"&keywordtype="&keywordtype&"&profession="&profession&"&edu1="&edu1&"&edu2="&edu2&"&sex="&sex&"&experience1="&experience1&"&experience2="&experience2&"&age="&age&""
page=Trim(Request("page"))
If page<>"" And IsNumeric(page) Then
	If page<1 Or Len(page)>10 Then
		page=1
	Else
    	page=CLng(page)
	End If
Else
	page=1
End If
if trim(request("step"))<>"" then
step=trim(request("step"))
member=request("member")
select case step
case "reload"
	conn.execute("update job_c_hire set hire_command=0,hire_commandstartdate=null,hire_commandenddate=null where datediff("&FR_HR_d&",hire_commandenddate,"&FR_HR_Now&")>0")
case "audit"
	if member<>"" then
 		pp=ubound(split(member,","))+1 
			for v=1 to pp
			member=request("member")(v)
 conn.execute("update job_c_hire set hire_status=1 where hire_id="&member&"")
			next
	end if
case "unaudit"
	if member<>"" then
 		pp=ubound(split(member,","))+1 
			for v=1 to pp
			member=request("member")(v)
 conn.execute("update job_c_hire set hire_status=0 where hire_id="&member&"")
			next
	end if
case "command"
	response.Redirect "hire_commend.asp?member="&member
case "uncommand"
	if member<>"" then
 		pp=ubound(split(member,","))+1 
			for v=1 to pp
			member=request("member")(v)
 conn.execute("update job_c_hire set hire_command=0,hire_commandstartdate=null,hire_commandenddate=null where hire_id="&member&"")
			next
	end if
case "Refresh"
	if member<>"" then
 		pp=ubound(split(member,","))+1 
			for v=1 to pp
			member=request("member")(v)
			conn.execute("update job_c_hire set hire_announcedate='"&now()&"' where hire_id="&member&"")
			next
	end if
case "Republish"
	if member<>"" then
 		pp=ubound(split(member,","))+1 
			for v=1 to pp
			member=request("member")(v)
				if FR_HR_DataBaseType=1 then
				conn.execute("update job_c_hire set hire_announcedate="&FR_HR_Now&",hire_enddate='"&dateadd("d",30,date())&"' where hire_id="&member&"")
				else
				conn.execute("update job_c_hire set hire_announcedate="&FR_HR_Now&",hire_enddate=#"&dateadd("d",30,date())&"# where hire_id="&member&"")
				end if
			next
	end if
case "edit"
	response.Redirect "hire_modi.asp?member="&member&""
case "del"
	if member<>"" then
 		pp=ubound(split(member,","))+1 
			for v=1 to pp
			member=request("member")(v)
	 conn.execute("delete from job_c_hire where hire_id="&member&"")
	 		next
	end if
case "clear"
	set Crs=server.createobject("adodb.recordset")
	Csql="select company_id from JOB_C_hire order by hire_id desc"
	Crs.open Csql,conn,1,3
	if not Crs.eof then
	do while not Crs.eof
	set rs=conn.execute("select member_id from JOB_member where member_id="&Crs("company_id")&"")
		if rs.eof and rs.bof then
		Crs.delete
		end if
	set rs=nothing
	Crs.movenext
	loop
	end if
	Crs.close
	Set Crs=nothing
end select
end if
%>
<html>
<head>
<title>招聘信息列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../css/style<%=sk%>.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../inc/input.js"></script><style type="text/css">
<!--
.STYLE2 {color: #FF0000}
-->
</style>
</head>
<body>
<table width="100%" border="0" align="center" cellpadding=2 cellspacing=1 class="tableBorder">
  <tr>
    <th height=25  class="tableHeaderText">企业招聘管理</th>
  </tr>
  <form action="hire_searchlist.asp" method="post">
      <tr>
      <td height="28" align="left"><font color="ff6600"><b class="style1">　管理选项</b></font>：&nbsp;<a href="cmember_searchlist.asp">管理首页</a> | <a href="company_add.asp">企业添加</a> |  <a href="cmember_searchlist.asp">企业管理</a> | <a href="hire_add.asp">职位添加</a> | <a href="hire_searchlist.asp">职位管理</a> | <a href="hire_search.asp" target="main">职位查询</a> | [<a href="javascript:location.reload()">刷新页面</a>]</td>
    </tr>
    <tr>
      <td height="28" align="left"><font color="ff6600"><b class="style11">　二级选项</b></font>： <a href="?operate=0">待审职位</a> | <a href="?operate=1">已审职位</a> | <a href="?operate=2">已推荐职位</a> | <a href="?operate=3">已过期职位</a> | <a href="?operate=4">一周内到期</a> | <a href="?operate=5">30天内到期</a> </td>
    </tr>
    <tr> 
      <td align="left"><font color="ff6600"><b class="style1">　职位搜索</b></font>：</span>
      <input name="search" type="text" id="search" size="20">
          <select name="segment" size="1" id="segment">
            <option value="1">职位名称</option>
            <option value="2">公司名称</option>
        </select>
          <input name="Submit" type="submit" class="inputs" value="搜索">
      <a href="hire_search.asp"><font color="#FF0000">[高级搜索]</font></a>&nbsp; <a href="hire_searchlist.asp?step=reload" title="更新过期推荐职位状态！">刷新</a> <a href="hire_searchlist.asp?step=clear" title="清理企业已删除，尚未彻底删除的无效职位！">清理</a></td>
    </tr>
  </form>
</table> 
<%Call main()
if FoundErr=True then
	call Show_Err()
end if
%>
<%sub main()
sql="select * from job_c_hire where"
select case segment
case 1:sql=sql&" hire_place like '%"&keyword&"%'"
case 2:sql=sql&" hire_comname like '%"&keyword&"%'"
case else:sql=sql&" (hire_place like '%"&keyword&"%' or hire_comname like '%"&keyword&"%')"
end select
 if operate<>"" then
	select case operate
		case 0:sql=sql&" and hire_status=0"
		case 1:sql=sql&" and hire_status=1"
		case 2:sql=sql&" and hire_command=1"
		case 3:sql=sql&" and datediff("&FR_HR_d&",hire_enddate,"&FR_HR_Now&")>0"
		case 4:sql=sql&" and datediff("&FR_HR_d&",hire_enddate,"&FR_HR_Now&")>7 and datediff("&FR_HR_d&",hire_enddate,"&FR_HR_Now&")<=0"
		case 5:sql=sql&" and datediff("&FR_HR_d&",hire_enddate,"&FR_HR_Now&")>30 and datediff("&FR_HR_d&",hire_enddate,"&FR_HR_Now&")<=0"
	end select	
end if
if usergroup<>"" and IsNumeric(usergroup) then
	if usergroup<>3 and usergroup<>0 then
		sql=sql&" and hire_type="&usergroup
	end if
end if
if trade<>"" and trade<>"0000" then
mystring=split(trade,",")
  for i=0 to ubound(mystring)
  if i=0 then
    sql=sql&" and (hire_trade  like '%"&trim(mystring(i))&"%'"
   else
    sql=sql&" or hire_trade like '%"&trim(mystring(i))&"%'"
   end if
  next
   sql=sql&")"
end if
if position<>"" and position<>"0000" then
mystring=split(position,",")
  for i=0 to ubound(mystring)
  if i=0 then
    sql=sql&" and (hire_position like '%"&trim(mystring(i))&"%'"
   else
    sql=sql&" or hire_position like '%"&trim(mystring(i))&"%'"
   end if
  next
   sql=sql&")"
end if
if workadd<>"" and workadd<>"0000" then
mystring=split(workadd,",")
  for i=0 to ubound(mystring)
  if i=0 then
    sql=sql&" and (hire_workadd  like '%"&trim(mystring(i))&"%'"
   else
    sql=sql&" or hire_workadd like '%"&trim(mystring(i))&"%'"
   end if
  next
   sql=sql&")"
end if
if datetime<>"" and IsNumeric(datetime) then
	if datetime<>0 then 
		sql=sql&" and datediff("&FR_HR_d&",hire_announcedate,"&FR_HR_Now&"-"&datetime&")<=0"
	end if
end if
if profession<>"" and profession<>"0000" then
mystring=split(profession,",")
	for i=0 to ubound(mystring)
	if i=0 then
		sql=sql&" and (hire_profession like '%"&trim(mystring(i))&"%'"
	else
		sql=sql&" or hire_profession like '%"&trim(mystring(i))&"%'"
	end if
	next
		sql=sql&")"
end if
if edu1<>"" and IsNumeric(edu1) then
sql=sql&" and hire_edu>="&edu1
end if
if edu2<>"" and IsNumeric(edu2) then
sql=sql&" and hire_edu<="&edu2
end if
if sex<>"" and IsNumeric(sex) then
	if sex<>0 then
		select case sex
		case 1:sql=sql&" and hire_sex=1"
		case 2:sql=sql&" and hire_sex=2"
		end select
	end if
end if
if experience1<>"" and IsNumeric(experience1) then
	sql=sql&" and hire_experience>="&experience1
end if
if experience2<>"" and IsNumeric(experience2) then
	sql=sql&" and hire_experience<="&experience2
end if

if age<>"" then
	if age<>0 then
		sql=sql&" and hire_age1<="&age&" and hire_age2>="&age&""
	end if
end if
select case taxis
	case 1
	sql=sql&" order by hire_announcedate desc"
	case 2
	sql=sql&" order by hire_announcedate asc"
	case 3
	sql=sql&" order by hire_visitcount desc"
end select
 sql=sql&" order by hire_command desc,hire_announcedate desc,hire_id desc"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if rs.eof and rs.bof then
	FoundErr=True
	ErrMsg=ErrMsg & "<br><li>暂无招聘职位，请添加后再进行管理！</li>"
	exit sub
else
	totalPut=rs.recordcount
	if (page-1)*MaxPerpage>totalput then
		if (totalPut mod MaxPerpage)=0 then
			page= totalPut \ MaxPerpage
		else
			page= totalPut \ MaxPerpage + 1
		end if
	end if
	if page=1 then
		Call MainInfo()
	else
		if (page-1)*MaxPerpage<totalPut then
			rs.move  (page-1)*MaxPerpage
			dim bookmark
			bookmark=rs.bookmark
			Call MainInfo()
		else
			page=1
			Call MainInfo()
		end if
	end if
end if
rs.close
set rs=nothing
end sub	
%>
<%Sub MainInfo()%>
<table width="99%" border="0" align="center" cellpadding="2" cellspacing="1" class="tableBorder">
  <tr>
    <th height=25  class="tableHeaderText" colspan="10">招聘信息列表</th>
  </tr>
 <form name="form2" action="hire_searchlist.asp" method="post">
<tr height=25> 
  <td width="30" align="center"><b>编号</b></td>
  <td width="100" align="center"><b>招聘职位</b></td>
  <td align="center"><b>公司名称</b></td>
  <td width="100" align="center"><b>点击/申请/邀请</b></td>
  <td width="120" align="center"><b>发布时间</b></td>
  <td width="60" align="center"><b>截止日期</b></td>
  <td width="40"  align="center"><b>状态</b></td>
  <td width="80" align="center"><b>会员/录入员</b></td>
  <td width="30" align="center"><input name="checkSelect" type="checkbox" class="checkbox" onClick="javascript: checkAll(this)" value="checkbox"></td>
</tr>
<%do while not rs.eof%>
<tr onMouseOver="this.style.background='#FFFFCC'" onMouseOut="this.style.background='#EEF7FD'">
<td height="25" align="center"><%=rs("hire_id")%></td>
<td align="left"><a href="#" onClick="window.open ('hire_info.asp?id=<%=rs("hire_id")%>','newwindow','height=500,width=550,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=no,location=no, status=no') ">
  <%if rs("hire_command")=1 and rs("hire_commandenddate")>date() then
	response.Write "<font color=red>"&rs("hire_place")&"</font>"
  elseif rs("hire_command")=1 and rs("hire_commandenddate")<date()then
	response.Write "<font color=red>"&rs("hire_place")&"</font>(<font color=blue>过期</font>)"
  else response.Write rs("hire_place")
  end if%></a></td>
<td align="left">
<%if not isnull(rs("company_id")) then%>
<a href="#" onClick="window.open ('cmember_info.asp?id=<%=rs("company_id")%>','newwindow','height=500,width=550,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=no,location=no, status=no') "><%=rs("hire_comname")%></a>
<%else
response.Write rs("hire_comname")&"(<font color=red>"&rs("hire_operator")&"</font>添加)"
end if%>		  </td>
<td align="center"><%=rs("hire_visitcount")%>/<%=rs("hire_receiveresume")%>/<%=rs("hire_sendinterview")%></td>
<td align="center"><%=rs("hire_announcedate")%></td>
<td align="center"><%=rs("hire_enddate")%></td>
<td align="center"><%if rs("hire_enddate")<date() and rs("hire_status")=1 then
  response.Write "<font color=red>过期</font>"
  elseif rs("hire_enddate")>date() and rs("hire_status")=1 then
  response.Write "正常"
  elseif  rs("hire_status")=0 then
  response.Write "<font color='#666666'>未审核</font>"
  elseif  rs("hire_status")=2 then
  response.Write "<font color='#666666'>屏蔽</font>"
  end if
%></td>
<td align="center" bordercolor="#101880"><%=rs("hire_cmember")%>/<%if rs("hire_operator")<>"" then response.Write rs("hire_operator") end if%></td>
<td align="center"><input name="member" type="checkbox" class="checkbox" id="member" value="<%=rs("hire_id")%>"></td>
</tr>
<%
i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
%>
<tr  class="tabbgcolorli"> 
<input type="hidden" name="search" value="<%=search%>"> 
<input type="hidden" name="segment" value="<%=segment%>">
<td colspan="10" align="right" aligh="right">
<input name="button" type="button" class="inputs" id="button" onClick="confirmX(1);" value="审核职位">
<input name="button" type="button" class="inputs" id="button" onClick="confirmX(2);" value="撤销审核">
<input name="button" type="button" class="inputs" id="button" onClick="confirmX(3);" value="推荐职位">
<input name="button" type="button" class="inputs" id="button" onClick="confirmX(4);" value="撤销推荐">
<input name="button" type="button" class="inputs" id="button" onClick="confirmX(7);" value="刷新职位">
<input name="button" type="button" class="inputs" id="button" onClick="confirmX(8);" value="重新发布">
<input name="button" type="button" class="inputs" id="button" onClick="confirmX(5);" value="修改">
<input name="button" type="button" class="inputs" id="button" onClick="confirmX(6);" value="删除">          </td>
</tr>
<tr  class="tabbgcolorli"> 
<td colspan="10" aligh="right"><%If totalput>0 Then
Call Showpage(strFileName,totalput,MaxPerPage,false,true,"个职位")
End If%>     </td>
</tr>
</form>
</table>
<%end sub%>
<!--#include file="../inc/copy.asp" -->
</body>
</html>
<%Conn.Close:Set Conn=Nothing%>
<script language="javascript">
function confirmX(num)
{
	var ids = document.getElementsByName("member");
	var check=false;
	var a=0;
	if (ids != null) 
	{
		
		for (i=0; i<ids.length; i++) 
		{
			var obj = ids(i);
			if (obj.checked==true)
			{
				check=true;
				a+=1
			}
		}
		if(check==false){alert("请选择操作对象！");return false;}
	}
	if(num==1)
	{
		if(confirm("你确定要审核你所选择的职位吗？"))	
		{
			document.form2.action="hire_searchlist.asp?step=audit";
			document.form2.submit();		
		}
	}
	if(num==2)
	{
		if(confirm("你确定要撤销审核你所选择的职位吗？"))	
		{
			document.form2.action="hire_searchlist.asp?step=unaudit";
			document.form2.submit();		
		}
	}
	if(num==3)
	{
		if(a==1){
		if(confirm("你确定要推荐你所选择的职位吗？"))	
		{
			document.form2.action="hire_searchlist.asp?step=command";
			document.form2.submit();		
		}
		}
		else
		{
		alert("同一时刻只能选择一个操作对象进行修改!")
		return false;
		}
		
	}
	if(num==4)
	{
		if(confirm("你确定要撤销推荐你所选择的职位吗？"))	
		{
			document.form2.action="hire_searchlist.asp?step=uncommand";
			document.form2.submit();		
		}
	}
	if(num==5)
	{
		if(a==1){
		if(confirm("你确定要修改你所选择的职位吗？"))	
		{
			document.form2.action="hire_searchlist.asp?step=edit";
			document.form2.submit();		
		}
		}
		else
		{
		alert("同一时刻只能选择一个操作对象进行修改!")
		return false;
		}
	}
	if(num==6)
	{
		if(confirm("警告：此操作将会删除该职位！\n是否继续本操作？"))	
		{
			document.form2.action="hire_searchlist.asp?step=del";
			document.form2.submit();		
		}
	}
	if(num==7)
	{
		if(confirm("您确定要刷新选定的职位吗？"))	
		{
			document.form2.action="hire_searchlist.asp?step=Refresh";
			document.form2.submit();		
		}
	}
	if(num==8)
	{
		if(confirm("您确定要重新发布选定的职位吗？"))	
		{
			document.form2.action="hire_searchlist.asp?step=Republish";
			document.form2.submit();		
		}
	}
	return false;	
}
function checkAll(box1) {
    var ids = document.getElementsByName("member");
	if (ids != null) {
		for (i=0; i<ids.length; i++) {
			var obj = ids(i);
			obj.checked = box1.checked;
		}
	}
}
</script>