<%@ page contentType="text/html; charset=GBK" %>
<%@ page import = "zr.zrpower.common.util.SysPreperty" %>
<%@ page import = "zr.zrpower.entity.sys.SessionUser" %>
<%@ page import = "zr.zrpower.collectionengine.*"%>
<%@ page import = "zr.zrpower.ejb.sys.UIService" %>
<%@ page import = "zr.zrpower.analyseengine.service.StatisticsConfig"%>
<%@ page import = "zr.zrpower.analyseengine.service.StatisticsControl"%>
<%@ page import = "zr.zrpower.analyseengine.mode.ANALYSE_STATISTICS_MAIN"%>
<%@ page import = "zr.zrpower.analyseengine.mode.ANALYSE_STATISTICS_CFIELD"%>

<%@ page import = "zr.zrpower.common.util.DateWork" %>
<%@ page import = "java.lang.Object"%>

<HTML>
<%
SessionUser user = (SessionUser)session.getAttribute("userinfo");
UIService userUI =new UIService();
StatisticsConfig StatisticsCfg =  new StatisticsConfig();
StatisticsControl Control =  new StatisticsControl();
String strID=request.getParameter("ID");
ANALYSE_STATISTICS_CFIELD[] cfield = StatisticsCfg.GetAnalyseCFieldList(strID);
ANALYSE_STATISTICS_MAIN STATISTICS = Control.GetSmain(strID);

%>
<%
     int row1 = 0;
     String strshow_data = "";
     String gl = "";
     String g2 = "";
     strshow_data = strshow_data + "[";




     if (cfield!=null && cfield.length>0){
       row1 = cfield.length;

       String fieldchinese1="";
       String tablechinese = "";
       String tableid2 ="";
       String fieldchinese2 = "";

       for(int i=0;i<cfield.length;i++){
         strshow_data = strshow_data + "[";

        tablechinese =StatisticsCfg.GetAllTableFieldName("CHINESENAME","BPIP_TABLE","TABLENAME",cfield[i].getTABLEID());
        tableid2 =StatisticsCfg.GetAllTableFieldName("TABLEID","BPIP_TABLE","TABLENAME",cfield[i].getTABLEID());
        fieldchinese2 = StatisticsCfg.GetAllFieldName(tableid2,cfield[i].getCPLANARFIELD());

        strshow_data = strshow_data + "\""+cfield[i].getID()+"\",";
        strshow_data = strshow_data + "\""+cfield[i].getSHOWCODE()+"\",";
        strshow_data = strshow_data + "\""+cfield[i].getSFIELDNAME()+"\",";
        strshow_data = strshow_data + "\""+cfield[i].getSFIELDSHOWNAME()+"\",";

        strshow_data = strshow_data + "\""+cfield[i].getEXPRESSIONS()+"\",";
        strshow_data = strshow_data + "\""+cfield[i].getDISTINCTION()+"\",";


        gl = cfield[i].getISSHOW();
        if (gl.equals("1")){gl="是";}
        if (gl.equals("0")){gl="否";}

        strshow_data = strshow_data + "\""+gl+"\",";
        strshow_data = strshow_data + "\""+cfield[i].getEXPRESSIONSWHERE()+"\",";
        strshow_data = strshow_data + "\""+cfield[i].getADDSIGN()+"\",";
        strshow_data = strshow_data + "\""+cfield[i].getRADIXPOINT()+"\",";
        strshow_data = strshow_data + "\""+tablechinese+"\",";
        strshow_data = strshow_data + "\""+fieldchinese2+"\",";

        g2 = cfield[i].getCJOIN();

        if (g2==null){g2="1";}
        if (g2.equals("0")){g2="无";}
        if (g2.equals("1")){g2="等于";}
        if (g2.equals("2")){g2="全包含";}
        if (g2.equals("3")){g2="左包含";}
        if (g2.equals("4")){g2="右包含";}
        strshow_data = strshow_data + "\""+g2+"\",";
        strshow_data = strshow_data + "\""+cfield[i].getSFIELDNAME()+"\",";
        strshow_data = strshow_data + "\""+cfield[i].getSFIELDSHOWNAME()+"\",";
        strshow_data = strshow_data + "\""+cfield[i].getEXPRESSIONS()+"\",";
        strshow_data = strshow_data + "\""+cfield[i].getDISTINCTION()+"\",";
        strshow_data = strshow_data + "\""+cfield[i].getISSHOW()+"\",";

        strshow_data = strshow_data + "\""+cfield[i].getTABLEID()+"\",";
        strshow_data = strshow_data + "\""+cfield[i].getCPLANARFIELD()+"\",";
        strshow_data = strshow_data + "\""+cfield[i].getCJOIN()+"\",";

        if (i<49 )
         {
            strshow_data = strshow_data + "\""+cfield[i].getCPLANARESPECIAL()+"\"],\r\n";
         }else
         {
            strshow_data = strshow_data + "\""+cfield[i].getCPLANARESPECIAL()+"\"]";
         }

       }
     }


