<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.Collection" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="net.sz600.basicdata.*" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.tool.SzDateHelp" %>
<%@ page import="net.sz600.system.*" %>
<%@ page import="net.sz600.flow.*" %>
<%@ page import="net.sz600.online.*" %>
<%@ page import="net.sz600.formEngine2.*" %>
<%@ page import="net.sz600.weboffice.*" %>
<%@ include file="/sessionInfo.jsp"%>
<% 
  String strLevel = "../../"; 
%> 
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="<%=strSkin_SESSION%>/css2007.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="<%=strLevel%>share/ckeditor/ckeditor.js"></script>
</head>
<%
    //获取提交的参数
    String sType = SzConvert.toZeroStr(request.getParameter("type"));
    String sPage = SzConvert.toZeroStr(request.getParameter("page"));
    String sSearch = SzConvert.strWriteData(request.getParameter("txtSearch"));
    String sPKEY = SzConvert.toZeroStr(request.getParameter("PKEY"));
    String sPFORM = SzConvert.toZeroStr(request.getParameter("PFORM"));
		//上上级
		String sType2  = SzConvert.toZeroStr(request.getParameter("type2"));	//关联的ID
		String sPKEY2  = SzConvert.toZeroStr(request.getParameter("PKEY2"));	//主表单信息ID
		String sPFORM2 = SzConvert.toZeroStr(request.getParameter("PFORM2"));	//主表单ID
	
    String sOPERATOR = SzConvert.toSpaceStr(request.getParameter("OPERATOR"));
    String sOPERATOR_SOURCE = SzConvert.toSpaceStr(request.getParameter("OPERATOR_SOURCE"));
    String sKEY =  SzConvert.toZeroStr(request.getParameter("KEY"));
    
    int iFormID = SzConvert.toInt(request.getParameter("FormID"));
		String readonly = SzConvert.toSpaceStr(request.getParameter("readonly"));
    //取得表单的信息
    String moduleName = "";
    String formName = "";
		LcForm lcForm = new LcForm();
		LcFormInfo lcFormInfo = null;    
    if (iFormID == 0) {
    	moduleName = SzConvert.toSpaceStr(request.getParameter("moduleName"));
    	formName = SzConvert.toSpaceStr(request.getParameter("formName")); 
    	//
    	iFormID = lcForm.getKeyByCond(moduleName, formName); 
    } else {
    	lcFormInfo = (LcFormInfo)lcForm.getInfoByKey(iFormID);    
    	if (lcFormInfo != null) {
    		moduleName = lcFormInfo.getBDLJ();
    		formName = lcFormInfo.getBDBY1();  
    	}
    } 
    
    //System.out.println("moduleName=" + moduleName);
    //System.out.println("formName=" + formName);
    if (moduleName.equals("") || formName.equals("")) {
    	out.println("还没有设置相关表单信息！");
    	return;
    }   
    
    //2010-2-21
    BdPopedom bdPopedom = new BdPopedom();        
    String strDenyField = bdPopedom.getDenyField(iFormID, 0, iDLID_SESSION);
    String strDenyField2 = bdPopedom.getDenyField(iFormID, SzConvert.toInt(sKEY), iDLID_SESSION);
    bdPopedom.read(iFormID, SzConvert.toInt(sKEY), iDLID_SESSION);
    
    BdFormControl bdFormControl = new BdFormControl();
    //取得关联的名称
    String sTriggerName = bdFormControl.getTriggerName(moduleName, formName);
  	//根据名称取得关联的条件控件
    String sRelateObject = bdFormControl.getRelateObject(sTriggerName);
    
    
    
    String sHTML = "";    
	BdValueControl bdValueControl = new BdValueControl(moduleName, formName);	
	sHTML = bdValueControl.getHTML();
	String sTable = bdValueControl.getTableName();
	String sFieldID = bdValueControl.getKeyField();	
	//获取附件名
	String sTableAnnex = bdValueControl.getTableAnnex();
	String sEditor    = bdValueControl.getEditor();
	String sWeboffice = bdValueControl.getWebOffice();
	String sTemplateSelect = bdValueControl.getTemplateSelect();
	String printTemp = bdValueControl.getPrintTemp();
	String printTempRelate = bdValueControl.getPrintTempRelate();
	//是否有流程，由关联决定
	BdRelateForm bdRelateForm = new BdRelateForm();
	//boolean hasFlow   = bdValueControl.getHasFlow();
	boolean hasFlow = bdRelateForm.hasFlow(sType);
	
	boolean hasAnnex  = false;
	if (!sTableAnnex.equals("")) {
		hasAnnex = true;
	}
	
