<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../conn/conn.asp"-->
<!--#include file="../inc/Commoncode.asp"-->
<!--#include file="../inc/CommonFunction.asp"-->
<%SQLin
link="company_works.asp"%>
<!--#include file="checkcmember.asp" -->
<!--#include file="flagandexpend.asp"-->
<%
Dim page,i
Dim totalPut
const MaxPerpage=10
Const strFileName="company_works.asp"
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("action"))<>"" then
  action=trim(request("action"))
  checks=trim(request("checks"))
  set rs=Server.CreateObject("Adodb.Recordset")
  myreceive=split(checks,",")
  select case action
   case "myexpert" '放入人才库
	If CheckCFlag("Climits",2)=False Then
	Response.Write("<script language=JavaScript>{alert('您无权使用人才库！');location.href = 'javascript:history.go(-1)';}</script>")
	End If
    for i=0 to ubound(myreceive)
	 id=Chkint(trim(myreceive(i)))
     sql="select * from job_c_myreceive where myreceive_id="&id
     rs.open sql,conn,1,1
	 hireid=rs("myreceive_hireid")
     resumeid=rs("myreceive_resumeid")
     name=rs("myreceive_name")
     sex=rs("myreceive_sex")
     birth=rs("myreceive_birth")
     edu=rs("myreceive_edu")
	 pmember=rs("myreceive_pmember")
     rs.close
	 sql="select * from job_c_myexpert where myexpert_pmember='"&pmember&"'" '存入人才库
     rs.open sql,conn,1,3
	 if rs.eof then
	 	If CheckCFlag("Climits",3)=False then
			If CheckCFlag("Cdianshus",1)=False then
				response.write "<script language=javascript>alert('恭喜您成功添加"&t&"个人才！\n由于您人才库的数量已达到上限（或无可用点数），暂不能继续收藏，如需继续扩大人才库容量请联系网站客服进行升级！');location.href='javascript:window.close()';</script>"
				response.end()
			else
				Call PayLog(cmember_login,2,"将"&name&"的简历放入到人才库",Group_Cdianshus(1),0)
			end if
		else
			Call PayLog(cmember_login,2,"将"&name&"的简历放入到人才库",0,0)
		end if
		 rs.addnew
		  rs("myexpert_resumeid")=resumeid
		  rs("myexpert_name")=name
		  rs("myexpert_sex")=sex
		  rs("myexpert_birth")=birth
		  rs("myexpert_edu")=edu
		  rs("myexpert_cmember")=cmember_login
		  rs("myexpert_pmember")=pmember
		  rs("myexpert_date")=now()
		  rs("myexpert_exp")=1
		  rs.update
		  '修改人才库人才数量
		if Group_Climits(3)=0 then
			conn.Execute("Update JOB_member set Member_expertnums=Member_expertnums+1 where Member_login = '"&cmember_login&"' and Member_typeid=2")
		else
			conn.Execute("Update JOB_member set Member_expertnums=Member_expertnums+1,Member_expertnum=Member_expertnum-1 where Member_login = '"&cmember_login&"' and Member_typeid=2")
		end if
		Call IncomeIntegral(cmember_login,2,-Group_Cintegrals(1))
	 else
	 	if rs("myexpert_exp")<>1 then
			If CheckCFlag("Climits",3)=False then
				If CheckCFlag("Cdianshus",1)=False then
					response.write "<script language=javascript>alert('恭喜您成功添加"&t&"个人才！\n由于您人才库的数量已达到上限（或无可用点数），暂不能继续收藏，如需继续扩大人才库容量请联系网站客服进行升级！');location.href='javascript:window.close()';</script>"
					response.end()
				else
					Call PayLog(cmember_login,2,"将"&name&"的简历放入到人才库",Group_Cdianshus(1),0)
				end if
			else
				Call PayLog(cmember_login,2,"将"&name&"的简历放入到人才库",0,0)
			end if
			rs("myexpert_date")=now()
			rs("myexpert_exp")=1
			rs.update
			'修改人才库人才数量
			if Group_Climits(3)=0 then
				conn.Execute("Update JOB_member set Member_expertnums=Member_expertnums+1 where Member_login = '"&cmember_login&"' and Member_typeid=2")
			else
				conn.Execute("Update JOB_member set Member_expertnums=Member_expertnums+1,Member_expertnum=Member_expertnum-1 where Member_login = '"&cmember_login&"' and Member_typeid=2")
			end if
			Call IncomeIntegral(cmember_login,2,-Group_Cintegrals(1))
		end if
	 end if
	 rs.close
	 '把工作申请记录中相应信息的收藏标志置1
	 conn.execute("update job_p_mysend set mysend_favorite=1 where mysend_hireid="&hireid&" and mysend_pmember='"&pmember&"'")
	next
   case "comrecycle" '放入回收站
   	If CheckCFlag("Climits",6)=False Then
		Response.Write("<script language=JavaScript>{alert('您无权使用回收站！');location.href = 'javascript:history.go(-1)';}</script>")
	End If
    for i=0 to ubound(myreceive)
	 id=Chkint(trim(myreceive(i)))
     sql="select * from job_c_myreceive where myreceive_id="&id
     rs.open sql,conn,1,1
     resumeid=rs("myreceive_resumeid")
     name=rs("myreceive_name")
     sex=rs("myreceive_sex")
     birth=rs("myreceive_birth")
     edu=rs("myreceive_edu")
	 hireid=rs("myreceive_hireid")
	 place=rs("myreceive_place")
	 pmember=rs("myreceive_pmember")
	 myreceive_date=rs("myreceive_date")
	 myreceive_content=rs("myreceive_content")
     rs.close
	 sql="select * from job_c_recycle " '存入回收站
     rs.open sql,conn,1,3
	 If CheckCFlag("Climits",7)=False then
		If CheckCFlag("Cdianshus",3)=False then
			response.write "<script language=javascript>alert('您的回收站容量达到最大限制（或无可用点数），暂不能继续放入，如需继续放入回收站请联系网站客服进行升级！');window.close();</script>"
			response.end()
		else
			Call PayLog(cmember_login,2,"将"&name&"的简历放入到回收站",Group_Cdianshus(3),0)
		end if
	else
		Call PayLog(cmember_login,2,"将"&name&"的简历放入到回收站",0,0)
	end if
	 rs.addnew
	  rs("comrecycle_resumeid")=resumeid
	  rs("comrecycle_name")=name
	  rs("comrecycle_sex")=sex
	  rs("comrecycle_birth")=birth
	  rs("comrecycle_edu")=edu
	  rs("comrecycle_hireid")=hireid
	  rs("comrecycle_place")=place
	  rs("comrecycle_cmember")=cmember_login
	  rs("comrecycle_pmember")=pmember
	  rs("comrecycle_date")=myreceive_date
	  rs("comrecycle_content")=myreceive_content
	 rs.update
	 rs.close
	 '修改回收站数量
		if Group_Climits(7)=0 then
			conn.Execute("Update JOB_member set Member_recyclenums=Member_recyclenums+1 where Member_login = '"&cmember_login&"' and Member_typeid=2")
		else
			conn.Execute("Update JOB_member set Member_recyclenums=Member_recyclenums+1,Member_recyclenum=Member_recyclenum-1 where Member_login = '"&cmember_login&"' and Member_typeid=2")
		end if
	 '删除简历
	 conn.execute("delete from job_c_myreceive where myreceive_id="&id)
	next
   case "del"  '删除选中的应聘简历
    for i=0 to ubound(myreceive)
	 id=Chkint(trim(myreceive(i)))
	 conn.execute("delete from job_c_myreceive where myreceive_id="&id)
	next
  end select
  response.redirect "company_works.asp?page="&page&""
  response.end
 end if%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>收到应聘简历-企业招聘管理中心-<%=SiteTitle%></title>
