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

📄 equi_statistic_by_sys.inc

📁 物业管理和办公自动化系统
💻 INC
字号:
<%
Function ListTableRecords(sSQL, iCols)
'	response.write sSQL & "<br>"
'	response.end
	dim sTemp	: sTemp = ""	' 临时字符串变量
	dim j					' 临时循环变量

	'------------------------------------
	' 记录序号
	'------------------------------------
	dim iRecCounter		: iRecCounter = 0
	
	'------------------------------------
	' 获取数据库连接
	'------------------------------------
	dim iLastSysId, iThisSysId, sSysDesc, iDiscarded, iCount
	
	dim iEquiInUse			: iEquiInUse = 0				'' 某种设备类别的在用设备数
	dim iEquiDiscarded	: iEquiDiscarded = 0			'' 某种设备类别的已报废设备数
	dim iEquiCount			: iEquiCount = 0				'' 某种设备类别所有(在用和已报废的)的设备数

	dim iEquiTotalInUse			: iEquiTotalInUse = 0			'' 总的在用设备数
	dim iEquiTotalDiscarded	: iEquiTotalDiscarded = 0		'' 总的已报废的设备数
	dim iEquiTotal					: iEquiTotal = 0						'' 总的设备数
	
'	response.write sSQL
'	response.end
	dim rs	: set rs = Openrs(conn,sSQL)

	while not rs.EOF
		iThisSysId	= GetValue(rs, "sys_id")
		sSysDesc = GetValue(rs,"sys_desc")
		iEquiInUse = GetValue(rs,"nodiscarded_count")
		iEquiDiscarded = GetValue(rs,"discarded_count")
		iEquiCount = GetValue(rs,"all_count")
		iRecCounter	= iRecCounter + 1	'' 记录数(行数)加一
		sTemp = sTemp &	"<tr bgcolor=white>" 
		sTemp = sTemp &	"	<td align=center>" & iRecCounter & "</td>" & vbLF
'		sTemp = sTemp &	"	<td align=center>" & iThisSysId & "</td>" & vbLF 
		if iParentId > 0 then