%>
<%
    SzData szData = null;
    SzDataInfo szDataInfo = null;

    String sReadonly = "";
    boolean bReadonly = false;
    if (sOPERATOR.startsWith("detail")) {
        sReadonly = "readonly";
        bReadonly = true;
    }
    if (sOPERATOR.equals("detailPass")) {
    	LcFlowControl.readPass(iFormID, iDLID_SESSION, Integer.parseInt(sKEY));
        sReadonly = "readonly";
        bReadonly = true;    	
    }
    //读取数据
	String value_str[] = null;
    if (!sKEY.equals("0")) {
    	value_str = (String[])bdValueControl.getInfoByKey(Integer.parseInt(sKEY));
    }
    
    //检查是否有权利办理，如果没有就进入待办列表中
    if (sOPERATOR.equals("transact")) {
    	
    	LcFlowControl lcFlowControl = new LcFlowControl();
    	String str_InfoID = lcFlowControl.getTransactInfoID(iFormID, iDLID_SESSION) + ",0"; 
    	//System.out.println(str_InfoID + "==" + sKEY);
    	if (value_str == null || value_str[0] == null || str_InfoID.indexOf(("," + sKEY + ",")) == -1) {
    		//不在待办中，提示已过期
    		out.println(SzPageHelp.jsAlertBack("该文已办理或不存在"));
    		return;
    	} else {
			//读取相关的提醒。
    		OlMessageControl olMessageControl = new OlMessageControl();
    		olMessageControl.readMessage(iFormID, SzConvert.toInt(sKEY), iDLID_SESSION);
    	}
    }        
%>
<%    
    //流程相关
    //根据已经有的信息ID，读取流程ID
    LcFlowControl lcFlowControl = new LcFlowControl();
    //取得流程权限信息
    LcFlowPopedomInfo lcFlowPopedomInfo = lcFlowControl.getFlowPopedomInfo(iFormID, Integer.parseInt(sKEY));
    
    int iFlowID = lcFlowPopedomInfo.getFlowID();
	boolean hasSend = lcFlowPopedomInfo.isHasSend();
	boolean isLastStep = lcFlowPopedomInfo.isLastStep();
	boolean canSend = lcFlowPopedomInfo.isCanSend();
	boolean canFinish = lcFlowPopedomInfo.isCanFinish();
	boolean canDeny = lcFlowPopedomInfo.isCanDeny();
	boolean canUntread = lcFlowPopedomInfo.isCanUntread();
	boolean canSkip = lcFlowPopedomInfo.isCanSkip();
	boolean canModifyForm = lcFlowPopedomInfo.isCanModifyForm();
	if (bReadonly) {
		canModifyForm = false;
	}
	if (canModifyForm || sOPERATOR.startsWith("add") || sOPERATOR.startsWith("update")) {
		 sReadonly = "";
	} else {
		 sReadonly = "readonly";		
	}
	
	boolean canDraftSave = false;
	boolean canDraftSend = false;
	boolean canTransactSave = false;
	if (hasFlow && !hasSend) {
		canDraftSave = true;
		canDraftSend = true;
	} else if (hasFlow && hasSend) {
		canTransactSave = true;
	} else if (!hasFlow) {
		canDraftSave = true;
	}
	boolean isTransact = false;
	if (sOPERATOR.startsWith("transact")) {
		isTransact = true;	
	}
	if (sOPERATOR.equals("updateWin")) {
		hasSend = false;
		isLastStep = false;
		canSend = false;
		canFinish = false;
		canDeny = false;
		canUntread = false;
		canSkip = false;
		
		canDraftSave = true;
		canDraftSend = false;
		canTransactSave = false;
		isTransact = false;
	}	
	
	//EditType //// 0 显示  1 起草 2 批改 3 审核
	String sEditType = "0";
	if (sOPERATOR.startsWith("add") || (sOPERATOR.startsWith("update") && hasFlow)) {
		sEditType = "1";
	} else if (sOPERATOR.startsWith("update") && !hasFlow) {
		sEditType = "2";
	} else if (sOPERATOR.startsWith("transact")) {
		sEditType = "3";
	} 	
