<%
ds="../"
%>
<!--#include file="../conn/conn.asp" -->
<!--#include file="../inc/sub.asp"-->
<!--#include file="checkcmember.asp" -->
<%
Dim page,i
Dim totalPut
const MaxPerpage=20
Const strFileName="company_payhire.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.Form("action"))="payhire" Then
	ID=Trim(Request.Form("ID"))
	ID=Replace(ID," ","")
	If ID="" Then
		Response.Write("<script>alert(""请至少选择一项要推荐的职位！"");window.location='company_payhire.asp';</script>")
	Else

		Set rs=Server.CreateObject("ADODB.RecordSet")
		sql="Select * From job_c_hire Where hire_id In("&ID&")"
		rs.Open sql,conn,1,3
		If Not(rs.EOF) Then
			PayNumber=0
			Do While Not rs.EOF
				If Pay_ItemPoint(session("user_name"),2,PayItem(4,0))=True Then
					rs("hire_status")=1
					rs("hire_command")=1
					rs("hire_commandstartdate")=Date()
					rs("hire_commandenddate")=DateValue(Date()+PayItem(4,1))
					rs.Update
					Call PayLog(session("user_name"),2,"职位推荐",PayItem(4,0),0)
					PayNumber=PayNumber+1
				End If
				rs.MoveNext
			Loop
			Response.Write("<script>alert(""成功购买了"&PayNumber&"条推荐职位！"");window.location='company_manager.asp';</script>")
		End If
		rs.Close
		Set rs=Nothing
	End If
End If
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>企业招聘管理中心-<%=SiteName%></title>
<LINK href="../css/css.css" rel=stylesheet>
</head>
<body>
<!--#include file="../inc/head.asp"-->
<br class="br">
<table width="778" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="200" valign="top"><!--#include file="menu.asp" --></td>
    <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="28" background="../images/companyleftregbg.gif">&nbsp;<font class=font-14><b><img src="../images/arrow_01.gif" width="11" height="11" align="absmiddle"> </b></font><span class="bl_14"><b>您的企业名称是</b></span><font class=font-14><b>：</b></font><font 
            class=font-title color="#FF6600"><%=session("user_cname")%></font></td>
        <td width="122" background="../images/companyleftregbg.gif"><font 
            class=font-title color="#FF6600"><a 
            style="CURSOR: hand" 
            href="logout.asp"><img src="../images/exit.gif" width=79 
            height=19 border="0"></a></font></td>
      </tr>
    </table>
      <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" class="orange-bar">
        <tr>
          <td width="2%" align="right">&nbsp;</td>
          <td width="97%" class="white14">请选择要推荐的职位</td>
          <td width="1%">&nbsp;</td>
        </tr>
      </table>
<%
Set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from job_c_hire where hire_cmember='"&session("user_name")&"'order by hire_id desc"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
	Response.Write("<br><br><div align=""center"">暂无职位信息！</div><br><br>")
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
%>
      <%Sub MainInfo()%>
      <table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">
        <form name="form1" method="Post" action="company_payhire.asp">
          <tr>
            <td><table width="98%" border="0" align="center" cellpadding="6" cellspacing="0">
                <tr align="center">
                  <td width="8%" height="28" bgcolor="#E7E7E7"><strong>选中</strong></td>
                  <td width="16%" bgcolor="#E7E7E7"><b>部门</b></td>
                  <td width="16%" bgcolor="#E7E7E7"><b>招聘职位</b></td>
                  <td width="10%" bgcolor="#E7E7E7"><b>状态</b></td>
                  <td width="10%" bgcolor="#E7E7E7"><b>浏览次数</b></td>
                  <td width="10%" bgcolor="#E7E7E7"><b>收到简历</b></td>
                  <td bgcolor="#E7E7E7"><b>是否推荐</b></td>
                  <td bgcolor="#E7E7E7"><b>起止日期</b></td>
                </tr>
<%
		do while not rs.eof
%>
                <tr bgcolor="#f7f7f7">
                  <td height="22" align="center"><input name="ID" type="checkbox" value="<%=rs("hire_id")%>"></td>
                  <td align="center"><%=rs("hire_dept")%></td>
                  <td align="center"><%=rs("hire_place")%></td>
                  <td align="center"><%if rs("hire_enddate")<date() then
			           response.write "<font color='#ff0000'>已经过期</font>"
			          else
			           select case rs("hire_status")
			            case "0"
				         response.write "<font color='#cccccc'>等待审核</font>"
				        case "1"
				         response.write "<font color='#008000'>正在招聘</font>"
				        case "2"
				         response.write "<font color='#808080'>暂时屏蔽</font>"
			           end select
			          end if
%></td>
                  <td align="center"><%=rs("hire_visitcount")%></td>
                  <td align="center"><%=rs("hire_receiveresume")%></td>
                  <td align="center"><%if rs("hire_command")=1 and rs("hire_commandenddate")>=date() then%><font color="#0000FF">推荐</font><%else%>否<%end If%></td>
                  <td align="center"><%=year(rs("hire_announcedate"))&"-"&month(rs("hire_announcedate"))&"-"&day(rs("hire_announcedate"))&"~"&rs("hire_enddate")%></td>
                </tr>
<%
		i=i+1
		if i>=MaxPerPage then exit do
		rs.movenext
		loop
%>
            </table>
				<table width="100%" border="0" cellpadding="0" cellspacing="0">
				  <tr>
					<td height="30" align="center"><input name="action" type="hidden" id="action" value="payhire">
					<input name="submit" type="submit" value="购买推荐职位"<%If CheckPoint(session("user_name"),2,PayItem(4,0))<>True Then Response.Write(" disabled")%>></td>
				  </tr>
				</table>
			</td>
          </tr>
        </form>
      </table>
      <%End Sub%>
<%
If totalput>0 Then
	call showpage(strFileName,totalput,MaxPerPage,false,true,"个职位")
End If
%>
    </td>
  </tr>
</table>
<!--#include file="../inc/bottom.asp"-->
</body>
</html>

