<!--#include file="../../conn/conn.asp" -->
<!--#include file="../../Inc/Commoncode.asp" -->
<!--#include file="../checkvalid.asp" -->
<%
If Not FRAdminLevel(303) Then
	Call ErrorMsg()
End If
keyword=trim(request("keyword"))
segment=trim(request("segment"))
operate=trim(request("operate"))
group=trim(request("group"))
page=trim(request("page"))
member=trim(request("member"))
%>
<%
if trim(request("step"))="2" then
  member_id=trim(request("id"))
  member_commandstartdate=trim(request("startdate"))
  member_commandenddate=trim(request("enddate")) 
  member=request("member")
	 if request("free")=0 then
	   if member<>"" then
 		pp=ubound(split(member,",")) 
		member=split(member,",")
			for v=0 to pp
			member1=member(v)
      conn.execute("update job_member set member_command=1,member_commandstartdate='"&member_commandstartdate&"',member_commandenddate='"&member_commandenddate&"' where member_login='"&member1&"'")
	  		next
		end if
	  else
	  	if member<>"" then
			prices2=request("consumenums")
			Dim result
			pp=ubound(split(member,","))
			member=split(member,",")		
			for v=0 to pp
				member1=member(v)
			if Pay_ItemPoint(member1,2,prices2) then
				conn.execute("update job_member set member_command=1,member_commandstartdate='"&member_commandstartdate&"',member_commandenddate='"&member_commandenddate&"' where member_login='"&member1&"'")
				Call PayLog(member1,2,"名企推荐",prices2,1)
	 			if result<>"" then
					result=result&",true"
				else
					result=result&"true"
				end if
			else
				if result<>"" then
					result=result&",false"
				else
					result=result&"false"
				end if
			end if  
			next
		end if
		call maderesult(request("member"),result)
	   response.End()
	end if
	 response.Redirect "cmember_searchlist.asp?segment="&segment&"&keyword="&keyword&"&operate="&operate&"&group="&group&"&page="&page&""
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>
<script type="text/javascript" src="../inc/Admin.js"></script><script language="JavaScript">
<!--
function IsDate(DateString , Dilimeter) 
{ 
if (DateString==null) return false; 
if (Dilimeter=='' || Dilimeter==null) 
Dilimeter = '-'; 
var tempy=''; 
var tempm=''; 
var tempd=''; 
var tempArray; 
if (DateString.length<8 && DateString.length>10) 
return false;  
tempArray = DateString.split(Dilimeter); 
if (tempArray.length!=3) 
return false; 
if (tempArray[0].length==4) 
{ 
tempy = tempArray[0]; 
tempd = tempArray[2]; 
} 
else 
{ 
tempy = tempArray[2]; 
tempd = tempArray[1]; 
} 
tempm = tempArray[1]; 
var tDateString = tempy + '/'+tempm + '/'+tempd+' 8:0:0';//加八小时是因为我们处于东八区 
var tempDate = new Date(tDateString); 
if (isNaN(tempDate)) 
return false; 
if (((tempDate.getUTCFullYear()).toString()==tempy) && (tempDate.getMonth()==parseInt(tempm)-1) && (tempDate.getDate()==parseInt(tempd))) 
{ 
return true; 
} 
else 
{ 
return false; 
} 
} 
function Juge(theForm)
{
  if (!IsDate(theForm.startdate.value == ""))
  {
    alert("请正确填写开始时间!");
    theForm.startdate.focus();
    return (false);
  }
  if (!IsDate(theForm.enddate.value == ""))
  {
    alert("请正确填写结束时间!");
    theForm.enddate.focus();
    return (false);
  }
}
function show1()
{
	consume.style.display="";
}
function show2()
{
	consume.style.display="none";
}
//-->
</script><style type="text/css">
<!--
.STYLE2 {	color: #FF0000;
	font-weight: bold;
}
-->
 </style>
</head>

