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

📄 plancompany.asp

📁 物业管理和办公自动化系统
💻 ASP
字号:
<%
'************************************************************************************************
' 文件名: plancompany.asp
' Copyright(c) 2001-2002 上海阿尔卡特网络支援系统有限公司
'
'  创建人 : 蔡晓燕
'  日 期 : 2002-06-11
' 修改历史 :
'   ****年**月**日 ****** 修改内容:**************************************************
' 功能描述 : 公司工作计划的查询和新增、维护,输入查询条件(指定计划种类,时间),列出查询结果
'  版 本 :
'************************************************************************************************
option explicit
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
%>

<!-- #include file="../include/config.inc" -->
<!-- #include file="../include/common.inc" -->
<!-- #include file="../include/debug.inc" -->
<!-- #include file="../include/db.inc" -->
<!-- #include file="../include/emp.inc" -->
<!-- #include file="../include/date.inc" -->
<!-- #include file="../include/datahandle.inc" -->
<!-- #include file="../include/recordlist.inc" -->
<!-- #include file="../include/security.inc" -->
<!-- #include file="../common/commonpage.inc" -->
<!-- #include file="plancompany.inc" -->

<%
call CheckSecurity()

'********************************************************************************************************
' 服务器端代码

'-------------------------------------------------------------------------------------------------------------------'********************************************************************************************************
' 如果是提交,则调用函数UpdatePlan()更新数据库
if UCase(Request.ServerVariables("REQUEST_METHOD") = "POST")  and (Request.Form("formAction") <> "quetype")then
	UpdatePlan()
end if
'------------------------------
' 分页相关的变量定义
'-------------------------------------------------------------------------------------------------------------------------------------------------
Dim sSQL, sWhere, sOrderby
Dim sFileName			: sFileName = "plancompany.asp"
Dim iEmpSerial				: iEmpserial = GetEmpSerial
Dim iTotalRecords		: iTotalRecords = 0			' 分页
Dim iRecordsPerPage	': iRecordsPerPage = 5
if iEmpSerial = GetOfficer then 
	iRecordsPerPage = 5
else 
	iRecordsPerPage = 10
end if
Dim iTotalPages			: iTotalPages = 0
Dim iCols					: iCols = 6
Dim iCurrentPage		: iCurrentPage = GetParam("Page")
Dim iSort					: iSort = GetParam("Sorting")
Dim iSorted				: iSorted = GetParam("Sorted")
Dim sSortParams		: sSortParams = ""
Dim sFormParams		: sFormParams = ""
Dim sDirection			: sDirection = ""

'-------------------------------------------------------------------------------------------------------------------------------------------------
' frmSearchPlan表单提交的查询参数,计划种类,年份,月份,季度,默认值为当年当月月度计划表
' frmUpdatePlan表单提交的公司工作计划参数,计划种类,年份,月份,季度,本月计划完成的工作,实施目标和措施,完成进度,责任人,备注
' frmReleasePlan表单提交的查询参数,计划种类,年份,月份,季度,发布状态,默认值为当年当月月度计划表
'-------------------------------------------------------------------------------------------------------------------------------------------------
Dim iSerial  :	iSerial = GetParam("serial")'在更新工作计划的时候传过来的参数,指该计划在T_Plan_Detail.Serial的值。
Dim iPlanSerial : iPlanSerial = GetParam("plan_serial")
Dim iType  :	iType = GetParam("type")
Dim iOf_year  : iOf_year = GetParam("of_year")
Dim iOf_month  : iOf_month = GetParam("of_month")
Dim iOf_season  : iOf_season = GetParam("of_season")
Dim iRelease	: iRelease = GetParam("release")
'if isempty(irelease) then
'	response.write "empty"
'else
'	response.write irelease
'end if
'response.end
Dim sContent:		sContent = GetParam("content")
Dim sTarget:		sTarget = GetParam("Target")
Dim sProgress:		sProgress = GetParam("Progress")
Dim sHandler:		sHandler = GetParam("handler")
Dim sMemo:		sMemo = GetParam("memo")
Dim sAction:	sAction = GetParam("formAction")'包括quetype,addtype,updtype,deltype四种  

'如果iPlanSerial<>"",那么iType,iOf_year,iOf_month,iOf_season的值由iPlanSerial得到
if (iPlanSerial <> "") and (not Isnull(iPlanSerial)) and (not IsEmpty(iPlanSerial)) then
	sSQL = "select * from T_plan where serial = "&iPlanSerial
	dim crs	: set crs = New CRecordset
	dim rs	: set rs = crs.open(dbLocal,sSQL)
	if not rs.EOF then
		iType = crs.GetValue("type")
		iOf_year = crs.GetValue("of_year")
		iOf_month = crs.GetValue("of_month")
		iOf_season = crs.GetValue("of_season")
		iRelease = crs.GetValue("release")
	end if
	crs.Close()
end if