for (int i=0;i<(50-row1);i++)
{
   if (i<(49-row1))
   {
     strshow_data = strshow_data + "['','','','','','','','','','','','','','','','','','','','','','',''],";
   }else
   {
     strshow_data = strshow_data + "['','','','','','','','','','','','','','','','','','','','','','','']";
   }

}


strshow_data = strshow_data + "]";

String ccode = "01";
int cnum = 1;
cnum = row1 + 1;
if (cnum<10)
{ccode="0"+String.valueOf(cnum);}
else
{ccode=String.valueOf(cnum);}

 %>
<HTML>
<HEAD>
<TITLE></TITLE>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META http-equiv="Content-Type" content="text/html; charset=GBK">
<LINK type="text/css" rel="stylesheet" href="../../zrsysmanage/css/<%=user.getUserCSS()%>">


<SCRIPT LANGUAGE="JavaScript" src="../../zrsysmanage/script/Public.js"></SCRIPT>
<script type='text/javascript' src='../../dwr/engine.js'></script>
<script type='text/javascript' src='../../dwr/util.js'></script>
<script type='text/javascript' src='../../dwr/interface/AnalyseConfigBean.js'></script>


<%if("6".equals(user.getUserImage())){ %>
<link rel="stylesheet" type="text/css" media="all" href="../../ZrwebGui/sigma_grid_html/grid/calendar/calendar-blue.css">
<script type="text/javascript" src="../../ZrwebGui/sigma_grid_html/grid/calendar/calendar.js"></script>
<script type="text/javascript" src="../../ZrwebGui/sigma_grid_html/grid/calendar/calendar-setup.js"></script>
<link rel="stylesheet" type="text/css" href="../../ZrwebGui/sigma_grid_html/grid/gt_grid.css">
<link rel="stylesheet" type="text/css" href="../../ZrwebGui/sigma_grid_html/grid/skin/vista/skinstyle.css">
<link rel="stylesheet" type="text/css" href="../../ZrwebGui/sigma_grid_html/grid/skin/pink/skinstyle.css">
<link rel="stylesheet" type="text/css" href="../../ZrwebGui/sigma_grid_html/grid/skin/mac/skinstyle.css">
<script type="text/javascript" src="../../ZrwebGui/sigma_grid_html/grid/gt_msg_en.js"></script>
<script type="text/javascript" src="../../ZrwebGui/sigma_grid_html/grid/gt_const.js"></script>
<script type="text/javascript" src="../../ZrwebGui/sigma_grid_html/grid/gt_grid_all.js"></script>
<%}else{ %>
<link rel="stylesheet" type="text/css" media="all" href="../../ZrwebGui/sigma_grid/grid/calendar/calendar-blue.css">
<script type="text/javascript" src="../../ZrwebGui/sigma_grid/grid/calendar/calendar.js"></script>
<script type="text/javascript" src="../../ZrwebGui/sigma_grid/grid/calendar/calendar-setup.js"></script>
<link rel="stylesheet" type="text/css" href="../../ZrwebGui/sigma_grid/grid/gt_grid.css">
<link rel="stylesheet" type="text/css" href="../../ZrwebGui/sigma_grid/grid/skin/vista/skinstyle.css">
<link rel="stylesheet" type="text/css" href="../../ZrwebGui/sigma_grid/grid/skin/pink/skinstyle.css">
<link rel="stylesheet" type="text/css" href="../../ZrwebGui/sigma_grid/grid/skin/mac/skinstyle.css">
<script type="text/javascript" src="../../ZrwebGui/sigma_grid/grid/gt_msg_en.js"></script>
<script type="text/javascript" src="../../ZrwebGui/sigma_grid/grid/gt_const.js"></script>
<script type="text/javascript" src="../../ZrwebGui/sigma_grid/grid/gt_grid_all.js"></script>

<%} %>

<%if("6".equals(user.getUserWINDOWTYPE())){ %>
<SCRIPT LANGUAGE="JavaScript" src="../../zrsysmanage/html5/script/jquery-2.0.3.min.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" src="../../zrsysmanage/html5/layer/layer.js"></SCRIPT>
<%}%>

