<!--#include file="../../conn/conn.asp" -->
<!--#include file="../../Inc/Commoncode.asp" -->
<!--#include file="../checkvalid.asp" -->
<%
sUploadDir=UpFilesPath("Company")
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_logostartdate=trim(request("startdate"))
  member_logoenddate=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_logocommand=1,member_logostartdate='"&member_logostartdate&"',member_logoenddate='"&member_logoenddate&"' 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_logocommand=1,member_logostartdate='"&member_logostartdate&"',member_logoenddate='"&member_logoenddate&"' where member_login='"&member1&"'")
				Call PayLog(member1,2,"推荐Logo",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>推荐企业Logo</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 >
  <tr>
    <th height=25 class="tableHeaderText" colspan="4">推荐企业Logo</th>
  </tr>
  <form name="form1" method="post" action="company_logo.asp?step=2&segment=<%=segment%>&keyword=<%=keyword%>&operate=<%=operate%>&group=<%=group%>&page=<%=page%>" onSubmit="return Juge(this)">
    <tr bgcolor="#efefef">
      <td height=25 colspan=4 align=left><font color=#333333>（注：带</font><font color=#ff6600>＊</font><font color=#b00000><font color=#333333>号为必填项）</font></font> <span class="STYLE2">警告</span>：如企业LOGO被推荐过，再次推荐将会更新企业推荐时间。且此操作为不可逆操作！</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&"') and member_logo is not null order by member_logocommand desc,member_id desc"
				rs.open sql,conn,1,1
				v=0
				do while not rs.eof		
				v=v+1		
				startdate=rs("member_logostartdate")
				enddate=rs("member_logoenddate")								
				if member1<>"" then
					member1=member1&","&rs("member_login")
				else 
					member1=rs("member_login")
				end if
		%>
    <tr bgcolor="#efefef">
      <td width="18%" height="25" align="right">会员登录帐号：</td>
      <td width="41%"><input name="company_cmember" type="text" id="company_cmember" size="20" maxlength="50" value="<%=rs("member_login")%>" disabled></td>
      <td width="16%" align="right"><%
		if rs("member_logoenddate")<date() and rs("member_logocommand")=1 then
		response.Write "(<font color=red>已过期</font>)"
		elseif  rs("member_logoenddate")>date() and rs("member_logocommand")=1 then 
		response.Write "(<font color=red>已推荐</font>)" 
		end if
		%>
        企业LOGO：</td>
      <td width="25%" rowspan="2" align="center" valign="top"><img height=40 src="<%=sUploadDir&rs("member_logo")%>" width=100 border=0></td>
    </tr>
    <tr bgcolor="#efefef">
      <td height="25" align="right">企业名称：</td>
      <td colspan="2"><input name="keyword2" type="text" id="keyword2" size="40" maxlength="50" value="<%=rs("member_name")%>" disabled></td>
    </tr>
    <%
				rs.movenext
				loop
		end if
	   %>
    <input name="member" type="hidden" value="<%=member1%>">
    <%if v<>1 then%>
    <tr bgcolor="#efefef">
      <td height="25" align="right">设置logo推荐时限：</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; 至    
        &nbsp;
                   <%
		   key_enddate=dateadd("d",PayItem(2,1),date())%>
                   <input name="enddate" type="text" size="10" id=enddate value="<%=key_enddate%>">
        <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 bgcolor="#efefef">
      <td height="25" align="right"><%  if startdate&""="" or enddate&""="" then
				response.Write "设置logo推荐时限："
			else
				response.Write "本公司logo推荐时限："
			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;至&nbsp;
          <%enddate1=dateadd("d",PayItem(2,1),date())%>
          <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 bgcolor="#efefef">
      <td height="25">&nbsp;</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="25" align="right">扣除点数：</td>
      <td colspan="3"><input name="consumenums" type="text" size="8" value="<%=PayItem(2,0)%>"></td>
    </tr>
    <tr bgcolor="#efefef">
      <td height="25" colspan="4" align="center" class="forumRow">
	  <%if rs.recordcount<>0 then%><input name="Submit" type="submit" class="inputs" value="提 交">
	  <%end if%>
        &nbsp;
        <input name="Submit" type="reset" class="inputs" id="Submit" value="重 置">
        &nbsp;
        <input name="Submit" type="button" class="inputs" id="Submit" 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>推荐企业LOGO结果</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 member_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%>