<%@ 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.mode.ANALYSE_STATISTICS_MAIN"%>

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


<%
SessionUser user = (SessionUser)session.getAttribute("userinfo");
UIService userUI =new UIService();
ANALYSE_STATISTICS_MAIN[] Statistics = null;
StatisticsConfig StatisticsCfg =  new StatisticsConfig();
//得到查询的记录集
Statistics = StatisticsCfg.GetStatisticsMainList();
String strshow_data = "";
int row1 = 0;


if (Statistics!=null && Statistics.length>0){
  row1 = Statistics.length;
  strshow_data = strshow_data + "[";
  for(int i=0;i<Statistics.length;i++){
         strshow_data = strshow_data + "[";
         strshow_data = strshow_data + "\""+Statistics[i].getID()+"\",";
         strshow_data = strshow_data + "\""+Statistics[i].getSTATISTICSNAME()+"\",";
         strshow_data = strshow_data + "\""+StatisticsCfg.GetAllTableFieldName("CHINESENAME","BPIP_TABLE","TABLENAME",Statistics[i].getTABLEID())+"\",";
         strshow_data = strshow_data + "\""+Statistics[i].getTIMETEMPLATE()+"\",";
         if (i < 19 || (i>=19 && i<(Statistics.length-1)))
         {
            strshow_data = strshow_data + "\"&nbsp;\"],\r\n";
         }else
         {
            strshow_data = strshow_data + "\"&nbsp;\"]";
         }
  }


  for (int i=0;i<(20-row1);i++)
{
   if (i<(19-row1))
   {
     strshow_data = strshow_data + "['','','','',''],\r\n";
   }else
   {
     strshow_data = strshow_data + "['','','','','']";
   }

}

  strshow_data = strshow_data + "]";
}else
{
   strshow_data = "null";
}

%>
<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()%>">


