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

📄 复件 z_common.asp

📁 物业管理和办公自动化系统
💻 ASP
字号:
<%
	If Request.QueryString("m") <> "f" Then
		'not without menu==have menu
%>
<!-- #INCLUDE FILE="../u_menu.asp" -->
<%
	Else
%>
<%
	End If
	'Response.write(Request.ServerVariables("URL"))
	'CheckSecurity(Request.ServerVariables("URL"))
%>

<%
	Dim oConn			'Connection
	Dim oRs				'RecordSet
	Dim PageErr			'PageErr

	PageErr=""

	Sub DBConnect(strDSN,strUID,strPW)
		'dims
		Dim strConn

		'make connection
		set oConn=Server.CreateObject("ADODB.Connection")
		'strConn="Provider=SQLOLEDB;DSN=flowdb;SERVER=(local);User Id=admin;Password=''"
		strConn="Provider=SQLOLEDB;DSN=" & strDSN
		strConn=strConn & ";SERVER=(local);User Id=" & strUID 
		strConn=strConn & ";Password=" & strPW

		'oConn.open strConn
		oConn.open "InforTower_old","infor","tower"
	End Sub

	Sub DBExecute(strSQL)
        oConn.Execute strSQL
	End Sub

	Sub DBQuery(strSQL)
		set oRs=oConn.Execute (strSQL)
	End Sub

	Sub DBEndQuery
		oRs.Close
		Set oRs=nothing
	End Sub

	Sub DBDisconnect
		oConn.Close
		Set oConn=nothing
	End Sub	

	Sub MyDBConnect
		Dim strDSN
		Dim strUID
		Dim strPW
		
		strDSN=Application("DSN")
		strUID=Application("DBUID")
		strPW=Application("DBPW")
'		DBConnect strDSN,strUID,strPW
		DBConnect "flowdb","admin",""
	End Sub


	Sub MenuIndex
		Dim strURL
		Dim nodeId
		Dim strSplit
		Dim strSQL

		If Request.QueryString("m") <> "f"  Then
		strURL=Request.ServerVariables("URL")
		nPos=InstrRev(strURL,"/")
		strFileName=Mid(strURL,nPos+1)
		'Response.Write("<p>" & strFileName)

		MyDBConnect
	
