📄 depot_mgr.inc
字号:
<%
'##############################################################################
'#
'# 文 件 名 : depot_mgr.inc
'#
'#
'# 创 建 人 : yaoxiaohui
'# 日 期 : 2002-11-4
'#
'# 修改历史 : ****年**月**日 ******
'# 修改内容 : ***************************************
'#
'# 功能描述 : 仓库信息管理函数文件
'# 版 本 : v1.0
'#
'# Copyright(c) 2001-2002 上海阿尔卡特网络支援系统有限公司
'#
'##############################################################################
Function ListTableHeader()
ListTableHeader = _
"<table cellspacing=1 cellpadding=3 width=300 border=0 align=center bgcolor=silver>" & vbLF & _
"<tr><td colspan=" & iCols & " bgcolor=""#0040a0"" align=center style=""color:white;font-weight:600"" height=20 >仓库列表</td></tr>" & vbLF & _
"<tr bgcolor=""#eeeeee""><td class=tdHead width=300> <img src=""../images/bg/ar-y.gif"" width=8 height=8> " & TableHeaderField(sFileName, "depot_name", "仓库名称", sFormParams, sSorting, sSorted) & "</td>" & vbLF & _
"</tr>" & vbLF
End Function
Function ListTableTailer()
ListTableTailer = "</table>" & vbLF
End Function
Function ListTableRecords(sSQL, iCols, iRecordsPerPage, iTotalRecords, iCurrentPage, iTotalPages, sFileName, sFormParams, sSortParams)
dim sTemp : sTemp = "" ' 临时字符串变量
dim j ' 临时循环变量
'------------------------------------
' 分页所需的变量定义
'------------------------------------
Dim iCounter : iCounter = 1
Dim iPrevPage, iNextPage
'------------------------------------
' 获取数据库连接
'------------------------------------
' response.write sSQL
' response.end
dim rs : set rs = Openrs(conn,sSQL)
dim iDepotID, iDepotName
dim sColor
' 如果未到记录尾,将记录定位到你翻到的页面的第一个记录,否则显示空行
if Not rs.EOF then
rs.Move (iCurrentPage - 1) * iRecordsPerPage
end if
while not rs.EOF and iCounter <= iRecordsPerPage
iDepotID = rs("depot_id")
iDepotName = rs("depot_name")
if CStr(iDepotID) = CStr(pDepotID) then '' 如果是选中的纪录,显示不同的颜色,这里指定红色
sColor = "red"
else
sColor = "black"
end if
sTemp = sTemp & "<tr bgcolor=white>" & vbLF & _
"<td title=""" & iDepotName & """ style=""cursor:hand;color:" & sColor & """ onclick=""javascript:location.href='depot_mgr.asp?id=" & iDepotID & "&Page="&iCurrentPage&"';""> <img src=""../images/bg/ar-g.gif"" width=8 height=8> " & Bref(iDepotName,18) & " </td>" & vbLF & _
"</tr>" & vbLF
iCounter = iCounter + 1
rs.movenext
wend
' 填补空白行
sTemp = sTemp & WhiteRows(iCols, iCounter, iRecordsPerPage)
' 首页、前页、后页、尾页等分页信息
sTemp = sTemp & "<tr bgcolor=white><td colspan=" & iCols & " align=right>" & vbLF & _
Paginate(sFileName, sFormParams, sSortParams, iCurrentPage, iTotalPages) & vbLF & _
" </td></tr>" & vbLF
ListTableRecords = sTemp
End Function
Function FormTable()
dim sTitle, sActionLinks
if IsEmpty(pDepotID) then
sTitle = "新增仓库" '' 显示新增、取消的链接
sActionLinks = _
"<tr bgcolor=white height=30>" & vbLF & _
" <td colspan=8 align=center>" & vbLF & _
" <img border=0 src=""../images/button/add.gif"" onclick=""btnAdd_OnClick()"" style=""cursor:hand"">" & vbLF & _
" " & vbLF & _
" <img border=0 src=""../images/button/clear.gif"" onclick=""btnClear_OnClick()"" style=""cursor:hand"">" & vbLF & _
" </td>" & vbLF & _
"</tr>" & vbLF
else
sTitle = "修改仓库信息" '' 显示修改、删除、取消的链接
sActionLinks = _
"<tr bgcolor=white height=30>" & vbLF & _
" <td colspan=8 align=center>" & vbLF & _
" <img border=0 src=""../images/button/update.gif"" onclick=""btnUpdate_OnClick()"" style=""cursor:hand"">" & vbLF & _
" " & vbLF & _
" <img border=0 src=""../images/button/delete.gif"" onclick=""btnDelete_OnClick()"" style=""cursor:hand"">" & vbLF & _
" " & vbLF & _
" <img border=0 src=""../images/button/cancel.gif"" onclick=""btnCancel_OnClick()"" style=""cursor:hand"">" & vbLF & _
" </td>" & vbLF & _
"</tr>" & vbLF
end if
FormTable = _
"<table cellspacing=1 cellpadding=0 bgcolor=white border=0 width=300 height=""100%"">" & vbLF & _
"<form method=post name=frmMgr action=""depot_mgr.asp"">" & vbLF & _
"<input type=""hidden"" name=""FormAction"">" & vbLF & _
"<input type=""hidden"" name=""Page"" value=""" & iCurrentPage & """>" & vbLF & _
"<input type=""hidden"" name=""depot_id"" value=""" & pDepotID & """>" & vbLF & _
"<tr height=20>" & vbLF & _
" <td colspan=2 background=""../images/bg/bnbg.gif"" style=""color:white;font-weight:600"" align=center>" & sTitle & "</td></tr>" & vbLF & _
"<tr height=20><td></td></tr>" & vbLF & _
"<tr bgcolor=""#FFFFFF"" height=60>" & vbLF & _
" <td width=80 align=right>仓库名称:</td>" & _
" <td><input type=""text"" name=""depot_name"" value=""" & sDepotName & """ size=31 maxlength=10></td></tr>" & vbLF & _
sActionLinks & vbLF & _
"<tr height=180><td></td></tr>" & vbLF & _
"</form>" & _
"</table>" & vbLF & _
""
End Function
Function TableLink()
TableLink = _
"<table width=600 cellspacing=0 cellpadding=0 border=2 align=center>" & _
"<tr height=10>" & _
" <td width=600><img src=""../images/bg/line.gif"" width=600 height=3></td>" & _
"</tr>" & _
"<tr height=20>" & _
" <td width=600> " & _
" <img src=""../images/goto.gif""> <a href=""goods_query.asp"">库存查询</a>" & _
" " & _
" <img src=""../images/goto.gif""> <a href=""sheet_mgr.asp"">出入库单管理</a></td>" & _
"</tr>" & _
"</table>"
End Function
sub AddDepot()
dim sSQL, iRows
sDepotName = Trim(GetParam("depot_name"))
'' 类别名称不能为空
if sDepotName = "" then
Response.Write _
"<script language=""javascript"">" & vbLF & _
" alert(""对不起,请输入类型名称"");" & vbLF & _
"</script>" & vbLF
exit sub
end if
'' 检查是否存在重复的类别名称
iRows = DLookUp(conn, "select count(*) from t_depot where depot_name =" & ToSQL(sDepotName, "Text"))
if iRows > 0 then
Response.Write _
"<script language=""javascript"">" & vbLF & _
" alert(""对不起,已经存在名称为“" & sDepotName & "”的仓库,仓库名称不能重复!"");" & vbLF & _
"</script>" & vbLF
exit sub
end if
sSQL = "insert into t_depot(depot_name) values(" & ToSQL(sDepotName, "Text") & ")"
conn.Execute(sSQL)
pDepotID = empty '' 重新置成新增状态
sDepotName = ""
end sub
sub UpdateDepot()
dim sSQL, iRows
sDepotName = Trim(GetParam("depot_name"))
'' 类别名称不能为空
if sDepotName = "" then
Response.Write _
"<script language=""javascript"">" & vbLF & _
" alert(""对不起,请输入类型名称"");" & vbLF & _
"</script>" & vbLF
exit sub
end if
'' 检查是否存在重复的类别名称
iRows = DLookUp(conn, "select count(*) from t_depot where depot_name =" & ToSQL(sDepotName, "Text"))
if iRows > 0 then
Response.Write _
"<script language=""javascript"">" & vbLF & _
" alert(""对不起,已经存在名称为“" & sDepotName & "”的仓库,仓库名称不能重复!"");" & vbLF & _
"</script>" & vbLF
exit sub
end if
sSQL = "update t_depot set depot_name = " & ToSQL(sDepotName, "Text") & " where depot_id = " & ToSQL(pDepotID, "Number")
' response.write sSQL
' response.end
conn.Execute(sSQL)
pDepotID = empty
sDepotName = ""
end sub
sub DeleteDepot()
sDepotName = Trim(GetParam("depot_name"))
dim sSQL, iRows
'' 检查是否存在使用中的类别名称
iRows = DLookUp(conn, "select count(*) from t_goods where depot_id =" & ToSQL(pDepotID, "Number"))
if iRows > 0 then
Response.Write _
"<script language=""javascript"">" & vbLF & _
" alert(""对不起,仓库中有存货,该仓库不能删除!"");" & vbLF & _
"</script>" & vbLF
exit sub
end if
sSQL = "delete from t_depot where depot_id = " & ToSQL(pDepotID, "Number")
conn.Execute(sSQL)
pDepotID = empty '' 重新置成新增状态
sDepotName = ""
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -