<%@ page contentType="text/html; charset=GBK"%>
<%@ page import = "zr.zrpower.common.util.SysPreperty"%>
<%@ page import = "zr.zrpower.entity.sys.SessionUser"%>
<%@ page import = "zr.zrpower.ejb.sys.UIService"%>
<%@ page import = "zr.zrpower.common.web.SelectBox"%>
<%@ page import = "zr.zrpower.analyseengine.service.StatisticsConfig"%>

<%@ page import = "java.lang.Object"%>
<%@ page import = "java.util.*" %>
<%@ page import = "java.text.*" %>



<HTML>
<%
StatisticsConfig StatisticsCfg =  new StatisticsConfig();
UIService userUI =new UIService();
SessionUser user = (SessionUser)session.getAttribute("userinfo");
SelectBox sb = new SelectBox(StatisticsCfg.getTableList());
%>
<HTML>
<HEAD>
<TITLE><%=SysPreperty.getProperty().SystemName%><%=SysPreperty.getProperty().Versoin%></TITLE>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META http-equiv="Content-Type" content="text/html; charset=GBK">

<script type="text/javascript" src="../../ZrwebGui/tab/tab.js"></script>
<link rel="stylesheet" type="text/css" href="../../ZrwebGui/tab/tab.css">

<STYLE type=text/css>
#con { FONT-SIZE: 12px; MARGIN: 0px auto; WIDTH: 98% }
#tags { PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0px 10px; WIDTH: 98% ; PADDING-TOP: 0px; HEIGHT: 23px }
#tags LI { BACKGROUND: url(../../ZrwebGui/tab/skin/<%=user.getUserImage()%>/tagleft.gif) no-repeat left bottom; FLOAT: left; MARGIN-RIGHT: 1px; LIST-STYLE-TYPE: none; HEIGHT: 23px }
#tags LI A { PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BACKGROUND: url(../../ZrwebGui/tab/skin/<%=user.getUserImage()%>/tagright.gif) no-repeat right bottom; FLOAT: left; PADDING-BOTTOM: 0px; COLOR: #999;
LINE-HEIGHT: 23px; PADDING-TOP: 0px; HEIGHT: 23px; TEXT-DECORATION: none }
.tagContent { PADDING-RIGHT: 10px; DISPLAY: none; PADDING-LEFT: 10px; BACKGROUND: url(../../ZrwebGui/tab/skin/<%=user.getUserImage()%>/bg.gif) repeat-x; PADDING-BOTTOM: 10px; WIDTH: 100%; COLOR: #474747;
PADDING-TOP: 10px; HEIGHT: 400 }
</STYLE>


<link REL="stylesheet" type="text/css" 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>
<script language="JavaScript" type="text/JavaScript">
<!--
function Check(theForm){
//判断配置名称不能为空
  if (theForm.STATISTICSNAME.value == ""){

     <%if("6".equals(user.getUserWINDOWTYPE())){%>
    parent.layer.alert('统计配置名称不能为空!', {icon: 7});
    <%}else{%>
    alert("统计配置名称不能为空！");
    <%}%>

    theForm.STATISTICSNAME.focus();
    return (false);
  }

<%if("6".equals(user.getUserWINDOWTYPE())){%>
    RegForm.Act.value='savemain';
    document.RegForm.submit();
         window.parent.document.location.reload();
    <%}else{%>
    RegForm.Act.value='savemain';
   return true;
    <%}%>
}
//-->
</script>
</HEAD>
<BODY class="BodyMain">
<FORM name="RegForm" method="post" action="../../actionstatistics.do"  enctype="multipart/form-data" onsubmit="return Check(this);">
<input type="hidden" id="Act" name="Act" value="savemain">
<input type="hidden" name="ID" value="">
<input type="hidden" name="MONTH" value="">
<input type="hidden" name="WEEK" value="">
<input type="hidden" name="DAY" value="">
<input type="hidden" name="HOUR" value="">
<input type="hidden" name="MINUTE" value="">
<input type="hidden" name="TIMESTYPE" value="1">
<input type="hidden" id="PIEGRP" name="PIEGRP" value="">
<input type="hidden" id="COLUMNGRP" name="COLUMNGRP" value="">
<input type="hidden" id="LINESGRP" name="LINESGRP" value="">
<input type="hidden" id="EVENTGRP" name="EVENTGRP" value="">
<input type="hidden" id="MIXGRP" name="MIXGRP" value="">
<input type="hidden" id="BARGRP" name="BARGRP" value="">
<input type="hidden" id="CURVEGRP" name="CURVEGRP" value="">
<input type="hidden" id="PIEDGRP" name="PIEDGRP" value="">
<input type="hidden" id="STACKGRP" name="STACKGRP" value="">
<input type="hidden" id="BARSTACKGRP" name="BARSTACKGRP" value="">
<input type="hidden" id="ISCHART" name="ISCHART" value="0">


