⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 admintype.asp

📁 一个比较完整的企业erp系统
💻 ASP
字号:
<%@language="vbscript" codepage="936"%>
<%response.buffer = true%>
<%Public HOME_PATH:HOME_PATH = "../"%>
<!--#include file="../db.asp"-->
<!--#include file="../inc/function.asp"-->
<%Public title:title = "管理员类别"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title><%=title%></title><%
  if isLogin = false then
     Response.Write viewinfo("Logingo","","")
	 Response.end
  end if
%>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<link href="<%=HOME_PATH%>css/style.css" rel="stylesheet" type="text/css">
<style>
html{min-width: 776px;}
fieldset {padding:3px;}
</style>
</head>
<body style = 'border-style:none;margin:0px;'>
<div style = 'text-align:center;'>
<table border = '1' cellspacing = '0' cellpadding = '2' borderColorLight="#848284" borderColorDark="#eeeeee" bordercolor="#EFBAEF" style = 'width:100%;border-bottom:0px solid;border-right:0px solid;'/>
   <form method='post' action="<%=SELVAR("FN","")%>">
   <input type = 'hidden' name = 'Options' value = 'Addmain'/>
     <tr>
	   <td style = 'height:25px;width:45px;text-align:right;'>序号&nbsp;</td>
	   <td style = 'width:100px;'>主部门名</td>
	   <td style = 'width:30px;'>排列</td>
	   <td style = 'width:50px;'>已有数量</td>
	   <td style = 'width:60px;'>含子部门数</td>
	   <td style = 'width:auto;'>备注</td>
	   <td style = 'width:88px;'>&nbsp;</td>
	 </tr>
     <tr>
	   <td style = 'text-align:right;'>新加&nbsp;</td>
	   <td><input type="text" name="ATypeName" style = 'width:100%;' class = 'input'/></td>
	   <td><input type = 'text' name = 'ATypeArray' style = 'width:100%;' class = 'input'/></td>
	   <td>&nbsp;</td>
	   <td>&nbsp;</td>
	   <td><input type = 'text' name = 'ATypeRemark' style = 'width:100%;' class = 'input'/></td>
	   <td><input type="submit" value = '新添加主类' style = 'width:72px;'></td>
	 </tr>
    </form>
	<%
	    SQL = ("select * From adminType where ATypeSelect = 0 Order By Atypeid Desc")
	    Rs.Open(SQL),Conn,1,1
		   if not Rs.eof then
		      For i = 1 to Rs.RecordCount
			      Atypeid = Rs("Atypeid")
				  'Aboutpro = DataCount("select count(stockid) from stock Where typeid = " & typeid & "",0)
				  ATypeName = Rs("ATypeName")
				  ATypeArray = Rs("ATypeArray")
                  ATypeSelect = Rs("ATypeSelect")
				  AboutSub = DataCount("select count(Atypeid) from adminType where ATypeSelect = " & Atypeid & "",0)
				  ATypeRemark = Rs("ATypeRemark")

				  adminMainCount = DataCount("select count(aid) from admins where Atypeid in(select Atypeid from adminType where ATypeSelect = " & Atypeid & ")",0) '该主类的注册用户数

				  deleteButton = "<input type = 'submit' onclick = ""javascript:formm" & i & ".Options.value = 'deletemain';return confirm('即将彻底删除类别:(" & ATypeName & ")及与其相关的所有商品记录.\n\n此操作不可撤消.是否继续?');return true;"" value = '删除'/>"

			      Response.Write"" &_
				  "<form method = 'post' action='" & SELVAR("FN","") & "' name = 'formm" & i & "'>" &_
				  "<input name = 'Options' type = 'hidden'/>" & _
				  "<input name = 'Atypeid' type = 'hidden' value = '" & Atypeid & "'/>" & _
				  "<tr>" &_
				  "<td style = 'text-align:right;'>" & Atypeid & "&nbsp;</td>" & _
				  "<td><input type = 'text' name = 'ATypeName' value = '" & ATypeName & "' style = 'width:100%;' class = 'input'/></td>" & _
				  "<td><input type = 'text' name = 'ATypeArray' value = '" & ATypeArray & "' style = 'width:100%;' class = 'input'/></td>" & _
				  "<td style = 'text-align:center;'>" & adminMainCount & "</td>" &_
				  "<td>" & AboutSub & "</td>" & _
				  "<td><input type = 'text' name = 'ATypeRemark' value = '" & ATypeRemark & "' style = 'width:100%;' class = 'input'/></td>" & _
				  "<td><input type = 'submit' value = '修改' onclick = ""javascript:formm" & i &".Options.value = 'updatemain';""/>" & deleteButton & "</td>" &_
				  "</tr>" & _
				  "</form>"
				  Rs.movenext
			  Next
			  ATypeData = true
		   else
		      ATypeData = false
		      Response.Write"<tr><td colspan = '7' style = 'color:red;text-align:center;'>请先添加一个用户主类!</td></tr>"
		   end if
		   Rs.Close

