<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../conn/conn.asp"-->
<!--#include file="../inc/Commoncode.asp"-->
<%SQLin
link="company_services.asp"%>
<!--#include file="checkcmember.asp" -->
<!--#include file="flagandexpend.asp"-->
<!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>
<script src="../js/main.js" language="javascript"></script>
<link href="../member/css.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="memmenul">
<%step=trim(request("step"))
Select Case step
	Case "apply"
		Call apply()
	Case Else
		Call main()
End Select
Sub apply()
if request("Order_id")<>"" and IsNumeric(request("Order_id")) then
Order_id=trim(request("Order_id"))
else
response.write "<script language=javascript>alert('参数错误！');location.href='javascript:history.back()';</script>"
response.end()
end if
if request("Order_groupid")<>"" and IsNumeric(request("Order_groupid")) then
Order_groupid=trim(request("Order_groupid"))
else
response.write "<script language=javascript>alert('参数错误！');location.href='javascript:history.back()';</script>"
response.end()
end if
set rs=server.createobject("ADODB.Recordset")
sql="select * from JOB_orderservice where Order_id="&Order_id&" and Order_groupid="&Order_groupid&" and Order_member='"&cmember_login&"'"
rs.open sql,conn,1,1
if rs.eof then
rs.close
set rs=nothing
response.write "<script language=javascript>alert('服务申请不存在！');location.href='javascript:history.back()';</script>"
response.end()
else
	if rs("Order_result")<>"" then
	Select Case rs("Order_result")
	Case 3:response.write "<script language=javascript>alert('该申请已开通过了，本次操作不成功！');location.href='javascript:history.back()';</script>":response.end()
	Case 4:response.write "<script language=javascript>alert('该申请已过期，本次操作不成功！');location.href='javascript:history.back()';</script>":response.end()
	Case 5:response.write "<script language=javascript>alert('该申请已作废，本次操作不成功！');location.href='javascript:history.back()';</script>":response.end()
	End Select
	end if
	set rst=conn.execute("select * from JOB_Group where Group_membertype=2 and Group_id="&Order_groupid&"")
	if not rst.eof then
	Group_Climit=rst("Group_Climit")
	Group_Climits=split(Group_Climit,",")
	Group_outlay=rst("Group_outlay")
	Group_term=rst("Group_term")
	Group_unit=rst("Group_unit")
	if Cmbalance<Group_outlay then
	rs.close:set rs=nothing
	set rst=nothing
	response.write "<script language=javascript>alert('余额不足，开通失败！');location.href='javascript:history.back()';</script>"
	response.end()
	end if
	Member_startdate=date()
	Select Case Group_unit
		case "日"
		Member_enddate=DateAdd("d",Group_term,Member_startdate)
		case "月"
		Member_enddate=DateAdd("m",Group_term,Member_startdate)
		case "季"
		Member_enddate=DateAdd("q",Group_term,Member_startdate)
		case "年"
		Member_enddate=DateAdd("yyyy",Group_term,Member_startdate)
	end select
	Call PayMoney(cmember_login,2,Group_outlay) '扣费操作
	Call PayLog(cmember_login,2,"会员升级",Group_outlay,0) '创建日志
	conn.execute("update JOB_member set Member_groupid="&Order_groupid&",Member_hirenum="&Group_Climits(1)&",Member_expertnum="&Group_Climits(3)&",Member_interviewnum="&Group_Climits(5)&",Member_recyclenum="&Group_Climits(7)&",Member_contactnum="&Group_Climits(9)&",Member_smsnum="&Group_Climits(13)&",member_enddate='"&Member_enddate&"' where member_login='"&cmember_login&"' and member_typeid=2")
	conn.execute("update JOB_orderservice set Order_result=3 where Order_member='"&cmember_login&"' and Order_id="&Order_id&"")
	response.write "<script language=javascript>alert('支付成功！');location.href='../member/main.asp';</script>"
	response.end()
	else
	response.write "<script language=javascript>alert('参数错误！');location.href='javascript:history.back()';</script>"
	response.end()
	end if
	set rst=nothing
end if
rs.close
set rs=nothing
End Sub
%>
<%Sub main()%>
<div class="leftmenutit"><span>已申请的服务</span></div>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" class="mtable">
<%set rs=server.createobject("ADODB.Recordset")
sql="select * from JOB_orderservice where Order_member='"&cmember_login&"' order by Order_id"
rs.open sql,conn,1,1
if rs.eof then%>
  <tr>
    <td colspan="8">您还没有申请相关的服务，<a href="company_service.asp" target="main">现在去了解一下</a></td>
    </tr>
<%else%>
 <tr>
    <td colspan="8" class="tdcolor">您申请的相关招聘服务</td>
    </tr>
  <tr>
    <td width="12%" align="center"><strong>产品</strong></td>
    <td width="13%" align="center"><strong>可发布职位数</strong></td>
    <td width="12%" align="center"><strong>可下载简历数</strong></td>
    <td width="14%" align="center"><strong>面试邀请数</strong></td>
    <td width="14%" align="center"><strong>人才库容量</strong></td>
    <td width="12%" align="center"><strong>服务期限</strong></td>
    <td width="15%" align="center"><strong>合同编号</strong></td>
    <td width="8%" align="center"><strong>状态</strong></td>
  </tr>
<%i=0
do while not rs.eof
i=i+1
set rst=conn.execute("select * from JOB_Group where Group_id="&rs("Order_groupid")&"")
if not rst.eof then
if rs("Order_result")<>"" then
Select Case rs("Order_result")
Case 0:Order_result="申请中"
Case 1:Order_result="处理中"
Case 2:Order_result="等待付款"
Case 3:Order_result="成功"
Case 4:Order_result="过期"
Case 5:Order_result="作废"
End Select
end if
Group_Climits=split(rst("Group_Climit"),",")
%>
  <tr>
    <td align="left"><input type="radio" name="Groupid" value="<%=rst("Group_id")%>" disabled="disabled" /><%=rst("Group_name")%></td>
    <td align="center"><%if Group_Climits(0)=1 then%><%if Group_Climits(1)=0 then%>无限制<%else%><%=Group_Climits(1)%><%end if%><%else%>0<%end if%></td>
    <td align="center"><%if Group_Climits(8)=1 then%><%if Group_Climits(9)=0 then%>无限制<%else%><%=Group_Climits(9)%><%end if%><%else%>0<%end if%></td>
    <td align="center"><%if Group_Climits(4)=1 then%><%if Group_Climits(5)=0 then%>无限制<%else%><%=Group_Climits(5)%><%end if%><%else%>0<%end if%></td>
    <td align="center"><%if Group_Climits(2)=1 then%><%if Group_Climits(3)=0 then%>无限制<%else%><%=Group_Climits(3)%><%end if%><%else%>0<%end if%></td>
    <td align="center"><%=rst("Group_term")%><%=rst("Group_unit")%></td>
    <td align="center"><%=rs("Order_pactnum")%></td>
    <td align="center"><%=Order_result%></td>
  </tr>
  <%if rs("Order_result")<3 then%><tr>
    <td colspan="4" align="left"><span class="tdcolor">客服回复：</span><%if rs("Order_revert")<>"" then%><%=rs("Order_revert")%><%else%>尚未回复！<%end if%></td>
    <td colspan="4" align="left">该服务需要支付<%=rst("Group_outlay")%>元，当前余额：<%=Cmbalance%>元，<%if rst("Group_outlay")>Cmbalance then%>余额不足。<%else%><a href="#" onclick="if (confirm('确定要开通该服务吗？系统将自动进行扣费并开通服务！'))location.href=' ?step=apply&Order_id=<%=rs("Order_id")%>&Order_groupid=<%=rs("Order_groupid")%>'">立即开通服务</a><%end if%> <input name="" type="button" onclick="location.href='../onlinepay/payindex.asp'" value="充值" class="inputs" /></td>
    </tr>
	<%end if%>
<%end if
rst.close
set rst=nothing
rs.movenext
loop
end if
rs.close
set rs=nothing
%>
</table>
<%End Sub%>
</div>
<%CloseConn%>