<script type="text/javascript" >
var css = "<%=user.getUserCSS()%>";
var skincss = "vista";

if (css=="Blue.css")
{skincss = "vista";}
else if (css=="Public.css")
{skincss = "default";}
else if (css=="Window.css" || css=="nBlue.css")
{skincss = "mac";}
else if (css=="Yellow.css")
{skincss = "pink";}
else
{skincss = "mac";}

var grid_demo_id = "myGrid1" ;
var show_data= <%=strshow_data%>;

var dsOption= {

	fields :[
		{name : 'f1'  },
		{name : 'f2'  },
		{name : 'f3'  },
                {name : 'f4'  },
		{name : 'f5'  },
		{name : 'f6'  },
                {name : 'f7'  },
		{name : 'f8'  },
		{name : 'f9'  },
                {name : 'f10'  },
		{name : 'f11'  },
		{name : 'f12'  },
                {name : 'f13'  },
		{name : 'f14'  },
		{name : 'f15'  },
                {name : 'f16'  },
		{name : 'f17'  },
		{name : 'f18'  },
                {name : 'f19'  },
		{name : 'f20'  },
		{name : 'f21'  },
		{name : 'f22'  }
	],

	recordType : 'array',
	data : show_data
}


var colsOption = [
           {id: 'f1' , header: "<center>编号</center>" , width :10 , align : 'center' ,hidden:true },
           {id: 'f2' , header: "<center>显示序号</center>" , width :60,  align : 'center'  },
	   {id: 'f3' , header: "<center>计算字段名称</center>" , width :200 ,align : 'center'  },
           {id: 'f4' , header: "<center>计算字段显示名称</center>" , width :150 ,align : 'center'  },
           {id: 'f5' , header: "<center>计算表达式</center>" , width :200,  align : 'center'  },
	   {id: 'f6' , header: "<center>计算级别</center>" , width :60 ,align : 'center'  },
           {id: 'f7' , header: "<center>是否隐藏列</center>" , width :70 ,align : 'center'  },

           {id: 'f8' , header: "<center>表达式运算条件</center>" , width :150 ,align : 'center'  },
           {id: 'f9' , header: "<center>附加符号</center>" , width :90,  align : 'center'  },
	   {id: 'f10' , header: "<center>小数点位数</center>" , width :90 ,align : 'center'  },
           {id: 'f11' , header: "<center>统计主表</center>" , width :150 ,align : 'center'  },

           {id: 'f12' , header: "<center>维数据对应的字段</center>" , width :120 ,align : 'center'  },
           {id: 'f13' , header: "<center>对应关系</center>" , width :90 ,align : 'center'  },



           {id: 'f14' , header: "add1" , width :10 ,align : 'center',hidden:true   },
           {id: 'f15' , header: "add2" , width :10 ,align : 'center',hidden:true   },
           {id: 'f16' , header: "add3" , width :10 ,align : 'center',hidden:true   },
           {id: 'f17' , header: "add4" , width :10 ,align : 'center',hidden:true   },
           {id: 'f18' , header: "add5" , width :10 ,align : 'center',hidden:true   },
           {id: 'f19' , header: "add6" , width :10 ,align : 'center',hidden:true   },
           {id: 'f20' , header: "add7" , width :10 ,align : 'center',hidden:true   },
           {id: 'f21' , header: "add8" , width :10 ,align : 'center',hidden:true   },
	   {id: 'f22' , header: "add9" , width :10 , align : 'center',hidden:true  }
];


var gridOption={
	id : grid_demo_id,
	<%if("6".equals(user.getUserImage())){%>
	width: "98%",
	height: "250px",
	<%}else{%>
	width: "98%",
	height: "98%",
	<%}%>
	container : 'gridbox',
	replaceContainer : true,
	dataset : dsOption ,
	columns : colsOption,
	pageSize : 500,
	toolbarContent : null,
        skin : skincss,

        onCellClick:function(value, record , cell, row,  colNO, rowNO,columnObj,grid){
           crow1 = rowNO;
        },

        onCellDblClick:function(value, record , cell, row,  colNO, rowNO,columnObj,grid){
           crow1 = rowNO;
           gridClick();
        },

       showIndexColumn : false
};


var mygrid=new Sigma.Grid( gridOption );
Sigma.Util.onLoad( Sigma.Grid.render(mygrid));

</script>






<script language="JavaScript" type="text/JavaScript">
<!--
function Check(theForm)
{
  try
  {
   AnalyseCFieldStr();
    return true;
  }
  catch(e)
  {
    alert(e.description);
    return false;
  }
}

