<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../conn/conn.asp"-->
<!--#include file="../inc/Commoncode.asp"-->
<!--#include file="../inc/CommonFunction.asp"-->
<!--#include file="../inc/sendmail.asp"-->
<%Call SQLin()
link="person_resumesend.asp?action="&request("action")&"&checks="&request("checks")&""%>
<!--#include file="checkpmember.asp" -->
<!--#include file="flagandexpend.asp" -->
<%'是否可在线申请职位
If CheckPFlag("Plimits",4)=False then
response.write "<script language=javascript>alert('您所在的会员组不能在线申请职位，请联系网站客服进行升级！');location.href='javascript:history.back()';</script>"
response.end()
end if
if trim(request("step"))="2" then
action=CheckStr(trim(request("action")))
checks=trim(request("checks"))
resumes=trim(request("resumeid"))
resumes=split(resumes,",")
resumeid=int(trim(resumes(0)))
resumename=trim(resumes(1))
letter=CheckStrbox(trim(request("letter")))
hire=split(checks,",")
set rs=Server.CreateObject("Adodb.Recordset")
set rst=Server.CreateObject("Adodb.Recordset")
'1）存入人才的“工作申请记录”
t=0 '成功发送数
for i=0 to ubound(hire)
id=trim(hire(i))
sqlt="select * from job_p_mysend where mysend_hireid="&id&" and mysend_pmember='"&pmember_login&"'"
rst.open sqlt,conn,1,3
if rst.eof then
select case action '取出相关信息
	case "myfavorite"   '职位收藏夹中触发
		sql="select * from job_p_myfavorite where myfavorite_id="&id
		rs.open sql,conn,1,1
		hireid=rs("myfavorite_hireid")
		comname=rs("myfavorite_comname")
		place=rs("myfavorite_place")
		cmember=rs("myfavorite_cmember")
		rs.close
	case "hire"   '职位信息触发
		sql="select * from job_c_hire where hire_id="&id
		rs.open sql,conn,1,1
		hireid=rs("hire_id")
		comname=rs("hire_comname")
		place=rs("hire_place")
		cmember=rs("hire_cmember")
		rs.close		
end select
If CheckPFlag("Plimits",5)=False then
	If CheckPFlag("Pdianshus",2)=False then
		response.write "<script language=javascript>alert('恭喜您成功发送"&t&"个职位申请！\n由于您申请的数量已达到上限（或无可用点数），暂不能继续申请，如需继续发送职位申请请联系网站客服进行升级！');location.href='javascript:window.close()';</script>"
		response.end()
	else
		Call PayLog(pmember_login,1,"申请"&comname&"发布的“"&place&"”职位扣点",Group_Pdianshus(2),0)
	end if
else
	Call PayLog(pmember_login,1,"申请"&comname&"发布的“"&place&"”职位",0,0)
end if
rst.addnew
rst("mysend_hireid")=hireid
rst("mysend_comname")=comname
rst("mysend_place")=place
rst("mysend_resumeid")=resumeid
rst("mysend_resumename")=resumename
rst("mysend_pmember")=pmember_login
rst("mysend_cmember")=cmember
rst("mysend_date")=now()
rst.update 
'修改申请的职位数量
if Pmysendnums="" or isnull(Pmysendnums) then
	conn.execute("update JOB_Member set Member_mysendnums=1,Member_activedate='"&now()&"' where member_login='"&pmember_login&"' and Member_typeid=1")
else
	if CheckPFlag("Climits",5)=False Or Group_Plimits(5)=0 then
		conn.execute("update JOB_Member set Member_mysendnums=Member_mysendnums+1,Member_activedate='"&now()&"' where member_login='"&pmember_login&"' and Member_typeid=1")
	else
		conn.execute("update JOB_Member set Member_mysendnums=Member_mysendnums+1,Member_mysendnum=Member_mysendnum-1,Member_activedate='"&now()&"' where member_login='"&pmember_login&"' and Member_typeid=1")
	end if
end if
set rsw=conn.execute("select * from JOB_P_resume where resume_id="&resumeid)
	names=rsw("resume_name")
	sex=rsw("resume_sex")
	birth=rsw("resume_birth")
	edu=rsw("resume_edu")
	rsw.close
