FnaInvoiceWfSetEditPageFieldSet.jsp 12.4 KB
<%@page import="weaver.fna.invoice.utils.FnaInvoiceWfUtil"%>
<%@page import="weaver.fna.budget.FnaWfSet"%>
<%@page import="weaver.systeminfo.label.LabelComInfo"%>
<%@page import="org.apache.commons.lang.StringEscapeUtils"%>
<%@ taglib uri="/WEB-INF/weaver.tld" prefix="wea"%>
<%@page import="weaver.hrm.HrmUserVarify"%>
<%@page import="weaver.hrm.User"%>
<%@ page import="weaver.general.Util" %>

<%@ page language="java" contentType="text/html; charset=UTF-8" %> 
<%@ include file="/systeminfo/init_wev8.jsp" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="rs1" class="weaver.conn.RecordSet" scope="page" />
<%
if(!HrmUserVarify.checkUserRight("FnaInvoiceReset:Permissions", user)){
	response.sendRedirect("/notice/noright.jsp") ;
	return ;
}

String imagefilename = "/images/hdMaintenance_wev8.gif";
String titlename = "";//费控流程 //33075
String needfav ="1";
String needhelp ="";

int detachable=Util.getIntValue(String.valueOf(session.getAttribute("detachable")),0);
int parentid=Util.getIntValue(request.getParameter("paraid"),0);

String nameQuery = Util.null2String(request.getParameter("nameQuery")).trim();

int mainId = Util.getIntValue(request.getParameter("id"));

int tabIndex = Util.getIntValue(request.getParameter("tabIndex"));
String thisGuid = Util.null2String(request.getParameter("thisGuid"));
int workflowid = 0;

String sql = "select * from fnaInvoiceWfInfo where id = "+mainId;
rs.executeSql(sql);
if(rs.next()){
	workflowid = rs.getInt("workflowid");
}

List fieldIdListAll = new ArrayList();
HashMap fieldInfoHmAll = new HashMap();
int formid = FnaWfSet.getFieldListForFieldTypeMain(fieldIdListAll, fieldInfoHmAll, workflowid);
int formidABS = Math.abs(formid);

List dtlFieldIdListAll = new ArrayList();//所有明细字段
HashMap dtlFieldInfoHmAll = new HashMap();
FnaWfSet.getWfFieldList(dtlFieldIdListAll, dtlFieldInfoHmAll, "", 0, workflowid, 0);

List dtlFieldIdListInvoice = new ArrayList();//发票浏览框
HashMap dtlFieldInfoHmInvoice = new HashMap();

List dtlFieldIdListBillingDate = new ArrayList();//日期浏览框
HashMap dtlFieldInfoHmBillingDate = new HashMap();

List dtlFieldIdListSubject = new ArrayList();//科目浏览框
HashMap dtlFieldInfoHmSubject = new HashMap();

List dtlFieldIdListAmount = new ArrayList();//金额
HashMap dtlFieldInfoHmAmount = new HashMap();

List dtlFieldIdListDescription = new ArrayList();//说明
HashMap dtlFieldInfoHmDescription = new HashMap();

if(tabIndex == 0){
	FnaWfSet.getWfFieldList(dtlFieldIdListInvoice, dtlFieldInfoHmInvoice, "3", 292, workflowid, 0);
	FnaWfSet.getWfFieldList(dtlFieldIdListBillingDate, dtlFieldInfoHmBillingDate, "3", 2, workflowid, 0);
	FnaWfSet.getWfFieldList(dtlFieldIdListSubject, dtlFieldInfoHmSubject, "3", 22, workflowid, 0);
	FnaWfSet.getWfFieldList(dtlFieldIdListAmount, dtlFieldInfoHmAmount, "1", 3, workflowid, 0);
	FnaWfSet.getWfFieldList(dtlFieldIdListDescription, dtlFieldInfoHmDescription, "1", 1, workflowid, 0);
}