//-->
</script>

</HEAD>
<BODY class="BodyMain">
<FORM name="RegForm" method="post" action="../../actionstatisticsother.do"  onsubmit="return Check(this);">
<input type="hidden" id ="Act" name="Act"  value="savecfield">
<input type="hidden" id ="FID" name="FID" value="<%=strID%>">
<input type="hidden" id ="AnalyseCFieldStr" name="AnalyseCFieldStr" value="">

     <%if("6".equals(user.getUserImage())){ %>
      <table border='0'  width="100%" cellspacing="0" cellpadding="0" align=center>
      <%}else{ %>
     <table border='0' height="100%" width="100%" cellspacing="0" cellpadding="0" align=center>
     <%} %>
       <tr>
          <td height="25" align="right"> </td>
          <td align="left"></td><td height="25" align="right">
          <td height="25" align="right"> </td>
           <td align="left"></td>
      </tr>
       <tr>
          <td height="25" align="right">
            计算字段名称：</td>
            <td align="left">

              <input class="text" type="text"  id="SFIELDNAME" name="SFIELDNAME" size="30" value="C<%=ccode%>">

         </td>
         <td height="25" align="right">
            字段显示名称：</td>
            <td align="left">
               <input class="text" type="text"  id="SFIELDSHOWNAME" name="SFIELDSHOWNAME" size="30">
         </td>
         </tr>
      <tr>
          <td height="25" align="right">
            计算表达式：</td>
            <td align="left" colspan="3">

           <table cellspacing="0" cellpadding="0" border='0'>
                       <tr>
                          <td>
                               <input class="text" type="text"  id="EXPRESSIONS" name="EXPRESSIONS" size="70"><%=userUI.ClickButton("设置","JavaScript:ShowModal1();","buttonSelect.gif",user.getUserImage())%>
                          </td>
                       </tr>
          </table>
         </td>
         </tr>
         <tr>
          <td height="25" align="right">
            运算条件：</td>
            <td align="left" colspan="3">
            <table cellspacing="0" cellpadding="0" border='0'>
                       <tr>
                          <td>
                               <input class="text" type="text"  id="EXPRESSIONSWHERE" name="EXPRESSIONSWHERE" size="70"><%=userUI.ClickButton("设置","JavaScript:ShowModal();","buttonSelect.gif",user.getUserImage())%>
                          </td>
                       </tr>
          </table>

         </td>
         </tr>
        <tr>
          <td height="25" align="right">
            计算级别：</td>
            <td align="left">
            <input class="text" type="text"  id="DISTINCTION" name="DISTINCTION" size="10" value="1" maxlength="1" onkeypress="if(event.keyCode<48 || event.keyCode>57) event.returnValue=false;">
         </td>
         <td height="25" align="right">
            是否隐藏列：</td>
            <td align="left">
             <input type="radio" name="ISSHOW"  id="ISSHOW1" value=1 >
              是　　
              <input type="radio" name="ISSHOW" id="ISSHOW0" value=0  checked>
              否

         </td>
         </tr>

          <tr>
          <td height="25" align="right">附加符号：</td>
          <td height="25" align="left">
            <input class="text" type="text"  id="ADDSIGN" name="ADDSIGN" size="10" maxlength="5">&nbsp;&nbsp;&nbsp;&nbsp;

            <td height="25" align="right">小数点位数：</td>
            <td height="25" align="left"><input class="text" type="text"  id="RADIXPOINT" name="RADIXPOINT" size="10" maxlength="2"  onkeypress="if(event.keyCode<48 || event.keyCode>57) event.returnValue=false;"></td>
          </tr>
          <tr>
               <td align="right">统计主表：</td>
               <td class="inputTd">
               <table cellspacing="0" cellpadding="0" border='0'>
                       <tr>
                          <td>
                               <input class="text" type="text"  id="TABLEIDname" name="TABLEIDname" size="24" readonly="readonly" value="<%=STATISTICS.getTABLEID()%>"><input class="text" type="hidden"  id="TABLEID" name="TABLEID" size="24"  value="<%=STATISTICS.getTABLEID()%>"><%=userUI.ClickButton("选择","JavaScript:ShowModalTableTree();","buttonSelect.gif",user.getUserImage())%>
                          </td>
                       </tr>
              </table>
              </td>
         <td height="25" align="right">
           维数据对应字段：</td>
            <td class="inputTd">
             <table cellspacing="0" cellpadding="0" border='0'>
                       <tr>
                          <td>
                               <input class="text" type="text"  id="CPLANARFIELDname" name="CPLANARFIELDname" size="20" readonly="readonly" value="<%=STATISTICS.getCPLANARFIELD()%>"><input class="text" type="hidden"  id="CPLANARFIELD" name="CPLANARFIELD" size="50"  value="<%=STATISTICS.getCPLANARFIELD()%>"><%=userUI.ClickButton("选择","JavaScript:ShowModalFieldList();","buttonSelect.gif",user.getUserImage())%>
                          </td>
                       </tr>
              </table>
            </td>
         </tr>
         <tr>
          <td height="25" align="right">
            维数据特殊关系：</td>
            <td align="left" colspan="3">
               <input class="text" type="text"  id="CPLANARESPECIAL" name="CPLANARESPECIAL" size="24">
               <br>
               <font class="WriteSign">说明：设置时对应字段失效，substr(字段,1,6)表示从1位取6个字符。</font>
           </td>
         </tr>
         <tr>
          <td height="25" align="right">
            对应关系：</td>
            <td align="left">
            <select name="CJOIN" id="CJOIN"  style="width=100">
                  <option value="0" <% if (STATISTICS.getCJOIN().equals("0")){%>selected<%}%>>无
                  <option value="1" <% if (STATISTICS.getCJOIN().equals("1")){%>selected<%}%>>等于
                  <option value="2" <% if (STATISTICS.getCJOIN().equals("2")){%>selected<%}%>>全包含
                  <option value="3" <% if (STATISTICS.getCJOIN().equals("3")){%>selected<%}%>>左包含
                  <option value="4" <% if (STATISTICS.getCJOIN().equals("4")){%>selected<%}%>>右包含
               </select>
         </td>
          <td height="25" align="right"> 显示序号： </td>
           <td align="left"> <input class="text" type="text"  id="SHOWCODE" name="SHOWCODE" size="10" maxlength="6"   value="<%=ccode%>" onkeypress="if(event.keyCode<48 || event.keyCode>57) event.returnValue=false;">
         </td>
         </tr>
      <tr>
          <td height="25" align="center" colspan="4">
               <table cellspacing="0" cellpadding="0" border='0'>
                   <tr>
                     <%=userUI.ClickButton1("增加行","gridAddRow();","IcoAdd.gif",user.getUserImage())%>
                     <%=userUI.ClickButton1("删除行","gridDeleteRow();","buttonDelete.gif",user.getUserImage())%>
                     <%=userUI.ClickButton1("更  新","gridUpdateRow();","buttonCancel.gif",user.getUserImage())%>
                     <%=userUI.ClickButton1("设置关联配置","OpenSun();","buttonSure.gif",user.getUserImage())%>
                     <%=userUI.ClickButton1("初始条件配置","OpenSunWhere();","IcoEdit.gif",user.getUserImage())%>
                     <%=userUI.ClickButton("保 存","JavaScript:if(Check(document.RegForm)){document.RegForm.submit();}","buttonSave.gif",user.getUserImage())%>
                   </tr>
                </table>
      </td></tr>
      <tr>
      <%if("6".equals(user.getUserImage())){ %>
      <td  colspan="4" style="padding-left: 120px;">
      <br/>
      <DIV id="divMessage" style='position:absolute;width:90%;height:90%;overflow:auto'>
      <div id="gridbox" style="border:0px solid #cccccc;background-color:#f3f3f3;padding:5px;height:200px;width:700px;" ></div>

        </div>
     </td>
      <%}else{ %>
      <td height="90%"  colspan="4"  align="left" valign="top">
      <DIV id="divMessage" style='position:absolute;width:100%;height:310;overflow:auto'>
      <div id="gridbox" style="border:0px solid #cccccc;background-color:#f3f3f3;padding:5px;height:200px;width:700px;" ></div>

        </div>
     </td>
      <%} %>


  </tr>

  </table>


  </form>