'以下代码确定缺省的查询参数
if IsEmpty(iType) then iType = 1
if IsEmpty(iOf_year) then iOf_year = year(date)
if IsEmpty(iOf_month) or Isnull(iOf_month) or (iOf_month = "") then iOf_month = month(date)
if IsEmpty(iOf_season) or Isnull(iOf_season)  or (iOf_season = "") then iOf_season = 1
'if IsEmpty(iRelease) then 
'	iRelease = 1
'	response.write "iRelease is set to 1"
'	response.end
'end if
sFormParams = "type=" & iType & "&of_year=" & iOf_year & "&of_month=" & iOf_month & "&of_season=" & iOf_season & _ 
"&release=" & iRelease & "&"
'---------------------------------------------------------------------------------------------------------
'根据登录本页面的用户的身份不同,构造不同的页面,办公室主任可以编辑公司计划,其他人员只能查看已发布的公司计划
'---------------------------------------------------------------------------------------------------------
if GetEmpSerial = GetOfficer then
	'********************************************************************************************************
	' 根据查询的计划类型不同,构造分页的SQL语句
	'********************************************************************************************************
	select case iType 
	case 1'月度个人计划查询
		sSQL = "select * from T_Plan_Detail where plan_serial = (select serial from T_Plan where type = " &_
		ToSQL(iType, "Number") & " and of_year = " & ToSQL(iOf_year, "Number") & " and of_month = " & ToSQL(iOf_month, "Number") & " and scope = 3" & ")"
	case 2'季度个人计划查询
		sSQL = "select * from T_Plan_Detail where plan_serial = (select serial from T_Plan where type = " &_
		ToSQL(iType, "Number") & " and of_year = " & ToSQL(iOf_year, "Number") & " and of_season = " & ToSQL(iOf_season, "Number") & " and scope = 3" & ")"
	case 3'年度个人计划查询
		sSQL = "select * from T_Plan_Detail where plan_serial = (select serial from T_Plan where type = " &_
		ToSQL(iType, "Number") & " and of_year = " & ToSQL(iOf_year, "Number") & " and scope = 3"  & ")"
	end select
else
	'********************************************************************************************************
	' 根据查询的计划类型不同,构造分页的SQL语句
	'********************************************************************************************************
	select case iType 
	case 1'月度个人计划查询
		sSQL = "select * from T_Plan_Detail where plan_serial = (select serial from T_Plan where type = " &_
		ToSQL(iType, "Number") & " and of_year = " & ToSQL(iOf_year, "Number") & " and of_month = " & ToSQL(iOf_month, "Number") & " and scope = 3" & "and release = 1 " & ")"
	case 2'季度个人计划查询
		sSQL = "select * from T_Plan_Detail where plan_serial = (select serial from T_Plan where type = " &_
		ToSQL(iType, "Number") & " and of_year = " & ToSQL(iOf_year, "Number") & " and of_season = " & ToSQL(iOf_season, "Number") & " and scope = 3" & "and release = 1"  & ")"
	case 3'年度个人计划查询
		sSQL = "select * from T_Plan_Detail where plan_serial = (select serial from T_Plan where type = " &_
		ToSQL(iType, "Number") & " and of_year = " & ToSQL(iOf_year, "Number") & " and scope = 3"  & "and release =1 "  & ")"
	end select
end if
sOrderby = " order by T_Plan_Detail.serial"
'********************************************************************************************************
' 分页SQL语句构造完毕,调用PrepareListData进行分页前的准备
'-------------------------------------------------------------------------------------------------------------------------------------------------
dim arrayFields(4), sDelimiter
sDelimiter = "*"
arrayFields(0) = "content"
arrayFields(1) = "target"
arrayFields(2) = "progress"
arrayFields(3) = "handler"
arrayFields(4) = "memo"
call PrepareListData(sSQL & sWhere & sOrderBy, Join(arrayFields, sDelimiter), sDelimiter)
'response.end
'********************************************************************************************************

%>

<html>
<head>
<title>上海信息大楼 Shanghai Information Tower</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../common/common.css" type="text/css">
<script language="VBScript" src="../common/validate.vbs"></script>
<script language="VBScript" src="plantypechange.vbs"></script>
<script language="VBScript">
Sub btnSearch_OnClick()
	document.all.frmSearchPlan.submit()
End Sub

Sub btnUpdate_OnClick()
	dim sError
	sError = ValidateText("document.all.frmUpdatePlan.content", "工作计划", true, 50)
	if sError <> "" then
		msgbox sError
		exit sub
	end if
	sError = ValidateText("document.all.frmUpdatePlan.target", "实施目标和措施", false, 50)
	if sError <> "" then
		msgbox sError
		exit sub
	end if
	sError = ValidateText("document.all.frmUpdatePlan.progress", "完成进度", false, 25)
	if sError <> "" then
		msgbox sError
		exit sub
	end if
	sError = ValidateText("document.all.frmUpdatePlan.handler", "责任人", false, 25)
	if sError <> "" then
		msgbox sError
		exit sub
	end if
	sError = ValidateText("document.all.frmUpdatePlan.memo", "备注", false, 50)
	if sError <> "" then
		msgbox sError
		exit sub
	end if
	document.all.frmUpdatePlan.formAction.value = "updtype"
	document.all.frmUpdatePlan.submit()
End Sub

Sub btnDelete_OnClick()
	if  DeleteConfirm("这条工作计划") then
		document.all.frmUpdatePlan.formAction.value = "deltype"
		document.all.frmUpdatePlan.submit()
	end if
End Sub

Sub btnRelease_OnClick()
	document.all.frmReleasePlan.formAction.value = "reltype"
	document.all.frmReleasePlan.submit()
End Sub

Sub btnAdd_OnClick()
	dim sError
	sError = ValidateText("document.all.frmUpdatePlan.content", "工作计划", true, 50)
	if sError <> "" then
		msgbox sError
		exit sub
	end if
	sError = ValidateText("document.all.frmUpdatePlan.target", "实施目标和措施", false, 50)
	if sError <> "" then
		msgbox sError
		exit sub
	end if
	sError = ValidateText("document.all.frmUpdatePlan.progress", "完成进度", false, 25)
	if sError <> "" then
		msgbox sError
		exit sub
	end if
	sError = ValidateText("document.all.frmUpdatePlan.handler", "责任人", false, 25)
	if sError <> "" then
		msgbox sError
		exit sub
	end if
	sError = ValidateText("document.all.frmUpdatePlan.memo", "备注", false, 50)
	if sError <> "" then
		msgbox sError
		exit sub
	end if
	document.all.frmUpdatePlan.formAction.value = "addtype"
	document.all.frmUpdatePlan.submit()
End Sub

Sub btnReset_OnClick()
	document.all.frmUpdatePlan.reset()
End Sub

Sub btnClear_OnClick()
	document.all.frmUpdatePlan.reset()
End Sub

Sub btnCancel_OnClick()
	document.all.frmUpdatePlan.formAction.value = "cancel"
	document.all.frmUpdatePlan.submit()
'	location.href = "../workmgr/plancompany.asp"
End Sub

</script>
</head>

<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="../images/bg/bg0.jpg">
<br>

<%
Response.Write OuterTableHeader
Response.Write HeaderWithMenu
Response.Write InnerTableHeader
'********************************************************************************************************
' 主体从这里开始
'-------------------------------------------------------------------------------------------------------------------------------------------------
Response.Write TableSearch
'------------------------------------------------------
'根据不同类型的查询,显示不同的表头
'------------------------------------------------------
select case iType
case 1
	Response.Write MonthTableHeader
case 2
	Response.Write SeasonTableHeader
case 3
	Response.Write YearTableHeader
end select
'---------------------------------------------------------
'显示查询结果
'---------------------------------------------------------
Response.Write TableRecords(sSQL & sWhere & sOrderby, iCols, iRecordsPerPage, iTotalRecords, iCurrentPage, iTotalPages, sFileName, sFormParams, sSortParams )
'----------------------------------------------------------
'如果计划尚未发布,则显示发布公司工作计划的按钮
'----------------------------------------------------------
if GetEmpSerial = GetOfficer then
'response.write itype&"<br>"&iof_year&"<br>"&iof_month&"<br>"&iof_season
	select case iType 
	case 1'月度公司计划查询
		iRelease = DLookUp(dbLocal, "T_Plan", "release", "type = " & ToSQL(iType,"Number") &  "and of_year = " & ToSQL(iOf_year, "Number") & "and of_month = " & ToSQL(iOf_month, "Number") & "and scope = 3" )
	case 2'季度公司计划查询
		iRelease = DLookUp(dbLocal, "T_Plan", "release", "type = " & ToSQL(iType,"Number") &  "and of_year = " & ToSQL(iOf_year, "Number") & "and of_season = " & ToSQL(iOf_season, "Number") &  "and scope = 3" )
	case 3'年度公司计划查询
		iRelease = DLookUp(dbLocal, "T_Plan", "release", "type = " & ToSQL(iType,"Number") &  "and of_year = " & ToSQL(iOf_year, "Number") &  "and scope = 3" )
	end select
'	response.end
'	response.write "irelease is now ="&irelease
	if IsEmpty(iRelease) then 
		iRelease = 1
		response.write "iRelease is set to 1 again"
		response.end
	end if
'	if (not IsEmpty(iRelease)) and (iRelease <> "") and (iRelease = 0) then 
'		response.write BtnRelease(iType)
'		response.write "itype="&itype
'		response.end
'	end if
	if  (CStr(iRelease) = "0")  then 
		response.write BtnRelease(iType)
'		response.write "itype="&itype
'		response.end
	end if
end if
'----------------------------------------------------------
'如果当前用户是办公室主任,则显示更新/新添表单,以及连接
'----------------------------------------------------------
if GetEmpSerial = GetOfficer then 
	Response.Write FormUpdatePlan
	Response.Write TableLink()	
end if
'-------------------------------------------------------------------------------------------------------------------------------------------------
' 主体到这里结束
'********************************************************************************************************
Response.Write InnerTableTailer
Response.Write Footer
Response.Write OuterTableTailer
%>

</body>
</html>

⌨️ 快捷键说明

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