%>

<body>

<!-----上面的工具栏------>
<% if (hasAnnex) { %>
<form name="formUpdate" method="post" ENCTYPE="multipart/form-data">
<% } else { %>
<form name="formUpdate" method="post">
<% } %>
  <!---使用流程的时候需要使用--->
  <input type="hidden" name="LCID_FLOW" value="0">
  <input type="hidden" name="BZID_FLOW" value="0">
  <input type="hidden" name="BZXH_FLOW" value="0">
  <input type="hidden" name="BZRYID_FLOW" value="0">  
  <input type="hidden" name="RYBLYJ_FLOW" value="">
  <input type="hidden" name="RYBLTP_FLOW" value="">  
  
  <input type="hidden" name="PFORM" value="<%=sPFORM%>">
  <input type="hidden" name="PKEY" value="<%=sPKEY%>">
  <input type="hidden" name="type2" value="<%=sType2%>">
  <input type="hidden" name="PKEY2" value="<%=sPKEY2%>">  
  <input type="hidden" name="PFORM2" value="<%=sPFORM2%>"> 
    
  <input type="hidden" name="page" value="<%=sPage%>">
  <input type="hidden" name="txtSearch" value="<%=sSearch%>">
  <input type="hidden" name="OPERATOR" value="<%=sOPERATOR%>">
  <input type="hidden" name="OPERATOR_SOURCE" value="<%=sOPERATOR_SOURCE%>">  
  <input type="hidden" name="KEY" value="<%=sKEY%>">
  <input type="hidden" name="type" value="<%=sType%>">
  <input type="hidden" name="detailCount" value="0">
  <input type="hidden" name="detailCount1" value="0">
  <input type="hidden" name="detailCount2" value="0">
  <input type="hidden" name="detailCount3" value="0">
  <input type="hidden" name="detailCount4" value="0">
  <input type="hidden" name="FormID" value="<%=iFormID%>"> 
   
 <!--  <input type="hidden" name="szContent" value="">   -->
  <input type="hidden" name="RecordID" value="">    
  <input type="hidden" name="TriggerName" value="<%= sTriggerName%>">
  <input type="hidden" name="RelateObject" value="<%= sRelateObject%>">  
  <input type="hidden" name="hasFlow" value="<%=hasFlow %>">
  <input type="hidden" name="hiddenSave" value="not">
  <input type="hidden" name="readonly" value="<%=readonly%>">   
<%@ include file="title.jsp"%>
<table width="100%">
  <tr>
    <td>
    <% if (!bReadonly) { %>
      <%
        out.println( LcHelp.saveButton(canDraftSave, hasAnnex, "saveButtonUpdate"));
        out.println( LcHelp.draftSendButton(canDraftSend, hasAnnex)); 
        out.println( LcHelp.transactSaveButton(canTransactSave, hasAnnex, "saveButtonUpdate"));        
      %>      
      <!-- 下面操作只在办理的过程中才会有 --> 
      <%
        out.println( LcHelp.sendButton(canSend, hasAnnex));
        out.println( LcHelp.finishButton(canFinish, hasAnnex));
        out.println( LcHelp.denyButton(canDeny, hasAnnex));
        out.println( LcHelp.untreadButton(canUntread, iFlowID ));
        out.println( LcHelp.skipButton(canSkip, iFlowID));
      %>    
      <%
      if (canModifyForm || sOPERATOR.startsWith("add") || sOPERATOR.startsWith("update")) {
    	  out.println(bdValueControl.addDetailButton() );   	  
      }
      if (    !sRelateObject.equals("") && !sTriggerName.equals("") 
          && ( sOPERATOR.startsWith("add") || sOPERATOR.startsWith("update"))) {
    	  out.println(SzPageHelp.button("重新获取","javascript:RelateWin();")); 
      }
      %>         
    <% } %>  
      <%
      if (!sOPERATOR.startsWith("updateWin")) {
    	 out.println( SzPageHelp.backButton() );
    	 out.println( SzPageHelp.button("打印","javascript:PrintWin();") );
      } else {
    	 out.println( SzPageHelp.closeButton() ); 
      }
      
      //是否有word模板打印
      if (!printTemp.equals("") && !sOPERATOR.startsWith("detailPass") && !sOPERATOR.startsWith("updateWin")) {
    	  out.println( SzPageHelp.button("单据打印","javascript:PrintWinWord();") );
      }
      if (!printTempRelate.equals("") && !sOPERATOR.startsWith("detailPass") && !sOPERATOR.startsWith("updateWin")) {
    	  out.println( SzPageHelp.button("关联打印","javascript:PrintWinWordRelate();") );
      }   
      if (!sOPERATOR.startsWith("add")) {
      	 out.println( SzPageHelp.button("操作日志","javascript:LogWin();") );
       }    
      if (sType.equals("51") && (sOPERATOR.startsWith("add") || sOPERATOR.startsWith("update"))) {
       	 out.println( SzPageHelp.button("btnClass100","选择主合同号","javascript:SelectMainContactWin();") );
        }       
      %>            
    </td>
  </tr>
