<%/**
     * **********************************************************@@ Program Name
     * : report_view.jsp Description	: /보고자/내문서함/임시보고함/보고자료 보기 Author	: 기현테크
     * Create Date	: 2010.11.26 History	:
     * Modify Date      : 2015.03.03 /제출자료/제출진행자료/자료제출
     * @@***********************************************************
     */%>

<%@ page contentType="text/html; charset=UTF-8"
         import="java.net.URLEncoder"
         import="javax.jdo.PersistenceManager"
         import="javax.jdo.Query"
         import="kr.co.kihyun.beans.entity.util.*"
         import="kr.co.kihyun.beans.user.HttpSSOLogin"
         import="kr.co.kihyun.lang.MString"
         import="kr.co.kihyun.lang.MLong"
         import="kr.co.kihyun.moumi.MoumiConfig"
         import="kr.co.kihyun.beans.entity.MUser"
         import="kr.co.kihyun.beans.entity.SysAuth"
         import="kr.co.kihyun.beans.user.DeptAdd"
         import="kr.co.kihyun.beans.entity.TotDoc"
         import="kr.co.kihyun.beans.entity.TotReport"
         import="kr.co.kihyun.beans.entity.TotReportProcess"
         import="kr.co.kihyun.beans.user.*"
         import="kr.co.kihyun.moumi.report.MReport"
         import="kr.co.kihyun.beans.totsys.report.Report"
         import="kr.co.kihyun.lang.MInteger"
         import="kr.co.kihyun.beans.totsys.repoper.RepoadmList"
         import="kr.co.kihyun.beans.totsys.report.ReportView"
         import="kr.co.kihyun.beans.totsys.report.ReportViewManager"
         import="javax.jdo.PersistenceManager"
         import="javax.jdo.Transaction"
         import="kr.co.kihyun.beans.entity.util.*"
         import="kr.co.kihyun.beans.entity.TotDoc"
         import="org.slf4j.Logger"
         import="java.sql.ResultSet"
         import="org.slf4j.LoggerFactory"
         import="kr.co.kihyun.beans.entity.Board"
         import="kr.co.kihyun.service.*"
         import="kr.co.kihyun.service.vo.*"
         import="kr.co.kihyun.text.html.TagFilter"
         import="kr.co.kihyun.prop.QueryStringList"
         import="kr.co.kihyun.db.CommonDBManager"
         import="kr.co.kihyun.lang.Encoder"
         import="kr.co.kihyun.beans.entity.*"%>
