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

📄 position.inc

📁 物业管理和办公自动化系统
💻 INC
字号:
<%
Function ListTableHeader()
	ListTableHeader = _
		"<table cellspacing=1 cellpadding=0 width=300 align=center bgcolor=white style=""table-layout:fixed"">" & vbLF & _
		"<tr style=""display:none"">" & vbLF & _
		"	<td width=120>这一行仅用于控制表格宽度</td>" & vbLF & _
		"	<td width=""*""></td>" & vbLF & _
		"</tr>" & vbLF & _
		"<tr><td colspan=" & iCols & " bgcolor=""#0040a0"" align=center style=""color:white;font-weight:600"" height=20>职务列表</td></tr>" & vbLF & _
		"<tr>" & vbLF & _
		"	<td class=tdHead>&nbsp;<img src=""../images/bg/ar-y.gif"" width=8 height=8>" & vbLF & _
				TableHeaderField(sFileName, "description", "职务名称", sFormParams, iSort, iSorted) & "</td>" & vbLF & _
		"	<td class=tdHead align=center>" & vbLF & _
				TableHeaderField(sFileName, "admin_level", "管理级别", sFormParams, iSort, iSorted) & "</td>" & vbLF & _
		"	<!--td class=tdHead width=100 align=center>" & vbLF & _
				TableHeaderField(sFileName, "role", "缺省角色", sFormParams, iSort, iSorted) & "</td-->" & vbLF & _
		"</tr>" & vbLF
End Function