<DIV id="con">
<%if("6".equals(user.getUserWINDOWTYPE())){ %>
<UL id="tags">
    <LI >
    <a style="" onClick="selectTag('tagContent0',this)"  href="javascript:void(0)" class="btn1 btn-medium btn-blue btn-radius">
      基本属性
    </a>
    </LI>
     <LI>
     <a style="" onClick="selectTag('tagContent1',this)"  href="javascript:void(0)" class="btn1 btn-medium btn-blue btn-radius">
      其它属性
    </a>

     </LI>
     </UL>
<%}else{ %>
  <UL id="tags">
    <LI class="selectTag">
      <A onClick="selectTag('tagContent0',this)"  href="javascript:void(0)">
      <IMG src="../../ZrwebGui/tab/skin/<%=user.getUserImage()%>/page.gif" align='absmiddle' border=0>
      基本属性
      </A>
    </LI>
     <LI>
       <A onClick="selectTag('tagContent1',this)" href="javascript:void(0)">
       <IMG src="../../ZrwebGui/tab/skin/<%=user.getUserImage()%>/page.gif" align='absmiddle' border=0>
         其它属性
       </A>
     </LI>
  </UL>
  <%} %>
  <DIV id="tagContent" style="height: 465px;">
    <DIV class="tagContent selectTag" id="tagContent0">


    <table border="0" class="inputTable" cellspacing="0" cellpadding="0" align="center">
           <tr>
               <td   height="30"  width = "25%" align="right">统计配置名称：</td>
               <td   height="30" class="inputTd"><input class="text" type="text" name="STATISTICSNAME" size="50" maxlength="100"><Font class="WriteSign">*</Font></td>
           </tr>
           <tr>
               <td   height="30" width = "25%" align="right">统计配置描述：</td>
               <td   height="30" class="inputTd" ><input class="text" type="text" name="SDESC" size="50" maxlength="100"></td>
          </tr>
          <tr>
               <td   height="30" width = "25%" align="right">统计表：</td>
               <td   height="30" class="inputTd" >
               <table cellspacing="0" cellpadding="0" border='0'>
                       <tr>
                          <td>
                               <input class="text" type="text"  id="TABLEID" name="TABLEID" size="50"><%=userUI.ClickButton("选择","JavaScript:ShowModalTableTree();","buttonSelect.gif",user.getUserImage())%>
                          </td>
                       </tr>
              </table>
              </td>
          </tr>



      <tr><td   height="30" colspan="2" width = "100%" align="center">

          <table border="0" class="inputTable" cellspacing="0" cellpadding="0" align="center">
           <tr>
            <td width = "30%" align="right">二维数据对应的表：</td>
            <td class="inputTd">
             <table cellspacing="0" cellpadding="0" border='0'>
                       <tr>
                          <td>
                               <input class="text" type="text"  id="PLANARTABLE" name="PLANARTABLE" size="50"><%=userUI.ClickButton("选择","JavaScript:ShowModalTableTree1();","buttonSelect.gif",user.getUserImage())%>
                          </td>
                       </tr>
              </table>

            </td>
          </tr>

          <tr>
            <td   height="30" width = "30%" align="right">维数据项是否包含统计单位：</td>
            <td   height="30" class="inputTd">
               <input type="radio" name="WISMATCH"  id="WISMATCH" value=1>
              是　　
              <input type="radio" name="WISMATCH" id="WISMATCH" value=0 checked>
              否&nbsp;&nbsp;<Font class="WriteSign">注：当二维数据对应的表为单位表时填写。</Font>
            </td>
          </tr>
           <tr>
            <td   height="30" width = "30%" align="right">是否是与单位表相似的字典表：</td>
            <td   height="30" class="inputTd">
               <input type="radio" name="ISUNIT"  id="ISUNIT" value=1>
              是　　
              <input type="radio" name="ISUNIT" id="ISUNIT" value=0 checked>
              否&nbsp;&nbsp;<Font class="WriteSign">注：设置后按单位相似的多级统计方式。</Font>
            </td>
          </tr>
           <tr>
            <td   height="30" width = "30%" align="right">二维表的关联字段：</td>
            <td   height="30" class="inputTd">
             <table cellspacing="0" cellpadding="0" border='0'>
                       <tr>
                          <td>
                               <input class="text" type="text"  id="PLANARFIELD" name="PLANARFIELD" size="50"><%=userUI.ClickButton("选择","JavaScript:ShowModalFieldList11();","buttonSelect.gif",user.getUserImage())%>
                          </td>
                       </tr>
              </table>
            </td>
          </tr>

           <tr>
            <td   height="30" width = "30%" align="right">二维表的关联中文字段：</td>
            <td   height="30" class="inputTd">
               <table cellspacing="0" cellpadding="0" border='0'>
                       <tr>
                          <td>
                               <input class="text" type="text"  id="PLANARFIELDNAME" name="PLANARFIELDNAME" size="50"><%=userUI.ClickButton("选择","JavaScript:ShowModalFieldList12();","buttonSelect.gif",user.getUserImage())%>
                          </td>
                       </tr>
              </table>

            </td>
          </tr>
            <tr>
            <td   height="30" width = "30%" align="right">当前表与二维表对应的字段：</td>
            <td   height="30" class="inputTd">
             <table cellspacing="0" cellpadding="0" border='0'>
                       <tr>
                          <td>
                               <select name="CJOIN" id="CJOIN"  style="width=100">
                  <option value="1">等于
                  <option value="2">全包含
                  <option value="3">左包含
                  <option value="4">右包含
               </select><input class="text" type="text"  id="CPLANARFIELD" name="CPLANARFIELD" size="33"><%=userUI.ClickButton("选择","JavaScript:ShowModalFieldList();","buttonSelect.gif",user.getUserImage())%>
                          </td>
                       </tr>
              </table>

            </td>
          </tr>
          <tr>
            <td   height="30" width = "30%" align="right">二维数据的条件：</td>
            <td   height="30" class="inputTd">
             <table cellspacing="0" cellpadding="0" border='0'>
                       <tr>
                          <td>
                               <input class="text" type="text"  id="WHEREVALUE" name="WHEREVALUE" size="50"><%=userUI.ClickButton("设置","JavaScript:ShowModal();","buttonSelect.gif",user.getUserImage())%>
                          </td>
                       </tr>
          </table>

            </td>
          </tr>
           <tr>
            <td   height="30" width = "30%" align="right">是否显示序号列：</td>
            <td   height="30" class="inputTd">
             <table cellspacing="0" cellpadding="0" border='0'>
                       <tr>
                          <td>
                               <input type="radio" name="ISNUMBER"  id="ISNUMBER" value=1>
                                 是　　
                                 <input type="radio" name="ISNUMBER" id="ISNUMBER" value=0 checked>
                                 否

                                 &nbsp;&nbsp;&nbsp;
                                 是否显示全为零的行:
                                 <input type="radio" name="ISZERO"  id="ISZERO" value=1>
                                 是　　
                                 <input type="radio" name="ISZERO" id="ISZERO" value=0 checked>
                                 否
                          </td>
                       </tr>
          </table>

            </td>
          </tr>


           <tr>
            <td   height="30" width = "30%" align="right">二维表附加显示字段：</td>
            <td   height="30" class="inputTd">
             <table cellspacing="0" cellpadding="0" border='0'>
                       <tr>
                          <td>
                               <input class="text" type="text"  id="ADDFIELD" name="ADDFIELD" size="35">
                               多个字段间用,号分隔。
                          </td>
                       </tr>
          </table>

            </td>
          </tr>


             </table>

          </td></tr>


          </table>


    </DIV>
    <DIV class="tagContent" id="tagContent1">

   <br>注意：设置各种日期选择类型时注意所传参数P1到P5值的变化，然后在统计初始条件中引用相关参数即可。
               <br><br>
         <fieldset>
           <legend>自定义统计前选择的条件</legend>
           <table border="0" class="inputTable" cellspacing="0" cellpadding="0" align="center">

          <tr>
               <td width = "30%" align="right">日期选择类型：</td>
               <td class="inputTd" >
               <select name="SINPUTTYPE" id="SINPUTTYPE"  style="width=320"  onchange="ChangradItem2()">
                  <option value="1">无
                  <option value="2">年月周日固定格式条件
                  <option value="3">日报固定格式条件
                  <option value="B">日报固定格式条件(默认上一天日期)
                  <option value="9">年报固定格式条件
                  <option value="A">月报固定格式条件
                  <option value="C">月报固定格式条件(默认上月)
                  <option value="4">自定义条件
                  <option value="5">自定义条件录入页面
                  <option value="6">年份比较条件
                  <option value="7">年份月份比较条件
                  <option value="8">年份季度比较条件
               </select>



               </td>
          </tr>
          <tr>
            <td width = "30%" align="right">统计字典表：</td>
            <td  height="30">
             <br>
               <input class="text" type="text"  id="CODETABLE" name="CODETABLE"   size="30">
               <br>字典表的内容下拉作为选择的条件时设置,单独年、月、日报条件时生效。


             </td>
          </tr>
         <tr>
            <td width = "30%" align="right"><div id="div21" style="display:none">条件录入页面：</div></td>
            <td class="inputTd"><div id="div22" style="display:none">
            <input class="text" type="text"  id="SINPUTPAGE" name="SINPUTPAGE" size="50"></div>
              </td>
          </tr>
           </table>
          <br>
          </fieldset>
           <fieldset>
           <legend>自动计算及报表形式</legend>
           <table border="0" class="inputTable" cellspacing="0" cellpadding="0" align="center">
          <tr>
               <td width = "30%" align="right">是否显示平均值统计行：</td>
               <td class="inputTd" >
              <input type="radio" name="ISAGV"  id="ISAGV" value=1 >
              是&nbsp;&nbsp;　　
              <input type="radio" name="ISAGV" id="ISAGV" value=0  checked>
              否</td>
          </tr>
          <tr>
               <td width = "30%" align="right">是否显示合计统计行：</td>
               <td class="inputTd" >
              <input type="radio" name="ISSUM"  id="ISSUM" value=1  checked>
              是&nbsp;&nbsp;　　
              <input type="radio" name="ISSUM" id="ISSUM" value=0 >
              否</td>
          </tr>
         <tr>
               <td width = "30%" align="right">报表显示类型：</td>
               <td class="inputTd" >
              <input type="radio" name="ISSHOWTYPE"  id="ISSHOWTYPE" value=1 checked>
              一般　　
              <input type="radio" name="ISSHOWTYPE" id="ISSHOWTYPE" value=2  >
              嵌入式</td>
          </tr>

           </table>
          <br>
           <br>
          </fieldset>


         <fieldset>
           <legend>其它设置</legend>
           <table border="0" class="inputTable" cellspacing="0" cellpadding="0" align="center">
           <tr>
               <td width = "30%" align="right">单元格的详细信息链接设置：</td>
               <td class="inputTd">
                 <input class="text" type="text"  id="SHOWLINK" name="SHOWLINK" size="50">
                 <br>设置后报表点击到最后一层时可打开相应地址，可用来显示明细等。
               </td>
           </tr>
           <tr>
               <td width = "30%" align="right">统计按钮描述：</td>
               <td class="inputTd">
                 <input class="text" type="text"  id="TBUTTON" name="TBUTTON"   size="50">
                 <br>生成统计时,默认的"统计"按钮名称叫其它名称时可设置。
               </td>
           </tr>

           </table>
          <br>
          </fieldset>





    </DIV>
  </DIV>
</DIV>


                 <center><br>
                 <table cellspacing="0" cellpadding="0" border='0'><tr>
                 <%=userUI.ClickButton("保存","JavaScript:if(Check(document.RegForm)){document.RegForm.submit();}","buttonSave.gif",user.getUserImage())%>

                 <%if("6".equals(user.getUserWINDOWTYPE())){%>
     <%=userUI.ClickButton("关闭","JavaScript:parent.layer.closeAll();","buttonClose.gif",user.getUserImage())%>

  <%}else{ %>
    <%=userUI.ClickButton("关闭","JavaScript:window.opener.document.location.reload();window.close();","buttonClose.gif",user.getUserImage())%>

 <%} %>
                 </tr></table>
                 </center>


</FORM>
<%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 language="JavaScript" type="text/JavaScript">
function ShowModal()
{
  var url='ConValueSetup.jsp?strResult='+RegForm.WHEREVALUE.value;
  var status='dialogHeight:450px;dialogWidth:850px;status:0;help:no;center:yes';
  <%if("6".equals(user.getUserWINDOWTYPE())){ %>
  layer.open({
     type: 2,
     title:'设置二维数据的条件',
     area: ['700px', '408px'],
     fix: false, //不固定
     maxmin: false,
     content: url+'&zdid=WHEREVALUE'
   });
  <%}else{%>
  var rtnResult=window.showModalDialog(url,window,status);
 if (rtnResult!=null)
   {
     RegForm.WHEREVALUE.value=rtnResult;
   }
   <%}%>
}
function ShowModalTableTree()
{
  var url='TableTree.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'
   });
  <%}else{%>
  var rtnResult=window.showModalDialog(url,window,status);
 if (rtnResult!=null)
   {
     RegForm.TABLEID.value=rtnResult;
   }
   <%}%>
}
function ShowModalTableTree1()
{
  var url='TableTree.jsp?strResult='+RegForm.PLANARTABLE.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=PLANARTABLE'
   });
  <%}else{%>
  var rtnResult=window.showModalDialog(url,window,status);
 if (rtnResult!=null)
   {
     RegForm.PLANARTABLE.value=rtnResult;
   }
   <%}%>
}