<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())){ %>
<LINK type="text/css" rel="stylesheet" href="../../zrsysmanage/html5/css/style_tables.css">
<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";}
if (css=="Public.css")
{skincss = "default";}
if (css=="Window.css" || css=="nBlue.css")
{skincss = "mac";}
if (css=="Yellow.css")
{skincss = "pink";}


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

var dsOption= {

	fields :[
		{name : 'id'  },
		{name : 'statisticsname'  },
		{name : 'tablename'  },
		{name : 'timetemplate'  },
                {name : 'add1'  }
	],

	recordType : 'array',
	data : show_data
}


var colsOption = [
           {id: 'id' , header: "<center>编号</center>" , width :100 , align : 'center'  },
           {id: 'statisticsname' , header: "<center>统计配置名称</center>" , width :280,  align : 'center'  },
	   {id: 'tablename' , header: "<center>统计主表</center>" , width :180 ,align : 'center'  },
	   {id: 'timetemplate' , header: "<center>网页显示模板</center>" , width :280 , align : 'center'   },
           {id: 'add1' , header: "<center>&nbsp;</center>" , width :280 , align : 'center'   }
];


var gridOption={
	id : grid_demo_id,
	width: "100%",
	height: "100%",
	container : 'gridbox',
	replaceContainer : true,
	dataset : dsOption ,
	columns : colsOption,
	pageSize : 500,
	toolbarContent : null,
        skin : skincss,

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

       showIndexColumn : false
};



<%if(!"6".equals(user.getUserWINDOWTYPE())){ %>
var mygrid=new Sigma.Grid( gridOption );
Sigma.Util.onLoad( Sigma.Grid.render(mygrid));
<%}%>
</script>





<SCRIPT LANGUAGE="JavaScript" src="../../zrsysmanage/script/Public.js"></SCRIPT>

</HEAD>
<BODY class="BodyMain">
<form name="recordfrm" action="List1.jsp">
<input type="hidden" name="setall" value="0">


<%if(!"6".equals(user.getUserWINDOWTYPE())){ %>

  <table border='0' height="100%" width="100%" cellspacing="0" cellpadding="0" align=center>
       <tr>
          <td height="30">


      <table border='0' height="30" width="100%" cellspacing="0" cellpadding="0" align=center>
          <tr><td width="10%"></td>
           <td width="82%" valign="bottom"><center>
          <br>
           <table cellspacing="0" cellpadding="0" border='0'>
            <tr><td height='22'><a href=JavaScript:add(); title='增加统计方案'><img border='0' align='absmiddle' src='../../zrsysmanage/images/<%=user.getUserImage()%>/dataadd.gif'>&nbsp;增加统计方案</a></td>
               <td height='22'><a href=JavaScript:edit(); title='编辑统计方案'><img border='0' align='absmiddle' src='../../zrsysmanage/images/<%=user.getUserImage()%>/dataedit.gif'>&nbsp;编辑统计方案</a></td>
            </tr>
          </table>
          </center></td>
           <td width="8%"></td>
        </tr>
      </table>

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

  </td>
  </tr>
  </table>
<%}else{%>

<table border='0' cellspacing="0" cellpadding="0">
       <tr>
          <td height="30">
<%=userUI.ClickButton("增加统计方案","JavaScript:add();","IcoAdd.gif",user.getUserImage())%>
  <%=userUI.ClickButton("编辑统计方案","JavaScript:edit();","IcoEdit.gif",user.getUserImage())%>
  </tr></table>
<div id="mianRole" style="height: 80%;overflow: auto;">
  <table class="bordered" id="html5_table">

<thead>
<tr>
<th style="width:4%;">序号</th>
<th style="width:10%;">编码</th>
<th style="width:25%;">统计配置名称</th>
<th style="width:25%;">统计主表</th>
<th style="width:30%;">网页显示模板</th>


</tr>
</thead>

<%
if (Statistics!=null && Statistics.length>0){
  for(int i=0;i<Statistics.length;i++){
     %>
     <tr onclick="click_color(this,'<%=Statistics[i].getID() %>');">
        <td style="text-align:center;"><%=i+1%></td>
        <td style="text-align:center;"><%=Statistics[i].getID() %></td>
        <td style="text-align:center;"><%=Statistics[i].getSTATISTICSNAME() %></td>
        <td ><%=StatisticsCfg.GetAllTableFieldName("CHINESENAME","BPIP_TABLE","TABLENAME",Statistics[i].getTABLEID()) %></td>
        <td ><%=Statistics[i].getTIMETEMPLATE() %></td>

     </tr>
     <%
  }
}

 %>
</table></div>
<%} %>


  </form>
</BODY>
<script language="JavaScript" type="text/JavaScript">
<!--
var allvalue="";
function clickValue(value){
    allvalue=value;
}

function add(){
<%if("6".equals(user.getUserWINDOWTYPE())){%>
  layer.open({
  type: 2,
  area: ['700px', '580px'],
  fix: false, //不固定
  maxmin: false,//是否可以最大化
  content: 'StatisticsAdd.jsp'
});
  <%}else{%>
  var url="StatisticsAdd.jsp";
  var name="PopWindow";
  var ShowPopWindow = null;
  var status="toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes,width=650,height=500";
  ShowPopWindow = window.open(url,name,status);
  ShowPopWindow.moveTo(280,80);
  ShowPopWindow.focus();
  <%}%>
}
function edit(){


<%if("6".equals(user.getUserWINDOWTYPE())){ %>
        var strID = allvalue;
        if(strID.length>0){
             layer.open({
               type: 2,
               area: ['700px', '580px'],
               fix: false, //不固定
               maxmin: false,//是否可以最大化
               content: 'StatisticsEdit.jsp?SelectedItems='+strID
          });
        }else{
           parent.parent.parent.layer.alert('请选择要编辑的记录!', {icon: 7});
        }
    <%}else{%>
        var allvalue = mygrid.getSelectedRecords()+",0";
    var strID = allvalue.split(",")[0];
    var url="StatisticsEdit.jsp?SelectedItems="+strID;
  var name="PopWindow";
  var ShowPopWindow = null;
  var status="toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes,width=650,height=580";
  ShowPopWindow = window.open(url,name,status);
  ShowPopWindow.moveTo(280,60);
  ShowPopWindow.focus();
    <%}%>


}

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