String dbTableName = "formtable_main_"+formidABS;
sql = "select DISTINCT detailtable \n" +
	" from workflow_billfield \n" +
	" where detailtable = '"+StringEscapeUtils.escapeSql(dbTableName+"_dt"+tabIndex)+"' \n"+
	" order by detailtable asc";
rs.executeSql(sql);
int dtlNumber = 0;
if(rs.next()){
	String detailtable = Util.null2String(rs.getString("detailtable")).trim();
	dtlNumber = Util.getIntValue(detailtable.replaceAll("formtable_main_"+formidABS+"_dt", ""), 0);
	
	dbTableName += "_dt"+tabIndex;
	
	FnaInvoiceWfUtil.getFieldListForInvoiceFieldType(
            dtlFieldIdListInvoice, dtlFieldInfoHmInvoice,
            dtlFieldIdListBillingDate, dtlFieldInfoHmBillingDate,
            dtlFieldIdListSubject, dtlFieldInfoHmSubject,
            dtlFieldIdListAmount, dtlFieldInfoHmAmount,
            dtlFieldIdListDescription, dtlFieldInfoHmDescription,
            dtlFieldIdListAll, dtlFieldInfoHmAll, 
            workflowid, dtlNumber);
}

String fieldIdInvoice = "";
String fieldIdDate = "";
String fieldIdSubject = "";
String fieldIdAmount = "";
String fieldIdDesc = "";
sql = "select * from fnaInvoiceWfInfoField where tabIndex = ? and mainId=?";
rs1.executeQuery(sql, tabIndex, mainId);
while(rs1.next()){
	String fieldname = Util.null2String(rs1.getString("fieldname")).trim();
	String fieldId = Util.null2String(rs1.getString("fieldId")).trim();
	if("fieldIdInvoice".equals(fieldname)){
		fieldIdInvoice = fieldId;
	}else if("fieldIdDate".equals(fieldname)){
		fieldIdDate = fieldId;
	}else if("fieldIdSubject".equals(fieldname)){
		fieldIdSubject = fieldId;
    }else if("fieldIdAmount".equals(fieldname)){
    	fieldIdAmount = fieldId;
    }else if("fieldIdDesc".equals(fieldname)){
    	fieldIdDesc = fieldId;
    }
}
String tempFieldId_invoiceNo = Util.null2String(request.getSession().getAttribute("fnaInvoiceWfSetEditSaveFnaAjax_"+thisGuid+"_"+tabIndex+"_fieldIdInvoice"));
String tempFieldId_BillingDate = Util.null2String(request.getSession().getAttribute("fnaInvoiceWfSetEditSaveFnaAjax_"+thisGuid+"_"+tabIndex+"_fieldIdBillingDate"));
String tempFieldId_Subject = Util.null2String(request.getSession().getAttribute("fnaInvoiceWfSetEditSaveFnaAjax_"+thisGuid+"_"+tabIndex+"_fieldIdSubject"));
String tempFieldId_Amount = Util.null2String(request.getSession().getAttribute("fnaInvoiceWfSetEditSaveFnaAjax_"+thisGuid+"_"+tabIndex+"_fieldIdAmount"));
String tempFieldId_Description = Util.null2String(request.getSession().getAttribute("fnaInvoiceWfSetEditSaveFnaAjax_"+thisGuid+"_"+tabIndex+"_fieldIdDescription"));