function ShowModalFieldList()
{
  var url='SelectField.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: ['380px', '180px'],
     fix: false, //不固定
     maxmin: false,
     content: url+'&zdid=CPLANARFIELD'
   });
  <%}else{%>
  var rtnResult=window.showModalDialog(url,window,status);
 if (rtnResult!=null)
   {
     RegForm.CPLANARFIELD.value=rtnResult;
   }
   <%}%>
}
function ShowModalFieldList11()
{
  var url='SelectField.jsp?TableName='+RegForm.PLANARTABLE.value+'&strResult='+RegForm.PLANARFIELD.value;
  var status='dialogHeight:150px;dialogWidth:380px;status:0;help:no;center:yes';
  <%if("6".equals(user.getUserWINDOWTYPE())){ %>
  layer.open({
     type: 2,
     title:'选择字段',
     area: ['380px', '180px'],
     fix: false, //不固定
     maxmin: false,
     content: url+'&zdid=PLANARFIELD'
   });
  <%}else{%>
  var rtnResult=window.showModalDialog(url,window,status);
  if (rtnResult!=null)
    {
     RegForm.PLANARFIELD.value=rtnResult;
    }
   <%}%>
}
function ShowModalFieldList12()
{
  var url='SelectField.jsp?TableName='+RegForm.PLANARTABLE.value+'&strResult='+RegForm.PLANARFIELDNAME.value;
  var status='dialogHeight:150px;dialogWidth:380px;status:0;help:no;center:yes';
  <%if("6".equals(user.getUserWINDOWTYPE())){ %>
  layer.open({
     type: 2,
     title:'选择字段',
     area: ['380px', '180px'],
     fix: false, //不固定
     maxmin: false,

     content: url+'&zdid=PLANARFIELDNAME'
   });
  <%}else{%>
  var rtnResult=window.showModalDialog(url,window,status);
 if (rtnResult!=null)
   {
     RegForm.PLANARFIELDNAME.value=rtnResult;
   }
   <%}%>
}


