<!--#include file="../../conn/conn.asp" -->
<!--#include file="../../Inc/Commoncode.asp" -->
<!--#include file="../../Inc/CommonFunction.asp" -->
<!--#include file="../checkvalid.asp"-->
<%If Not FRAdminLevel(201) Then Call ErrorMsg()
Response.Expires = 0 
Response.CacheControl = "no-cache" 
Response.ExpiresAbsolute = Now() - 1

action=request("action")
select case action
 case "add"
   call add()
 case "modi"
   call modi()
 case "del"
   call del()
end select

sub add()
	price_name=request("price_name")
	price_picture=request("price_picture")
	price_type=request("price_type")
	price_useday=request("price_useday")
	price_value=request("price_value")
	price_content=request("price_content")
	if price_name="" or price_type="" or price_useday="" or price_value="" then
		response.write"<SCRIPT language=JavaScript>alert('请将信息填写完整！');"
		response.write"javascript:history.go(-1)</SCRIPT>"
		response.end
	end if
	sql="insert into job_prices (price_name,price_picture,price_useday,price_value,price_content,price_type) values('"&price_name&"','"&price_picture&"',"&price_useday&","&price_value&",'"&price_content&"','"&price_type&"')"
	conn.execute(sql)
	response.write"<SCRIPT language=JavaScript>alert('添加成功！');"
	response.write"window.location='admin_PayItem.asp';</SCRIPT>"
	response.end
end sub
sub modi()
	id=request("id")
	price_name=request("price_name")
	price_picture=request("price_picture")
	price_type=request("price_type")
	price_useday=request("price_useday")
	price_value=request("price_value")
	price_content=request("price_content")
	if id="" or price_name="" or price_type="" or price_useday="" or price_value="" then
		response.write"<SCRIPT language=JavaScript>alert('请将信息填写完整！');"
		response.write"javascript:history.go(-1)</SCRIPT>"
		response.end
	end if
	sql="update job_prices set price_name='"&price_name&"', price_picture='"&price_picture&"', price_useday="&price_useday&", price_value="&price_value&",price_content='"&price_content&"',price_type="&price_type&" where id="&id
	conn.execute(sql)
	response.write"<SCRIPT language=JavaScript>alert('修改成功！');"
	response.write"window.location='admin_PayItem.asp';</SCRIPT>"
	response.end
end sub

sub del()
	id=request("id")
	sql = "delete from job_prices where id="&id
	conn.execute(sql)
	response.write"<SCRIPT language=JavaScript>alert('删除成功！');"
	response.write"window.location='admin_PayItem.asp';</SCRIPT>"
	response.end
end sub
%>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>自定义消费设定</title>
<link href="../css/style<%=sk%>.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../inc/input.js"></script>
<script language="javascript">
function checkdata()
{
 if (document.formAdd.price_name.value=="")
	{
	  alert("消费项目名称不能为空！")
	  document.formAdd.price_name.focus()
	  return false
	 }
 if (document.formAdd.price_type.value=="")
	{
	  alert("消费项目类型不能为空！")
	  document.formAdd.price_type.focus()
	  return false
	 }
 if (document.formAdd.price_useday.value=="")
	{
	  alert("可用天数不能为空！")
	  document.formAdd.price_useday.focus()
	  return false
	 }
 if (document.formAdd.price_value.value=="")
	{
	  alert("消费值不能为空！")
	  document.formAdd.price_value.focus()
	  return false
	 }
 if (document.formAdd.price_content.value=="")
	{
	  alert("简要说明不能为空！")
	  document.formAdd.price_content.focus()
	  return false
	 }
}
</script>
</head>
<body>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="tableBorder">
  <tr>
    <th height="22" align="center" >用户消费设置</th>
  </tr>
  <tr>
    <td height="20"><b>　管理选项</b>：<a href="Admin_Member.asp">管理首页</a> | <a href="Admin_AddMember.asp">添加用户</a> | <a href="Admin_Member.asp?show=all">用户管理</a>&nbsp;| <a href="Admin_Member.asp?operate=0">审核新用户</a> | <a href="Admin_Paypoint.asp">会员消费记录</a> | <a href="Admin_PayItem.asp">用户消费设置</a>&nbsp;[<a href="javascript:location.reload()">刷新页面</a>]</td>
  </tr>
<form action="Admin_Paypoint.asp" method="post">
    <tr> 
      <td height="28"><div align="left"> 
          &nbsp;&nbsp;&nbsp;&nbsp;关键字： 
          <input name="keyword" type="text" id="keyword" size="10">
          <select name="segment" size="1" id="segment">
            <option value="member">会员帐号</option>
			<option value="point">扣点数目</option>
          </select>
          <select name="membertype" size="1" id="membertype">
            <option value="">-不限-</option>
            <option value="1">个人会员</option>
            <option value="2">企业会员</option>
			<option value="3">培训会员</option>
			<option value="4">院校会员</option>
          </select>
				  <input name="paydate" type="text" size="10" id=funddate value=""><img src="../images/calendar_bnt.gif" style="cursor:hand;" align="absmiddle" onClick="fPopUpCalendarDlg(paydate);return false" WIDTH="34" HEIGHT="21">
          <input name="Submit" type="submit" class="inputs" value="搜索">
      </div></td>
    </tr>
  </form>
