📄 goods_query.asp.bak
字号:
<%
'##############################################################################
'#
'# 文 件 名 : goods_query.asp
'#
'#
'# 创 建 人 : yaoxiaohui
'# 日 期 : 2002-11-4
'#
'# 修改历史 : ****年**月**日 ******
'# 修改内容 : **************************************************
'#
'# 功能描述 : 模板
'# 版 本 : v1.0
'#
'# Copyright(c) 2001-2002 上海阿尔卡特网络支援系统有限公司
'#
'##############################################################################
'------------------------------------------------------------------------------
'---- 服务器端设置
'------------------------------------------------------------------------------
option explicit
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
%>
<!-- include files begin -->
<!-- #include file="../include/common.inc" -->
<!-- #include file="../include/recordlist.inc" -->
<!-- #include file="../include/commonpage.inc" -->
<!-- #include file="goods_query.inc" -->
<!-- include files end -->
<%
'##############################################################################
'---- 服务器端代码
'##############################################################################
call CheckSecurity()
if hasright(ID_STOCK) < RIGHT_READ then
Response.Clear
Response.Redirect "../include/error.asp?error=你没有查询权限!"
Response.end
end if
'******************************************************************************
'---- 建立数据库连接
'------------------------------------------------------------------------------
dim conn
set conn = DBConnection
'******************************************************************************
'---- 分页相关的变量定义
'------------------------------------------------------------------------------
Dim sSQL, sWhere, sOrderby
Dim sFileName : sFileName = "goods_query.asp"
Dim iTotalRecords : iTotalRecords = 0 ' 分页
Dim iRecordsPerPage : iRecordsPerPage = 10 ' 一页10行
Dim iTotalPages : iTotalPages = 0
Dim iCols : iCols = 8 ' 8列
Dim iCurrentPage : iCurrentPage = GetParam("Page")
Dim sSorting : sSorting = GetParam("Sorting")
Dim sSorted : sSorted = GetParam("Sorted")
Dim sSortParams : sSortParams = ""
Dim sFormParams : sFormParams = ""
Dim sDirection : sDirection = ""
'******************************************************************************
'---- 查询参数
'------------------------------------------------------------------------------
'' 物品或设备名称
dim pGoodsName : pGoodsName = GetParam("goods_name")
'' 型号规格
dim pModel : pModel = GetParam("model")
'' 单位
dim pUnit : pUnit = GetParam("unit")
'' 库存数
dim pQuantity : pQuantity = GetParam("quantity")
'' 物品类别
dim pGoodsType : pGoodsType = GetParam("goods_type")
if IsEmpty(pGoodsType) then pGoodsType = -1
'' 进货方式
dim pInputMethod : pInputMethod = GetParam("input_method")
if IsEmpty(pInputMethod) then pInputMethod = 0
'' 当前状态
dim pCurrentStatus : pCurrentStatus = GetParam("current_status")
if IsEmpty(pCurrentStatus) then pCurrentStatus = 0
'' 存货仓库
dim pDepotID : pDepotID = GetParam("depot_id")
if IsEmpty(pDepotID) then pDepotID = -1
sFormParams = "goods_name=" & pGoodsName & "&model=" & pModel & "&unit=" & pUnit & "&quantity=" & pQuantity & "&goods_type=" & pGoodsType & "&input_method=" & pInputMethod & "¤t_status=" & pCurrentStatus & "&depot_id=" & pDepotID & "&"
'******************************************************************************
'---- 构造分页的SQL语句
'------------------------------------------------------------------------------
sSQL = " select t1.goods_id as id,t1.goods_name,t1.model,t1.unit,t1.quantity,t2.type_desc ,t3.depot_name,t1.input_method,t1.current_status" & _
" from t_goods t1" & _
" left join t_goods_type t2 on t1.goods_type=t2.type_id" & _
" left join t_depot t3 on t1.depot_id=t3.depot_id"
sWhere = " where t1.goods_id = t1.goods_id"
sOrderby = " order by t1.goods_name"
'******************************************************************************
'---- 查询条件限制
'------------------------------------------------------------------------------
'' 物品或设备名称
if pGoodsName <> "" then sWhere = sWhere & " and t1.goods_name like " & ToSQL("%" & pGoodsName & "%","Text")
'' 型号规格
if pModel <> "" then sWhere = sWhere & " and t1.model like " & ToSQL("%" & pModel & "%","Text")
'' 单位
if pUnit <> "" then sWhere = sWhere & " and t1.unit like " & ToSQL("%" & pUnit & "%","Text")
'' 库存数
if pQuantity <> "" then sWhere = sWhere & " and t1.quantity = " & ToSQL( pQuantity ,"Text")
'------------------------------------------------------------------------------
'' 物品类别
if pGoodsType > 0 then sWhere = sWhere & " and t2.type_id=" & pGoodsType
'' 进货方式
if pInputMethod > 0 then sWhere = sWhere & " and t1.input_method=" & pInputMethod
'' 当前状态
if pCurrentStatus > 0 then sWhere = sWhere & " and t1.current_status=" & pCurrentStatus
'' 存货仓库
if pDepotID > 0 then sWhere = sWhere & " and t3.depot_id =" & pDepotID
'******************************************************************************
'---- 分页SQL语句构造完毕,调用PrepareListData进行分页前的准备
'------------------------------------------------------------------------------
dim arrayFields(7), sDelimiter
sDelimiter = "*"
arrayFields(0) = "goods_name"
arrayFields(1) = "model"
arrayFields(2) = "unit"
arrayFields(3) = "quantity"
arrayFields(4) = "type_desc"
arrayFields(5) = "input_method"
arrayFields(6) = "current_status"
arrayFields(7) = "depot_name"
'response.write sSQL & sWhere & sOrderby : response.end
call PrepareListData(conn,sSQL & sWhere & sOrderby, Join(arrayFields, sDelimiter), sDelimiter)
'******************************************************************************
%>
<html>
<head>
<title>上海信息大楼 Shanghai Information Tower</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../include/common.css" type="text/css">
<style type="text/css">
.tdlist {border-width:0px}
.tdHead {border-width:0px}
</style>
<script language="VBScript">
Sub btnSearch_OnClick()
document.all.frmSearch.submit()
End Sub
</script>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="../images/bg/bg0.jpg">
<br>
<%
'response.write sSQL & sWhere & sOrderby & "<br>" : response.end
Response.Write OuterTableHeader
Response.Write HeaderWithMenu
Response.Write InnerTableHeader
'******************************************************************************
'---- 主体从这里开始
'------------------------------------------------------------------------------
Response.Write TableSearch
Response.Write TableHeader
Response.Write TableRecords(sSQL & sWhere & sOrderby, iCols, iRecordsPerPage, iTotalRecords, iCurrentPage, iTotalPages, sFileName, sFormParams, sSortParams )
Response.Write TableLink
'------------------------------------------------------------------------------
'---- 主体到这里结束
'******************************************************************************
Response.Write InnerTableTailer
Response.Write Footer
Response.Write OuterTableTailer
Disconnect(conn)
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -