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

📄 buildfilegoods.asp

📁 物业管理和办公自动化系统
💻 ASP
字号:
<%
'##############################################################################
'#
'#		文 件 名	 : BuildFileGoods.asp
'#
'#
'#		创 建 人	 : yaoxiaohui
'#  	日   期	 : 2002-12-2
'#
'#		修改历史  : ****年**月**日 ******
'#      修改内容  : **************************************************
'#
'#		功能描述	 : 仓库报表生成Excel文件
'#  	版   本	 : v1.0
'#	
'#	    Copyright(c) 2001-2002 上海阿尔卡特网络支援系统有限公司
'#
'##############################################################################
'------------------------------------------------------------------------------
'----   服务器端设置
'------------------------------------------------------------------------------
option explicit
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
%>
<!-- #include file="../include/common.inc" -->
<!-- #include file="../include/recordlist.inc" -->
<!-- #include file="../include/commonpage.inc" -->

<!-- #include file="BuildFileGoods.inc" -->
<%
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 filename
dim pOpdate1,pOpdate2,pDepot,pDepotID,pStyle
filename = Request.Form("filename")
pOpdate1 = Request.Form("opdate1")
pOpdate2 = Request.Form("opdate2")
pDepot	 = Request.Form("depot")
pDepotID = Request.Form("depot_id")
pStyle	 = Request.Form("style")

'******************************************************************************
'----   确定日期和报表表头,下载
'------------------------------------------------------------------------------
dim sDate, pYear, pMonth
pYear	= year(pOpdate1)
pMonth	= month(pOpdate1)
if pStyle = "1" then 
	sDate = pYear & "年度" & pMonth & "月份"
else
	sDate = pYear & "年度"
end if

if filename = "" then 
	filename = "报表"
end if
Response.AddHeader "Content-Disposition","attachment;filename=" & sDate & pDepot & filename & ".xls"
Response.ContentType = "APPLICATION/OCTET-STREAM"

'******************************************************************************
'----   确定字体
'------------------------------------------------------------------------------
'Response.Charset = "UTF-16"
Response.Charset = "gb2312"			' 编码中的“简体中文(HZ)”
'Response.Charset = "hz-gb-2312"		' 编码中的“简体中文(GB2312)”,这两种编码都可以正常显示中文

'******************************************************************************
'----   确定报表类别和所统计的仓库
'------------------------------------------------------------------------------
dim sql, rs, j
dim pGoodsType, pGoodsDesc,sGoodsDesc, pCompare1, pCompare2
dim sDepotName
dim sSQL,sWhere
dim pOpdate		: pOpdate	= date

if pDepotID = "-1" then
	sWhere = ""
else
	sWhere = " and t1.depot_id =" & ToSQL(pDepotID,"number")
end if

sSQL = "select t1.goods_id,t1.goods_name,t1.model,t1.quantity,t1.unit" & _
	",t1.goods_type,t2.depot_name" & _
	" from t_goods t1" & _
	" left join t_depot t2 on t1.depot_id = t2.depot_id" & _
	" where t1.goods_id = t1.goods_id" & _
	sWhere & _
	" order by t1.goods_id"
set rs = Openrs(conn,sSQL)
if Not rs.EOF then
	pCompare2 = GetValue(rs,"goods_type")
end if 
	pGoodsDesc = ""
while Not rs.EOF
	pCompare1 = GetValue(rs,"goods_type")
	if pCompare1 = pComPare2 then
		pGoodsType = pCompare1
	else 
		pGoodsDesc = "全部"
	end if
	rs.movenext
wend
rs.Close()
set rs = nothing

if pGoodsDesc = "全部" then 
	sGoodsDesc = pGoodsDesc
else
	sql = "select type_desc from t_goods_type where type_id =" & pGoodsType
	sGoodsDesc = DLookUp(conn,sql)
end if

sql = "select depot_name from t_depot where depot_id =" & ToSQL(pDepotID,"number")
sDepotName = DLookUp(conn,sql)

'******************************************************************************
'----   分页相关的变量定义
'------------------------------------------------------------------------------
Dim sFileName			: sFileName			= "BuildFileGoods.asp"
Dim iTotalRecords		: iTotalRecords		= 0			                ' 分页
Dim iRecordsPerPage		: iRecordsPerPage	= 25                        ' 一页8行
Dim iTotalPages			: iTotalPages		= 0
Dim iCols				: iCols				= 9                         ' 9列
Dim iCurrentPage		: iCurrentPage		= GetParam("Page")
Dim sSorting			: sSorting			= GetParam("Sorting")
Dim sSorted				: sSorted			= GetParam("Sorted")
Dim sSortParams			: sSortParams		= ""
Dim sFormParams			: sFormParams		= ""
Dim sDirection			: sDirection		= ""

'******************************************************************************
'----   分页SQL语句构造完毕,调用PrepareListData进行分页前的准备
'------------------------------------------------------------------------------
dim arrayFields(4), sDelimiter
sDelimiter = "*"
arrayFields(0)	=	"goods_id"
arrayFields(1)	=	"goods_name"
arrayFields(2)	=	"model"
arrayFields(3)	=	"quantity"
arrayFields(4)	=	"unit"
call PrepareListData(conn, sSQL, Join(arrayFields, sDelimiter), sDelimiter)

'******************************************************************************
'----   主体从这里开始
'------------------------------------------------------------------------------
Response.Write SheetTop
Response.Write TableHeader
Response.Write TableRecords( sSQL, iCols, iRecordsPerPage, iTotalRecords, iCurrentPage, iTotalPages, sFileName, sFormParams, sSortParams )
Response.Write SheetMasterDown
'------------------------------------------------------------------------------
'----   主体到这里结束
'******************************************************************************
Disconnect(conn)
%> 

⌨️ 快捷键说明

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