</table>

<div align="center">
<table cellspacing="1" cellpadding="4" width="100%" class="tableBorder mt10">
	<tr>
		<th height="25" colspan="8"><b>消费项目管理</b></th>
	</tr>
	<tr class=altbg1 align=center>
	  <td width="5%"><b>编号</b></td>
		<td width="15%"><b>消费项目名称</b></td>
		<td width="12%"><b>消费类型</b></td>
		<td width="10%"><b>可用天数</b></td>
		<td width="10%"><b>消费点数</b></td>
		<td width="30%"><b>简要说明</b></td>
		<td width="8%"><b>修改</b></td>
		<td width="5%"><b>操作</b></td>
	</tr>
    <%
		sql="select * from job_prices"
		set rs=server.CreateObject ("adodb.recordset")
		rs.open sql,conn,1,1
		if rs.eof then
		   response.write "<tr><td colspan=5 class=altbg2 align=center><font color=#ff0000>暂时还没有任何数据，请添加!</a></td></tr>"
		else
		   i=1
		   do while not rs.eof
		     id=rs("id")
		     price_name=rs("price_name")
		     price_picture=rs("price_picture")
		     price_useday=rs("price_useday")
		     price_value=rs("price_value")
			 price_content=rs("price_content")
			 price_type=rs("price_type")
	%>
	  <form name="form<%=id%>" action="admin_PayItem.asp" method="post">
		<input type="hidden" name="action" value="modi">
    <tr class=altbg2>
      <td align="center"><span class="amrow"><input type="hidden" name="id" value="<%=id%>"><%=rs("id")%></span></td>
		<td><span class="amrow">
		  <input name="price_name" type="text" value="<%=price_name%>" size="20">
		</span>		</td>
		<td align="center"><select name="price_type" size="1" id="price_type">
            <option value="1"<%if price_type="1" then response.write" selected"%>>个人简历推荐</option>
            <option value="2"<%if price_type="2" then response.write" selected"%>>个人照片固顶</option>
			<option value="3"<%if price_type="3" then response.write" selected"%>>企业LOGO推荐</option>
			<option value="4"<%if price_type="4" then response.write" selected"%>>企业固顶推荐</option>
            <option value="5"<%if price_type="5" then response.write" selected"%>>职位固顶推荐</option>
        </select></td>
		<td align="center"><input name="price_useday" type="text" id="price_useday" value="<%=price_useday%>" size="5" maxlength="10"></td>
		<td align="center">
			  <input name="price_value" type="text" value="<%=price_value%>" size="5" maxlength="10">
	　　</td>
		<td align="center"><span class="amrow">
		  <input name="price_content" type="text" value="<%=price_content%>" size="35">
		</span></td>
		<td align="center">
		<input type="submit" value="修改保存" name="B4" class="inputs"></td>
		<td align="center">
		<a href="#" onClick="javascript:if (confirm('确认要删除此消费项目吗？')){window.location='admin_PayItem.asp?id=<%=id%>&action=del'}">
		<u><font color="#0000FF">删除</font></u></a></td>
	</tr>
   </form>
		<%
		   rs.movenext
		   i=i+1
		   loop
		end if
		rs.close
		set rs=nothing
		%>
</table>
</div>
<div align="center">
<table cellspacing="1" cellpadding="4" width="100%" class="tableBorder mt10">
<form action="admin_PayItem.asp" method="post" name="formAdd" onSubmit="return checkdata();">
<input type="hidden" name="action" value="add">
	<tr>
		<th height="25" colspan="2"><b>添加自定义消费项目</b></th>
	</tr>
	<tr class=altbg1 align=center>
		<td class="altbg1" align="right">
		<p>消费项目名称：</td>
		<td class="altbg2" align="left">
		<input type="text" name="price_name" size="30"></td>
	</tr>
	<tr class=altbg1 align=center>
	  <td class="altbg1" align="right">项目图片：</td>
	  <td class="altbg2" align="left"><select name="price_type" size="1" id="price_type">
            <option value="1">个人简历推荐</option>
            <option value="2">个人照片固顶</option>
			<option value="3">企业LOGO推荐</option>
			<option value="4">企业固顶推荐</option>
            <option value="5">职位固顶推荐</option>
          </select></td>
	  </tr>
	<tr class=altbg1 align=center>
		<td class="altbg1" align="right">
		可用天数：</td>
		<td class="altbg2" align="left"><input name="price_useday" type="text" id="price_useday" size="15" maxlength="10">
	    天</td>
	</tr>
	<tr class=altbg1 align=center>
		<td class="altbg1" align="right">
		消费点数：</td>
		<td class="altbg2" align="left"><input name="price_value" type="text" id="price_value" size="15">
		点</td>
	</tr>
	<tr class=altbg1 align=center>
		<td class="altbg1" align="right">
		简要说明：</td>
		<td class="altbg2" align="left"><input name="price_content" type="text" id="price_content" size="50"></td>
	</tr>
	<tr class=altbg1 align=center>
		<td class="altbg1" align="right">
		　</td>
		<td class="altbg2">
		<p align="left">
		<input type="submit" value="添加项目" name="B1" class="inputs"></td>
	</tr>
</form>
</table>
</div>
</body>
</html>