<%@page contentType="text/html;charset=GBK"%>
<%@page import="zr.zrpower.queryengine.JxExcel"%>
<%@page import="java.io.*"%>
<%@page import="java.util.Date"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="zr.zrpower.queryengine.service.QueryControl"%>
<%@ 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 Strpage = request.getParameter("page");
  if (Strpage==null){Strpage="1";}
  String Strcrow = request.getParameter("crow");
  if (Strcrow==null){Strcrow="0";}
  
  String P1 = request.getParameter("P1");
  String P2 = request.getParameter("P2");
  String P3 = request.getParameter("P3");
  String P4 = request.getParameter("P4");
  String P5 = request.getParameter("P5");
  
  String ExcelLink = "";
  int k=0;
  String snum = "01";
  QueryControl queryControl = (QueryControl) (session.getAttribute("queryControl"));
  
  //if (Integer.parseInt(Strcrow)<=5000)
  //{
  //   out.print("<script>window.location='Excel.jsp?ID="+StrID+"&P1="+P1+"&P2="+P2+"&P3="+P3+"&P4="+P4+"&P5="+P5+"';</script>");
  //}else
  //{
     String fileName="";     
     fileName = queryControl.GetQueryTitle(StrID) + fmt.format(date);
     for (int i=0;i<=Integer.parseInt(Strcrow);i=i+5000)
     {
         k++;
         if (k<10){snum="0"+String.valueOf(k);}
         else
         {snum=String.valueOf(k);}
         
         ExcelLink = ExcelLink + "<img src='../zrsysmanage/images/blueimg/buttonExcel.gif' border='0' width='18' height='18' align='absmiddle'><a href=javascript:expexcel('Excel.jsp?ID="+StrID+"&P1="+P1+"&P2="+P2+"&P3="+P3+"&P4="+P4+"&P5="+P5+"&page="+String.valueOf(k)+"&crow="+Strcrow+"')>"
                     +fileName+"("+snum+").XLS</a><br>";
         
         
     }
  //}
  
%>
<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="">
<TABLE border="0" width="98%" cellpadding=0 cellspacing=0>
     <TR>
      <TD height="230" align="center" valign="middle">
      <font color="#FF0000">
      导出excel:<br>
      <DIV   style='width:96%;height:94%;overflow:auto;'>
      <%=ExcelLink%>
      </DIV>
      </font>
      </td></tr>

</TABLE>
</form>
</body>
</html>
<SCRIPT LANGUAGE="javascript">
function expexcel(url)
{
   var name="PopWindow1";
   var ShowPopWindow = null;
   var status="toolbar=no,location=no,directories=no,menubar=no,resizable=yes,scrollbars=yes,width=222,height=50";
   ShowPopWindow = window.open(url,name,status);
   ShowPopWindow.moveTo(300,260);
   ShowPopWindow.focus();
}
</script>
<%
//清空相关对象
user = null;
queryControl = null;
%>