<!--#INCLUDE FILE="../HXINCLUDE/HXINCLUDEHEAD.ASP"--><%if WS_S.MemberPriv("WS_SaleManageCustomRank")<>1 then HX_GoBack "对不起,您的权限不够!",""
columnName="":Tablename="HX_CustomRank":action=request("action")
WS_CRID=request("WS_CRID")
if WS_CRID<>"" and isnumeric(WS_CRID) then
Orderby=" where WS_CRID="&WS_CRID
else
Orderby=" ORDER BY WS_OrderBy ASC"
end if
set rs=WS_S.HX_SetRSD(ColumnName,Tablename,Orderby)
WS_CustomRankName=WS_S.HX_Replace(request.form("WS_CustomRankName"))
WS_CustomRankPice=WS_S.HX_Replace(request.form("WS_CustomRankPice"))
WS_OrderBy=WS_S.HX_Replace(request.form("WS_OrderBy"))
if WS_OrderBy="" then
WS_OrderBy=1
end if
select case action
case "addsaveinfo"
       WS_S.HX_Isnull "级别名称不能为空",WS_CustomRankName
       set SERS=WS_S.HX_SetRSD(ColumnName,Tablename," where WS_CustomRankName='"&WS_CustomRankName&"'")	 
	   If SERS.recordcount>0 then
	   HX_GoBack "添加失败:\n此级别已存在!",""
	   End If
	   Call WS_S.HX_RSClose(SERS)  
       msg="“"&WS_CustomRankName&"”级别添加成功!"
       rs.addnew    
       rs("WS_CustomRankName")=WS_CustomRankName
	   rs("WS_CustomRankPice")=WS_CustomRankPice
       rs("WS_OrderBy")=WS_OrderBy
       rs.update
	   Call WS_S.SaveAdminLog(LOGINUSERNAME,LogAppointment,msg)
       HX_GoBack msg,"CustomRank.asp"
case "editsaveinfo"
       WS_S.HX_Isnull "级别名称不能为空",WS_CustomRankName
       set SERS=WS_S.HX_SetRSD(ColumnName,Tablename," where WS_CustomRankName='"&WS_CustomRankName&"' and WS_CRID<>"&WS_CRID)	 
	   If SERS.recordcount>0 then
	   HX_GoBack "修改失败:\n此级别已存在!",""
	   End If
       msg="“"&rs("WS_CustomRankName")&"”级别修改成功!"
	   rs("WS_CustomRankName")=WS_CustomRankName
	   rs("WS_CustomRankPice")=WS_CustomRankPice
       rs("WS_OrderBy")=WS_OrderBy
       rs.update
	   call WS_S.SaveAdminLog(LOGINUSERNAME,LogAppointment,msg)
       HX_GoBack msg,"CustomRank.asp"
case "del"
     msg="“"&rs("WS_CustomRankName")&"”删除成功"
     conn.execute("delete from HX_CustomRank where WS_CRID="&WS_CRID)	
	 conn.execute("delete from HX_CustomConnect where WS_CRID="&WS_CRID)
	 conn.execute("delete from HX_CustomContact where WS_CRID="&WS_CRID)
	 call WS_S.SaveAdminLog(LOGINUSERNAME,LogAppointment,msg) 
	 HX_GoBack msg,"CustomRank.asp"  
end select
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>客户级别</title>
<link rel=stylesheet type=text/css href="../HXinclude/HX_Style.css">
<script src="../HXinclude/HX_Function.js"></script>
</head>
<body topmargin="20" leftmargin="0" bottommargin="0">
<table width="596"  border="0" cellspacing="1" cellpadding="0" align=center bgcolor="#613c25">
  <tr>
    <td colspan="2" bgcolor=FFFBE8><table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="25" background="../hximages/titleline.gif"><font class="fontmenu">客户级别</font></td>
  </tr>
</table>
<table width="100%"  border="0" cellspacing="1" cellpadding="3" bgcolor="#FFFBE8">
  <form name="form1" method="post" action="?action=addsaveinfo">
    <tr bgcolor="#BF9B73" class="td4">
      <td width="36%"><div align="center">级别名称</div></td>
      <td width="18%"><div align="center">价格</div></td>
      <td width="19%"><div align="center">排 序</div></td>
      <td><div align="center">操 作</div></td>
    </tr>
    <tr bgcolor="#FFFBE8" onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#FFFBE8'>
    <td align="center"><input type="text" name="WS_CustomRankName" size="18" value=""></td>
	<td width="18%" align="center"><input type="text" name="WS_CustomRankPice" size="8" value="">折</td>
    <td width="19%" align="center"><input type="text" name="WS_OrderBy" size="10" value="<%=rs.recordcount+1%>" onKeyPress="event.returnValue=IsDigit();" style="ime-mode:disabled"></td>
    <td width="27%" align="center"><input type="submit" name="Submit" value=" 添 加 "></td>
  </tr>
</form>
</table>
<br>
<table width="100%"  border="0" cellspacing="1" cellpadding="3" bgcolor="#FFFBE8">
 
    <tr bgcolor="#BF9B73" class="td4">
      <td width="14%"><div align="center">序　号</div></td>
      <td width="24%"><div align="center">级别名称</div></td>
      <td width="20%"><div align="center">价格</div></td>
      <td><div align="center">排 序</div></td>
      <td><div align="center">操 作</div></td>
    </tr>
	<%if rs.recordcount<=0 then
	 response.write "<tr><td height=30 align=center colspan=4 bgcolor=FFFBE8>暂 无 数 据</td></tr>"
	else
	do while not rs.EOF
	%>
    <form name="form1" method="post" action="?action=editsaveinfo&WS_CRID=<%=rs("WS_CRID")%>"> <tr bgcolor="#FFFBE8" onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#FFFBE8'>
    <td align="center"><%=rs("WS_CRID")%></td>
    <td align="center"><input type="text" name="WS_CustomRankName" size="18" value="<%=rs("WS_CustomRankName")%>"></td>
    <td align="center"><input type="text" name="WS_CustomRankPice" size="8" value="<%=rs("WS_CustomRankPice")%>">
      折</td>
    <td width="15%" align="center"><input type="text" name="WS_OrderBy" size="4" value="<%=rs("WS_OrderBy")%>" onKeyPress="event.returnValue=IsDigit();" style="ime-mode:disabled"></td>
    <td width="27%" align="center"><input type="submit" name="Submit" value=" 修改 ">&nbsp;<input type="button" name="Submit" value=" 删除 " onclick="javascript:if(!confirm('是否要删除此级别及其下面的职位和员工！')) return false;else location.href='CustomRank.asp?action=del&WS_CRID=<%=rs("WS_CRID")%>';"></td>
  </tr></form>
  <%
	  rs.movenext
      loop
  end if
  call WS_S.HX_RSClose(RS) 
  %>

</table>

</td>
  </tr>
</table>