<link href="../member/css.css" rel="stylesheet" type="text/css" />
<script language="JavaScript">
<!--
  function CheckAll(form)
  {
  for (var i=0;i<form.elements.length;i++)
    {
    var e = form.elements[i];
    if (e.name != 'chkall')
       e.checked = form.chkall.checked;
    }
  }
  function showconfirm(id,page)
{
	var flag=false; //是否有选择职位信息
	var k=0;
	var refid;
	for(i=0;i<document.thisForm.elements.length;i++) 
	{
		if (document.thisForm.elements[i].name=="checks")
		{		
			if (document.thisForm.elements[i].checked==true) 
			{
				flag=true;
				break;
			}
		}
	}
	if (flag==false)
	{
		alert("请先选择一个职位！");
		return false;
	}
	//发送面试邀请
	if (id==1)
	{
		if(confirm("您确定要发送面试邀请吗？")==true)
		{
			document.thisForm.action="company_interviewsend.asp?action=myreceive";
			document.thisForm.target="_blank";
			thisForm.submit();
		}
	}
	//发送简历回复
	if (id==2)
	{
	   if(confirm("您确定要发送简历回复吗？")==true)
		{
			document.thisForm.action="company_responsesend.asp";
			document.thisForm.target="_blank";
			thisForm.submit();
		}
	}
	//发送拒收简历
	if (id==3)
	{
		if(confirm("您确定要发送拒收简历吗？")==true)
		{
			document.thisForm.action="company_denysend.asp";
			document.thisForm.target="_blank";
			thisForm.submit();
		}
	}
	//放入人才库
	if (id==4)
	{
		if(confirm("您确定要放入人才库吗？")==true)
		{
			document.thisForm.action="company_works.asp?action=myexpert&page="+page+"";
			thisForm.submit();
		}
	}
	//放入回收站
	if (id==5)
	{
		if(confirm("您确定要放入回收站吗？")==true)
		{
			document.thisForm.action="company_works.asp?action=comrecycle&page="+page+"";
			thisForm.submit();
		}
	}
	//删除
	if (id==6)
	{
		if(confirm("您确定要删除简历吗？")==true)
		{
			document.thisForm.action="company_works.asp?action=del&page="+page+"";
			thisForm.submit();
		}
	}					
}
  //-->
