document_editsave.asp

来自「OFFICE办公自动化」· ASP 代码 · 共 533 行 · 第 1/2 页

ASP
533
字号
<%
'功能:保存公文并流转公文
'作者:展亮
'日期:2004-6-1 14:36
%>

<!--#include file="../inc/Secure.asp"-->
<!--#include file="../inc/Conn.asp"-->
<!--#include file="../inc/Const.asp"-->

<%
Response.Buffer=true
'------------------------------------------------设置参数
LoginID=trim(session("LoginID")) : if LoginID="" then LoginID=0 '当前用户ID
'------------------------------------------------
'=====================================================================================保存公文
mRecordID = request.form("RecordID")'公文编号
mTemplate = request.form("Template")'模板编号
mFileType = request.form("FileType")'文件类型
mHtmlPath = request.form("HtmlPath")'生成html文件页面路径及文件名
mStatus   = request.form("Status")  '文件状态
mStep	  = request.form("Step")    '流程号
'--------------------------------------------
mDocFileNo = request.form("DocFileNo")		 	'公文文号
mDocType = request.form("DocType")	     	 	'内外部公文
mDocType = request.form("DocMod")			'收发文
mDC_Doc_Sort 	= request.form("DC_Doc_Sort")	  	'公文种类
mDC_Doc_Security = request.form("DC_Doc_Security")	'公文密级
mDC_Doc_Exigence = request.form("DC_Doc_Exigence")	'公文紧急程度
mSubject 	= request.form("Subject")		'公文标题
mMainTitle = request.form("MainTitle")		  	'主题词
mMemo = request.form("Memo")			  	'摘要
mPSend_Dept = request.form("PSend_Dept")	  	'发文单位
mMSend_Dept = request.form("MSend_Dept")		'主送单位
mCSend_Dept = request.form("CSend_Dept")		'抄送机关
mCReport_Dept = request.form("CReport_Dept")		'报送机关
mMarker_ID = request.form("Marker_ID")	  		'签字人
mDo_Advice = request.form("Do_Advice")			'附注
mAuthor 	= request.form("Author")		'拟稿人
mFileDate = request.form("FileDate")			'拟稿日期
mDept = request.form("Dept")				'拟稿部门
mSign_Man = request.form("Sign_Man") 			'签发人
mSign_Date = request.form("Sign_Date") 			'签发日期
mRegistration_Man = request.form("Registration_Man")	'登记人
mRegistration_Date = request.form("Registration_Date")  '登记日期
mXyblry = request.form("xyblry")  '下一办理人员
'------------------------------------------------
'response.write mDC_Doc_Sort
Sql="SELECT * from tbioaOffice_Document Where RecordID='" + mRecordID + "'"
Set Rs=Server.CreateObject("ADODB.RecordSet")
Rs.Open Sql,oConn,1,3
if Rs.eof then
	Rs.addnew
end if

'--------------------------------------------
if mRecordID <> "" then Rs("RecordID")=mRecordID			    '公文编号
if mTemplate <> "" then Rs("Template")=mTemplate			    '模板编号
if mFileType <> "" then Rs("FileType")=mFileType			    '文件类型
if mHtmlPath <> "" then Rs("HtmlPath")=mHtmlPath			    '生成html文件页面路径及文件名
Rs("Status")="NONE"							    '文件状态
Rs("LockUserID")=0							    '锁定人
Rs("LockTime")=""							    '锁定时间
if mStep <> "" then Rs("Step")=mStep  					    '流程号
if mDocFileNo <> "" then Rs("DocFileNo") = mDocFileNo		 	    '公文文号
if mDocType <> "" then Rs("DocType")=mDocType	     	 		    '内外部公文
if mDocMod <> "" then Rs("DocMod")=mDocMod	     	 		    '内外部公文
if mDC_Doc_Sort <> "" then  Rs("DC_Doc_Sort")=mDC_Doc_Sort	  	    '公文种类
if mDC_Doc_Security <> "" then Rs("DC_Doc_Security")=mDC_Doc_Security	    '公文密级
if mDC_Doc_Exigence <> "" then RS("DC_Doc_Exigence")=mDC_Doc_Exigence	    '公文紧急程度
if mSubject <> "" then Rs("Subject")=mSubject				    '公文标题
if mMainTitle <> "" then Rs("MainTitle")=mMainTitle	   		    '主题词
if mMemo <> "" then Rs("Memo")=mMemo			  		    '摘要
if mPSend_Dept <> "" then Rs("PSend_Dept")=mPSend_Dept	  		    '发文单位
if mMSend_Dept <> "" then Rs("MSend_Dept")=mMSend_Dept			    '主送单位
if mCSend_Dept <> "" then  Rs("CSend_Dept")=mCSend_Dept			    '抄送机关
if mCReport_Dept <> "" then Rs("CReport_Dept")=mCReport_Dept		    '报送机关
if mMarker_ID <> "" then Rs("Marker_ID")=mMarker_ID			    '签字人
if mDo_Advice <> "" then Rs("Do_Advice")=mDo_Advice			    '附注
if mAuthor <> "" then Rs("Author")=mAuthor				    '拟稿人
if mFileDate <> "" then Rs("FileDate")=mFileDate			    '拟稿日期
if mDept <> "" then Rs("Dept")= mDept					    '拟稿部门
if mSign_Man <> "" then Rs("Sign_Man")=mSign_Man 			    '签发人
if mSign_Date <> "" then Rs("Sign_Date")= mSign_Date			    '签发日期
if mRegistration_Man <>"" then Rs("Registration_Man")=mRegistration_Man	    '登记人
if mRegistration_Date <>"" then Rs("Registration_Date")=mRegistration_Date  '登记日期
Rs.Update
Rs.close
'=====================================================================================