set rsw=nothing		
if cmember<>"" then  '如果该职位是企业会员发布的，则存入该会员的“收到的应聘简历”
	sql="select * from job_c_myreceive"
	rs.open sql,conn,3,3
	rs.addnew
	rs("myreceive_resumeid")=resumeid
	rs("myreceive_name")=names
	rs("myreceive_sex")=sex
	rs("myreceive_birth")=birth
	rs("myreceive_edu")=edu
	rs("myreceive_hireid")=hireid
	rs("myreceive_place")=place
	rs("myreceive_pmember")=pmember_login
	rs("myreceive_cmember")=cmember
	rs("myreceive_read")=0
	rs("myreceive_content")=letter
	rs("myreceive_date")=now()
	rs.update 
	rs.close
set rse=conn.execute("select Member_email from JOB_Member where Member_login='"&cmember&"' and Member_typeid=2")
	email=rse(0)
set rse=nothing
'发送应聘邮件通知
mail_tit=CreateHTMLReplace(LoadMailTemp("re_send",0))
mail_con=CreateHTMLReplace(LoadMailTemp("re_send",1))
mail_tit=replace(mail_tit,"{$FR_应聘者名称}",names)
mail_tit=replace(mail_tit,"{$FR_职位名称}",place)
mail_con=replace(mail_con,"{$FR_会员用户名}",cmember)
mail_con=replace(mail_con,"{$FR_会员名称}",comname)
mail_con=replace(mail_con,"{$FR_职位名称}",place)
mail_con=replace(mail_con,"{$FR_应聘者名称}",names)
mail_con=replace(mail_con,"{$FR_求职信内容}",letter)
mail_con=replace(mail_con,"{$FR_简历地址}",""&SiteUrl&InstallDir&"person/cnresume_view.asp?rid="&resumeid&"")
Call SendMail(email,mail_tit,mail_con)
end if
'修改职位的收到简历数
conn.execute ("update job_c_hire set hire_receiveresume=hire_receiveresume+1 where hire_id="&hireid)
t=t+1 '记录成功数
Call IncomeIntegral(pmember_login,1,-Group_Pintegrals(2))
end if
rst.close
next
set rs=nothing
set rst=nothing
response.write("<script language=javascript>alert('成功发送"&t&"个职位申请，"&ubound(hire)+1-t&"个重复！');location.href='javascript:window.close()';</script>")
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 type="text/javascript" src="../js/input.js"></script>
<script language="JavaScript">
<!--
function CoverLetter_Click(letterID,LetterCount)
{
 for (var i=1;i<=LetterCount;i++)
 {
  if (i == letterID)  //当前项
   {
     document.all["Lable"+i.toString()].style.fontWeight = "bold";
     document.all["TDLetter"+i.toString()].style.backgroundImage = "url('../images/button_01.gif')";
    }
  else //其他
   {                 
    document.all["Lable"+i.toString()].style.fontWeight = "normal";
    document.all["TDLetter"+i.toString()].style.backgroundImage = "url('../images/button_02.gif')";
   }
   document.all.letter.value = document.all["Hidden"+letterID].value.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,"\"").replace(/&amp;/g,"&");
  }
}
function reset_resume()
{
 for(i=0;i<document.sendresume.elements.length;i++) 
	{
		if (document.sendresume.elements[i].name=="resumelang")
		{		
			if (document.sendresume.elements[i].checked==true) 
			{
				document.sendresume.elements[i].checked=false;
			}
		}
	}
}
function Juge()
{
 var flag=false; //是否有选择
 for(i=0;i<document.sendresume.elements.length;i++) 
	{
		if (document.sendresume.elements[i].name=="resumeid")
		{		
			if (document.sendresume.elements[i].checked==true) 
			{
				flag=true;
				break;
			}
		}
	}
	if (flag==false)
	{
		alert("请选择一份简历！");
		return false;
	}
 var flag=false; //是否有选择
}
//-->
</script></head>
<body>
<div class="memmenul">
<div class="leftmenutit"><span>申请职位</span></div>
<TABLE cellSpacing=2 cellPadding=5 width=98% align=center border=0>
          <TBODY>
                      <TR> 
                        
              <TD><IMG height=11 hspace=4  src="../images/biao_01.gif" width=12  align=absMiddle><SPAN class=tit><STRONG style="font-size:14px">您要申请的职位如下：</STRONG></SPAN></TD>
                        <TD>&nbsp;</TD>
                      </TR>
                    </TBODY>
                </TABLE>
                  
        <TABLE width=98% height="36" 
                  border=0 align=center cellPadding=3 cellSpacing=3>
          <TBODY>
            <TR bgcolor="#0099CC"> 
              <TD height="23" align=center><font color="#FFFFFF"><STRONG style="font-size:14px">招聘职位</STRONG></font></TD>
              <TD align=center><font color="#FFFFFF"><STRONG style="font-size:14px">公司名称</STRONG></font></TD>
            </TR>
            <% action=CheckStr(trim(request("action")))
 checks=trim(request("checks"))
 set rst=server.createobject("adodb.recordset")
					select case action
					 case "myfavorite"  '职位收藏夹中触发
					  myfavorite=split(checks,",")
                      for i=0 to ubound(myfavorite)
                       id=trim(myfavorite(i))
					   sql="select * from job_p_myfavorite where myfavorite_id="&id
					   rst.open sql,conn,1,1
					   response.write "<TR>"               
					   response.write "<TD align=center><a href='../company/hire.asp?hireid="&rst("myfavorite_hireid")&"' target='_blank'>"&rst("myfavorite_place")&"</a></TD>"
					   response.write "<TD align=center>"&rst("myfavorite_comname")&"</TD>"
					   response.write "</TR>"
					   rst.close
					  next
					 case "hire"  '职位信息触发
					  hire=split(checks,",")
                      for i=0 to ubound(hire)
                       id=trim(hire(i))
					   sql="select hire_id,hire_comname,hire_place from job_c_hire where hire_id="&id
					   rst.open sql,conn,1,1
					   response.write "<TR>"
					   response.write "<TD align=center><a href='../company/hire.asp?hireid="&rst("hire_id")&"' target='_blank'>"&rst("hire_place")&"</a></TD>"
					   response.write "<TD align=center>"&rst("hire_comname")&"</TD>"
					   response.write "</TR>"
					   rst.close
					  next
					end select
					%>
          </TBODY>
        </TABLE>
        <br>
		<%
		sql="select * from job_p_resume where resume_pmember='"&pmember_login&"' order by resume_announcedate desc"
		rst.open sql,conn,1,1
		if rst.eof then
		%> 
        <TABLE cellSpacing=2 cellPadding=3 width=98% align=center 
              border=0>
          <TBODY>
            <TR> 
              <TD height="33" bgcolor="#f7f7f7">您还没有填写过简历，请先填写完整的简历再提交申请。 
                <INPUT onClick="javascript:location.href='person_addresume.asp'" type=button value=马上填写简历 name=AddCV>
              </TD>
            </TR>
          </TBODY>
        </TABLE>
		<%else%>
		<form name="sendresume" method="POST" action="person_resumesend.asp?step=2&action=<%=action%>&checks=<%=checks%>" onSubmit="return Juge()">
        <TABLE width="98%" border=0 align=center>
          <TBODY>
            <TR> 
              <TD>
				<%
				for i=1 to rst.recordcount
				%>
                <TABLE cellSpacing=2 cellPadding=3 width=98% align=center border=0>
                  <TBODY>
                    <TR> 
                        
                      <TD width="395" bgColor=#f7f7f7 class=border06> 
                        <input onClick='reset_resume()' type=radio value='<%=rst("resume_id")%>,<%=rst("resume_title")%>' name=resumeid <%if rst("resume_personinfo")<>1 or rst("resume_education")<>1 or rst("resume_train")<>1 or rst("resume_lang")<>1 or rst("resume_work")<>1 or rst("resume_careerwill")<>1 then%>disabled="disabled"<%end if%>>
                          <%=rst("resume_title")%> </TD>
                      <TD class=border07 width=499 bgColor=#ffffff> 
					  <%
					  if rst("resume_chinese")=1 then
					  %>
                        <TABLE cellSpacing=1 cellPadding=3 width="100%" border=0>
                          <TBODY>
                            <TR> 
                              <TD bgcolor="#f7f7f7" class=border01>
                                中文 
                                <%if rst("resume_personinfo")<>1 or rst("resume_education")<>1 or rst("resume_train")<>1 or rst("resume_lang")<>1 or rst("resume_work")<>1 or rst("resume_careerwill")<>1 then%>
                              <STRONG>-&nbsp;<SPAN class=tit>不完整</SPAN></STRONG><span class="tdcolor">(填写完整后方可使用)</span>
                              <%end if%> </TD>
                              <TD class=border01 align=middle width=40 bgColor=#f7f7f7> 
                                <A href="cnpreview.asp?rid=<%=rst("resume_id")%>" target=_blank>预览</A> 
                              </TD>
                              <TD class=border02 align=middle width=40  bgColor=#f7f7f7> 
                                <A href="person_addresume.asp?rid=<%=rst("resume_id")%>">修改</A> 
                              </TD>
                            </TR>
                          </TBODY>
                        </TABLE>
						<%end if%>						
					  </TD>
                    </TR>
                  </TBODY>
                </TABLE>
                <%
				rst.movenext
				if not rst.eof then
				 response.write "<br>"
				end if
				next
				rst.close
				%>
              </TD>
            </TR>
          </TBODY>
        </TABLE> 
        <br>
        <TABLE width="98%" border=0 align=center id=TabShowLetter>
          <TBODY>
            <TR> 
              <TD> <TABLE cellSpacing=0 cellPadding=3 width=98% align=center 
                  border=0>
                  <TBODY>
                    <TR> 
                      <TD><IMG height=11 hspace=4 src="../images/biao_01.gif" width=12 align=absMiddle><SPAN class=tit><STRONG style="font-size:14px">求职信：</STRONG></SPAN></TD>
                    </TR>
                    <TR> 
                      <TD></TD>
                    </TR>
                  </TBODY>
                </TABLE>
                <TABLE cellSpacing=2 cellPadding=3 width=98% align=center border=0>
                  <TBODY>
                    <TR> 
                      <TD height="27" bgcolor="#efefef"> 
                        <%
					   sql="select letter_title,letter_content from job_p_letter where letter_pmember='"&pmember_login&"' order by letter_id"
		               rst.open sql,conn,1,1
					   if rst.eof then
						response.write "您可以在下面写入求职信，它将附在简历上一起发出。"
					  else
					   response.write "<TABLE cellSpacing=0 cellPadding=0 align=left border=0><TBODY><TR>"
					   for i=1 to rst.recordcount
					    response.write "<INPUT type='hidden' value='"&rst("letter_content")&"' name='Hidden"&i&"'><TD id='TDLetter"&i&"' style=""WIDTH: 92px; CURSOR: hand; HEIGHT: 20px; FONT-WEIGHT:normal; BACKGROUND-IMAGE:url('../images/button_02.gif');"" align='middle' onclick='JavaScript: CoverLetter_Click("&i&","&rst.recordcount&");'><SPAN id='Lable"&i&"'>"&rst("letter_title")&"</SPAN></TD>"
					   rst.movenext
					   if not rst.eof then
					    response.write "<TD style='WIDTH: 4px; HEIGHT: 20px'></TD>"
					   end if
					   next
					   response.write "</TR></TBODY></TABLE>"
					  end if
					  rst.close
					  %>
                      </TD>
                    </TR><TABLE cellSpacing=2 cellPadding=5 width=98% align=center 
                  border=0>
                  <TBODY>
                    <TR> 
                      <TD><IMG height=11 hspace=4 src="../images/biao_01.gif" width=12 align=absMiddle><SPAN class=tit><STRONG style="font-size:14px">选择简历：</STRONG></SPAN></TD>
                    </TR>
                    <TR> 
                      <TD height="27" bgcolor="#efefef">请选择一份适合该职位的完整简历提交！ 
                      </TD>
                    </TR>
                  </TBODY>
                </TABLE>
                </TABLE>
                <TABLE cellSpacing=2 cellPadding=3 width=98% align=center border=0>
                  <TBODY>
                    <TR> 
                      <TD height="74" align=middle bgcolor="#f9f9f9"> 
                        <TEXTAREA name="letter" cols=90 rows=4 id="letter"></TEXTAREA>
                      </TD>
                  </TBODY>
                </TABLE></TD>
            </TR>
          </TBODY>
        </TABLE>
        <TABLE cellSpacing=0 cellPadding=3 width=98% align=center border=0>
          <TBODY>
            <TR> 
              <TD align=center><BR>
                  <INPUT name=btnApply type=submit class="inputa2" id=btnApply value=提交申请>                  <BR>
                <BR></TD>
            </TR>
          </TBODY>
        </TABLE>
		</form>
		<%
		end if
		set rst=nothing
		%>
</div>
<%conn.close:set conn=nothing%>