</BODY>
<script language="JavaScript" type="text/JavaScript">
<!--
var row1 = <%=row1%>;
var crow1 = 0;

function ShowModal()
{
  var url='CtlAbleFieldDValue.jsp?ID=<%=strID%>';
  var status='dialogHeight:400px;dialogWidth:850px;status:0;help:no;center:yes';
  <%if("6".equals(user.getUserWINDOWTYPE())){ %>
  layer.open({
     type: 2,
     title:'设置条件',
     area: ['850px', '408px'],
     fix: false, //不固定
     maxmin: false,
     content: url+'&zdid=EXPRESSIONSWHERE'
   });
  <%}else{%>
    var rtnResult=window.showModalDialog(url,window,status);
   if (rtnResult!=null)
     {
       RegForm.EXPRESSIONSWHERE.value=rtnResult;
     }
<%}%>
}
function ShowModal1()
{
  var url='CtlAbleFieldDValue1.jsp?ID=<%=strID%>';
  var status='dialogHeight:400px;dialogWidth:850px;status:0;help:no;center:yes';
  <%if("6".equals(user.getUserWINDOWTYPE())){ %>
  layer.open({
     type: 2,
     title:'设置条件',
     area: ['850px', '408px'],
     fix: false, //不固定
     maxmin: false,
     content: url+'&zdid=EXPRESSIONS'
   });
  <%}else{%>
  var rtnResult=window.showModalDialog(url,window,status);
 if (rtnResult!=null)
   {
     RegForm.EXPRESSIONS.value=rtnResult;
   }
<%}%>
}
//
function OpenSun(){
    if (mygrid.getCellValue("f1",crow1)!="")
    {
      var aa = mygrid.getCellValue("f1",crow1);
      if(aa=="1"){
          alert("请先保存该记录后再设置关联配置!");
      }else{
        var url="ListSun4.jsp?FID="+aa;
        var name="PopWindow";
        var ShowPopWindow = null;
        var status="toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes,width=700,height=400";
        <%if("6".equals(user.getUserWINDOWTYPE())){ %>
       layer.open({
        type: 2,
        title:'设置关联配置',
        area: ['800px', '450px'],
        fix: false, //不固定
        maxmin: false,
        content: url+'&zdid=WHEREVALUE'
       });

  <%}else{%>
        ShowPopWindow = window.open(url,name,status);
        ShowPopWindow.moveTo(200,60);
        ShowPopWindow.focus();
        <%}%>
      }
   }

}
//
function OpenSunWhere(){
    if (mygrid.getCellValue("f1",crow1)!="")
    {
      var aa =  mygrid.getCellValue("f1",crow1);
      if(aa=="1"){
      alert("请先保存该记录后再配置初始条件!");
      }else{
        var url="ListSunWhere.jsp?TableName="+RegForm.TABLEID.value+"&ID="+aa;
        var name="PopWindow";
        var ShowPopWindow = null;
        var status="toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes,width=700,height=400";
        <%if("6".equals(user.getUserWINDOWTYPE())){ %>
       layer.open({
         type: 2,
         title:'初始条件配置',
         area: ['800px', '450px'],
         fix: false, //不固定
         maxmin: false,
         content: url+'&zdid=WHEREVALUE'
        });
  <%}else{%>
        ShowPopWindow = window.open(url,name,status);
        ShowPopWindow.moveTo(200,60);
        ShowPopWindow.focus();
        <%}%>
      }

}
}
//
function ShowModalTableTree()
{
  var url='TableTree1.jsp?strResult='+RegForm.TABLEID.value;
  var status='dialogHeight:450px;dialogWidth:250px;status:0;help:no;center:yes';
  <%if("6".equals(user.getUserWINDOWTYPE())){ %>
  layer.open({
     type: 2,
     title:'选择表',
     area: ['300px', '450px'],
     fix: false, //不固定
     maxmin: false,
     content: url+'&zdid=TABLEID/TABLEIDname'
   });
  <%}else{%>
  var rtnResult=window.showModalDialog(url,window,status);
 if (rtnResult!=null)
   {
     var   sarray=new   Array();
     sarray=rtnResult.split(',');
     RegForm.TABLEID.value=sarray[0];
     RegForm.TABLEIDname.value=sarray[1];
   }
<%}%>
}
function ShowModalFieldList()
{
  var url='SelectField1.jsp?TableName='+RegForm.TABLEID.value+'&strResult='+RegForm.CPLANARFIELD.value;

  var status='dialogHeight:150px;dialogWidth:380px;status:0;help:no;center:yes';
  <%if("6".equals(user.getUserWINDOWTYPE())){ %>
  layer.open({
     type: 2,
     title:'选择字段',
     area: ['300px', '150px'],
     fix: false, //不固定
     maxmin: false,
     content: url+'&zdid=CPLANARFIELD/CPLANARFIELDname'
   });
  <%}else{%>
  var rtnResult=window.showModalDialog(url,window,status);
 if (rtnResult!=null)
   {
    var  sarray=new   Array();
     sarray=rtnResult.split(',');
     RegForm.CPLANARFIELD.value=sarray[0];
     RegForm.CPLANARFIELDname.value=sarray[1];
   }
<%}%>
}

