<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.basicdata.SzData" %>
<%@ page import="net.sz600.basicdata.SzDataInfo" %>
<%@ page import="net.sz600.formEngine2.*" %>
<%@ page import="net.sz600.flow.*" %>
<%@ include file="/sessionInfo.jsp"%>
<%
    String sFieldID   = "";
    String sFieldName = "";
    SzData szData = new SzData();
    String sTable = "";
    String sKEY =  SzConvert.toZeroStr(request.getParameter("KEY"));


    int iFormID = SzConvert.toInt(request.getParameter("FormID"));
    //取得表单的信息
    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;
    }   
    
	BdValueControl bdValueControl = new BdValueControl(moduleName, formName);	 
	sTable = bdValueControl.getTableName();
	sFieldID = bdValueControl.getKeyField();
	sFieldName = bdValueControl.getEditor();
    /*    
System.out.println("==" + sTable);
System.out.println("==" + sFieldID);
System.out.println("==" + sFieldName);
*/
    szData.setTableInfo(sTable, sFieldID, sFieldName);
    SzDataInfo szDataInfo = (SzDataInfo)szData.getInfoByKey(Integer.parseInt(sKEY));
    String sValue = "";
    if (szDataInfo != null) {
        sValue = szDataInfo.getName();
    }

    out.println(sValue);
%>