<body>
    
  <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="tableBorder" >
    <form name="form1" method="post" action="company_command.asp?step=2&segment=<%=segment%>&keyword=<%=keyword%>&operate=<%=operate%>&group=<%=group%>&page=<%=page%>" onSubmit="return Juge(this)">
	<tr>	
		<th height=25 colspan="4" class="tableHeaderText">名企招聘推荐</th>
	</tr>
	<tr> 
        <td height=28 colSpan=4 align=left ><FONT color=#333333>（注：带</FONT><FONT color=#ff6600>＊</FONT><FONT color=#b00000><FONT color=#333333>号为必填项）</FONT></FONT>         <span class="STYLE2">警告</span>：如企业被推荐过，再次推荐将会更新企业推荐时间。且此操作为不可逆操作！</td>
      </tr>
	   <%
		dim member1:member1=""
		if member<>"" then			
				member=replace(replace(member,",","','")," ","")
				set rs=server.CreateObject("adodb.recordset")
				sql="select * from job_member where member_login in ('"&member&"') order by member_command desc,member_id desc"
				rs.open sql,conn,1,1
				v=0
				do while not rs.eof		
				v=v+1		
				startdate=rs("member_commandstartdate")
				enddate=rs("member_commandenddate")								
				if member1<>"" then
					member1=member1&","&rs("member_login")
				else 
					member1=rs("member_login")
				end if
		%>
      <tr > 
        <td width="15%" height="30" align="right">企业名称：</td>
        <td width="36%">
		<input name="comname" type="text" id="comname" size="40" maxlength="50" value="<%=rs("member_name")%>" disabled></td>
        <td width="15%" align="right"><%
		if rs("member_commandenddate")<date() and rs("member_command")=1 then
		response.Write "(<font color=red>已过期</font>)"
		elseif  rs("member_commandenddate")>date() and rs("member_command")=1 then 
		response.Write "(<font color=red>已推荐</font>)" 
		end if
		%>企业帐户：</td>
        <td width="34%" align="left"><input name="comname2" type="text" id="comname2" size="20" maxlength="50" value="<%=rs("member_login")%>" disabled></td>
      </tr>
	  <%
	  	rs.movenext
		loop
	  end if
	  %>
	   <input name="member" type="hidden" value="<%=member1%>">
	  <%if v<>1 then
	  %>
	  <tr> 
        <td height="30" align="right">设置推荐时限：</td>
        <td colspan="3">	<input name="startdate" type="text" size="10" id=startdate value="<%=date()%>">
          <img src="../images/calendar_bnt.gif" style="cursor:hand;" align="absmiddle" onClick="fPopUpCalendarDlg(startdate);return false" WIDTH="34" HEIGHT="21">       
         &nbsp;&nbsp; 至 
             <%enddate1=dateadd("d",30,date())%>
	&nbsp;	<input name="enddate" type="text" size="10" id=enddate value="<%=enddate1%>"><img src="../images/calendar_bnt.gif" style="cursor:hand;" align="absmiddle" onClick="fPopUpCalendarDlg(enddate);return false" WIDTH="34" HEIGHT="21">    		  
	    <font color=#ff6600>＊</font></td>
      </tr>
	  <%else%>
      <tr > 
        <td height="30" align="right"><%  if startdate&""="" or enddate&""="" then
				response.Write "设置推荐时限："
			else
				response.Write "本公司推荐时限："
			end if
		%></td>
        <td colspan="3">	<input name="startdate" type="text" size="10" id=startdate value="<%if startdate&""="" then
		   response.Write date()
		   else
		   response.Write startdate
		   end if		
		%>">
          <img src="../images/calendar_bnt.gif" style="cursor:hand;" align="absmiddle" onClick="fPopUpCalendarDlg(startdate);return false" WIDTH="34" HEIGHT="21">       
         &nbsp;&nbsp; 至 
            <%enddate1=dateadd("d",PayItem(3,1),date())%>
	&nbsp;	<input name="enddate" type="text" size="10" id=enddate value="<%
		if enddate&""="" then 
		response.Write enddate1
		else 
		response.Write enddate
		end if
		%>"><img src="../images/calendar_bnt.gif" style="cursor:hand;" align="absmiddle" onClick="fPopUpCalendarDlg(enddate);return false" WIDTH="34" HEIGHT="21">    		  
	    <font color=#ff6600>＊</font></td>
      </tr>
	  <%end if%>
      <tr > 
        <td height="30">　</td>
        <td colspan="3"><input name="free" type="radio" class="checkbox" onClick="show1()" value="1">
是
  <input name="free" type="radio" class="checkbox" onClick="show2()" value="0" checked>
  否（此操作是否扣费）　 </td>
      </tr>
      <tr id="consume" style="display:none">
        <td height="30" align="right">扣除点数：</td>
        <td colspan="3"><input name="consumenums" type="text" size="8" value="<%=PayItem(3,0)%>"></td>
      </tr>
      <tr > 
        <td height="30" colspan="4" align="center">    
			<input name="Submit" type="submit" class="inputs" value="提 交">
            &nbsp;
            <input name="Submit" type="reset" class="inputs" value="重 置">
			&nbsp;
            <input name="Submit" type="button" class="inputs" onClick="window.location='cmember_searchlist.asp?segment=<%=segment%>&keyword=<%=keyword%>&operate=<%=operate%>&group=<%=group%>&page=<%=page%>';" value="返 回">        </td>
      </tr>
    </form>
</table>
</body>
</html>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
sub maderesult(member,result)
	pp=ubound(split(member,",")) 
	member=split(member,",")
	result=split(result,",")
%>

<html>
<head>
<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><title>操作结果</title>
</head>

<body>
<table cellpadding=2 cellspacing=1 border=0 width=400 class=tableBorder align=center><TR>
  <TH class=tableHeaderText colSpan=2 height=25>推荐名企结果</TH>
<TR><tr>
  <td height=85 valign=top class=huiby><table width="100%" border="0" cellpadding="2" cellspacing="1">
      <tr>
        <td align="center">企业名称</td>
        <td align="center">帐号</td>
        <td align="center">操作结果</td>
        <td align="center">失败原因</td>
      </tr>
	 <%
	 for v=0 to pp
		member1=member(v)
		result1=result(v)
	 %>
	 <tr>
        <td align="center"><%
		dim company_name
		set rsw=conn.execute("select * from job_member where member_login='"&replace(member1," ","")&"'")
		if not rsw.eof then
		member_name=rsw("member_name")
		end if
		rsw.close
		set rsw=nothing
		response.Write member_name
		%>
		</td>
        <td align="center"><%=member1%></td>
        <td align="center">
		<%if result1="true" then
			response.Write "成功"
		  else
		  	response.Write "<font color=red>失败</font>"
		  end if
		%>
		</td>
        <td align="center">
		<%if result1="false" then
		  	response.Write "<strong>点数不够</strong>"
		  end if%>　</td>
      </tr>
	  <%next%>
    </table></td>
</tr><tr align=center><td height=30 class=amrow><a href='cmember_searchlist.asp?segment=<%=segment%>&keyword=<%=keyword%>&operate=<%=operate%>&group=<%=group%>&page=<%=page%>'>&lt;&lt; 返回</a></td>
</tr></table>
<!--#include file="../inc/copy.asp" -->
</body>
</html>
<%
end sub
%>

