<%@page contentType="text/html;charset=GBK"%>
<%@page import="zr.zrpower.analyseengine.web.servlet.JxExcel"%>
<%@page import="java.io.*"%>
<%@page import="java.util.Date"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@ page import = "zr.zrpower.analyseengine.service.StatisticsControl"%>
<%@ page import = "zr.zrpower.analyseengine.mode.ANALYSE_STATISTICS_MAIN"%>
<%@ page import = "zr.zrpower.entity.sys.SessionUser" %>
<%
  SessionUser user = (SessionUser)session.getAttribute("userinfo");
  Date date = new Date();
  SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMdd");

  String StrID = request.getParameter("ID");


  String isexp = request.getParameter("isexp");
  if (isexp==null){isexp="";}


  String fileName;

  if (isexp.equals("1"))
  {
  try {
    StatisticsControl SControl =  new StatisticsControl();
    ANALYSE_STATISTICS_MAIN STATISTICS = SControl.GetSmain(StrID);

    fileName = STATISTICS.getSTATISTICSNAME() + fmt.format(date) + ".XLS";
    JxExcel jxExcel = new JxExcel();
    response.reset();
    response.setContentType("application/vnd.ms-excel;charset=GBK");
    response.addHeader("Content-Disposition", "attachment;filename=" + new String(fileName.getBytes("GBK"), "iso8859-1"));
    ServletOutputStream os = response.getOutputStream();
    jxExcel.WriteExcel(SControl,os,StrID,user);

  }
  catch (Exception ex) {
    out.print("导出Excel文件出现异常" + ex.getMessage());

  }

  }
%>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title>导出excel</title>
<link REL="stylesheet" type="text/css" href="../../zrsysmanage/css/<%=user.getUserCSS()%>">
<SCRIPT LANGUAGE="JavaScript" src="../../zrsysmanage/script/Public.js"></SCRIPT>

</head>
<BODY class="BodyMain">
<FORM method="post" name="recordfrm" action="">

<%if (!isexp.equals("1")){%>
<BR>
      <div style="position:absolute;width:222;height:14;border:1 #707888 solid;overflow:hidden" id="w">
	<div style="position:absolute;top:-1;left:0" id="pimg">
	</div>
</div>
<div  style="position:absolute;top:30;left:20;font-size:9pt;color:#f4f4f4" id="abc">
正在导出excel,请等待...</div>
<%}%>
</form>
</body>
</html>
<SCRIPT LANGUAGE="javascript">

<%if (!isexp.equals("1")){%>
function expexcel()
{


   location.href="Excel.jsp?ID=<%=StrID%>&isexp=1";

   document.all.pimg.style.display='none';
   document.all.abc.style.display='none';
   document.all.w.style.display='none';
}
setTimeout("expexcel()",800);


s=new Array();
s[0]="#050626";
s[1]="#0a0b44";
s[2]="#0f1165";
s[3]="#1a1d95";
s[4]="#1c1fa7";
s[5]="#1c20c8";
s[6]="#060cff";
s[7]="#2963f8";
function ls(){
		pimg.innerHTML="";
		for(i=0;i<9;i++){
		pimg.innerHTML+="<input style=\"width:15;height:10;border:0;background:"+s[i]+";margin:1\">";
		}
	}

function rs(){
		pimg.innerHTML="";
		for(i=9;i>-1;i--){
		pimg.innerHTML+="<input style=\"width:15;height:10;border:0;background:"+s[i]+";margin:1\">";
		}
	}

ls();
var g=0;sped=0;
function str(){
	if(pimg.style.pixelLeft<350&&g==0){
	if(sped==0){
		ls();
		sped=1;
		}
	pimg.style.pixelLeft+=2;
	setTimeout("str()",1);
	return;
	}
	g=1;
	if(pimg.style.pixelLeft>-200&&g==1){
	if(sped==1){
		rs();
		sped=0;
		}
	pimg.style.pixelLeft-=2;
	setTimeout("str()",1);
	return;
	}
	g=0;
	str();
}

function flashs(){
if(abc.style.color=="#ffffff"){
	abc.style.color="#707888";
	setTimeout('flashs()',500);
	}
else{
	abc.style.color="#ffffff";
	setTimeout('flashs()',500);
	}
}
flashs();
str();
<%}%>
</script>