</script>
<style type="text/css">
<!--
.STYLE1 {font-weight: bold}
-->
</style>
</head>
<body>
<div class="memmenul">
<div class="leftmenutit"><span>收到应聘简历</span></div>
<%
Set rsw= Server.CreateObject(FR_HR_RS)
hireid=trim(request("hireid"))
'If CheckInfo(2)=False Then
'sqlOther=" top "&OutInfo("JOB_C_cmembertype","type_id","rehirenums",session("user_type"))
'End If
'sql="select "& sqlOther &" * from job_c_myreceive where myreceive_cmember='"&cmember_login&"'"
sql="select * from job_c_myreceive where myreceive_cmember='"&cmember_login&"'"
if hireid<>"" then
hireid=clng(hireid)
sql=sql&" and myreceive_hireid="&hireid&""
end if
sql=sql&" order by myreceive_date desc"
	rsw.open sql,conn,1,1
	if rsw.eof and rsw.bof then
		response.Write("<center><br><br>尚未收到应聘简历，请稍侯再进行管理!<br></center>")
		response.Write("<center><br><br><a href=index.asp target=_blank>浏览人才</a>  <a href=company_searchresume.asp target=main>搜索人才</a><br><br><br><br></center>")
		response.End()
	else
		totalPut=rsw.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
				rsw.move  (page-1)*MaxPerpage
				dim bookmark
				bookmark=rsw.bookmark
				Call MainInfo()
			else
				page=1
				Call MainInfo()
			end if
		end if
	end if
	rsw.close
	set rsw=nothing
if FoundErr=True then
	call Show_Err()
end if
%>
<%Sub MainInfo()%>
<table width="98%" border="0" cellspacing="0" cellpadding="0" class="mtable" align="center">
  <tr>
    <td colspan="8">查看应聘 
