
<%@page import="kr.co.kihyun.lang.MLong"%>
<%
/************************************************************@@
  * Program Name	: tot_reports_excel.jsp
  * Description		: /집계자/내문서함/등록함/문서 등록
  * Author			: 기현테크
  * Create Date		: 2010.11.24
  * History			:
@@************************************************************/
%>
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ page contentType="text/html; charset=UTF-8"
	import="java.net.URLEncoder" import="java.net.URLDecoder"
	import="kr.co.kihyun.beans.user.HttpSSOLogin" import="java.util.*"
	import="java.io.StringReader"
	import="javax.swing.text.html.parser.ParserDelegator"
	import="kr.co.kihyun.lang.Encoder" import="kr.co.kihyun.util.Stopwatch"
	import="kr.co.kihyun.text.html.TagFilter"
	import="kr.co.kihyun.text.html.ServletUtil"
	import="kr.co.kihyun.text.html.CallbackHandler"
	import="kr.co.kihyun.moumi.Moumi" import="kr.co.kihyun.moumi.doc.MDoc"
	import="kr.co.kihyun.moumi.doc.table.MTable"
	import="kr.co.kihyun.moumi.doc.table.TableDefine"
	import="kr.co.kihyun.moumi.doc.table.TableCreation"
	import="kr.co.kihyun.moumi.doc.table.item.MItem"
	import="kr.co.kihyun.lang.MInteger" import="kr.co.kihyun.lang.MString"%>

<%@ include file="/totsys/common/inc/sec/secure.inc.jsp"%>
<% request.setCharacterEncoding("UTF-8"); %>
<%
  try{
	/********** session내의 userId **********/
	String usID = HttpSSOLogin.getLoginID(request);
        String dpID = HttpSSOLogin.getDeptID(request);

	/********** parameter **********/
	String docID = clearXSS(MString.checkNull(request.getParameter("docID")),"");
	String partID = clearXSS(request.getParameter("partID"),"");
	int gradeCode = MInteger.parseInt(request.getParameter("gradeCode"), -1);
	int tableNum = MInteger.parseInt(request.getParameter("tableNum"), 0);
	int searchType = MInteger.parseInt(request.getParameter("searchType"), -1);
	String displaySummary = MString.checkNull(request.getParameter("displaySummary"));
	String prssSelect = MString.checkNull(request.getParameter("prssSelect"));
        String findOption = clearXSS(URLDecoder.decode(MString.checkNull(request.getParameter("findOption")), "UTF-8"), "");
        String findWord = clearXSS(URLDecoder.decode(MString.checkNull(request.getParameter("findWord")), "UTF-8"), "");
        String innerFindOption = clearXSS(request.getParameter("innerFindOption"), "");
        String innerFindWord = URLDecoder.decode(MString.checkNull(request.getParameter("innerFindWord")), "UTF-8");

        String docName=request.getParameter("docName");

        String sort = clearXSS(request.getParameter("sort"),"");

        String mngcode = clearXSS(request.getParameter("mngcode"), "");//20160509 추가
        if( dpID.contains("A00") && MLong.parseLong(docID) > 1700000000){
        	mngcode = "".equals(mngcode) ? "": mngcode ;//20160509 추가
        }

        //무조건 다운로드를 위한 컨텐트 타입 설정
        response.setHeader("Accept-Ranges", "bytes");
        response.setHeader("Content-Disposition", "attachment; filename=" + (URLEncoder.encode(docName, "UTF-8")).replaceAll(":", "_").replace("+", " ") + ".xls;");
%>
<html xmlns:o="urn:schemas-microsoft-com:office:office"
      xmlns:x="urn:schemas-microsoft-com:office:excel"
      xmlns="http://www.w3.org/TR/REC-html40">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=MS949">
        <meta name="ProgId" content="Excel.Sheet">
        <meta name="Generator" content="Microsoft Excel 11">

     <style type="text/css">
        /*td {mso-number-format:"\@";}*/  // 엑셀저장시 문자로 취합하도록 설정
        .x124 {mso-number-format:"\@";}
        br {mso-data-placement:same-cell;} //엑셀저장시 BR을 같은 셀로 인식하도록 설정
    </style>
</head>
<body style=''>
<!------------------------------- form config start ------------------------------->
<jsp:include page="./total_reports_save.jsp" flush="true">
	<jsp:param name="docID" value="<%= docID %>" />
	<jsp:param name="partID" value="<%= partID %>" />
	<jsp:param name="gradeCode" value="<%= gradeCode %>" />
	<jsp:param name="tableNum" value="<%= tableNum %>" />
	<jsp:param name="searchType" value="<%= searchType %>" />
	<jsp:param name="displaySummary" value="<%= displaySummary %>" />
	<jsp:param name="prssSelect" value="<%= prssSelect %>" />
        <jsp:param name="findOption" value="<%= findOption%>" />
        <jsp:param name="findWord" value="<%= MString.checkNull(findWord)%>" />
        <jsp:param name="innerFindOption" value="<%= innerFindOption%>" />
        <jsp:param name="innerFindWord" value="<%= MString.checkNull(innerFindWord)%>" />
    <jsp:param name="sort" value="<%= sort %>" />
        <jsp:param name="mngcode" value="<%= mngcode %>" />
</jsp:include> <!-- 20160509 mngcode param 추가 -->
</body>
</html>
<%
}catch(Exception ex){ex.printStackTrace();
	out.println(kr.co.kihyun.text.html.ServletUtil.getJavaScript("location='/servlet/kr.co.kihyun.beans.user.HttpSSOLogin?mode=logout';"));
}finally{
}
%>