//
function gridAddRow()
{
  mygrid.setCellValue("f1",row1,"1");
  mygrid.setCellValue("f2",row1,RegForm.SHOWCODE.value);
  mygrid.setCellValue("f3",row1,RegForm.SFIELDNAME.value);
  mygrid.setCellValue("f4",row1,RegForm.SFIELDSHOWNAME.value);
  mygrid.setCellValue("f5",row1,RegForm.EXPRESSIONS.value);
  mygrid.setCellValue("f6",row1,RegForm.DISTINCTION.value);
  if(RegForm.ISSHOW1.checked){
      mygrid.setCellValue("f7",row1,"是");
      mygrid.setCellValue("f18",row1,"1");
      }
   else{
      mygrid.setCellValue("f7",row1,"否");
      mygrid.setCellValue("f18",row1,"0");
  }
  mygrid.setCellValue("f8",row1,RegForm.EXPRESSIONSWHERE.value);
  mygrid.setCellValue("f9",row1,RegForm.ADDSIGN.value);
  mygrid.setCellValue("f10",row1,RegForm.RADIXPOINT.value);
  mygrid.setCellValue("f11",row1,RegForm.TABLEIDname.value);
  mygrid.setCellValue("f12",row1,RegForm.CPLANARFIELDname.value);
  mygrid.setCellValue("f13",row1,RegForm.CJOIN.options[RegForm.CJOIN.selectedIndex].text);
  mygrid.setCellValue("f14",row1,RegForm.SFIELDNAME.value);
  mygrid.setCellValue("f15",row1,RegForm.SFIELDSHOWNAME.value);
  mygrid.setCellValue("f16",row1,RegForm.EXPRESSIONS.value);
  mygrid.setCellValue("f17",row1,RegForm.DISTINCTION.value);

  mygrid.setCellValue("f19",row1,RegForm.TABLEID.value);
  mygrid.setCellValue("f20",row1,RegForm.CPLANARFIELD.value);
  mygrid.setCellValue("f21",row1,RegForm.CJOIN.value);
  mygrid.setCellValue("f22",row1,RegForm.CPLANARESPECIAL.value);

  mygrid.refresh();

  row1 = row1+1;

}