<%@page import="java.util.Date"%>
<%@page import="kr.co.kihyun.util.Base64_2"%>
<%@page import="kr.co.kihyun.util.Base64"%>
<%@page import="java.net.URLDecoder"%>
<%@ 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);
        String deptName = HttpSSOLogin.getDeptName(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"));
        String totperInfo = clearXSS(MString.checkNull(request.getParameter("totperInfo")), "");
        String reportType = clearXSS(request.getParameter("reportType"), null);
        Long repoadminID = MLong.parseLong(request.getParameter("repoadminID"));
        String tmpStrMagam = clearXSS(request.getParameter("tmpStrMagam"), null);
        //String tmpSubStrEndDate = clearXSS(request.getParameter("tmpSubStrEndDate"), null);
        /*tmpSubStrEndDate = tmpSubStrEndDate.replaceAll("-", "");
         tmpSubStrEndDate = tmpSubStrEndDate.replaceAll(":", "");*/
        //System.out.println(" tmpSubStrEndDate:::::::" + tmpSubStrEndDate + "   tmpStrMagam::::::" + tmpStrMagam);
        String strPage = clearXSS(request.getParameter("strPage"), "");
        String findOption = clearXSS(request.getParameter("findOption"), null);
        String findWord = clearXSS(Encoder.toJava(request.getParameter("findWord")), null);

        session.setAttribute("compSuccTargetURI", "/totsys/repoper/mydocbox/tempbox/report_list.jsp?reportType=" + reportType);

        String procMode = request.getParameter("proc_mode");

        if (MString.isNull(procMode)) {
        	/* 미결함 확인 */
        	//boolean isMigulham = false;
        	//if(reportID == null){
			//out.println("현재 접속자 수가 많아 서비스가 원할하지 않습니다. 잠시후 이용하여 주시기 바랍니다.");
			//return;
			//}
        	//String sql = QueryStringList.CheckMigulhamSql;
        	//CommonDBManager cdb = new CommonDBManager();
        	//ResultSet rs = cdb.execQuery(sql, reportID);
            //if(rs.next()){
            //	isMigulham = true;
            //}
            //rs.close();
            //cdb.execClose();
            /* 미결함 확인 */

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

            Repoadm repoadm = null;
            TotReport totReport = pm.getObjectById(TotReport.class, reportID);
            String accDocCd = clearXSS(MString.checkNull(request.getParameter("accDocCd")), "");
            String userId = MString.checkNull(totReport.getUser());

            boolean closedFlag = false;

            TotDoc td = totReport.getSlaveTotDoc();
            if (td == null) {
                closedFlag = true;
            } else {
                Date date = td.getEndDate();
                long time = System.currentTimeMillis();
                if (date.getTime() <= System.currentTimeMillis()) {
                    closedFlag = true;
                }
            }

            String docName = totReport.getTotDoc().getName();
            Long downDocId = null;
            try {
                downDocId = totReport.getSlaveTotDoc().getId();
            } catch (Exception ex) {
                downDocId = null;
            }

            String doctName = totReport.getTotDoc().getName();
            String doctName2 = totReport.getTotDoc().getName();
            doctName = Base64_2.encode(doctName);
            //doctName = URLEncoder.encode(doctName, "UTF-8");

            //String doctName4 = new String(Base64_2.decode(doctName));

            if (repoadminID != null) {
                repoadm = pm.getObjectById(Repoadm.class, repoadminID);
            }

            int totRange = totReport.getTotDoc().getTotRange().ordinal();

            String slav = "";
            if (totReport.getSlaveTotDoc() == null) {
                slav = "[]";
            } else {
                Long tmpLong = totReport.getSlaveTotDoc().getId();
                slav = clearXSS(MString.checkNull(tmpLong.toString()), "[]");
            }

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

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

			tx.rollback();
%>
<!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/kecttep.css" type="text/css">
        <link rel="stylesheet" href="/totsys/common/css/tabs.css" type="text/css">
        <link rel="stylesheet" href="/totsys/common/css/SquareButtons.css" type="text/css">
        <script src="/totsys/common/js/rollover.js"></script>
        <script src="/totsys/common/js/popup.js"></script>
        <script src="/totsys/common/js/jquery-1.12.4.min.js"></script>
        <script src="/totsys/common/js/jquery.fixFormTable.js"></script>
        <script src="/totsys/common/js/jquery.custom.indicator.js"></script>
        <script>
            function reportComp() {
                if (<%=closedFlag%> == false)
                {
                    alert('집계가 종료되지않았습니다. 먼저 집계를 종료하신후 승인상신하셔야 합니다');
                    return false;
                }

                var uri = '/totsys/memo/rereport/pop_accDocCd.jsp';
                sendReport = getOpener(uri, 'sendReport', 300, 200, 'center', 'middle', 'yes', 'yes');
                sendReport.focus();
            }

            // 재입력 상태로 만들어 목록에서 더 이상 나타나지 않게 하고
            // 집계가 재진행 될 경우 재입력요청 상태로 접수함에 나타남.
            function reportDel() {
                if (!confirm("<%= MoumiConfig.getMessageBundle().getString("moumi.message.popup.deletion")%>")) {
                    return;
                }
                compForm.proc_mode.value = "delete";
                compForm.prss.value = '<%=MReport.RETURN%>';
                compForm.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 deptRegist() {

                var height = screen.height;
                var width = screen.width;
                var leftpos = width / 2 - 350;
                var toppos = height / 2 - 350;
                var urlname = "/totsys/common/web/report_dept/edit_dept_list.jsp?reportID=<%=reportID%>&usedType=RECOG";

                post = window.open(urlname, "post", "width=713, height=425, toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left=" + leftpos + ",top=" + toppos);
                post.focus();
            }

            function recogSet() {
            <%if (totReport.getRepoadms().size() > 0) {%>
                if (confirm("<%=MoumiConfig.getMessageBundle().getString("moumi.message.popup.recogUp")%>")) {
                    dform.submit();
                }
            <%} else {%>
                alert('<%=MoumiConfig.getMessageBundle().getString("moumi.message.popup.approvalRecogUp")%>');
            <%}%>
            }
            function acptdoc() {
                if (confirm("<%=MoumiConfig.getMessageBundle().getString("moumi.message.popup.deletion")%>")) {
                    acptdocform.target = "hiddenFrame";
                    acptdocform.submit();
                }
            }
            function recogProccessChagne(repoadmType)
            {
                dform.repoadmType.value = repoadmType;
                if (repoadmType == "<%=Recog.RETURN_RECOG.ordinal()%>")
                {
                    window.open('/totsys/memo/rereport/pop_rereport.jsp?isRecog=RECOG&docID=<%=totReport.getTotDoc().getId()%>&deptID=<%=totReport.getTotDoc().getDept(pm).getId()%>&userID=<%=usID%>', 'rereport', 'width=601, height=300,toolbar=no, directories=no, status=no, menubar=no, resizable=no');
                } else
                {
                    dform.action = "/servlet/kr.co.kihyun.beans.totsys.repoadm.HttpRecogUpdate";
                    dform.submit();
                }
            }
            //LJH
            function sendDraft() { // 엑셀 결재하기 버튼을 눌렀을 시
                var height = screen.height;
                var width = screen.width;
                var leftpos = width / 2 - 350;
                var toppos = height / 2 - 350;
                frm = document.payForm;
                frm.action = '/servlet/kr.co.kihyun.beans.totsys.repoper.HttpExcelDown';
                frm.target = 'payform';
                frm.method = 'post';
                win = window.open('', 'payform', "width=713,height=455,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left=" + leftpos + ",top=" + toppos);
                win.focus();
                frm.submit();
                //location.href="./moumi_ex.jsp?reportID=<%= reportID%>";
            }

            //승인상신 버튼
            function sendNeisRecog(p_reportID) {
                if (<%=closedFlag%> == false) {
                    alert('집계가 종료되지않았습니다. 먼저 집계를 종료하신후 승인상신하셔야 합니다.');
                    return false;
                }
                //if(<%--=isMigulham--%> == true){
                //	alert('결재진행중입니다. \n\n결재자가 나이스 승인에서 반려 또는 결재 후 승인상신하셔야 합니다.');
                //    return false;
                //}

                try {
                    $.ajax({
                        url:"/servlet/kr.co.kihyun.service.servlet.AjaxProcessServlet",
                        type:"POST",
                        dataType:"json",
                        async: true,
                        data:{
                            proc_type:"send_neis_recog",
                            report_id:p_reportID
                        },
                        success:function(data) {
                            fn_callBackForSuccess(data);
                        },
                        error:function(e) {
                            alert("error=" + e);
                        }
                        //,
                        //beforeSend:function() {
                        //    $.customIndicator.show(window.self);
                        //},
                        //complete:function() {
                        //    $.customIndicator.hide(window.self);
                        //}
                    });
                } catch (e) {
                    alert(e.message);
                }
            }

            function fn_callBackForSuccess(data) {
                var target_win = null;
                var unModifiableCount = 0

                if( data != null ) {
                    for(var i = 0; i < data.length; i++ ) {
                        unModifiableCount = data[i].unModifiableCount;
                    }
                }

                if(unModifiableCount > 0) {
                    alert('제출자료의 정보를 수정할 수 없습니다. 제출된 자료가 결재대기중 또는 결재완료된 상태에 있습니다.');
                    return false;
                }
				<%if(request.getServerName().equals("ats.dvk.go.kr") || request.getServerName().equals("ats.ack.go.kr")){%>
				target_win = window.open("http://<%= request.getServerName().replace("ats", "eis")%>/displayXUI.jsp?mipid=cm.bcm.cfm.rt::bcm_cfmrt00_m01.xfdl&reportID=<%=reportID%>&USER_ID=<%=usID%>&DEPT_CODE=<%=dtID%>&doctName=<%=doctName%>", "NEIS_POPUP", "width=835px, height=555px, top=0px, left=0px, toolbar=no, scrollbars=no, resizable=no, status=no, location=no, menubar=no, fullscreen=no");
				<%}else{%>
				target_win = window.open("http://<%= request.getServerName().replace("ats", "gan")%>/displayXUI.jsp?mipid=cm.bcm.cfm.rt::bcm_cfmrt00_m01.xfdl&reportID=<%=reportID%>&USER_ID=<%=usID%>&DEPT_CODE=<%=dtID%>&doctName=<%=doctName%>", "NEIS_POPUP", "width=835px, height=555px, top=0px, left=0px, toolbar=no, scrollbars=no, resizable=no, status=no, location=no, menubar=no, fullscreen=no");
				<%}%>

                //document.location.href= "report_list.jsp?reportType=TEMP";
                fn_goToList();
            }

            /*
             * 접수자료 상세페이지로 이동처리하는 함수
             */
            function fn_goToAcceptPage() {
                document.rsForm.submit();
            }

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

            /*
             * 자료수정Tab으로 이동처리하는 함수
             */
            function fn_goToModofyTab() {
                try{
                    $.customIndicator.show(window.self);
                    document.modifyForm.submit();
//                    $.customIndicator.hide(window.self);
                }catch(e){
                    alert(e.message);
                }
            }

           function changeDam() {

                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_transfer11.jsp";
                frm.target = 'damdangForm';
                frm.method = 'post';
                win = window.open('', "damdangForm", "width=620, height=680, toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left=" + leftpos + ",top=" + toppos);
                win.focus();
                frm.submit();
            }

           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="<%= docName%>"/>';
        		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>
    </head>
    <body class="mp_0" onload="scrollObjectContent('formDiv');">
        <span id="SetWin" style="position: absolute; z-index: 10px; Visibility: hidden; height: 65px; width: 210px; background: silver; border: 1px #333333 solid; line-height: 1.4em; padding: 3px 3px"></span>
        <form name="listForm" method="post" action="/totsys/repoper/mydocbox/tempbox/report_list.jsp">
            <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="reportType" value="<%=reportType%>">
        </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="modifyForm" method="post" action="./temp_report_modify.jsp">
            <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="reportType" value="<%=reportType%>">
            <input type="hidden" name="doctName" value="<%=doctName2%>">
            <input type="hidden" name="reportID" value="<%=reportID%>">
            <input type="hidden" name="totperInfo" value="<%=totperInfo%>">
            <input type="hidden" name="tmpStrMagam" value="<%=tmpStrMagam%>">
        </form>
        <form name="dform" action="/servlet/kr.co.kihyun.beans.totsys.repoadm.HttpRecogSet" method="post">
            <input type="hidden" name="deptIDs">
            <input type="hidden" name="deptNames">
            <input type="hidden" name="deptTypes">
            <input type="hidden" name="deptCountText">
            <input type="hidden" name="deptChange">
            <input type="hidden" name="contents">
            <input type="hidden" name="reportID" value="<%=reportID%>">
            <input type="hidden" name="repoadminID" value="<%=repoadminID%>">
            <input type="hidden" name="repoadmType">
            <input type="hidden" name="reportType" value="<%=reportType%>">
        </form>
        <!--연계등록 초기화를 위한 폼-->
        <form name="acptdocform" action="/servlet/kr.co.kihyun.beans.totsys.repoper.HttpAcptDocUpdate" method="post" >
            <input type="hidden" name="reportID" value="<%=reportID%>">
            <input type="hidden" name="callbackFunc" value="parent.fn_goToAcceptPage();">
        </form>
        <form name="rsForm" method="post" action="/totsys/repoper/mydocbox/tempbox/report_regist.jsp">
            <input type="hidden" name="reportID" value="<%= reportID%>">
            <input type="hidden" name="type" value="returndoc">
            <input type="hidden" name="totperInfo" value="true">
        </form>
        <form name="compForm" method="post">
            <input type="hidden" name="proc_mode" value="complete">
            <input type="hidden" name="reportID" value="<%=reportID%>">
            <input type="hidden" name="prss" value="<%=MReport.COMP%>">
            <input type="hidden" name="repDocID" value="">
            <input type="hidden" name="accDocCd" value="<%=accDocCd%>">
            <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="reportType" value="<%=reportType%>">
        </form>
        <form name="NotDoc" method="post"action="/servlet/kr.co.kihyun.beans.totsys.repoper.HttpNotUpdate">
            <input type="hidden" name="reportID" value="<%=reportID%>">
        </form>
        <form name="prssChange" method="post" action="/servlet/kr.co.kihyun.beans.totsys.repoper.HttpPrssUpdate">
            <input type="hidden" name="reportID" value="<%=reportID%>">
            <input type="hidden" name="prss" value="<%=MReport.ACCEPT_LIST%>">
            <input type="hidden" name="totRange" value="<%=totRange%>">
            <input type="hidden" name="repDocID" value="">
        </form>
        <form name="payForm" method="post">
            <input type="hidden" name="reportID" value="<%=reportID%>">
        </form>

        <div>
            <table>
                <%--<jsp:include page="/totsys/common/inc/totper/top/top.jsp" flush="true" />--%>
                <jsp:include page="/totsys/common/inc/title/title.jsp" flush="true">
                    <jsp:param value="<%=doctName2%>" name="desc" />
                </jsp:include>
            </table>
        </div>

        <div id="header">
            <ul id="primary">
            <!-- ie10,11 에서 호환성 보기 문제 수정 a,span 태그에 스타일 추가 -->
                <li><span style="padding: 0px; line-height: 25px;" class="kecttep_menu_focous"><%= MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.doc")%><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_report.submit")%></span></li>
                <%if (totReport.getProcess() == TotReportProcess.TEMP && totReport.getSlaveTotDoc() == null) {%>
                <li>
                    <a style="padding: 0px; line-height: 25px;" href="javascript:fn_goToModofyTab();">
                        <%= MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.doc")%><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.modify")%>
                    </a>
                </li>
                <%}%>
            </ul>
        </div>
        <div id="main">
            <div id="contents">
                <table>
                    <tr class="toolbar">
                        <td style="text-align: left;">
                            <table>
                                <tr>
                                    <td style="text-align: left;" colspan="4">
                                        <table>
                                            <tr>
                                                <td class="kecttep_button_td">
                                        <%if (totReport.getTotDoc().getProcess(pm) != TotDocProcess.END) {%>
                                            <%if (totReport.getProcess() != TotReportProcess.APPROVE) {%>
                                                <%if (MoumiConfig.getUseRecog()) {//승인선 지정%>
                                                    <a class="simplebutton" href="#" onclick="deptRegist();">
                                                        <span class="check"><%= MoumiConfig.getMessageBundle().getString("moumi.message.tot_report.recog")%><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_report.lineSelect")%></span>
                                                    </a>
                                                <%}%>
                                                <%if (totReport.getProcess() == TotReportProcess.TEMP) {%>
                                                    
                                                    <!-- 제출완료 버튼 -->                                                     
                                                    <a href="#" onclick="reportComp();">
                                                        <img src="/totsys/common/images/bt_report_ok.gif" alt="<%= MoumiConfig.getMessageBundle().getString("moumi.message.button_small.comp")%>" />
                                                    </a>												

                                                <%}%>
                                            <%}%>
                                        <%} else {%>
                                                    <span><%= MoumiConfig.getMessageBundle().getString("moumi.message.doc.EndedDocDesc")%></span>
                                                    <a href="javascript:void(0)" onclick="reportDel();">
                                                        <img src="/totsys/common/images/bt_redell.gif" alt="<%= MoumiConfig.getMessageBundle().getString("moumi.message.button_small.docDel")%>" />
                                                    </a>
                                        <%}%>

                                                <%if ("RECOG".equals(reportType)) {%>
                                                    <%if (repoadm.getRecogNum() + 1 < totReport.getRepoadms().size()) {%>
                                                    <a class="simplebutton" href="#" onclick="recogProccessChagne('<%=Recog.NOT_RECOG.ordinal()%>');">
                                                        <span class="info"><%= MoumiConfig.getMessageBundle().getString("moumi.message.tot_report.recog")%></span>
                                                    </a>
                                                    <a class="simplebutton" href="#" onclick="recogProccessChagne('<%=Recog.ARBITRARY.ordinal()%>');">
                                                        <span class="info"><%= Recog.ARBITRARY%></span>
                                                    </a>
                                                    <%}%>
                                                    <%if (repoadm.getRecogNum() + 1 == totReport.getRepoadms().size()) {%>
                                                    <a class="simplebutton" href="#" onclick="recogProccessChagne('<%=Recog.FINAL_RECOG.ordinal()%>');">
                                                        <span class="info"><%= Recog.FINAL_RECOG%></span>
                                                    </a>
                                                    <%}%>
                                                    <a class="simplebutton" href="#" onclick="recogProccessChagne('<%=Recog.RETURN_RECOG.ordinal()%>');">
                                                        <span class="info"><%= Recog.RETURN_RECOG%></span>
                                                    </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>
                                                     -->
                                                    <img style="cursor: pointer;" onclick="downExl();" src="/totsys/common/images/bt_excel.gif" alt="<%= MoumiConfig.getMessageBundle().getString("moumi.message.button_small.excel")%>" />
                                                    <!--//인쇄//-->
                                                    <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>
                                                    <% } 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=<%=docName%>" target="_parent">
                                                        <img src="/totsys/common/images/bt_excel.gif" alt="<%= MoumiConfig.getMessageBundle().getString("moumi.message.button_small.excel")%>" />
                                                    </a>
                                                    <!--//인쇄//-->
                                                    <a href="#" onclick="window.open('/totsys/common/inc/documents/tot_reports/total_reports_print.jsp?tableNum=&docID=<%=downDocId %>&displaySummary=false&prssSelect=false&docName=<%=docName%>','sendReport','toolbars=no,scrollbars=yes,resizable=yes,width=600,height=650');">
                                                        <img src="/totsys/common/images/bt_print2.gif" alt="<%= MoumiConfig.getMessageBundle().getString("moumi.message.button_small.excel")%>" />
                                                    </a>
                                                    <% }%>

                                                    <%if (!slav.equals("[]")) {%>
                                                    <a href="javascript:void(0);" onclick="acptdoc();">
                                                        <img src="/totsys/common/images/bt_init_2ndreg.jpg" alt="<%= MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.subDocRegist")%><%=MoumiConfig.getMessageBundle().getString("moumi.message.button_small.initialization")%>" />
                                                    </a>
                                                    <%}%>

                                                    <% if (downDocId != null && downDocId != 0L) {
                                                           if( ( usID.equals(userId) || sysAuth == SysAuth.SUB_SYSADM || sysAuth == SysAuth.SYSADM || sysAuth == SysAuth.REPOADM || sysAuth == SysAuth.SUB_TOTADM ) ) { %>
                                                        <a href="javascript:void(0);" onclick="changeDam();">
                                                            <img src="/totsys/common/images/bt_damdang.gif" alt="담당변경" />
                                                        </a>
                                                    <%     }
                                                       } %>

                                                    <a href="#" onclick="fn_goToList();">
                                                        <img src="/totsys/common/images/bt_doc_list.gif" alt="<%= MoumiConfig.getMessageBundle().getString("moumi.message.doc")%><%= MoumiConfig.getMessageBundle().getString("moumi.message.button.boardList")%>" />
                                                    </a>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <!-- 내용-->
                    <tr>
                        <td style="height: 31px; vertical-align: top;">
                            <table>
                                <tr style="height: 10px;">
                                <!--
                                <font color="red"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * 승인상신시 승인 팝업창이 나오지 않는 경우에는 호환성 보기설정을 추가하시면 됩니다.(업무포탈 접속 : 인터넷 익스플로러의 도구 - 호환성보기설정 - 이 웹사이트 추가)</font>
                                 -->
                                    <td style="height: 10px;"></td>
                                    <td style="height: 10px;"></td>
                                    <td style="height: 10px;"></td>
                                    <td style="height: 10px;"></td>
                                </tr>
                                <!-- 집계자 정보 시작 -->
                                <!--
                                <%--jsp:include page="/totsys/common/inc/totper/totper.jsp" flush="true">
                                    <jsp:param name="docID"	value='<%= totReport.getTotDoc().getId()%>' />
                                    <jsp:param name="tmpStrMagam" value="<%= tmpStrMagam%>" />
                                </jsp:include--%>
                                -->
                                <!-- 집계자 정보 끝 -->
                                <tr style="height: 10px;">
                                    <td style="height: 10px; width: 149px;"></td>
                                    <td style="height: 10px;"></td>
                                    <td style="height: 10px; width: 149px;"></td>
                                    <td style="height: 10px;"></td>
                                </tr>

                                <!-- 승인상태-->
                                <%if (false) { //if(totReport.getRecog() != Recog.NOT_RECOG){%>
                                <tr>
                                    <td colspan="4" style="vertical-align: top;">
                                        <jsp:include page="/totsys/common/inc/repoadm/repoadm_info.jsp" flush="true">
                                            <jsp:param name="reportID" value="<%= reportID%>" />
                                        </jsp:include>
                                    </td>
                                </tr>
                                <%}%>
                                <!-- 승인상태 끝-->

                                <!-- 반려 사유-->
                                <%if (false) { //if(totReport.getRecog() == Recog.RETURN_RECOG){%>
                                <tr style="padding-top: 10px;">
                                    <td colspan="4" style="vertical-align: top;">
                                        <jsp:include page="/totsys/common/inc/memo/recog_return_message.jsp" flush="true">
                                            <jsp:param name="repoadminID" value="<%= repoadminID%>" />
                                        </jsp:include>
                                    </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="<%= tmpStrMagam%>" />
                                        </jsp:include>
                                    </td>
                                </tr>
                                <!-- 보고 내용 시작 -->
                                <tr>
                                    <td>
                                    </td>
                                </tr>

                            </table>
                        </td>
                    </tr>
                    <!-- top menu start -->
                    <%@ include file="/totsys/common/inc/buttom/buttom.jsp"%>
                    <!-- top menu end -->
                </table>
            </div>
        </div>
        <form name="reuseForm" method="post">
            <input type="hidden" name="reportID">
            <input type="hidden" name="USER_ID">
            <input type="hidden" name="DEPT_CODE">
            <input type="hidden" name="doctName">
        </form>
        <iframe name="hiddenFrame" frameborder="0" width="0" height="0" src="" style="display: none" />
    </body>
</html>
<%
} else {
	tx.begin();
    TotReportService reportService = new TotReportService(pm);
    if (procMode.equals("delete")) {
        reportService.updatePrssForReport(reportID, TotReportProcess.RETURN);
    } else if (procMode.equals("complete")) {
        int accDocCdInt = MInteger.parseInt(request.getParameter("accDocCd"));
        reportService.procCompleteForReport(reportID, accDocCdInt, deptName);
    }
	tx.commit();

%>
	<head>
		<meta charset="UTF-8">
        <title><%=MoumiConfig.getTitle()%></title>
        <script>
            /*
             * 목록페이지로 이동처리하는 함수
             */
            function fn_goToList() {
                document.listForm.submit();
            }
            window.onload = fn_goToList;
        </script>
    </head>
    <body>
        <form name="listForm" method="post" action="/totsys/repoper/mydocbox/tempbox/report_list.jsp">
            <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="reportType" value="<%=reportType%>">
        </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();
    }
%>
