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

📄 addnew.asp

📁 功能齐全的oa系统
💻 ASP
字号:
<%option explicit%>
<!--#include virtual = "/Include/DataEnvi.asp"-->
<!--#include virtual = "/Include/String.asp"-->
<!--#include virtual = "/Include/Page.asp"-->
<!--#include virtual = "/Include/Function.asp"-->
<!--#include virtual = "/Include/SelectValue.asp" -->
<!--#include file    = "Function.asp" -->
<%
Dim objDB,objRS,strSQL
Dim ExecuteID,PassType,IsNeed,IsEnd
Dim SubmitOrder,LetMeEnd,strShowEnd
Dim flowName,intFlowID,CurrentFlowID,ParentID,NodeName
Dim strShowPre,StrOptionExecute,IsAllPass

Set objDB = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")
OpenDB objDB

LetMeEnd  = False
SubmitOrder = Request.Form("SubmitOrder")
IF SubmitOrder = "" Then  SubmitOrder = 0
SubmitOrder = SubmitOrder + 1

flowName  = FixSQL(Request.Form("flowName"))
NodeName  = FixSQL(Request.Form("NodeName"))
ExecuteID = Request.Form("ExecuteID")
PassType  = Request.Form("PassType")
IsNeed    = Request.Form("IsNeed")
IsEnd     = Request.Form("IsEnd")
intFlowID = Request.Form("intFlowID")
ParentID  = Request.form("CurrentFlowID")
IsAllPass = Request.form("IsAllPass")

If PassType = "" Then PassType = 0
If IsNeed = "" Then IsNeed = 0
If IsEnd = "" Then IsEnd = 0
If IsAllPass = "" Then IsAllPass = 0


If Request.Form("isLastTime") = "True"  Then
  strSQL  = "select IsValid From t_OA_Work_Flow Where ID = " & Request.Form("intFlowID") 
  objRS.Open strSQL,objDB,1,3
  objRS.Fields("IsValid") = 1
  objRS.Update()
  objRS.Close()
  Response.Redirect "List.asp"
' Response.Write "<script language=javaScript>window.close()</script>"      ' 在这里退出
End If

If SubmitOrder = 2 Then '第一次提交,操作两个表,添加三条记录
  
  strSQL    = "Select * from t_OA_Work_Flow"
  objRS.Open strSQL,objDB,1,3
  objRS.AddNew()
  objRS.Fields("flowName")  = flowName
  objRS.Update()
  intFlowID = objRS.Fields("ID")
  intFlowID = Replace(intFlowID, " ", "") 
  objRS.Close()


  strSQL    = "select * from t_OA_Work_Flow_Node"
  objRS.Open strSQL,objDB,1,3

  objRS.AddNew()
  objRS.Fields("NodeName")  = NodeName
  objRS.Fields("FlowID")    = intFlowID
  objRS.Fields("ParentID")  = 0
  objRS.Fields("ChildID")  = -1
  objRS.Fields("ExecuteID") = ExecuteID
  objRS.Fields("PassType")  = PassType
  objRS.Fields("IsNeed")    = IsNeed
  objRS.Fields("IsEnd")   = 1
  objRS.Fields("IsAllPass") = IsAllPass
  objRS.Update()
  CurrentFlowID = objRS.Fields("ID")
  objRS.Close()

  
  IF IsEnd  = 1 Then
    LetMeEnd  = True
    strSQL  = "Select * from t_OA_Work_Flow_Node where FlowID = " & IntFlowID & " Order By id "
    objRS.Open strSQL,objDB,1,3
    strShowEnd  = ""
    Do While Not objRS.EOF
      strShowEnd  = strShowEnd  & "<tr><td>"  & objRS.Fields("ExecuteID") & "</td>" & vbcrlf
      strShowEnd  = strShowEnd  & "<td>"    & objRS.Fields("PassType")  & "</td>" & vbcrlf
      strShowEnd  = strShowEnd  & "<td>"    & objRS.Fields("IsNeed")    & "</td>" & vbcrlf
      strShowEnd  = strShowEnd  & "</tr>"
      objRS.MoveNext()
    Loop
    objRS.Close()
  End If
  
End If