function gridDeleteRow()
{
  if(confirm("确定要删除选中的行吗?"))
  {
      mygrid.setCellValue("f1",crow1,"");
      mygrid.setCellValue("f2",crow1,"");
      mygrid.setCellValue("f3",crow1,"");
      mygrid.setCellValue("f4",crow1,"");
      mygrid.setCellValue("f5",crow1,"");
      mygrid.setCellValue("f6",crow1,"");
      mygrid.setCellValue("f7",crow1,"");
      mygrid.setCellValue("f8",crow1,"");
      mygrid.setCellValue("f9",crow1,"");
      mygrid.setCellValue("f10",crow1,"");
      mygrid.setCellValue("f11",crow1,"");
      mygrid.setCellValue("f12",crow1,"");
      mygrid.setCellValue("f13",crow1,"");
      mygrid.setCellValue("f14",crow1,"");
      mygrid.setCellValue("f15",crow1,"");
      mygrid.setCellValue("f16",crow1,"");
      mygrid.setCellValue("f17",crow1,"");
      mygrid.setCellValue("f18",crow1,"");
      mygrid.setCellValue("f19",crow1,"");
      mygrid.setCellValue("f20",crow1,"");
      mygrid.setCellValue("f21",crow1,"");
      mygrid.setCellValue("f22",crow1,"");
      mygrid.refresh();
  }

}