function ChangradItem2()
{
switch(window.RegForm.SINPUTTYPE.value)
{
  case '5':
    flag=1;
    break;
  case '4':
    flag=3;
    break;
  default:
  flag=2;
}
if(flag==1)
{
  div21.style.display='';
  div22.style.display='';
}
else{
  div21.style.display='none';
  div22.style.display='none';
}

}

function ChangradItem5(value)
{
switch(value)
{
  case '1':
  flag=1;
  break;
  default:
  flag=2;
}
if(flag==1)
{
  frm2.style.display='';
  frm3.style.display='';
}
else{
   frm2.style.display='none';
   frm3.style.display='';
  }
}
function Change(TypeName)
{
  if (TypeName=='day')
  {
        document.RegForm.TIMESTYPE.value = "1" ;
  }
  if (TypeName=='week')
  {
        document.RegForm.TIMESTYPE.value = "2"
  }
  if (TypeName=='month')
  {
        document.RegForm.TIMESTYPE.value = "3" ;
  }
  if (TypeName=='year')
  {
        document.RegForm.TIMESTYPE.value = "4";
  }
}

</script>
</BODY>
</HTML>
<script language="JavaScript" type="text/JavaScript">

function selectTag(showContent,selfObj){

	// 操作标签
	var tag = document.getElementById("tags").getElementsByTagName("li");
	var taglength = tag.length;
	for(i=0; i<taglength; i++){
		tag[i].className = "";
	}
	selfObj.parentNode.className = "selectTag";
	// 操作内容
	for(i=0; j=document.getElementById("tagContent"+i); i++){
		j.style.display = "none";
	}
	document.getElementById(showContent).style.display = "block";

}

</script>
<%
//清空相关对象
user = null;
userUI = null;
StatisticsCfg = null;
%>