If SubmitOrder > 2 Then '以后提交只需操作一个表,添加一条记录
  StrSQL    = "Update t_OA_Work_Flow_Node Set IsEnd = 0 Where FlowID = " & IntFlowID
  objDB.Execute StrSQL
  
  strSQL    = "select * from t_OA_Work_Flow_Node"
  objRS.Open strSQL,objDB,1,3
  objRS.AddNew()
  objRS.Fields("NodeName")  = NodeName
  objRS.Fields("FlowID")    = intFlowID
  objRS.Fields("ParentID")  = ParentID
  objRS.Fields("ChildID")   = -1
  objRS.Fields("ExecuteID") = ExecuteID
  objRS.Fields("PassType")  = PassType
  objRS.Fields("IsNeed")    = IsNeed
  objRS.Fields("IsEnd")   = 1
  objRS.Fields("IsAllPass") = IsAllPass
  objRS.Update()
  CurrentFlowID = objRS.Fields("ID")
  objRS.Close()
  
  StrSQL = "Update t_OA_Work_Flow_Node Set ChildID = " & CurrentFlowID & " Where ID = " & ParentID
  objDB.Execute StrSQL
  
  IF IsEnd  = 1 Then
    LetMeEnd  = True
  End If
End If

StrOptionExecute = GetOption(ObjDB,"Select AccountID,TrueName From t_OA_SYS_Account_Character",0)

Sub Main()
%> 
<form name="thisForm" onsubmit="return(CheckForm(this))" method="post" action="">
<!-------------工作流名称显示区域--------------------------------->
<table class=Ltable cellspacing=1 cellpadding=3>
<tr class=LHtr>
<td width=20%>新增工作流</td>
<td width=80%></td>
</tr>
<%If SubmitOrder=1 Then%>
<tr class=Ltr>
<td>工作流名称:</td>
<td><input name=flowName Check=1 Show="工作流名称" class=Input></td>
</tr>
<%End If%>
</table>
<!--------------------------------------------------------------->


<!-------------工作流流程图显示区域--------------------------------->
<%
  If intFlowID<>"" Then
%>
<table class=Ltable cellspacing=1 cellpadding=3>
<tr>
  <td>
  <table><tr>
  <td><%Call DrawNode("起始节点","创建人",1,0,2)%></td>
  <td><img src="<%=Application("RootPath")%>Images/OA/Work/Flow/Next.gif"></td>
<%
  strSQL  = "select * from t_OA_Work_Flow_Node where FlowID = " & intFlowID
  objRS.Open strSQL,objDB,1,3
  Do While Not objRS.EOF 
%>
  <td><%Call DrawNode(ObjRS("NodeName"),Replace(GetTrueNames(ObjDB,ObjRS("ExecuteID")),Vbcrlf,"<br>"),ObjRS("IsAllPass"),ObjRS("PassType"),ObjRS("IsNeed"))%></td>
  <td><img src="<%=Application("RootPath")%>Images/OA/Work/Flow/Next.gif"></td>
<%
    objRS.MoveNext()  
  Loop
  objRS.Close()
  If LetMeEnd Then
%>
  <td><%Call DrawNode("结束节点","归档人",1,0,2)%></td>
<%
  End If
%>
  </tr></table>
  </td>
</tr>
</table>
<%
  End If
%>
<!--------------------------------------------------------------->

<!-------------新增加工作流节点显示区域--------------------------------->
<%
  If Not LetMeEnd Then
%>
<table class=Ltable cellspacing=1 cellpadding=3>
<tr class=LHtr>
<td width=20%>下一个节点信息</td>
<td width=80%></td>
</tr>
<tr class=Ltr>
<td>节点名称</td>
<td><input name=NodeName class=Input Check=1 Show="节点名称"></td>
</tr>
<tr class=Ltr>
<td valign=top>处理人</td>
<td><select name=ExecuteID class=Input multiple size=10 Check=1 Show="处理人"><%=StrOptionExecute%></select></td>
</tr>
<tr class=Ltr>
<td></td>
<td>
<input type=Checkbox name=passType value="1" checked>需要审核(处理人明确给出通过或者不通过)<br>
<input type=Checkbox name=IsNeed value="1" checked>需要等待本节点处理后才流向下个节点<br>
<input type=Checkbox name=IsAllPass value="1" >需要节点内所有人员处理<br>
<input type=CheckBox name=IsEnd value="1">结束点
</td>
</tr>
</table>
<input type=submit class=button value="下一步">
<input type=hidden name=IsSubmit value="True">
<input type=hidden name=SubmitOrder value="<%=SubmitOrder%>">
<input type=hidden name=intFlowID value="<%=intFlowID%>">
<input type=hidden name= CurrentFlowID value="<%=CurrentFlowID%>">
</form>
<%
  Else
%>
<Form action="" method="post">
<input type=hidden name=isLastTime value="True">
<input type=hidden name=intFlowID value="<%=intFlowID%>">
<input type=submit class=button value="确    定">
</Form>
<%
  END IF
  
End Sub
%>  
<!--#include file ="Templet.asp"-->

⌨️ 快捷键说明

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