function gridUpdateRow()
{
  if (mygrid.getCellValue("f1",crow1)=="")
     {
        alert("提示:只能选择保存过的记录更新!");
        return;
     }

  mygrid.setCellValue("f2",crow1,RegForm.SHOWCODE.value);
  mygrid.setCellValue("f3",crow1,RegForm.SFIELDNAME.value);
  mygrid.setCellValue("f4",crow1,RegForm.SFIELDSHOWNAME.value);
  mygrid.setCellValue("f5",crow1,RegForm.EXPRESSIONS.value);
  mygrid.setCellValue("f6",crow1,RegForm.DISTINCTION.value);
  if(RegForm.ISSHOW1.checked){
      mygrid.setCellValue("f7",crow1,"是");
      mygrid.setCellValue("f18",crow1,"1");
      }
   else{
      mygrid.setCellValue("f7",crow1,"否");
      mygrid.setCellValue("f18",crow1,"0");
  }

  mygrid.setCellValue("f8",crow1,RegForm.EXPRESSIONSWHERE.value);
  mygrid.setCellValue("f9",crow1,RegForm.ADDSIGN.value);
  mygrid.setCellValue("f10",crow1,RegForm.RADIXPOINT.value);
  mygrid.setCellValue("f11",crow1,RegForm.TABLEIDname.value);
  mygrid.setCellValue("f12",crow1,RegForm.CPLANARFIELDname.value);
  mygrid.setCellValue("f13",crow1,RegForm.CJOIN.options[RegForm.CJOIN.selectedIndex].text);
  mygrid.setCellValue("f14",crow1,RegForm.SFIELDNAME.value);
  mygrid.setCellValue("f15",crow1,RegForm.SFIELDSHOWNAME.value);
  mygrid.setCellValue("f16",crow1,RegForm.EXPRESSIONS.value);
  mygrid.setCellValue("f17",crow1,RegForm.DISTINCTION.value);
  mygrid.setCellValue("f19",crow1,RegForm.TABLEID.value);
  mygrid.setCellValue("f20",crow1,RegForm.CPLANARFIELD.value);
  mygrid.setCellValue("f21",crow1,RegForm.CJOIN.value);
  mygrid.setCellValue("f22",crow1,RegForm.CPLANARESPECIAL.value);
  mygrid.refresh();

}

function AnalyseCFieldStr()
{
  var strResult="0#0#0#0#0#0#0#0#0#0#0#0#0#0&";
  //
  for(row=0;row<=50;row++)
  {
    var getid = mygrid.getCellValue("f1",row);
    if (getid!="" )
     {

    strResult+=mygrid.getCellValue("f14",row)+"#"+
               mygrid.getCellValue("f15",row)+"#"+
               mygrid.getCellValue("f16",row)+"#"+
               mygrid.getCellValue("f17",row)+"#"+
               mygrid.getCellValue("f18",row)+"#"+
               mygrid.getCellValue("f8",row)+"#"+
               mygrid.getCellValue("f9",row)+"#"+
               mygrid.getCellValue("f10",row)+"#"+
               mygrid.getCellValue("f2",row)+"#"+
               mygrid.getCellValue("f19",row)+"#"+
               mygrid.getCellValue("f20",row)+"#"+
               mygrid.getCellValue("f21",row)+"#"+
               mygrid.getCellValue("f22",row)+"#"+
               mygrid.getCellValue("f1",row)+"&";

      }

   }
  RegForm.AnalyseCFieldStr.value=strResult;
}

function gridClick() //点击响应
{
   if (mygrid.getCellValue("f1",crow1)!="")
   {
       RegForm.SHOWCODE.value=mygrid.getCellValue("f2",crow1);
       RegForm.EXPRESSIONSWHERE.value=mygrid.getCellValue("f8",crow1);
       RegForm.ADDSIGN.value=mygrid.getCellValue("f9",crow1);
       RegForm.RADIXPOINT.value=mygrid.getCellValue("f10",crow1);
       RegForm.SFIELDNAME.value=mygrid.getCellValue("f14",crow1);
       RegForm.SFIELDSHOWNAME.value=mygrid.getCellValue("f15",crow1);
       RegForm.EXPRESSIONS.value=mygrid.getCellValue("f16",crow1);
       RegForm.DISTINCTION.value=mygrid.getCellValue("f17",crow1);
       if(mygrid.getCellValue("f18",crow1)=="1"){
          RegForm.ISSHOW1.checked=true;
       }
       else{
          RegForm.ISSHOW0.checked=true;
       }

       RegForm.TABLEIDname.value=mygrid.getCellValue("f11",crow1);
       RegForm.TABLEID.value=mygrid.getCellValue("f19",crow1);
       RegForm.CPLANARFIELDname.value=mygrid.getCellValue("f12",crow1);
       RegForm.CPLANARFIELD.value=mygrid.getCellValue("f20",crow1);
       RegForm.CJOIN.value=mygrid.getCellValue("f21",crow1);
       RegForm.CPLANARESPECIAL.value=mygrid.getCellValue("f22",crow1);

   }

}
<%if("6".equals(user.getUserImage())){%>
var h=$(document.body).height();//浏览器当前窗口文档body的高度
h=h*1-300;

//$("#divMessage").css("height", h+"px");//通过设置CSS属性来设置元素的高

<%}%>
//--
</script>
</HTML>
<%
//清空相关对象
user = null;
userUI = null;
StatisticsCfg = null;
cfield = null;
STATISTICS = null;

%>