Function ata(SELExe , oldRequestid , newRequestid)

    dim AboutUserTypeArr , AUTUBound , i_AUT
	oldRequestid = GetText(oldRequestid,"P","number",1,10,0)
	newRequestid = GetText(newRequestid,"P","number",1,10,0)

    AboutUserTypeArr = array("stock","sale")
	AUTUBound = UBound(AboutUserTypeArr)
	Select Case SELExe
	   Case "U"
			Conn.Execute("update adminType set ATypeSelect = " & newRequestid & " where Atypeid = " & oldRequestid & "")
		For i_AUT = 0 to AUTUBound
			Conn.Execute("update " & AUTUBound(i_AUT) & " set Atypeid = " & newRequestid & " where Atypeid = " & oldRequestid & "")
		Next
	   Case "D"
		For i_AUT = 0 to AUTUBound
			Conn.Execute(SQL)
		Next
	End Select
End Function

			      dim SQLAdd

		   Select Case trim(Request.Form("Options"))
		     Case "Addmain"
			      SQLAdd = "insert into adminType (ATypeName,ATypeArray,ATypeSelect,ATypeRemark) values ('" & Replace(GetText("ATypeName","P","Str",1,110,"none"),"'","’") & "' , " & GetText("ATypeArray","P","number",1,10,0) & " , 0 , '" & Replace(GetText("ATypeRemark","P","Str",1,1000,"none"),"'","’") & "') "
				  Conn.Execute(SQLAdd)
				  Response.Write viewinfo("alertLoca","主类添加成功!",SELVAR("FN",""))
				  SQL = ""
		     Case "updatemain"
			      Atypeid__ = abs(GetText("Atypeid","P","number",1,10,0))
			      SQL = "update adminType Set ATypeName = '" & Replace(GetText("ATypeName","P","Str",1,110,"none"),"'","’") & "' , ATypeArray = " & GetText("ATypeArray","P","number",1,10,0) & " , ATypeSelect = " & GetText("ATypeSelect","P","number",1,10,0) & " , ATypeRemark = '"  & Replace(GetText("ATypeRemark","P","Str",1,1000,"none"),"'","’") & "' where Atypeid = " & Atypeid__ & ""
			      Conn.Execute(SQL)
				  Response.Write viewinfo("alertLoca","主类修改成功!",SELVAR("FN",""))
			 Case "deletemain"
			      Atypeid__ = abs(GetText("Atypeid","P","number",1,10,0))
			      SQL = "delete from adminType where Atypeid = " & Atypeid__ & ""
				  SQLs = "delete from adminType where ATypeSelect = " & Atypeid__ & ""
				  SQLadmin = "delete from admins where Atypeid in(select Atypeid from adminType where ATypeSelect = " & Atypeid__ & ")"
				  Conn.Execute(SQL)
				  Conn.Execute(SQLs)
				  Conn.Execute(SQLadmin)
				  Response.Write viewinfo("alertLoca","主部门-子部门及相关管理员删除成功!",SELVAR("FN","?"))

			 
			 Case "AddSub"
			      dim SELmainid
			      SELmainid = GetText("ATypeSelect","P","number",1,10,0)
				  SELmainid = SelectZD("select Atypeid from adminType where Atypeid = " & SELmainid & "","F")
				  if SELmainid = "F" then 
				     Response.Write viewinfo("alertLoca","不存在的主部门.请重新选择主部门!",SELVAR("FN",""))
					 Response.end
				  end if
			      SQLAdd = "insert into adminType (ATypeName,ATypeArray,ATypeSelect,ATypeRemark) values ('" & Replace(GetText("ATypeName","P","Str",1,110,"none"),"'","’") & "' , " & GetText("ATypeArray","P","number",1,10,0) & " , " & SELmainid & " , '" & Replace(GetText("ATypeRemark","P","Str",1,1000,"none"),"'","’") & "') "
				  Conn.Execute(SQLAdd)
				  Response.Write viewinfo("alertLoca","子部门添加成功!",SELVAR("FN",""))
		     Case "updateSub"
			      Atypeid__ = abs(GetText("Atypeid","P","number",1,10,0))
			      SQL = "update adminType Set ATypeName = '" & Replace(GetText("ATypeName","P","Str",1,110,"none"),"'","’") & "' , ATypeArray = " & GetText("ATypeArray","P","number",1,10,0) & " , ATypeSelect = " & GetText("ATypeSelect","P","number",1,10,0) & " , ATypeRemark = '"  & Replace(GetText("ATypeRemark","P","Str",1,1000,"none"),"'","’") & "' where Atypeid = " & Atypeid__ & ""
			      Conn.Execute(SQL)
				  Response.Write viewinfo("alertLoca","子部门修改成功!",SELVAR("FN",""))
			 Case "deleteSub"
			      Atypeid__ = abs(GetText("Atypeid","P","number",1,10,0))
			      SQL = "delete from adminType where Atypeid = " & Atypeid__ & ""
				  Conn.Execute(SQL)
				  Response.Write viewinfo("alertLoca","子部门删除成功!",SELVAR("FN",""))
			      
		   End Select

	%>



   <form method='post' action="<%=SELVAR("FN","")%>">
   <input type = 'hidden' name = 'Options' value = 'AddSub'/>
     <tr>
	   <td style = 'height:25px;width:45px;text-align:right;'>序号&nbsp;</td>
	   <td style = 'width:100px;'>子部门名</td>
	   <td style = 'width:30px;'>排列</td>
	   <td style = 'width:50px;'>已有数量</td>
	   <td style = 'width:80px;'>所属主部门</td>
	   <td style = 'width:auto;'>备注</td>
	   <td style = 'width:88px;'>&nbsp;</td>
	 </tr>
     <tr>
	   <td style = 'text-align:right;'>新加&nbsp;</td>
	   <td><input type="text" name="ATypeName" style = 'width:100%;' class = 'input'/></td>
	   <td><input type = 'text' name = 'ATypeArray' style = 'width:100%;' class = 'input'/></td>
	   <td>&nbsp;</td>
	   <td><%=admintype(SQL,GetText("ATypeSelect","P","number",1,10,0),"100%","ATypeSelect","")%></td>
	   <td><input type = 'text' name = 'ATypeRemark' style = 'width:100%;' class = 'input'/></td>
	   <td><input type="submit" value = '新添加子类' style = 'width:72px;'></td>
	 </tr>
    </form>
	<%

	  SQL = ("select * From adminType where not ATypeSelect = 0 Order By ATypeSelect , Atypeid Desc")
	    Rs.Open(SQL),Conn,1,1
		   if not Rs.eof then
		      For i = 1 to Rs.RecordCount
			      Atypeid = Rs("Atypeid")
				  utypeid_ = Atypeid
				  'Aboutpro = DataCount("select count(stockid) from stock Where Atypeid = " & Atypeid & "",0)
				  ATypeName = Rs("ATypeName")
				  ATypeArray = Rs("ATypeArray")
                  ATypeSelect = Rs("ATypeSelect")
				  AboutSub = DataCount("select count(Atypeid) from adminType where Atypeid = " & ATypeSelect & "",0)
				  ATypeRemark = Rs("ATypeRemark")
				  adminCount = DataCount("select count(aid) from admins where Atypeid = " & Atypeid & "",0) '该子类的注册用户数

				  deleteButton = "<input type = 'submit' onclick = ""javascript:forms" & i & ".Options.value = 'deleteSub';return confirm('即将彻底删除类别:(" & ATypeName & ")及与其相关的所有商品记录.\n\n此操作不可撤消.是否继续?');return true;"" value = '删除'/>"
                  ismainSQL = "select * from adminType where ATypeSelect = 0 "
			      Response.Write"" &_
				  "<form method = 'post' action='" & SELVAR("FN","") & "' name = 'forms" & i & "'>" &_
				  "<input name = 'Options' type = 'hidden'/>" & _
				  "<input name = 'Atypeid' type = 'hidden' value = '" & Atypeid & "'/>" & _
				  "<tr>" &_
				  "<td style = 'text-align:right;'>" & Atypeid & "&nbsp;</td>" & _
				  "<td><input type = 'text' name = 'ATypeName' value = '" & ATypeName & "' style = 'width:100%;' class = 'input'/></td>" & _
				  "<td><input type = 'text' name = 'ATypeArray' value = '" & ATypeArray & "' style = 'width:100%;' class = 'input'/></td>" & _
				  "<td style = 'text-align:center;'>" & adminCount & "</td>" &_
				  "<td>" & adminType(ismainSQL,ATypeSelect,"100%","ATypeSelect","") & "</td>" & _
				  "<td><input type = 'text' name = 'ATypeRemark' value = '" & ATypeRemark & "' style = 'width:100%;' class = 'input'/></td>" & _
				  "<td><input type = 'submit' value = '修改' onclick = ""javascript:forms" & i &".Options.value = 'updateSub';""/>" & deleteButton & "</td>" &_
				  "</tr>" & _
				  "</form>"
				  Rs.movenext
			  Next
		   else
		      Response.Write"<tr><td colspan = '7' style = 'color:red;text-align:center;'>请先添加一个用户子类!</td></tr>"
		   end if
		   Rs.Close
ConnClose()
%>
 </table>
</div>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -