
<%@page import="java.util.Date"%>
<%@page import="kr.co.kihyun.beans.user.DeptView"%>
<%    /**
     * **********************************************************@@ Program Name
     * : report_view.jsp Description	: /보고자/내문서함/종료함/보고자료 보기 Author	: 기현테크
     * Create Date	: 2010.11.27 History	:
     * @@***********************************************************
     */
%>
<%@ page contentType="text/html; charset=UTF-8"
         import="java.text.SimpleDateFormat"
         import="java.net.URLEncoder"
         import="kr.co.kihyun.beans.user.HttpSSOLogin"
         import="kr.co.kihyun.lang.MLong" import="kr.co.kihyun.lang.MString"
         import="kr.co.kihyun.lang.Encoder" import="kr.co.kihyun.moumi.MoumiConfig"
         import="javax.jdo.PersistenceManager"
         import="kr.co.kihyun.beans.entity.util.*"
         import="kr.co.kihyun.lang.MString"
         import="kr.co.kihyun.text.html.TagFilter"
         import="kr.co.kihyun.beans.entity.TotDoc"
         import="kr.co.kihyun.beans.entity.MUser"
         import="kr.co.kihyun.beans.entity.SysAuth"
         import="kr.co.kihyun.beans.entity.TotReport"
         import="kr.co.kihyun.beans.entity.Board"
         import="kr.co.kihyun.beans.entity.Category"
         import="kr.co.kihyun.beans.entity.TotReport"
         import="kr.co.kihyun.beans.entity.TotReportProcess"
         import="kr.co.kihyun.beans.entity.TotDocProcess"
         import="kr.co.kihyun.beans.user.DeptAdd"
         import="kr.co.kihyun.beans.batch.AcceptNote"
         import="javax.jdo.Transaction" import="kr.co.kihyun.service.*" %>
<%@ page import="java.util.Map.Entry"%>
<%@ page import="java.util.List"%>

<%@ include file="/totsys/common/inc/sec/secure.inc.jsp"%>

<%    PersistenceManager pm = new MPersistenceManager(PMF.get().getPersistenceManager());

    Transaction tx = pm.currentTransaction();
    try {
        /**
         * ******** session내의 userId *********
         */
        String usID = HttpSSOLogin.getLoginID(request);
        String dtID = HttpSSOLogin.getDeptID(request);
//         DeptAdd dept = new DeptAdd();
//         int grade = dept.getGrade(usID, dtID);
//         int foundation = dept.getFoundation(usID, dtID);

        //String rootDept = dept.getRootDept(usID);
        /**
         * ******** Parameter *********
         */
        Long reportID = MLong.parseLong(request.getParameter("reportID"), null);
        String reportType = clearXSS(Encoder.toJava(request.getParameter("reportType")), null);
        String endDate = clearXSS(Encoder.toJava(request.getParameter("endDate")), null);
        String tmpSubStrEndDate = clearXSS(Encoder.toJava(request.getParameter("tmpSubStrEndDate")), null);
        String strPage = MString.checkNull(request.getParameter("strPage"));
        String findOption = clearXSS(request.getParameter("findOption"), null);
        String findWord = clearXSS(Encoder.toJava(request.getParameter("findWord")), null);
        String stDate = clearXSS(request.getParameter("stDate"),"");
        String edDate = clearXSS(request.getParameter("edDate"),"");
        String procMode = request.getParameter("proc_mode");
        String modeMessage = "";        //자바스크립트 alert창에 업무처리결과를 보여줄 메세지를 저장
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        String id = clearXSS(request.getParameter("id"), "");
        String user_id = clearXSS(request.getParameter("user_id"), "");
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


        if (MString.isNull(procMode)) {
            tmpSubStrEndDate = tmpSubStrEndDate.replaceAll("-", "");
            tmpSubStrEndDate = tmpSubStrEndDate.replaceAll(":", "");
            String tmpEndDate = endDate;
            endDate = endDate.replaceAll("-", "");
            tx.begin();

            MUser user = pm.getObjectById(MUser.class, usID);
            SysAuth sysAuth = user.getSysAuth();

            TotReport totReport = pm.getObjectById(TotReport.class, reportID);
            String acptDoc = totReport.getActDoc().toString();
            String userId = MString.checkNull(totReport.getUser());
            String secuYn = MString.checkNull(totReport.getSecuYn());

            pm.refresh(totReport);
            pm.makePersistent(totReport);

            TotDoc doc = totReport.getTotDoc();
            TotDocProcess docPrss = doc.getProcess(pm);

            String docName = doc.getName();
            String prss = totReport.getProcess().toString();

            Long downDocId = null;

            try {
                downDocId = totReport.getSlaveTotDoc().getId();
            } catch (Exception ex) {
                downDocId = null;
            }

            tx.commit();

            String boardGroupID = Category.ID_TOT_DOC_COMMENT;
            String url = clearXSS(request.getParameter("url"), "");

            if (url == null) {
                url = "";
            }

            String boardContents = "";
            String svrFilenames = "";
            int visit = 0;



//            String reportName = "";
//            if ("COMP".equals(reportType)) {
//                reportName = MoumiConfig.getMessageBundle().getString("moumi.message.tot_report.mySubmit") + MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.doc") + MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.box");
//            } else if ("END".equals(reportType)) {
//                reportName = MoumiConfig.getMessageBundle().getString("moumi.message.tot_report.end") + MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.doc") + MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.box");
//            }
//
//            String titleName = reportName + " > " + MoumiConfig.getMessageBundle().getString("moumi.message.tot_report.submit") + MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.doc");

//            DeptView deptView = new DeptView();
//            boolean flag = deptView.getID_AT_IS_MOUMI_TOT_REPORT(reportID);

            Date nowDate = new Date();

%>
<!DOCTYPE html>
<html lang="ko">
	<head>
		<meta charset="UTF-8">
		<title><%=MoumiConfig.getTitle()%></title>
		<link rel="stylesheet" href="/totsys/common/css/contentStyle.css" type="text/css">
		<link rel="stylesheet" href="/totsys/common/css/basic.css" type="text/css">
        <link rel="stylesheet" href="/totsys/common/css/text.css" type="text/css">
        <link rel="stylesheet" href="/totsys/common/css/SquareButtons.css" type="text/css">
        <link rel="stylesheet" href="/totsys/common/css/kecttep.css" type="text/css">
        <script src="/totsys/common/js/rollover.js"></script>
        <script src="/totsys/common/js/popup.js"></script>
        <script>

            function reportTrans() {
                var frm = document.Trans;
                if (confirm('<%= MoumiConfig.getMessageBundle().getString("moumi.message.popup.reportDocTrans")%>')) {
                    frm.submit();
                }
            }

            function printReport() {
                var uri = '/totsys/common/inc/documents/report/report_view_print.jsp?reportID=<%=reportID%>';
                sendReport = getOpener(uri, 'sendReport', 600, 650, 'center', 'middle', 'yes', 'yes');
                sendReport.focus();
            }

            function recallNote() {
                var uri = '/totsys/common/web/note/popup_recall_note.jsp?reportID=<%=reportID%>&reportType=<%=reportType%>';
                sendReport = getOpener(uri, 'sendReport', 720, 490, 'center', 'middle', 'no', 'no');
                sendReport.focus();
            }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            function recallNoteCancel(){
                if(confirm("자료회수요청을 취소하시겠습니까?")){
                    document.recallCancel.submit();
                }else
                    alert("취소되었습니다.");
                    return;
            }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            function loadKWD() {
                var form1 = document.Trans;
                form1.action = "/servlet/kr.co.kihyun.beans.totsys.report.HttpVCMCCMC2016Send?reportID=<%=reportID%>";
                form1.submit();
            }

            function changeDam()
            {
                if (<%= docPrss.ordinal()%> != <%= TotDocProcess.END.ordinal()%>) {
                    alert("집계진행중인 자료는 담당변경을 할수없습니다.");
                    return;
                }

                var height = screen.height;
                var width = screen.width;
                var leftpos = width / 2 - 350;
                var toppos = height / 2 - 350;
                frm = document.damdangForm;
                frm.docID.value="";
                frm.rptDocID.value="";
                frm.reportID.value =<%=reportID%>;
                frm.rptReportID.value =<%=reportID%>;
                frm.reportType.value = "<%=reportType%>";
                frm.action = "/totsys/repoper/mydocbox/returnbox/popup_rep_transfer9.jsp";
                frm.target = 'damdangForm';
                frm.method = 'post';
                win = window.open('', "damdangForm", "width=572, height=680, toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left=" + leftpos + ",top=" + toppos);
                win.focus();
                frm.submit();
            }

            /*
             * 목록페이지로 이동처리하는 함수
             */
            function fn_goToList() {
                document.listForm.submit();
            }

            /*
             * 보안지정/해제처리하는 함수
             */
            function fn_setSecuYn(p_secu_yn) {
                var v_message;
                if (p_secu_yn == 'Y') {
                    v_message = "<%= MoumiConfig.getMessageBundle().getString("moumi.message.tot_report.secu.yes")%><%= MoumiConfig.getMessageBundle().getString("moumi.message.set")%>";
                } else {
                    v_message = "<%= MoumiConfig.getMessageBundle().getString("moumi.message.tot_report.secu.yes")%><%= MoumiConfig.getMessageBundle().getString("moumi.message.unset")%>";
                }

                if (!confirm(v_message + "하시겠습니까?"))
                    return false;
                document.secuForm.secuYn.value = p_secu_yn;
                document.secuForm.submit();
            }

            /*
             * 윈도우 로딩 후 호출되는 함수
             * @returns {undefined}     */
            function fn_onLoad() {
                scrollObjectContent('formDiv');
            }

            window.onload = fn_onLoad;
        </script>
    </head>

    <body>
        <!-- 자료회수요청 취소  시작 -->
        <form name ="recallCancel" method ="post">
            <input type="hidden" name="proc_mode" value="recallCancel">
            <input type="hidden" name="id" value="<%=reportID%>"/>
        </form>
        <!-- 자료회수요청 취소  끝-->

        <form name="listForm" method="post" action="./report_list.jsp">
            <input type="hidden" name="reportType" value="<%=reportType%>">
            <input type="hidden" name="strPage" value="<%= strPage%>">
            <input type="hidden" name="findOption" value="<%=MString.checkNull(findOption)%>">
            <input type="hidden" name="findWord" value="<%=MString.checkNull(findWord)%>">
            <input type="hidden" name="stDate" value="<%=stDate%>">
            <input type="hidden" name="edDate" value="<%=edDate%>">
        </form>
        <form name="damdangForm" method="post" >
            <input type="hidden" name="docReportType" value="R">
            <input type="hidden" name="exeFlag"       value="form">
            <input type="hidden" name="docID"         value="">
            <input type="hidden" name="rptDocID"      value="">
            <input type="hidden" name="reportID"      value="">
            <input type="hidden" name="rptReportID"   value="">
            <input type="hidden" name="reportType"    value="<%=reportType%>">
            <input type="hidden" name="callbackFunc"  value="fn_goToList()">
        </form>
        <form name="secuForm" method="post">
            <input type="hidden" name="proc_mode" value="security">
            <input type="hidden" name="reportID" value="<%= reportID%>">
            <input type="hidden" name="secuYn" value="">
            <input type="hidden" name="endDate" value="<%= tmpEndDate%>">
            <input type="hidden" name="tmpSubStrEndDate" value="<%= tmpSubStrEndDate%>">
            <input type="hidden" name="reportType" value="<%=reportType%>">
            <input type="hidden" name="strPage" value="<%= strPage%>">
            <input type="hidden" name="findOption" value="<%=MString.checkNull(findOption)%>">
            <input type="hidden" name="findWord" value="<%=MString.checkNull(findWord)%>">
        </form>
        <form name="excelSaveForm" target="_parent" method="post">
            <input type="hidden" name="reportID" value="<%= reportID%>">
        </form>

        <FORM name="Trans" action="/servlet/kr.co.kihyun.beans.totsys.repoper.HttpReportTrans" method="post">
            <INPUT type="hidden" name="reportID" value="<%= reportID%>">
        </FORM>

        <table>
            <!--jsp:include page="/totsys/common/inc/repoper/top/top.jsp" flush="true" /-->
            <tr>
                <td></td>
                <td style="vertical-align: top;">
                    <table>
                        <jsp:include page="/totsys/common/inc/title/title.jsp" flush="true">
                            <jsp:param value='<%= URLEncoder.encode(docName, "UTF-8")%>' name="desc" />
                        </jsp:include>
                        <tr>
                            <!--  topbar  버튼 시작-->
                            <td>
                                <table class="kecttep_button">
                                    <tr class="toolbar">
                                        <td class="tal">
                                            <table>
                                                <tr>
                                                    <td class="kecttep_button_td">
                                                    <% if( ( usID.equals(userId) || sysAuth == SysAuth.SUB_SYSADM || sysAuth == SysAuth.SYSADM ) ) { %>
                                                        <a href="javascript:void(0);" onclick="changeDam();">
                                                            <img src="/totsys/common/images/bt_damdang.gif" alt="담당변경" />
                                                        </a>
                                                    <% } %>
                                                    <%if (null != totReport.getTotDoc().getBoard().getContents()) {%>

                                                        <!--// 관련정보 -->
                                                        <a href="javascript:void(0);" onclick="totperInfo('<%= totReport.getTotDoc().getBoard().getId()%>', '<%= boardGroupID%>');">
                                                            <img src="/totsys/common/images/bt_info_modify.gif" alt="<%= MoumiConfig.getMessageBundle().getString("moumi.message.button_small.totperInfo")%>" />
                                                        </a><!-- 관련정보 //-->

                                                    <%}%>

                                                    <% if (downDocId == null || downDocId == 0L) {%>
                                                    <!--
                                                        <a href="/totsys/common/inc/documents/report/report_view_excel1.jsp?reportID=<%=reportID%>" target="_parent">
                                                            <img src="/totsys/common/images/bt_excel.gif" alt="<%= MoumiConfig.getMessageBundle().getString("moumi.message.button_small.excel")%>" />
                                                        </a>
                                                     -->
                                                     <script>
                                                   		var outhtml='',clone;
                                                     	function downExl(ishan){
                                                     		var clone=$('#formDiv').clone();
                                                     		outhtml=clone.html().replace(/<!--[\s\S]*?-->/g,'');
                                                     		//alert(outhtml);return;
                                                     		$('#downexl').remove();
                                                     		var form='<form id="downexl" style="display:none;" method="post" target="downexl" action="/totsys/common/inc/documents/report/report_view_excel2.jsp">';
                                                     		//컨트롤키 누르고 클릭시 utf-8 로 다운로드
                                                    		try{
                                                    			if(event.ctrlKey){
                                                    				if(confirm("인코딩을 UTF-8로 저장하시겠습니까?")){
                                                    					form+='<input type="hidden" name="enc" value="utf-8"/>';
                                                    				}else{
                                                    					return;
                                                    				}
                                                        		}
                                                    		}catch(e){}
                                                     		form+='<input type="hidden" name="downexl" value="true"/>';
                                                     		form+='<input type="hidden" name="outhtml" value=""/>';
                                                     		form+='<input type="hidden" name="docname" value="<%=URLEncoder.encode(docName,"utf-8")%>"/>';
                                                     		if(ishan)form+='<input type="hidden" name="ishan" value="true"/>';
                                                     		form+='<iframe style="display:none;" name="downexl"></iframe>';
                                                     		form+='</form>';
                                                     		form=$(form).appendTo('body');
                                                     		outhtml=encodeURIComponent(outhtml);
                                                     		form.find('[name=outhtml]').val(outhtml);
                                                     		form.submit();
                                                     	}
                                                     </script>
                                                     <img src="/totsys/common/images/bt_excel.gif" alt="액셀다운" style="cursor: pointer;" onclick="downExl()"/>
                                                    <% } else {%>
                                                        <a href="/totsys/common/inc/documents/tot_reports/total_reports_excel.jsp?reportID=<%=reportID%>&gradeCode=-1&searchType=-1&displaySummary=false&docID=<%=downDocId%>&tableNum=&docName=<%=URLEncoder.encode(docName, "UTF-8")%>" target="_parent">
                                                            <img src="/totsys/common/images/bt_excel.gif" alt="<%= MoumiConfig.getMessageBundle().getString("moumi.message.button_small.excel")%>" />
                                                        </a>

                                                    <% }%>

                                                        <a href="javascript:void(0);" onclick="printReport();">
                                                            <img src="/totsys/common/images/bt_print2.gif" alt="<%= MoumiConfig.getMessageBundle().getString("moumi.message.button_small.print")%>" />
                                                        </a>

                                                    <!--//자료회수요청//-->
                                                    <%if( prss != MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.recalInfo")
                                                        && ( usID.equals(userId) || sysAuth == SysAuth.SUB_SYSADM || sysAuth == SysAuth.SYSADM )
                                                       ) {%>

                                                        <a href="javascript:void(0);" onclick="recallNote();">
                                                            <img src="/totsys/common/images/bt_collect.jpg" alt="<%= MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.recalInfo")%>" />
                                                        </a>

                                                    <%}%>
<!-- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  -->
                                                  <!--//자료회수요청취소//-->
                                                    <%if( prss == MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.recalInfo")
                                                        && ( usID.equals(userId) || sysAuth == SysAuth.SUB_SYSADM || sysAuth == SysAuth.SYSADM )
                                                       ) {%>
                                                        <a href="javascript:void(0);" onclick="recallNoteCancel();">
                                                            <img src="/totsys/common/images/btn_recallCancel.jpg" alt="자료회수요청 취소" />
                                                        </a>
                                                    <%}%>
<!-- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -->

                                                    <%if (usID.equals(userId)) {%>
                                                    <!--//보안해제//-->

                                                        <a href="javascript:void(0);" onclick="fn_setSecuYn('<%= secuYn.equals("Y") ? "N" : "Y"%>');">
                                                        <%
                                                            if (secuYn.equals("Y")) {
                                                        %>
                                                            <img src="/totsys/common/images/bt_secure_off.jpg" alt="<%= MoumiConfig.getMessageBundle().getString("moumi.message.tot_report.secu.yes")%><%=MoumiConfig.getMessageBundle().getString("moumi.message.unset")%>" />
                                                        <%
                                                            } else {
                                                        %>
                                                            <img src="/totsys/common/images/bt_secure_on.jpg" alt="<%= MoumiConfig.getMessageBundle().getString("moumi.message.tot_report.secu.yes")%><%=MoumiConfig.getMessageBundle().getString("moumi.message.set")%>" />
                                                        <%
                                                            }
                                                        %>
                                                        </a>

                                                    <%}%>

                                                    <%
                                                    //교육부 문서일 경우만
                                                    //if (reportID > 1700000000 && flag == false) {
                                                    %>
<!--                                                        <a class="simplebutton" href="#" onclick="loadKWD();"><span class="print"><%--= MoumiConfig.getMessageBundle().getString("moumi.message.button_small.edu")--%></span></a>-->
                                                    <%//}
                                                    %>

                                                    <%--
                                                    <td class="kecttep_button_td">
                                                        <a class="simplebutton" href="#" onclick="loadKWD();">
                                                             <span class="print"><%= MoumiConfig.getMessageBundle().getString("moumi.message.button_small.edu") %></span>
                                                        </a>
                                                                           </td>
                                                    --%>

                                                        <a href="javascript:void(0);" onclick="fn_goToList();">
                                                            <img src="/totsys/common/images/bt_list.gif" alt="<%= MoumiConfig.getMessageBundle().getString("moumi.message.button.boardList")%>" />
                                                        </a>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                            <!--  topbar  버튼 끝-->
                        </tr>

                        <tr>
                            <!-- 내용-->
                            <td style="height: 31px; vertical-align: top;">
                                <table>

                                    <tr style="height: 10px;">
                                        <td style="height: 10px;"></td>
                                        <td style="height: 10px;"></td>
                                        <td style="height: 10px;"></td>
                                        <td style="height: 10px;"></td>
                                    </tr>

                                    <tr style="height: 10px;">
                                        <td style="width: 149px; height: 10px;"></td>
                                        <td style="height: 10px;"></td>
                                        <td style="height: 10px; width: 149px;"></td>
                                        <td style="height: 10px;"></td>
                                    </tr>
                                    <!--
                                                                            <tr>
                                                                                    <td>
                                                                                            <table>
                                                                                                    <tr>
                                                                                                            <td class="kecttep_list_tdmenu" width="143" nowrap><img
                                                                                                                    src="/totsys/common/images/reg_icon.gif" align="middle"><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.executionCode")%></td>
                                                                                                            <td class="kecttep_top2_graytd" style="padding-left: 15;">
                                    <%= totReport.getTotDoc().getExecutionCode()%>
                            </td>
                    </tr>
            </table>
    </td>
</tr>

<tr height="10">
    <td nowrap width="149" height="10"></td>
    <td height="10"></td>
    <td nowrap width="149" height="10"></td>
    <td height="10"></td>
</tr>
                                    -->
                                    <!-- 보고자 정보 시작 -->
                                    <%
                                        tx.begin();
                                        if (!totReport.getHistories().isEmpty()) {%>
                                    <jsp:include page="/totsys/common/inc/repoper/repoper.jsp"
                                                 flush="true">
                                        <jsp:param name="userID"
                                        value='<%= URLEncoder.encode(totReport.getUser(pm).getId() == null ? "&nbsp;" : totReport.getUser(pm).getId(), "UTF-8")%>' />
                                        <jsp:param name="reportID" value="<%= reportID%>" />
                                        <jsp:param name="tmp1" value="1" />
                                    </jsp:include>
                                    <%} else {%>
                                    <jsp:include page="/totsys/common/inc/repoper/repoper.jsp"
                                                 flush="true">
                                        <jsp:param name="userID"
                                        value='<%= URLEncoder.encode(totReport.getUser(pm).getId() == null ? "&nbsp;" : totReport.getUser(pm).getId(), "UTF-8")%>' />
                                        <jsp:param name="reportID" value="<%= reportID%>" />
                                    </jsp:include>
                                    <%}
                                        tx.rollback();
                                    %>
                                    <!-- 보고자 정보 끝 -->
                                    <tr>
                                        <td colspan="4">
                                            <table>
                                                <tr>
                                                    <td class="kecttep_tdmenu_middle" style="padding-left: 20px; width: 150px;">
                                                        <%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_report.submitDate")%>
                                                    </td>
                                                    <td class="kecttep_last_graytd" style="padding-left: 15px;">
                                                        <%= totReport.getSubmitDate() == null ? "&nbsp;" : new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(totReport.getSubmitDate())%>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td class="kecttep_tdmenu" style="padding-left: 20px; width: 150px;">
                                                        <%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.document")%><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.number")%>
                                                    </td>
                                                    <td class="kecttep_last_graytd_bottom" style="padding-left: 15px;">
                                                        <%= acptDoc%>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>

                                    <tr style="height: 10px;">
                                        <td style="width: 149px; height: 10px;"></td>
                                        <td style="height: 10px;"></td>
                                        <td style="width: 149px; height: 10px;"></td>
                                        <td style="height: 10px;"></td>
                                    </tr>

                                    <tr>
                                        <td colspan="4" style="vertical-align: top;"><!-- 문서 내용 시작 -->
                                            <jsp:include
                                                page="/totsys/common/inc/documents/report/report_view.jsp"
                                                flush="true">
                                                <jsp:param name="reportID" value="<%= reportID%>" />
                                                <jsp:param name="tmpStrMagam" value="<%= tmpEndDate%>" />

                                            </jsp:include> <!-- 문서 내용 시작 -->
                                        </td>
                                    </tr>

                                    <tr>
                                        <td></td>
                                    </tr>
                                    <tr>
                                        <td>&nbsp;</td>
                                        <td colspan="3" class="tac vTop">&nbsp;</td>
                                    </tr>

                                </table>
                            </td>
                        </tr>

                        <tr>
                            <!--  topbar  버튼 시작-->
                            <td>
                                <table>
                                    <tr>
                                        <!--td width="537"></td-->
                                        <td class="tal">
                                            <table>
                                                <tr>
                                                    <td style="width: 3px;">&nbsp;</td>
                                                    <td>&nbsp;</td>
                                                    <td style="width: 3px;">&nbsp;</td>
                                                    <td><a href="#">&nbsp;</a></td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                            <!--  topbar  버튼 끝-->
                        </tr>

                        <!--1픽셀 띄우기-->
                        <tr>
                            <td style="height: 1px;"></td>
                        </tr>

                        <tr>
                            <!--  topbar  버튼 시작-->
                            <td>
                                <table style="width: 100%;">
                                    <tr>
                                        <td style="width: 537px;">&nbsp;</td>
                                        <td class="tar">
                                            <table>
                                                <tr>
                                                    <td>&nbsp;</td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                            <!--  topbar  버튼 끝-->
                        </tr>
                    </table>
                </td>
                <td style="width: 10px;"></td>
            </tr>

            <!--1픽셀 띄우기-->
            <tr>
                <td height="30"></td>
            </tr>

            <!-- top menu start -->
            <%@ include file="/totsys/common/inc/buttom/buttom.jsp"%>
            <!-- top menu end -->
        </table>
    </BODY>
</HTML>
<%
} else if (procMode.equals("security") || procMode.equals("recallCancel")) {
    //보안지정/해제, 부서공유/취소 처리 부분
    tx.begin();

    if(procMode.equals("security")){
        String secuYn = request.getParameter("secuYn");

        TotReportService reportService = new TotReportService(pm);
        reportService.updateSecuYnForReport(reportID, secuYn);

        if (secuYn.equals("Y")) {
            //보안지정
            modeMessage = MoumiConfig.getMessageBundle().getString("moumi.message.tot_report.secu.yes") + MoumiConfig.getMessageBundle().getString("moumi.message.set");
        } else if (secuYn.equals("N")) {
            //보안해제
            modeMessage = MoumiConfig.getMessageBundle().getString("moumi.message.tot_report.secu.yes") + MoumiConfig.getMessageBundle().getString("moumi.message.unset");
        }
    }else if(procMode.equals("recallCancel")){
        Long cancelID = MLong.parseLong(request.getParameter("id"));
        TotReportService reportService = new TotReportService(pm);
        reportService.updatePrssForReport(cancelID, TotReportProcess.COMP);

        modeMessage = "자료회수요청 " + MoumiConfig.getMessageBundle().getString("moumi.message.unset");

    }

    tx.commit();


%>
	<head>
        <TITLE><%=MoumiConfig.getTitle()%></TITLE>
        <meta charset="UTF-8">
        <SCRIPT>
            /*
             * 목록페이지로 이동처리하는 함수
             */
            function fn_goToList() {
                document.listForm.submit();
            }
            /*
             * 윈도우 로딩 후 호출되는 함수
             * @returns {undefined}     */
            function fn_onLoad() {
                alert("<%= modeMessage%> <%= MoumiConfig.getMessageBundle().getString("moumi.message.popup.process.complete")%>");
                        fn_goToList();
                    }

                    window.onload = fn_onLoad;
        </SCRIPT>
    </HEAD>
</BODY>
<form name="listForm" method="post" action="./report_list.jsp">
    <input type="hidden" name="reportType" value="<%=reportType%>">
    <input type="hidden" name="strPage" value="<%= strPage%>">
    <input type="hidden" name="findOption" value="<%=MString.checkNull(findOption)%>">
    <input type="hidden" name="findWord" value="<%=MString.checkNull(findWord)%>">
</form>
</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 {
        if (tx.isActive()) {
            tx.rollback();
        }
        pm.close();
    }
%>