'			response.write "this="&iThisSysId&"<br>"
'			response.write "parent="&iParentId&"<br>"
			if Cint(iThisSysId) = Cint(iParentId) then
				sTemp = sTemp &	"	<td align=center title=""点击可以查看该系统下的设备列表""><a href=""tree_equi_list.asp?id=" & iThisSysId & "&"">" & sSysDesc & "</a>&nbsp;</td>" & vbLF 
			else
				sTemp = sTemp &	"	<td align=center title=""点击可以查看该系统及子系统的设备数量统计""><a href=""equi_statistic_by_sys.asp?id=" & iThisSysId & "&"">" & sSysDesc & "</a>&nbsp;</td>" & vbLF 
			end if
		else
			sTemp = sTemp &	"	<td align=center title=""点击可以查看该系统及子系统的设备数量统计""><a href=""equi_statistic_by_sys.asp?id=" & iThisSysId & "&"">" & sSysDesc & "</a>&nbsp;</td>" & vbLF 
		end if
		sTemp = sTemp &	"	<td align=center>" & iEquiInUse & "</td>" & vbLF 
		sTemp = sTemp &	"	<td align=center>" & iEquiDiscarded & "</td>" & vbLF 
		sTemp = sTemp &	"	<td align=center>" & iEquiCount & "</td>" & vbLF 
		sTemp = sTemp &	"</tr>" & vbLF			

		iEquiTotalDiscarded = iEquiTotalDiscarded + iEquiDiscarded		'' 所有设备类型总的设备数
		iEquiTotalInUse = iEquiTotalInUse + iEquiInUse						'' 所有设备类型总的设备数
		rs.movenext
	wend
	iEquiTotal = iEquiTotalInUse + iEquiTotalDiscarded

	''写“合计”统计数据
	sTemp = sTemp & "<tr bgcolor=white style=""font-weight:600"">" & vbLF & _
				"	<td align=center colspan=2>合 计</td>" & vbLF & _
				"	<td align=center>" & iEquiTotalInUse & "</td>" & vbLF & _
				"	<td align=center>" & iEquiTotalDiscarded & "</td>" & vbLF & _
				"	<td align=center>" & iEquiTotal & "</td>" & vbLF & _
				"</tr>" & vbLF

	ListTableRecords = _
		"<table cellspacing=1 cellpadding=3 width=""100%"" border=0 align=center  bgcolor=silver style=""table-layout:fixed"">" & vbLF & _
		"<tr style=""display:none"">" & vbLF & _
		"	<td width=40>序号</td>" & vbLF & _
		"	<td width=100>系统名称</td>" & vbLF & _
		"	<td width=""*"">在用设备数</td>" & vbLF & _
		"	<td width=""*"">已报废设备数</td>" & vbLF & _
		"	<td width=70>总的设备数</td></tr>" & vbLF & _
 
		"<tr><td colspan=" & iCols & " bgcolor=""#0040a0"" align=center style=""color:white;font-weight:600"" height=20 >按 系 统 统 计 设 备</td></tr>" & vbLF & _
		"<tr bgcolor=""#eeeeee"">" &  vbLF & _
		"	<td nowrap class=tdHead align=center>序号</td>" & vbLF & _
		"	<td nowrap class=tdHead align=center>&nbsp;<img src=""../images/bg/ar-y.gif"" width=8 height=8>&nbsp;" & _
						TableHeaderField("", "sys_desc", "系统名称", "", sSorting, sSorted) & "</td>" & vbLF & _
		"	<td nowrap class=tdHead align=center>"&_
						TableHeaderField("", "nodiscarded_count", "在用设备数", "", sSorting, sSorted) & "</td>" & vbLF & _
		"	<td nowrap class=tdHead align=center>"&_
						TableHeaderField("", "discarded_count", "已报废设备数", "", sSorting, sSorted) & "</td>" & vbLF & _
		"	<td nowrap class=tdHead align=center>"&_
						TableHeaderField("", "all_count", "设备数", "", sSorting, sSorted) & "</td>" & vbLF & _
		"</tr>" & vbLF & _

		sTemp & _

		"</table>" & vbLF
End Function

Sub PrepareOrderbyStmt(sSortFields, sDelimiter)
	dim arrayFields
	dim bFlag, i

	'--------------------------------------
	' 排序列、排序方向、排序参数
	'--------------------------------------
	arrayFields = Split(sSortFields, sDelimiter)	'' 分隔排序字段
'	response.write "test:ssorting="&sSorting&"<br>"
'	response.write "arrayFields="&sSortFields&"<br>"
	bFlag = false
	for i = LBound(arrayFields) to UBound(arrayFields)
		if sSorting = arrayFields(i) then
			bFlag = true				'' 标志找到了匹配的排序字段
			exit for
		end if
	next


	if IsEmpty(sSorting) then
		sSorting = ""
	elseif bFlag = false then
		response.write "bFlag = false"&"<br>"
		sSorting = ""						'' 如果没有找到匹配的排序字段,则不排序
	else
		if sSorting = sSorted then	' 这一列是上次排序的列,则将iSorted的值置空""(降序排列),否则置iSort的值(升序排列)
			sDirection = " desc"
			sSortParams = "Sorting" & sSorting & "&Sorted=" & sSorted & "&"
			sSorted = ""
		else
			sDirection = " asc"
			sSortParams = "Sorting=" & sSorting & "&Sorted=" & "&"
			sSorted = sSorting
		end if
	end if
'	response.write "sSorting="&sSorting&"<br>"
'	response.write "sSorted="&sSorted&"<br>"
'	response.end
	if sSorting <> "" then
		sOrderby = " order by " & sSorting & sDirection
	end if
'	sOrderby = "order by nodiscarded_count asc"
End Sub


%>

⌨️ 快捷键说明

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