<select onchange=javascript:window.location.href=this.value name=oWorkNo>
<option value=company_works.asp>(全 部)</option>
<%
hireid=trim(request("hireid"))
set rst=server.createobject("ADODB.Recordset")
sql1="select hire_id,hire_place from job_c_hire where hire_cmember='"&cmember_login&"' order by hire_announcedate desc"
rst.open sql1,conn,1,1
for a=1 to rst.recordcount
if hireid=rst("hire_id") then
response.write "<OPTION value='company_works.asp?hireid="&rst("hire_id")&"' selected>"&rst("hire_place")&"</OPTION>"
else
response.write "<OPTION value='company_works.asp?hireid="&rst("hire_id")&"'>"&rst("hire_place")&"</OPTION>"
end if
rst.movenext
next
rst.close
%>
</select> 职位的求职人员信息</td>
  </tr>
  <tr>
    <td width="10%" align="center"><strong>姓名</strong></td>
    <td width="10%" align="center"><strong>性别</strong></td>
    <td width="10%" align="center"><strong>年龄</strong></td>
    <td width="9%" align="center"><strong>学历</strong></td>
    <td width="18%" align="center"><strong>应聘职位</strong></td>
    <td width="23%" align="center"><strong>发送时间</strong></td>
    <td width="14%" align="center"><strong>是否已读</strong></td>
    <td width="6%" align="center"><IMG src="../images/sel_ico.gif" width=13 height=12 class="STYLE1"></td>
  </tr>
<form name="thisForm" action="" method="post">
<%do while not rsw.eof%>
  <tr>
    <td align="center"><a href="../person/cnresume_view.asp?rid=<%=rsw("myreceive_resumeid")%>" target="_blank"><%=rsw("myreceive_name")%></a></td>
    <td align="center"><%=Hiresex(rsw("myreceive_sex"))%></td>
    <td align="center"><%=year(date())-year(rsw("myreceive_birth"))%></td>
    <td align="center"><%=Hireedu(rsw("myreceive_edu"))%></td>
    <td align="center"><%=rsw("myreceive_place")%></td>
    <td align="center"><%=rsw("myreceive_date")%></td>
    <td align="center">
<%If rsw("myreceive_read")=1 Then
Response.Write "已读"
Else
Response.Write "<font color=blue>未读</font>"
End If
Response.Write "&nbsp;&nbsp;<a href=""Read_Letter.asp?letter_id="&rsw("myreceive_id")&""" target=""_blank"">查看</a>"
%>	</td>
    <td align="center"><input type='checkbox' name='checks' value="<%=rsw("myreceive_id")%>"></td>
  </tr>
<%
i=i+1
if i>=MaxPerPage then exit do
rsw.movenext
loop
%>
  <tr>
    <td colspan="8" align="right"><INPUT name=chkall onClick="CheckAll(this.form)" type=checkbox value=on>选中所有简历</td>
  </tr>
  <tr>
    <td colspan="8" align="right">
<!--面试邀请--><input name="Submit" type="button" class="inputs" value="发送面试邀请" onClick=javascrpt:showconfirm(1,<%=page%>)>
&nbsp;
<!--人才库-->
<input name="Submit4" type="button" class="inputs" value="放入人才库" onclick=javascript:showconfirm(4,<%=page%>)>
<!--回收站-->&nbsp; <input name="Submit5" type="button" class="inputs" value="放入回收站" onClick=javascript:showconfirm(5,<%=page%>)> 
&nbsp;
<!--删除简历-->
<input name="Submit6" type="button" class="inputs" value="删　除" onClick=javascript:showconfirm(6,<%=page%>)>
&nbsp; 	</td>
  </tr>
  <tr>
    <td colspan="8">
<%
If totalput>0 Then
	Call Showpage(strFileName,totalput,MaxPerPage,false,true,"位应聘者")
End If
%></td>
  </tr>
</form>
</table>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F1F8FC" style="margin-top:10px; padding:8px;">
  <tr>
    <td class="tdcolor">说&nbsp;明</td>
  </tr>
  <tr>
    <td><FONT color=#000000>“<strong>发送面试邀请</strong>”</FONT><FONT color=#333333>即邀请一个或多个满意的求职者面试。</FONT></td>
  </tr>
  <tr>
    <td><FONT color=#000000>“<STRONG>放入人才库</STRONG>”</FONT>即整理收集有价值的求职者，以备日后使用。</td>
  </tr>
  <tr>
    <td><FONT color=#000000>“<STRONG>放入回收站</STRONG>”</FONT>即删除简历到回收站，必要时可恢复。</td>
  </tr>
  <tr>
    <td><FONT color=#000000>“<STRONG>删除</STRONG>”</FONT><FONT color=#333333>即彻底删除简历。</FONT></td>
  </tr>
</table>
<%End Sub%>
</div>
<%CloseConn%>