</table>

<!-- 传阅反馈信息 -->
<% if (sOPERATOR.startsWith("detailPass")) { %>
<% } %>

<!-- 显示当前表单的名称 -->
<br><b><%=bdFormControl.getFormDesc(moduleName, formName) %></b>
<!-----信息维护------>
<div id="divForm">
<%=sHTML %>
</div>
<!-- 附件 -->
<% if (!sTableAnnex.equals("")) { %>
<table width="650" border="1" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF" class="tableClass" cellpadding="3" cellspacing="0"> 
  <tr> 
    <td class="tdClassTitle">附件</td> 
    <td><%=SzPageHelp.annex(sTableAnnex, sKEY, bReadonly)%></td> 
  </tr> 
</table> 
<% } %>
</form>
<% if (hasFlow ) { 
	 //而且不是发文的传阅
	 if (!formName.equals("document2") || !moduleName.equals("document_new.xml") || !sOPERATOR.startsWith("detailPass")) {
%>
<!--流程相关 包含流程的frame页面 -->
<iframe id="flowDraft" src="../../flow/flow/draft.jsp?type=<%=iFlowID%>&FormID=<%=iFormID%>&InfoID=<%=sKEY%>&OPERATOR=<%=sOPERATOR%>&type2=<%=sType%>&PFORM2=<%=sPFORM%>&PKEY2=<%=sPKEY%>" frameborder="0" scrolling="auto" width="650"></iframe><br>
<%
	 }
  } 
%>
<% if (!sEditor.equals("")) {%>
<table width="650" border="0" cellpadding="3" cellspacing="0">
  <tr>
    <td>
      <%//@ include file="/share/editor/edit.jsp"%>
			<%
				szData = new SzData();
			  szData.setTableInfo(sTable, sFieldID, sEditor);
			  szDataInfo = (SzDataInfo)szData.getInfoByKey(Integer.parseInt(sKEY));		
			  String sValue = "";
			  if (szDataInfo != null) {
			        sValue = szDataInfo.getName();
			  }	  			
			%>      
      <textarea id="szContent" name="szContent"><%=sValue %></textarea>  
    </td>
  </tr>
</table>
	<script type="text/javascript">
    CKEDITOR.replace( 'szContent');
   </script>
<% } %>
<% 
   session.setAttribute("SzModuleType", "");
   session.setAttribute("SzModuleID", "");
   session.setAttribute("SzInfoID", "");
   if (!sWeboffice.equals("")) {
		
		String FileType   = sWeboffice;
		String ModuleType = "formEngine";
		int    ModuleID   = iFormID;
		
	    //取得RecordID
	    OfficeRecordID officeRecordID = new OfficeRecordID();
	    String RecordID  = officeRecordID.loadRecordID(ModuleType,ModuleID,Integer.parseInt(sKEY));
	    session.setAttribute("SzModuleType", ModuleType);
	    session.setAttribute("SzModuleID", Integer.toString(ModuleID));
	    session.setAttribute("SzInfoID", sKEY);
%>
<table width="100%" border="0" cellpadding="3" cellspacing="0">
  <tr>
    <td>
      <iframe id="webOffice" width="100%" height="1380" 
              frameborder="0"
              src="../../share/weboffice/DocumentEdit.jsp?FileType=<%=FileType%>&ModuleType=<%=ModuleType %>&ModuleID=<%=ModuleID %>&RecordID=<%=RecordID%>&EditType=<%=sEditType%>&Template=<%=sTemplateSelect%>">
      </iframe>
    </td>
  </tr>
</table>
<% } %>
<%
	if (!sOPERATOR.equals("add")) {
		out.println(bdRelateForm.relateFatherList(SzConvert.toInt(sPFORM), sType, iFormID, SzConvert.toInt(sKEY), false, canModifyForm));
		out.println(bdRelateForm.relateChildList(iFormID, SzConvert.toInt(sKEY), false, canModifyForm, sOPERATOR_SOURCE));
		
		out.println(bdRelateForm.relateBrotherList(iFormID, SzConvert.toInt(sKEY), false, canModifyForm));
	}
%>
 
<!-----这里包含要提交的内容--->
<form name="formHidden" method="post">
  <input type="hidden" name="page" value="<%=sPage%>">
  <input type="hidden" name="txtSearch" value="<%=sSearch%>">
  <input type="hidden" name="type" value="<%=sType%>">
  <input type="hidden" name="FormID" value="<%=iFormID%>"> 
  <input type="hidden" name="type2" value="<%=sType2%>">
  <input type="hidden" name="PKEY2" value="<%=sPKEY2%>">  
  <input type="hidden" name="PFORM2" value="<%=sPFORM2%>">   
</form>

<script language="javascript" src="../../share/js/commonTool.js"></script>
<script language="javascript" src="../../share/js/formTool.js"></script>
<%=bdValueControl.updateJs(Integer.parseInt(sKEY), session, sOPERATOR, canModifyForm, strDenyField, strDenyField2)%>
<%=bdValueControl.detailJs(Integer.parseInt(sKEY), sOPERATOR, canModifyForm)%>
<%=LcFlowControl.fieldPopedom(iFormID, iFlowID, Integer.parseInt(sKEY), canModifyForm, isTransact) %>
<%=bdValueControl.saveCheckJs()%>
<script language="javascript">

  function FormSave(formName, url, vOPERATOR) {
	if (!FormCheck(formName)) {
		return false;
	}
    //保存前把流程ID、流程步骤ID、表单ID、信息ID等写到信息里面
    //流程相关
    <% if (hasFlow) {%>
    formName.LCID_FLOW.value = flowDraft.formList.LCID.value;
    formName.BZRYID_FLOW.value = ValueOfCheck(flowDraft.formList.BZRYID);
    formName.BZXH_FLOW.value = flowDraft.formList.BZXH.value;
    formName.RYBLYJ_FLOW.value = flowDraft.formList.RYBLYJ.value;
    formName.RYBLTP_FLOW.value = flowDraft.formList.selectSignature.value;    
    <% } %>	
    <% if (!sEditor.equals("")) {%>
    formName.szContent.value=tbContentElement.DocumentHTML;
    <% } %>	
    <% if (!sWeboffice.equals("")) { %>    
    //weboffice
    formName.RecordID.value = webOffice.webform.RecordID.value;
    webOffice.webform.save.click(); 
    <% } %>
        
    if (vOPERATOR != "") {
    	formName.OPERATOR.value = vOPERATOR;
    }
    //alert(formName.OPERATOR.value);
    
    formName.action = url;
    formName.submit();      
  }   
  
  
  function FormSaveConfirm(formName, url, vOPERATOR) {
	if (!FormCheck(formName)) {
		return false;
	}
    //保存前把流程ID、流程步骤ID、表单ID、信息ID等写到信息里面
    //流程相关
    formName.LCID_FLOW.value = flowDraft.formList.LCID.value;
    formName.BZRYID_FLOW.value = ValueOfCheck(flowDraft.formList.BZRYID);
    formName.BZXH_FLOW.value = flowDraft.formList.BZXH.value;
    formName.BZID_FLOW.value = flowDraft.formList.BZID.value;
    
    formName.RYBLYJ_FLOW.value = flowDraft.formList.RYBLYJ.value;
    formName.RYBLTP_FLOW.value = flowDraft.formList.selectSignature.value;
    
    var vMessage = "";
    if (vOPERATOR == "transact" || vOPERATOR == "send") {
      vMessage = "确定要发送？";
      if (formName.BZRYID_FLOW.value == "0" || formName.BZRYID_FLOW.value == "") {
    	  alert("请至少选择一个办理人员！");
    	  return false;
      } 
      //当multipart/form-data时，request不到后面的值，所以补充了下面      
    } else if (vOPERATOR=="transactFinish") {
      vMessage = "确定要办结？";    
    } else if (vOPERATOR=="transactDeny") {
      vMessage = "确定要否决？";    
    }
    if (vOPERATOR != "") {
    	formName.OPERATOR.value = vOPERATOR;
    }    
    
    if (confirm(vMessage)) {
    	<% if (!sEditor.equals("")) {%>
    	formName.szContent.value=tbContentElement.DocumentHTML;
    	<% } %>	
    	<% if (!sWeboffice.equals("")) { %>    
    	//weboffice
    	formName.RecordID.value = webOffice.webform.RecordID.value;
    	webOffice.webform.save.click(); 
    	<% } %>    
      	formName.action = url;
      	formName.submit();      
    }
  }   
  
  function OpenDetailWin(keyValue,formId) {
    var vUrl = "detail_win.jsp?OPERATOR=detail&KEY=" + keyValue + "&FormID=" + formId;
  	window.open(vUrl,"","left=100,top=100,scrollbars=yes,resizable=yes,status=yes,width=800,height=700");  
  }
  function OpenUpdateWin(keyValue,formId) {
    var vUrl = "update.jsp?OPERATOR=updateWin&KEY=" + keyValue + "&FormID=" + formId;
  	window.open(vUrl,"","left=100,top=100,scrollbars=yes,resizable=yes,status=yes,width=800,height=700");  
  }
  
  function OpenRelateDetailWin(keyValue,formId, pKey, pFormId, relateId) {
    var vUrl = "relate_detail.jsp?OPERATOR=detail&KEY=" + keyValue + "&FormID=" + formId + "&PKEY=" + pKey + "&PFORM=" + pFormId + "&type=" + relateId;
  	window.open(vUrl,"","left=100,top=100,scrollbars=yes,resizable=yes,status=yes,width=800,height=700");  
  } 
          
  function OpenRelateUpdateWin(keyValue,formId, pKey, pFormId, relateId, vOPERATOR) {    
    var vUrl = "relate_update.jsp?OPERATOR=updateWin&OPERATOR_SOURCE=" + vOPERATOR +"&KEY=" + keyValue + "&FormID=" + formId + "&PKEY=" + pKey + "&PFORM=" + pFormId + "&type=" + relateId;
  	window.open(vUrl,"","left=100,top=100,scrollbars=yes,resizable=yes,status=yes,width=800,height=700");  
  }   
  function LogWin() {
    var vUrl = "../../share/other/logList.jsp?LogType=FORM&ModuleID=<%=iFormID%>&InfoID=<%=sKEY%>";
  	window.open(vUrl,"","left=100,top=100,scrollbars=yes,resizable=yes,status=yes,width=800,height=700");  
  }  
    
  function RelateWin() {     
  	//这里就要取得值
  	var vTriggerName = formUpdate.TriggerName.value;
  	var oObject = formUpdate.RelateObject.value;
  	var vValue = "";
  	if (oObject != "") {
  		vValue = eval("formUpdate." + oObject + ".value;");
  	}
    var vUrl = "relate_win.jsp?moduleName=<%=moduleName%>&formName=<%=formName%>&triggerName=" + vTriggerName + "&relateValue=" + vValue;
  	window.open(vUrl,"","left=1020,top=1020,width=1,height=1");
  	//window.open(vUrl,"","left=102,top=102,width=551,height=551,status=yes");
	
  }
  
  function PrintWin() {
    var vUrl = "print.jsp?moduleName=<%=moduleName%>&formName=<%=formName%>&OPERATOR=detail&KEY=<%=sKEY%>";
  	//window.open(vUrl,"","left=20,top=20,width=600,height=600");
  	window.showModalDialog(vUrl,window,"status=no;dialogWidth=720px;dialogHeight=550px");
  	//window.showModalDialog(vUrl,window,"status=no;dialogWidth=720px;");
  }
  
  function PrintWinWord() {
    var vUrl = "printTemp.jsp?type=0&FormID=<%=iFormID%>&KEY=<%=sKEY%>&printTemp=<%=printTemp%>&printTempRelate=<%=printTempRelate%>&PKEY=<%=sPKEY%>&PFORM=<%=sPFORM%>";
  	//window.open(vUrl,"","left=20,top=20,width=600,height=600");
  	window.showModalDialog(vUrl,window,"status=no;dialogWidth=720px;dialogHeight=550px");
  	//window.showModalDialog(vUrl,window,"status=no;dialogWidth=720px;");
  }
  
  function PrintWinWordRelate() {
    var vUrl = "printTemp.jsp?type=1&FormID=<%=iFormID%>&KEY=<%=sKEY%>&printTemp=<%=printTemp%>&printTempRelate=<%=printTempRelate%>&PKEY=<%=sPKEY%>&PFORM=<%=sPFORM%>";
  	//window.open(vUrl,"","left=20,top=20,width=600,height=600");
  	window.showModalDialog(vUrl,window,"status=no;dialogWidth=720px;dialogHeight=550px");
  	//window.showModalDialog(vUrl,window,"status=no;dialogWidth=720px;");
  }  
  
    
  //这里做退回、跳签需要传递的参数：流程ID，操作类型
  function transactWin(vFlowID, vOPERATOR) {
    var vUrl = "../../flow/flow/untread_win.jsp";
    if (vOPERATOR == "transactUntread") {
    
    } else if (vOPERATOR == "transactSkip") {
    
    }
    vUrl += "?OPERATOR=" + vOPERATOR + "&FlowID=" + vFlowID;
    window.showModalDialog(vUrl,window,"status=no;dialogWidth=680px;dialogHeight=580px");  
  }  
  
  function transactSubmit() {
	formUpdate.RYBLYJ_FLOW.value = flowDraft.formList.RYBLYJ.value;
	formUpdate.RYBLTP_FLOW.value = flowDraft.formList.selectSignature.value;  
	<% if (!sEditor.equals("")) {%>
		formUpdate.szContent.value=tbContentElement.DocumentHTML;
	<% } %>	
	<% if (!sWeboffice.equals("")) { %>    
    	//weboffice
    	formUpdate.RecordID.value = webOffice.webform.RecordID.value;
    	webOffice.webform.save.click(); 
	<% } %> 	
    <% if (hasAnnex) { %>		  
	formUpdate.action = "control2.jsp";
	<% } else {%>
	formUpdate.action = "relate_control.jsp";
	<% } %>
	formUpdate.submit();  
  }
  
  //document.all.['flowDraft'].style.height = vHeight;  
  var vRelateObject = formUpdate.RelateObject.value;
  var vOPERATOR = formUpdate.OPERATOR.value;
  //添加的时候自动执行,
  if (vOPERATOR == "add" && vRelateObject != "") {
  	RelateWin();
  }
  
  function test(objName, a) {
  	CheckRadio(eval("formUpdate." + objName), a);
  }
  
  //选择主合同号：选择一个指定的兄弟。
  function SelectMainContactWin() {
    var url = "../../share/other/main_contact_number.jsp";
    url = url + "?FormID=<%=iFormID%>&KEY=<%=sKEY%>&PKEY=<%=sPKEY%>&PFORM=<%=sPFORM%>"
    window.showModalDialog(url,window,"status=no;dialogWidth=580px;dialogHeight=350px");    
  }
  
</script>
</body>
<%
	out.println(SzPageHelp.calendarFrame2());
	out.println(SzPageHelp.calendar2Frame2());
%>