if(!"".equals(tempFieldId_invoiceNo)){
	fieldIdInvoice = tempFieldId_invoiceNo;
}
if(!"".equals(tempFieldId_BillingDate)){
	fieldIdDate = tempFieldId_BillingDate;
}
if(!"".equals(tempFieldId_Subject)){
	fieldIdSubject = tempFieldId_Subject;
}
if(!"".equals(tempFieldId_Amount)){
	fieldIdAmount = tempFieldId_Amount;
}
if(!"".equals(tempFieldId_Description)){
	fieldIdDesc = tempFieldId_Description;
}
%>
<html>
<head>
<LINK href="/css/Weaver_wev8.css" type=text/css rel=STYLESHEET>
<script language="javascript" src="/wui/theme/ecology8/jquery/js/zDialog_wev8.js"></script>
<script language="javascript" src="/wui/theme/ecology8/jquery/js/zDrag_wev8.js"></script>
<script language="javascript" src="/js/weaver_wev8.js"></script>
<script language="javascript" src="/fna/js/e8Common_wev8.js?r=3"></script>
</head>
<body style="overflow:hidden;">
<%@ include file="/systeminfo/TopTitle_wev8.jsp" %>
<%@ include file="/systeminfo/RightClickMenuConent_wev8.jsp" %>
<%
	RCMenu += "{" + SystemEnv.getHtmlLabelName(86, user.getLanguage())
			+ ",javascript:doSave1(),_self} ";//保存
	RCMenuHeight += RCMenuHeightStep;
%>
<%@ include file="/systeminfo/RightClickMenu_wev8.jsp" %>
<div class="zDialog_div_content">
<form action="">
<input id="mainId" name="mainId" value="<%=mainId %>" type="hidden" />
<input id="workflowid" name="workflowid" value="<%=workflowid %>" type="hidden" />
<input id="formid" name="formid" value="<%=formid %>" type="hidden" />
<input id="tabIndex" name=tabIndex value="<%=tabIndex %>" type="hidden" />
<wea:layout type="2col">
	<wea:group context='<%=dbTableName %>'>
		<wea:item><%=SystemEnv.getHtmlLabelName(131488,user.getLanguage()) %></wea:item><!-- 发票号码 -->
			<wea:item>
				<%
					out.println(FnaWfSet.getSelect(dtlFieldIdListInvoice, dtlFieldInfoHmInvoice, fieldIdInvoice, user, formid, "fieldIdInvoice", true, -1, true, "width:380px;"));
				%>
				<img src="/wechat/images/remind_wev8.png" align="absMiddle" 
					title="<%=SystemEnv.getHtmlLabelNames("132211,695",user.getLanguage()) %>" /><!-- 发票浏览按钮 -->
		</wea:item>
		<wea:item><%=SystemEnv.getHtmlLabelName(17213,user.getLanguage()) %></wea:item><!-- 开票日期 -->
            <wea:item>
                <%
                    out.println(FnaWfSet.getSelect(dtlFieldIdListBillingDate, dtlFieldInfoHmBillingDate, fieldIdDate, user, formid, "fieldIdDate", true, -1, true, "width:380px;"));
                %>
                <img src="/wechat/images/remind_wev8.png" align="absMiddle" 
                    title="<%=SystemEnv.getHtmlLabelNames("31682",user.getLanguage()) %>" /><!-- 非必填 -->
        </wea:item>
        <wea:item><%=SystemEnv.getHtmlLabelName(585,user.getLanguage()) %></wea:item><!-- 科目 -->
            <wea:item>
                <%
                    out.println(FnaWfSet.getSelect(dtlFieldIdListSubject, dtlFieldInfoHmSubject, fieldIdSubject, user, formid, "fieldIdSubject", true, -1, true, "width:380px;"));
                %>
                <img src="/wechat/images/remind_wev8.png" align="absMiddle" 
                    title="<%=SystemEnv.getHtmlLabelNames("31682",user.getLanguage()) %>" /><!-- 非必填 -->
        </wea:item>
        <wea:item><%=SystemEnv.getHtmlLabelName(24940,user.getLanguage()) %></wea:item><!-- 开票金额 -->
            <wea:item>
                <%
                    out.println(FnaWfSet.getSelect(dtlFieldIdListAmount, dtlFieldInfoHmAmount, fieldIdAmount, user, formid, "fieldIdAmount", true, -1, true, "width:380px;"));
                %>
                <img src="/wechat/images/remind_wev8.png" align="absMiddle" 
                    title="<%=SystemEnv.getHtmlLabelNames("31682",user.getLanguage()) %>" /><!-- 非必填 -->
        </wea:item>
        <wea:item><%=SystemEnv.getHtmlLabelNames("1491,85",user.getLanguage()) %></wea:item><!-- 费用说明 -->
            <wea:item>
                <%
                    out.println(FnaWfSet.getSelect(dtlFieldIdListDescription, dtlFieldInfoHmDescription, fieldIdDesc, user, formid, "fieldIdDesc", true, -1, true, "width:380px;"));
                %>
                <img src="/wechat/images/remind_wev8.png" align="absMiddle" 
                    title="<%=SystemEnv.getHtmlLabelNames("688",user.getLanguage())+","+SystemEnv.getHtmlLabelNames("31682",user.getLanguage()) %>"/><!-- 非必填 -->
        </wea:item>
	</wea:group>