'=====================================================================================流转操作
'保存前判断条件
'1:判断此公文是否存在
'2:判断此公文是否已被撤销或完成
'3:判断此公文正文是否被锁定
'4:判断此办理记录是否存在
'5:判断办理记录可修改标志

mCZLX = request.form("CZLX")'操作类型
mBLXH = request.form("BLXH")'办理序号

oConn.BeginTrans '开始事务

if mRecordID="" or mBLXH="" then
   call error_wer("缺少必要参数")
end if
'-------------------------------------------------------保存办理表
sql="select * from tbioaOffice_Flow_Blqk where RecordID='"&mRecordID&"' and BLXH="&mBLXH
rs.Open sql,oConn,3,2
   if rs("blr")&""<>LoginID then
      rs("dlr")=LoginID '代理人ID
   else
      rs("dlr")=NUll
   end if
   rs("blrq")=date() '办理日期
   rs("blyj")=mDo_Advice '办理意见(附注)
   rs("blbz")="Y" '办理标志设为已办理
   tjlzbj=rs("tjlzbj")'推进流转标志(1全部完成继续/0一人完成继续)
   gzdxh=rs("gzdxh")'工作点序号
rs.Update
rs.close
'-------------------------------------------------------

'-------------------------------------------------------操作函数
'把上一工作点的修改标志置为不可修改
function gwlz_pub1(gwxh,blxh)
  dim psql,prs,psgzdxh
  set prs=createobject("adodb.recordset")
  psql="select sgzdxh from tbioaOffice_Flow where RecordID='"&gwxh&"' and zgzdxh=(select gzdxh from tbioaOffice_Flow_Blqk where RecordID='"&gwxh&"' and blxh="&blxh&")"
  'Response.Write psql
  prs.Open psql,oConn,1,1
  if not prs.eof and not prs.BOF then
     psgzdxh=prs("sgzdxh")
  else
    psgzdxh=""
  end if
  prs.close
  set prs=nothing

  if psgzdxh<>"" and isnull(psgzdxh)=false then
     psql="update tbioaOffice_Flow_Blqk set xgbz='0' where RecordID='" & gwxh & "' and gzdxh=" & psgzdxh
     oConn.execute(psql)
  end if
end function

