📄 mtype.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;'>序号 </td>
<td style = 'width:100px;'>主类名</td>
<td style = 'width:38px;'>代码</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;'> </td>
</tr>
<tr>
<td style = 'text-align:right;'>新加 </td>
<td><input type="text" name="mTypeName" style = 'width:100%;' class = 'input'/></td>
<td><input type="text" name="Code" style = 'width:100%;' class = 'input'/></td>
<td><input type = 'text' name = 'mTypeArray' style = 'width:100%;' class = 'input'/></td>
<td> </td>
<td> </td>
<td><input type = 'text' name = 'mTypeRemark' style = 'width:100%;' class = 'input'/></td>
<td><input type="submit" value = '新添加主类' style = 'width:72px;'></td>
</tr>
</form>
<%
SQL = ("select * From mType where mTypeSelect = 0 Order By mTypeid Desc")
Rs.Open(SQL),Conn,1,1
if not Rs.eof then
For i = 1 to Rs.RecordCount
mTypeid = Rs("mTypeid")
mTypeName = Rs("mTypeName")
Code__ = Rs("Code")
mTypeArray = Rs("mTypeArray")
mTypeSelect = Rs("mTypeSelect")
AboutSub = DataCount("select count(mTypeid) from mType where mTypeSelect = " & mTypeid & "",0)
mTypeRemark = Rs("mTypeRemark")
mMainCount = DataCount("select count(stockid) from stock where mTypeid in(select mTypeid from mType where mTypeSelect = " & mTypeid & ")",0) '该主类的注册用户数
deleteButton = "<input type = 'submit' onclick = ""javascript:formm" & i & ".Options.value = 'deletemain';return confirm('即将彻底删除类别:(" & mTypeName & ")及与其相关的所有商品记录.\n\n此操作不可撤消.是否继续?');return true;"" value = '删除'/>"
Response.Write"" &_
"<form method = 'post' action='" & SELVAR("FN","") & "' name = 'formm" & i & "'>" &_
"<input name = 'Options' type = 'hidden'/>" & _
"<input name = 'mTypeid' type = 'hidden' value = '" & mTypeid & "'/>" & _
"<tr>" &_
"<td style = 'text-align:right;'>" & mTypeid & " </td>" & _
"<td><input type = 'text' name = 'mTypeName' value = '" & mTypeName & "' style = 'width:100%;' class = 'input'/></td>" & _
"<td><input type = 'text' name = 'Code' style = 'width:100%;' value = '" & Code__ & "' class = 'input'/>" & _
"<td><input type = 'text' name = 'mTypeArray' value = '" & mTypeArray & "' style = 'width:100%;' class = 'input'/></td>" & _
"<td style = 'text-align:center;'>" & mMainCount & "</td>" &_
"<td>" & AboutSub & "</td>" & _
"<td><input type = 'text' name = 'mTypeRemark' value = '" & mTypeRemark & "' 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
mTypeData = true
else
mTypeData = false
Response.Write"<tr><td colspan = '8' 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 mType set mTypeSelect = " & newRequestid & " where mTypeid = " & oldRequestid & "")
For i_AUT = 0 to AUTUBound
Conn.Execute("update " & AUTUBound(i_AUT) & " set mTypeid = " & newRequestid & " where mTypeid = " & 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 mType (mTypeName,Code,mTypeArray,mTypeSelect,mTypeRemark) values ('" & Replace(GetText("mTypeName","P","Str",1,110,""),"'","’") & "' , '" & Replace(GetText("mTypeName","P","Str",1,110,"none"),"'","’") & "' , " & GetText("mTypeArray","P","number",1,10,0) & " , 0 , '" & Replace(GetText("mTypeRemark","P","Str",1,1000,"none"),"'","’") & "') "
Conn.Execute(SQLAdd)
Response.Write viewinfo("alertLoca","主类添加成功!",SELVAR("FN",""))
SQL = ""
Case "updatemain"
SQL = "update mType Set mTypeName = '" & Replace(GetText("mTypeName","P","Str",1,110,"none"),"'","’") & "' , Code = '" & Replace(GetText("Code","P","Str",1,110,"none"),"'","’") & "' , mTypeArray = " & GetText("mTypeArray","P","number",1,10,0) & " , mTypeSelect = " & GetText("mTypeSelect","P","number",1,10,0) & " , mTypeRemark = '" & Replace(GetText("mTypeRemark","P","Str",1,1000,"none"),"'","’") & "' where mTypeid = " & abs(GetText("mTypeid","P","number",1,10,0)) & ""
Conn.Execute(SQL)
Response.Write viewinfo("alertLoca","主类修改成功!",SELVAR("FN",""))
Case "deletemain"
mTypeid__ = abs(GetText("mTypeid","P","number",1,10,0))
SQLm = "delete from mType where mTypeid = " & mTypeid__ & ""
SQLs = "delete from mType where mTypeSelect = " & mTypeid__ & ""
SQLstock = "delete from stock where mtypeid in(select mTypeid from mType where mTypeSelect = " & mTypeid__ & ")"
SQLstockm = "delete from stockm where stockmid in(select isstockid from stock where mtypeid in(select mTypeid from mType where mTypeSelect = " & mTypeid__ & "))"
Conn.Execute(SQLstockm)'主
Conn.Execute(SQLstock)'子库存
Conn.Execute(SQLs)'子类
Conn.Execute(SQLm)'主类
'Response.Write SQLm & "<br/>" & SQLs & "<br/>" & SQLstock
Response.Write viewinfo("alertLoca","主类-子类-相关库存商品删除成功!",SELVAR("FN",""))
Case "AddSub"
dim SELmainid
SELmainid = GetText("mTypeSelect","P","number",1,10,0)
SELmainid = SelectZD("select mTypeid from mType where mTypeid = " & SELmainid & "","F")
if SELmainid = "F" then
Response.Write viewinfo("alertLoca","不存在的主类.请重新选择主类!",SELVAR("FN",""))
Response.end
end if
SQLAdd = "insert into mType (mTypeName,Code,mTypeArray,mTypeSelect,mTypeRemark) values ('" & Replace(GetText("mTypeName","P","Str",1,110,"none"),"'","’") & "' , '" & Replace(GetText("Code","P","Str",1,110,"none"),"'","’") & "' , " & GetText("mTypeArray","P","number",1,10,0) & " , " & SELmainid & " , '" & Replace(GetText("mTypeRemark","P","Str",1,1000,"none"),"'","’") & "') "
Conn.Execute(SQLAdd)
Response.Write viewinfo("alertLoca","子类添加成功!",SELVAR("FN",""))
Case "updateSub"
mTypeid__ = abs(GetText("mTypeid","P","number",1,10,0))
SQL = "update mType Set mTypeName = '" & Replace(GetText("mTypeName","P","Str",1,110,"none"),"'","’") & "' , Code = '" & Replace(GetText("Code","P","Str",1,110,"none"),"'","’") & "' , mTypeArray = " & GetText("mTypeArray","P","number",1,10,0) & " , mTypeSelect = " & GetText("mTypeSelect","P","number",1,10,0) & " , mTypeRemark = '" & Replace(GetText("mTypeRemark","P","Str",1,1000,"none"),"'","’") & "' where mTypeid = " & mTypeid__ & ""
Conn.Execute(SQL)
Response.Write viewinfo("alertLoca","子类修改成功!",SELVAR("FN",""))
Case "deleteSub"
mTypeid__ = abs(GetText("mTypeid","P","number",1,10,0))
SQLs = "delete from mType where mTypeid = " & mTypeid__ & ""
SQLstock = "delete from stock where mtypeid = " & mTypeid__ & ""
'Response.Write AboutSQL
Conn.Execute(SQLstock)
Conn.Execute(SQLs)
Response.Write viewinfo("alertLoca","子类-相关库存商品删除成功!",SELVAR("FN",""))
Response.end
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;'>序号 </td>
<td style = 'width:100px;'>子类名</td>
<td style = 'width:30px;'>代码</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;'> </td>
</tr>
<tr>
<td style = 'text-align:right;'>新加 </td>
<td><input type="text" name="mTypeName" style = 'width:100%;' class = 'input'/></td>
<td><input type="text" name="Code" style = 'width:100%;' class = 'input'/></td>
<td><input type = 'text' name = 'mTypeArray' style = 'width:100%;' class = 'input'/></td>
<td> </td>
<%SQL = ("select * From mType where mTypeSelect = 0 Order By mTypeid Desc")%>
<td><%=mType(SQL,GetText("mTypeSelect","P","number",1,10,0),"100%","mTypeSelect","")%></td>
<td><input type = 'text' name = 'mTypeRemark' style = 'width:100%;' class = 'input'/></td>
<td><input type="submit" value = '新添加子类' style = 'width:72px;'></td>
</tr>
</form>
<%
SQL = ("select * From mType where not mTypeSelect = 0 Order By mTypeSelect , mTypeid Desc")
Rs.Open(SQL),Conn,1,1
if not Rs.eof then
For i = 1 to Rs.RecordCount
mTypeid = Rs("mTypeid")
Code_sub = Rs("Code")
utypeid_ = mTypeid
mTypeName = Rs("mTypeName")
mTypeArray = Rs("mTypeArray")
mTypeSelect = Rs("mTypeSelect")
AboutSub = DataCount("select count(mTypeid) from mType where mTypeid = " & mTypeSelect & "",0)
mTypeRemark = Rs("mTypeRemark")
mCount = DataCount("select count(stockid) from stock where mTypeid = " & mTypeid & "",0) '该子类的注册用户数
deleteButton = "<input type = 'submit' onclick = ""javascript:forms" & i & ".Options.value = 'deleteSub';return confirm('即将彻底删除类别:(" & mTypeName & ")及与其相关的所有商品记录.\n\n此操作不可撤消.是否继续?');return true;"" value = '删除'/>"
ismainSQL = "select * from mType where mTypeSelect = 0 "
Response.Write"" &_
"<form method = 'post' action='" & SELVAR("FN","") & "' name = 'forms" & i & "'>" &_
"<input name = 'Options' type = 'hidden'/>" & _
"<input name = 'mTypeid' type = 'hidden' value = '" & mTypeid & "'/>" & _
"<tr>" &_
"<td style = 'text-align:right;'>" & mTypeid & " </td>" & _
"<td><input type = 'text' name = 'mTypeName' value = '" & mTypeName & "' style = 'width:100%;' class = 'input'/></td>" & _
"<td><input type = 'text' name = 'Code' style = 'width:100%;' value = '" & Code_sub & "' class = 'input'/>" & _
"<td><input type = 'text' name = 'mTypeArray' value = '" & mTypeArray & "' style = 'width:100%;' class = 'input'/></td>" & _
"<td style = 'text-align:center;'>" & mCount & "</td>" &_
"<td>" & mType(ismainSQL,mTypeSelect,"100%","mTypeSelect","") & "</td>" & _
"<td><input type = 'text' name = 'mTypeRemark' value = '" & mTypeRemark & "' 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 + -