Function ListTableTailer()
	ListTableTailer = "</table>"
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
	
	'------------------------------------
	' 获取数据库连接
	'------------------------------------
	dim crs	: set crs = New CRecordset
	dim rs	: set rs = crs.open(dbLocal,sSQL)
	dim iPositionId, sPositionDescription
	dim sAdminLevel, sDefaultRole
	dim sColor	

	' 如果未到记录尾,将记录定位到你翻到的页面的第一个记录,否则显示空行
	if Not rs.EOF then	
		rs.Move (iCurrentPage - 1) * iRecordsPerPage
	end if
	while not rs.EOF and iCounter <= iRecordsPerPage
		iPositionId				= crs.GetValue("id")
		sPositionDescription	= crs.GetValue("description")
		sAdminLevel = crs.GetValue("admin_level")
		sDefaultRole = crs.GetValue("role")

		select case sAdminLevel
			case 0
				sAdminLevel = "<span style=""color:gray"">( 未定义 )</span>"
			case 1
				sAdminLevel = "公司领导"
			case 2
				sAdminLevel = "部门经理"
			case 3
				sAdminLevel = "普通员工"
			case else
				sAdminLevel = "<span style=""color:gray"">( 未定义 )</span>"
		end select


		if CStr(iPositionId) = CStr(pPositionId) then		'' 如果是选中的纪录,显示不同的颜色,这里指定红色
				sColor = "red"
		else
				sColor = "black"
		end if
		sTemp = sTemp & "<tr bgcolor=white>" & vbLF & _
				"<td class=tdlist title=""" & sPositionDescription & """ style=""cursor:hand;color:" & sColor & """ onclick=""javascript:location.href='position.asp?id=" & iPositionId & "';"">&nbsp;<img src=""../images/bg/ar-g.gif"" width=8 height=8>&nbsp;" & Bref(sPositionDescription,6) & "&nbsp;</td>" & vbLF & _
				"<td class=tdlist align=center>" & sAdminLevel & "</td>" & vbLF & _
				"<!--td class=tdlist title=""" & sDefaultRole & """ align=center>" & sDefaultRole & "</td-->" & vbLF & _
				"</tr>" & vbLF
		iCounter = iCounter + 1
		rs.movenext
	wend
	crs.Close()

	' 填补空白行
	sTemp = sTemp & WhiteRows(iCols, iCounter, iRecordsPerPage)

	' 首页、前页、后页、尾页等分页信息
	sTemp = sTemp & "<tr bgcolor=white><td class=tdlist colspan=" & iCols & " align=right>" & vbLF & _
				Paginate(sFileName, sFormParams, sSortParams, iCurrentPage, iTotalPages) & vbLF & _
				"&nbsp;</td></tr>" & vbLF

	ListTableRecords = sTemp
End Function


Function FormTable()
	dim sPosition, sActionLinks
	if IsEmpty(pPositionId) then
		sPosition = "新增职务"			'' 显示新增、取消的链接
		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 & _
				"		&nbsp;&nbsp;&nbsp;&nbsp;" & vbLF & _
				"		<img border=0 src=""../images/button/clear.gif"" onclick=""btnClear_OnClick()"" style=""cursor:hand"">" & vbLF & _
				"	</td>" & vbLF & _
				"</tr>" & vbLF
	else
		sPosition = "修改职务相关信息"			'' 显示修改、删除、取消的链接
		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 & _
				"		&nbsp;&nbsp;&nbsp;&nbsp;" & vbLF & _
				"		<img border=0 src=""../images/button/delete.gif"" onclick=""btnDelete_OnClick()"" style=""cursor:hand"">" & vbLF & _
				"		&nbsp;&nbsp;&nbsp;&nbsp;" & 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=""position.asp"">" & vbLF & _
		"<input type=""hidden"" name=""FormAction"">" & vbLF & _
		"<input type=""hidden"" name=""id"" value=""" & pPositionId & """>" & vbLF & _
		"<tr height=20>" & vbLF & _
		"		<td colspan=2 background=""../images/bg/bnbg.gif"" style=""color:white;font-weight:600"" align=center>" & sPosition & "</td></tr>" & vbLF & _
		"<tr height=20><td></td></tr>" & vbLF & _
		"<tr height=30>" & vbLF & _
		"		<td width=80 align=right>职务名称:</td>" & _
		"		<td><input type=""text"" name=""description"" value=""" & sPositionDesp & """ size=31 maxlength=10></td></tr>" & vbLF & _
		"<tr height=30>" & vbLF & _
		"		<td align=right>管理级别:</td>" & vbLF & _
		"		<td><select name=""admin_level"" style=""width:200"">" & _
		"				<option value=""0"" style=""color:black"">[ 请选择对应的管理级别 ]</option>" & vbLF & _
		"				<option value=""1"">公司领导(总经理及总经理助理等)</option>" & vbLF & _
		"				<option value=""2"">部门经理</option>" & vbLF & _
		"				<option value=""3"">普通员工</option>" & vbLF & _
		"				</select></td>" & vbLF & _
		"</tr>" & vbLF & _
		"<tr height=30 style=""display:none"">" & vbLF & _
		"		<td align=right>缺省角色:</td>" & vbLF & _
		"		<td><select name=""default_role"" style=""width:200"">" & vbLF & _
		"				<option value=""0"" style=""color:black"">[ 请选择角色 ]</option>" & vbLF & _
						selectOptions(dbLocal, "t_role", "role_id", "role_desp", sDefaultRole, "") & vbLF & _
		"				</select></td>" & vbLF & _
		"</tr-->" & vbLF & _
		sActionLinks & vbLF & _
		"<tr height=30><td></td></tr>" & vbLF & _
		"<tr height=148><td></td></tr>" & vbLF & _
		"</form>" & _
		"</table>" & vbLF & _
		"<script language=""javascript"">frmMgr.admin_level.value='" & sAdminLevel & "';</script>"
End Function



Function TableLink()
	TableLink = _
		"<table width=600 cellspacing=0 cellpadding=0 border=0 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>&nbsp;" & _
		"		<img src=""../images/goto.gif"">&nbsp;<a href=""title.asp"">职称管理</a>" & _
		"		&nbsp;" & _
		"		<img src=""../images/goto.gif"">&nbsp;<a href=""emp_ol.asp"">员工信息查询</a></td>" & _
		"</tr>" & _
		"</table>"
End Function


sub AddPosition()
	dim sSQL, iRows
	sPositionDesp = Trim(GetParam("description"))
	sAdminLevel = GetParam("admin_level")
	sDefaultRole = GetParam("default_role")

	'' 类别名称不能为空
	if sPositionDesp = "" then
		Response.Write _
				"<script language=""javascript"">" & vbLF & _
				"		alert(""对不起,请输入职务名称"");" & vbLF & _
				"</script>" & vbLF
		exit sub
	end if

	'' 检查是否存在重复的类别名称
	iRows = DLookUp(dbLocal, "t_position", "count(*)", "position_desc =" & ToSQL(sPositionDesp, "Text"))
	if iRows > 0 then
		Response.Write _
				"<script language=""javascript"">" & vbLF & _
				"		alert(""对不起,已经存在名称为“" & sPositionDesp & "”的职务,职务名称不能重复!"");" & vbLF & _
				"</script>" & vbLF
		exit sub
	end if
	sSQL = "insert into t_position(position_desc, admin_level, default_role)" & _
				" values(" & ToSQL(sPositionDesp, "Text") & _
				", " & ToSQL(sAdminLevel, "Number") & _
				", " & ToSQL(sDefaultRole, "Number") & _
				")"
'	response.write sSQL : response.end
	call ExecuteSQL(dbLocal, sSQL)
	pPositionId = empty		'' 重新置成新增状态
	sPositionDesp = ""
end sub

sub UpdatePosition()
	dim sSQL, iRows
	sPositionDesp = Trim(GetParam("description"))
	sAdminLevel = GetParam("admin_level")
	sDefaultRole = GetParam("default_role")

	'' 类别名称不能为空
	if sPositionDesp = "" then
		Response.Write _
				"<script language=""javascript"">" & vbLF & _
				"		alert(""对不起,请输入职务名称"");" & vbLF & _
				"</script>" & vbLF
		exit sub
	end if

	'' 检查是否存在重复的类别名称
	iRows = DLookUp(dbLocal, "t_position", "count(*)", "position_desc=" & ToSQL(sPositionDesp, "Text") & " and position_id<>" & ToSQL(pPositionId,"Number"))
	if iRows > 0 then
		Response.Write _
				"<script language=""javascript"">" & vbLF & _
				"		alert(""对不起,职务名称不能重复!"");" & vbLF & _
				"</script>" & vbLF
		exit sub
	end if
	sSQL = "update t_position" & _
				" set position_desc = " & ToSQL(sPositionDesp, "Text") & _
				", admin_level = " & ToSQL(sAdminLevel, "Number") & _
				", default_role = " & ToSQL(sDefaultRole, "Number") & _
				" where position_id = " & ToSQL(pPositionId, "Number")
	call ExecuteSQL(dbLocal, sSQL)
	pPositionId = empty
	sPositionDesp = ""
end sub

sub DeletePosition()
	sPositionDesp = Trim(GetParam("description"))
	dim sSQL, iRows

	'' 检查是否存在重复的类别名称
	iRows = DLookUp(dbLocal, "t_employee", "count(*)", "pos =" & ToSQL(pPositionId, "Number") & " and dismissed=0")
	if iRows > 0 then
		Response.Write _
				"<script language=""javascript"">" & vbLF & _
				"		alert(""对不起,系统中有" & iRows & "位职务为“" & sPositionDesp & "”的在职员工,该职务名称不能删除!"");" & vbLF & _
				"</script>" & vbLF
		exit sub
	end if
	sSQL = "delete from t_position where position_id = " & ToSQL(pPositionId, "Number")
	call ExecuteSQL(dbLocal, sSQL)
	pPositionId = empty		'' 重新置成新增状态
	sPositionDesp = ""
end sub
%>

⌨️ 快捷键说明

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