'		strSplit=" --〉"
		strSplit = " <img src=""../images/arrowr.gif""> "
		strSQL="select * from t_audit_node where node_file='" & strFileName & "'"
		DBQuery(strSQL)
		strOut=oRs("node_name")
		nodeId=oRs("node_parent_id")
		DBEndQuery
		While nodeId > 0
			strSQL="select * from t_audit_node where node_id = " & nodeId
			DBQuery(strSQL)
			strOut= strSplit & strOut 
			strOut= oRs("node_name") & "</a>"  & strOut
			strOut="<a href='" & oRs("node_file") & "'>" & strOut
			nodeId=oRs("node_parent_id")
			DBEndQuery
		Wend
		
		Response.Write(strOut)

		DBDisconnect
		
		End If
	End Sub

	Sub FlowStateChange(flowId,opCode)
		MyDBConnect
		strSQL="select flow_stat from t_flow where flow_id=" & flowId
		DBQuery(strSQL)
		'1-运行 2-暂停 3-终止 4-完成
		'1-启动流程 2-暂停流程 3-终止流程 4-结束流程
		stat=oRs("flow_stat")
		Select Case opCode
			Case 1
				'1-启动流程 2->1
				if stat=2 Then
					strSQL="update t_flow set flow_stat=1 where flow_id=" & flowId
					DBExecute strSQL
					strSQL="select cur_step from t_cur_step where flow_id=" & flowId
					DBQuery(strSQL)
					if oRs("cur_step")=0 Then
						strSQL="update t_cur_step set cur_step=cur_step+1 where flow_id=" & flowId
						DBExecute strSQL
					End If
				Else
					ErrorDisplay("当前状态不能启动流程")
				End If
			Case 2
				'2-暂停流程 1->2
				if stat=1 Then
					strSQL="update t_flow set flow_stat=2 where flow_id=" & flowId
					DBExecute strSQL
				Else
					ErrorDisplay("当前状态不能暂停流程")
				End If
			Case 3
				'3-终止流程 1,2->3
				if stat=1 Or stat=2 Then
					strSQL="update t_flow set flow_stat=3 where flow_id=" & flowId
					DBExecute strSQL
					'special for meeting
					MeetingEnd(flowId)
				Else
					ErrorDisplay("当前状态不能终止流程")
				End If
			Case 4
				'4-结束流程
				if stat=1 Then
					strSQL="update t_flow set flow_stat=4 where flow_id=" & flowId
					DBExecute strSQL
					'special for meeting
					MeetingEnd(flowId)
				Else
					ErrorDisplay("当前状态不能结束流程")
				End If
			Case Else
				ErrorDisplay("无法修改流程状态")
		End Select
	End Sub

	Sub ErrorDisplay(str)
		'Response.Write(str)
	End Sub

	Sub MeetingEnd(fid)
	    Dim tempid
		Dim str
		tempid=fid	

		strSQL="select flow_file from t_flow where flow_id=" & tempid
		DBQuery(strSQL)
		'response.write(strSQL)
		str=oRs("flow_file")
		'DBEndQuery
		pos1=Instr(str,"mtype=0")
		If pos1>0 Then
			strSQL="update T_MeetingPrepare set meeting_status=2 , Isconfirmed=1 , Approve_flow=" & tempid & " where meeting_serial=" & GetSubject(str) & ""
			'response.write(strSQL)
			'response.end
			DBExecute strSQL
			Exit Sub
		End If
		pos2=Instr(str,"mtype=1")
		If pos2>0 Then
			strSQL="update T_meetingprepare set meeting_status=7 , Isconfirmed=1 , Approve_flow=" & tempid & " where meeting_serial=" & GetSubject(str) & ""
			DBExecute strSQL
			Exit Sub
		End If
	End Sub

	Sub MeetingEnd1(fid)
	    Dim tempid
		Dim str
		tempid=fid	

		strSQL="select flow_file from t_flow where flow_id=" & tempid
		DBQuery(strSQL)
		'response.write(strSQL)
		str=oRs("flow_file")
		'DBEndQuery
		pos1=Instr(str,"mtype=0")
		If pos1>0 Then
			strSQL="update T_MeetingPrepare set meeting_status=2 , Isconfirmed=0 , Approve_flow=" & tempid & " where meeting_serial=" & GetSubject(str) & ""
			'response.write(strSQL)
			'response.end
			DBExecute strSQL
			Exit Sub
		End If
		pos2=Instr(str,"mtype=1")
		If pos2>0 Then
			strSQL="update T_meetingprepare set meeting_status=7 , Isconfirmed=0 , Approve_flow=" & tempid & " where meeting_serial=" & GetSubject(str) & ""
			DBExecute strSQL
			Exit Sub
		End If
	End Sub

	Sub MeetingStart(se)
	    Dim tempid
		Dim str
		tempid=fid	

		strSQL="update T_MeetingPrepare set meeting_status=6 where meeting_serial=" & se
			'response.write(strSQL)
			'response.end
		DBExecute strSQL
	End Sub

	Function GetSubject(str)
		result=str
		'response.write(result & "||")
		pos1=InStr(str,"subject=")
		If pos1 > 0 Then
		    pos1=pos1+8
			pos2=InStr(pos1,str,"&")
'			response.write(pos2)
			If pos2 > 0 Then
				GetSubject=Mid(str,pos1,pos2-pos1)
			Else
				GetSubject = Mid(str,pos1)
			End If
'			response.write(GetSubject)
		Else
		    'response.write("here")
			GetSubject=result	
		End If
	End Function

	Function GetURL(str)
		GetURL=str
		
	End Function

	Sub EndMS(fid)
		
	End Sub

	Sub FlowNewTask(flowId, arg)
		Dim op
		Dim flowName
		Dim authorId

		strSQL="select flow_name,flow_author_id from t_flow where flow_id=" & flowId
		DBQuery(strSQL)
		flowName=oRs("flow_name")
		authorId=oRs("flow_author_id")
		
		If arg=0 Then
			'next step
		strSQL="select step_op_person  from t_flow_step a,t_cur_step b "
		strSQL=strSQL & "where a.flow_id=b.flow_id and a.flow_id =" & flowId & " and a.step_no = b.cur_step"

		DBQuery(strSQL)
		op=oRs(0)
        strSQL="proc_NewTask '请审批如下流程', '流程名:" & flowName & "', '" & authorId & "','','','" & op & "', 1,'',''"
		DBQuery(strSQL)
		'r=oRs(0)
		'if r<0 Then
		'	response.write("Error Happen, errorcode=" & r)
		'End If
		Else 
			'end
       ' strSQL="proc_NewTask '流程审批结束', '" & flowName & "', '" & authorId & "','','','" & authorId & "', 1,'',''"
	        strSQL= "proc_NewMessage 1,'如下流程审批结束','流程名:" & flowName & "','"& authorId & "','"& authorId &"',0 "
			'response.write(strSQL)
			
			'response.end
			DBQuery(strSQL)
			'response.end
			'r=oRs(0)
			'if r<0 Then
			'	response.write("Error Happen, errorcode=" & r)
			'End If
		End If
	End Sub	
%>


⌨️ 快捷键说明

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