</wea:layout>
</form>
</div>
<script type="text/javascript">
var _Label33574 = "<%=SystemEnv.getHtmlLabelName(33574,user.getLanguage()) %>";//正在处理数据,请不要离开该页面,请稍等...


jQuery(document).ready(function(){
	resizeDialog(document);
});

//保存
function doSave1(){
	var mainId = null2String(jQuery("#mainId").val());
	var workflowid = null2String(jQuery("#workflowid").val());
	var formid = null2String(jQuery("#formid").val());
	var tabIndex = null2String(jQuery("#tabIndex").val());
	var fieldIdInvoice = null2String(jQuery("#fieldIdInvoice").val());
    var fieldIdDate = null2String(jQuery("#fieldIdDate").val());
    var fieldIdSubject = null2String(jQuery("#fieldIdSubject").val());
    var fieldIdAmount = null2String(jQuery("#fieldIdAmount").val());
    var fieldIdDesc = null2String(jQuery("#fieldIdDesc").val());
	var _postStr = "&thisGuid=<%=thisGuid%>&mainId="+mainId+"&workflowid="+workflowid+"&formid="+formid+"&tabIndex="+tabIndex
        +"&fieldIdInvoice="+fieldIdInvoice
        +"&fieldIdDate="+fieldIdDate
        +"&fieldIdSubject="+fieldIdSubject
        +"&fieldIdAmount="+fieldIdAmount
        +"&fieldIdDesc="+fieldIdDesc;
	jQuery.ajax({
		url : "/fna/invoice/invoiceWf/FnaInvoiceWfEditSaveFnaAjax.jsp",
		type : "post",
		cache : false,
		processData : false,
		async:false,
		data : "postStr="+_postStr,
		dataType : "html",
		success: function do4Success(_json){
			doSave2();
		}
	});
}

function doSave2(){
	var mainId = null2String(jQuery("#mainId").val());
	var workflowid = null2String(jQuery("#workflowid").val());
	var formid = null2String(jQuery("#formid").val());
	try{
		//确定要保存么?
		top.Dialog.confirm("<%=SystemEnv.getHtmlLabelName(32130,user.getLanguage()) %>",
			function(){
				hideRightMenuIframe();
				var _data = "operation=editFieldSet&mainId="+mainId+"&workflowid="+workflowid+"&formid="+formid+"&thisGuid=<%=thisGuid%>&r=1";
			
				openNewDiv_FnaBudgetViewInner1(_Label33574);
				jQuery.ajax({
					url : "/fna/invoice/invoiceWf/FnaInvoiceWfSetOp.jsp",
					type : "post",
					cache : false,
					processData : false,
					data : _data,
					dataType : "json",
					success: function do4Success(_json){
					    try{
							try{closeNewDiv_FnaBudgetViewInner1();}catch(ex1){}
							if(_json.flag){
								//var parentWin = parent.parent.getParentWindow(parent.window);
								//onCancel2();
								top.Dialog.alert("<%=SystemEnv.getHtmlLabelName(18758,user.getLanguage()) %>");//保存成功
							}else{
								top.Dialog.alert(_json.msg);
							}
		
					    	showRightMenuIframe();
					    }catch(e1){
					    	showRightMenuIframe();
					    }
					}
				});	
			},
			function(){}
		);
	}catch(e1){
		showRightMenuIframe();
	}
}
</script>
</body>
</html>