'-------------------------------------------------------
'-------------------------------------------------------'正常流转
function czlx_zclz(gwxh,blxh)
     dim zsql,zrs,zgzdxh,ztjlzbj,zsign
     zsign=false '是否能流转

     zsql="select * from tbioaOffice_Flow_Blqk where RecordID='"&gwxh&"' and blxh="&blxh
     set zrs=createobject("adodb.recordset")
     zrs.Open zsql,oConn,1,1
     if not zrs.EOF and not zrs.BOF then
        zgzdxh=zrs("gzdxh")	'工作点序号
        ztjlzbj=zrs("tjlzbj")	'推进流转标志
     end if
     zrs.close

     '先删除下级记录
     zsql="delete from tbioaOffice_Flow_Blqk where RecordID='"&gwxh&"' and xgbz='1' and blbz='N' and gzdxh<>"&zgzdxh
     oConn.execute(zsql)
     call gwlz_pub1(mRecordID,mBLXH)'把已办理的工作点修改标志置为不可修改

     '判断点内流转情况
     if ztjlzbj="0" then	'一人完成继续
        zsql="delete from tbioaOffice_Flow_Blqk where RecordID='"&gwxh&"' and gzdxh="&zgzdxh&" and blbz<>'Y'"
        oConn.execute(zsql)
        zsign=true '能流转
     elseif ztjlzbj="1" then	'全部完成继续
        zsql="select * from tbioaOffice_Flow_Blqk where RecordID='"&gwxh&"' and gzdxh="&zgzdxh&" and blbz='N'"
        zrs.Open zsql,oConn,1,1
        if not zrs.EOF and not zrs.BOF then
             zsign=false
        else
             zsign=true '能流转
        end if
        zrs.close
     end if

     ''''''''''''''增加下级节点记录'''''''''''''''''
     '判断是否能流转
     'Response.Write zsign

     if zsign=true then '如果能流转
					zsql="update tbioaOffice_FlowPoint set blrylb='"&mXyblry&"' where blrylb like '' and RecordID='"&mRecordID&"' and gzdxh=(select zgzdxh from tbioaOffice_Flow where RecordID='"&mRecordID&"' and sgzdxh=" & gzdxh &")"
					oConn.execute zsql '确定下一办理人

         zsql="select zgzdxh from tbioaOffice_Flow where RecordID='" & gwxh & "' and sgzdxh=" & zgzdxh
         zrs.Open zsql,oConn,1,1
         '判断流程是否结束
         if zrs.EOF and zrs.bof then
            lcjsbz=true 	'流程结束
         else
            lcjsbz=false	'流程未结束
         end if
         zrs.close

         if (lcjsbz) then '如果流程结束
             zsql="update tbioaOffice_Document set Step='GD' where RecordID='"&gwxh&"'"
             oConn.execute zsql
             exit function
         else
             zsql="select * from tbioaOffice_FlowPoint where RecordID='"&gwxh&"' and gzdxh=(select zgzdxh from tbioaOffice_Flow where RecordID='"&gwxh&"' and sgzdxh=" & zgzdxh &")"
             zrs.Open zsql,oConn,1,1

             if not zrs.EOF and not zrs.BOF then
                 zxyblr=GetTableValue("tbioaOffice_Flow_Bldy","xyblr","blgzbh",zrs("blgzbh"))
                 if zxyblr=0 then
                   zyglb=zrs("blrylb")	'办理人列表
                 else
                  zyglb=GetTableValue("tbioaOffice_Document","Author","RecordID",gwxh)	'办理人列表
                 end if
                 zzgzdxh=zrs("gzdxh")	'工作点序号
                 zblgzdbh=zrs("blgzbh")	'办理工作编号
                 zgzsx=zrs("gzsx")	'工作时限
                 zlzbz=zrs("lzbz")	'流转标志
             end if
             zrs.close

             zsgzsx=formatdatetime(dateadd("D",zgzsx,now()),2)
             dim array_yglb
             array_yglb=split(zyglb,",") '办理人列表(数组)

             '增加新纪录
             for i=lbound(array_yglb) to ubound(array_yglb)
                    zsql="select max(blxh) from tbioaOffice_Flow_Blqk where RecordID='"&gwxh&"'"
                    zrs.Open zsql,oConn,1,1
                    count=zrs(0)
                    zrs.close

                    zrs.Open "tbioaOffice_Flow_Blqk",oConn,3,2
                    zrs.addnew
                    zrs("RecordID")=mRecordID	'公文编号
                    zrs("blxh")=count+1		'办理序号
                    zrs("gzdbh")=zblgzdbh	'办理工作编号(工作定义编号)
                    zrs("gzdxh")=zzgzdxh	'工作点序号
                    zrs("blr")=array_yglb(i)	'办理人ID
                    zrs("xgbz")="1"		'1 修改标志(1可修改)
                    zrs("blbz")="N"		'办理标志(N)
                    zrs("zcbz")="1"		'1正常流转
                    zrs("tjlzbj")=zlzbz         '流转标志(1全部完成继续/0一人完成继续)
                    zrs("clsj")=date()		'处理开始时间
                    zrs("clsx")= zsgzsx		'处理结束时间
                    zrs("lygzdxh")=zgzdxh	'工作点序号
                    zrs("lyblxh")=blxh		'办理序号
                    zrs.update
                    zrs.close

                    'OA精灵提醒
		    set rs1=Server.CreateObject("ADODB.RecordSet")
		    sql="select * from tbioaOffice_Document where RecordID='"&mRecordID&"'"
		    rs1.open sql,oConn,1,1
                    body="你收到一条新公文:"&vbcrlf&vbcrlf
                    body=body&"公文标题:"&rs1("Subject")&vbcrlf
                    body=body&"公文类型:"&rs1("DocType")&vbcrlf
                    body=body&"紧急程度:"&rs1("DC_Doc_Exigence")&vbcrlf
                    rs1.close
		    select case zblgzdbh
		    	case "FW"
		    		zblgzd = "发文拟制"
		    	case "SW"
		    		zblgzd = "收文登记"
		    	case "GD"
		    		zblgzd = "待归档"
		    	case "XH"

⌨️ 快捷键说明

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