
<%@page import="java.util.Calendar"%>
<%@page import="kr.co.kihyun.beans.totsys.doc.table.Table"%>
<%    /**
     * **********************************************************
     * @@ Program Name : doc_list.jsp
     * @@ Description	: /집계자/보고문서 목록 공통
     * @@ Author	: 기현테크
     * @@ Create Date	: 2010.11.21
     * @@ History	: 2014.10.14 Update by KWON,HAN
     * @@ 2021.11.4 부서초기화, 재입력 요청 오류 수정 이원석
     * @@***********************************************************
     */
%>
<%@ page contentType="text/html; charset=UTF-8"
         import="java.util.Date"
         import="java.util.List"
         import="java.util.ArrayList"
         import="java.util.Map"
         import="java.util.HashMap"
         import="java.text.SimpleDateFormat"
         import="java.net.URLEncoder"
         import="java.net.URLDecoder"
         import="kr.co.kihyun.beans.user.HttpSSOLogin"
         import="kr.co.kihyun.util.MDate"
         import="kr.co.kihyun.lang.MString"
         import="kr.co.kihyun.lang.MInteger"
         import="kr.co.kihyun.lang.MLong"
         import="kr.co.kihyun.lang.Encoder"
         import="kr.co.kihyun.moumi.MoumiConfig"
         import="kr.co.kihyun.moumi.doc.MDoc"
         import="kr.co.kihyun.moumi.Moumi"
         import="kr.co.kihyun.moumi.report.MReport"
         import="kr.co.kihyun.beans.user.User"
         import="kr.co.kihyun.beans.user.Dept"
         import="kr.co.kihyun.beans.totsys.report.Report"
         import="kr.co.kihyun.beans.totsys.doc.Doc"
         import="javax.jdo.PersistenceManager"
         import="javax.jdo.Transaction"
         import="kr.co.kihyun.beans.entity.util.*"
         import="kr.co.kihyun.beans.entity.*"
         import="org.slf4j.Logger"
         import="org.slf4j.LoggerFactory"
         import="kr.co.kihyun.service.TotDocService"
         import="kr.co.kihyun.service.PrssReportsService"
         import="kr.co.kihyun.service.vo.PrssReportsVO"
         import="kr.co.kihyun.service.vo.ReportCountVO"
         import="javax.jdo.Query"%>
<%@page import="kr.co.kihyun.beans.entity.TotReportProcess"%>

<%@ include file="/totsys/common/inc/sec/secure.inc.jsp"%>
<%  PersistenceManager pm = new MPersistenceManager(PMF.get().getPersistenceManager());
    Transaction tx = pm.currentTransaction();
    try {
        //request.setCharacterEncoding("UTF-8");
        Logger LOG = LoggerFactory.getLogger(this.getClass());
        /**
         * ******** session내의 userId *********
         */
        String usID = HttpSSOLogin.getLoginID(request);
        int sysAuth = HttpSSOLogin.getSysAuth(request);
        String dpID = HttpSSOLogin.getDeptID(request);
        String docType = clearXSS(request.getParameter("docType"), null);
        String dpNM = HttpSSOLogin.getDeptName(request);//20160426 추가 - 부서명

        /**
         * **** Parameter *****
         */
        Long docID = MLong.parseLong(request.getParameter("docID"), null);
        String accAuth = clearXSS(request.getParameter("accAuth"), "");

        String searchDepth = clearXSS(request.getParameter("searchDepth"), "");
        String strPage = clearXSS(request.getParameter("strPage"), "");
        String findOption = clearXSS(request.getParameter("findOption"), "");
        String findWord = URLDecoder.decode(MString.checkNull(request.getParameter("findWord")), "UTF-8");
        String stDate = clearXSS(request.getParameter("stDate"), "");
        String edDate = clearXSS(request.getParameter("edDate"), "");

        int innerStrPage = 0;
        String innerFindOption = "";
        String innerFindWord = "";

        if ("inner".equals(searchDepth)) {
            innerStrPage = MInteger.parseInt(request.getParameter("innerStrPage"), 1);
            innerFindOption = clearXSS(request.getParameter("innerFindOption"), "");
            innerFindWord = URLDecoder.decode(MString.checkNull(request.getParameter("innerFindWord")), "UTF-8");
        } else {
            innerStrPage = MInteger.parseInt(request.getParameter("innerStrPage"), 1);
            innerFindOption = clearXSS(request.getParameter("innerFindOption"), "");
            innerFindWord = URLDecoder.decode(MString.checkNull(request.getParameter("innerFindWord")), "UTF-8");
        }
        if (innerStrPage <= 0) {
            innerStrPage = 1;
        }

        if(findWord != null || innerFindWord != null){
            String[] filter_word= {"--", "\\(", "\\)", "\\'", "\\\""};
            for(int ii=0; ii< filter_word.length;ii++){
                findWord = findWord.replaceAll(filter_word[ii], "");
                innerFindWord = innerFindWord.replaceAll(filter_word[ii], "");
            }
        }

        String howSort = clearXSS(request.getParameter("howSort"), "");
        String file = clearXSS(request.getParameter("file"), "");
        String subDoc = clearXSS(request.getParameter("subDoc"), "");
        String procMode = request.getParameter("proc_mode");

        //자동회수 설정
        if (!MString.isNull(procMode)) {
            tx.begin();
            TotDocService docService = new TotDocService(pm);
            if (procMode.equals("auto_return")) {
                String autoRtnYn = MString.checkNull(request.getParameter("autoRtnYn"), "N");
                docService.updateAutoRtnYnForDoc(docID, autoRtnYn);
            }
            tx.commit();
        }

        int listType = MInteger.parseInt(request.getParameter("listType"));
        int prssENG = MInteger.parseInt(request.getParameter("prssENG"));
        String listNum = clearXSS(request.getParameter("listNum"), "");

        //페이징 기본개수 정해주는 파라메터
        int intlistNum = 30;
        if (!"".equals(listNum)) {
            intlistNum = MInteger.parseInt(request.getParameter("listNum"), 30);
        }
        //==============================

        int recog = MInteger.parseInt(request.getParameter("recog"), -1);
        tx.begin();

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

        TotDoc totDoc = pm.getObjectById(TotDoc.class, docID);
        String userId = totDoc.getUser();
        AccessAuth docAccAuth = totDoc.getAccessAuth();
        String regID = totDoc.getUser(pm).getId();
        String deptID = totDoc.getDept(pm).getId();
        Date endDate = totDoc.getEndDate();

        tx.rollback();
        String tmpStr = totDoc.getName();	//압축파일명에서 날짜 삭제 by wonseok Lee 20170911

        /**
         * **** all, send report *****
         */
        int allReportCount = 0;
        int sendReportCount = 0;
        int notReportCount = 0;
        int noteReportCount = 0;

        /**
         * ********** 리스트 페이지 구성 ***********
         */
        int pageSize = 0;
        int currentPage = 0;
        int currentPageSetUp = 0;
        int recordSize = intlistNum;

        currentPage = innerStrPage;

        currentPageSetUp = (int) (currentPage / 10) * 10;
        if (currentPage % 10 == 0) {
            currentPageSetUp -= 10;
        }

        //======================================================================
        PrssReportsService prssService = new PrssReportsService(pm);
        //검색조건파라미터
        Map params = new HashMap();
        params.put("docId", docID);
        params.put("listType", listType);
        params.put("findOption", innerFindOption);
        params.put("filterValue", innerFindWord);
        params.put("howSort", howSort);
        params.put("sort", sort);
        params.put("file", file);
        params.put("subDoc", subDoc);

        //검색메인쿼리와 레코드갯수조회쿼리를 생성 후 멤버변수로 저장
        prssService.createPrssReportListSearchQuery(params);

        //레코드갯수조회쿼리를 실행하여 레코드갯수를 구함
        int count = prssService.getCountFromMainQuery();

        if ((count % recordSize) == 0) {
            pageSize = (int) (count / recordSize);
        } else {
            pageSize = (int) (count / recordSize) + 1;
        }

        if (currentPage > pageSize) {
            currentPage = pageSize;
        }

        innerStrPage = currentPage; //파라미터로 넘길 현재페이지을 설정한다.

        int startNo = (currentPage - 1) * recordSize + 1;
        int endNo = currentPage * recordSize;

        List list = null;

        //검색목록조회쿼리 실행
        if (count > 0) {
            //페이징처리를 위한 추가파라미터 설정
            prssService.getParams().put("startNo", startNo);
            prssService.getParams().put("endNo", endNo);

            //검색메인쿼리를 페이징처리를 위한 쿼리로 변환
            prssService.convertToPagenatingQuery();

            //만족하는 레코드가 존재하면 조회
            list = prssService.executeQuery(PrssReportsVO.class);
        }
        //======================================================================

        List prssList = null;
        prssList = prssService.getReportCountByDocId(docID);

        if (prssList != null && prssList.size() > 0) {
            for (Object obj : prssList) {
                ReportCountVO countVO = (ReportCountVO) obj;
                allReportCount = (countVO.getAllCount() ==  null) ? 0 : MInteger.parseInt(countVO.getAllCount().toString(), 0);
                sendReportCount = (countVO.getSendCount() ==  null) ? 0 : MInteger.parseInt(countVO.getSendCount().toString(), 0);
                notReportCount = (countVO.getNotCount() ==  null) ? 0 : MInteger.parseInt(countVO.getNotCount().toString(), 0);
                noteReportCount = (countVO.getNoteCount() ==  null) ? 0 : MInteger.parseInt(countVO.getNoteCount().toString(), 0);
            }
        }


        String report_Ids = "";  //20160426 추가
%>
<link rel="stylesheet" href="/totsys/common/css/kecttep.css" type="text/css"> <!-- 20160428 추가 -->
        <link rel="stylesheet" href="/totsys/common/css/SquareButtons.css" type="text/css"> <!-- 20160428 추가 -->
        <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/popup.css" type="text/css">
        <script src="/totsys/common/js/popup.js"></script>
        <script src="/totsys/common/js/rollover.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>
            var cpt_layer = null;

            //첨부파일다운로드
            function fileDownLoad() {
                var checkValue = 0;
                var checkBoxList = document.getElementsByName("check"); //checkBoxList 추가. 첨부파일다운로드 체크박스 인식 오류 수정 2021.11.5 이원석
                
                var reportIDs = "";
                if (<%=count%> == 1 || <%=count%> == <%=((currentPage - 1) * recordSize) + 1%>) {
                    if (checkBoxList[0].checked == true) {
                        //2014.10.08 Update by KWON,HAN : 제출완료 -> 제출완료, 회수요청
                        if (typeof (checkPrss0) != 'undefined') {
                            if (reportIDs.length == 0) {
                                reportIDs = document.getElementById("checkReportID0").value;
                            } else {
                                reportIDs = reportIDs + "," + document.getElementById("checkReportID0").value;
                            }
                        } else {
                            if (reportIDs.length == 0) {
                                reportIDs = document.getElementById("checkUser<%=((currentPage - 1) * recordSize)%>").value;
                            } else {
                                reportIDs = reportIDs + "," + document.getElementById("checkUser<%=((currentPage - 1) * recordSize)%>").value;
                            }
                        }
                        checkValue++;
                    }
                } else if (<%=count%> != 0) {
                    tmp1 = eval(<%=((currentPage - 1) * recordSize)%>);
                    tmp2 = eval(<%=((currentPage - 1) * recordSize)%> + <%=count%>-1);
                    tmp3 = 0;

                    for (i = tmp1; i < tmp2; i++) {
                        if (checkBoxList[tmp3].checked == true) {
                            //2014.10.08 Update by KWON,HAN : 제출완료 -> 제출완료, 회수요청
                                if (reportIDs.length == 0) {
                                    reportIDs = document.getElementById("checkReportID" + i).value;
                                } else {
                                    reportIDs = reportIDs + "," + document.getElementById("checkReportID" + i).value;
                                }
                                checkValue++;
                        }
                        tmp3++;
                    }
                }
                //체크박스에서 선택을 한 경우
                if (checkValue > 0) {
                    //개의 부서를 선택하였습니다.\\n\\n선택된 부서의 첨부문서를 압축하시겠습니까?
                    if (confirm(checkValue + '<%=MoumiConfig.getMessageBundle().getString("moumi.message.popup.deptSelectDocPress")%>')) {
                        location.href = "/servlet/kr.co.kihyun.beans.totsys.totper.HttpFileDownLoad?saveAs=<%=URLEncoder.encode(tmpStr, "UTF-8")%>.zip&docID=<%=docID%>&listType=<%=listType%>&docType=<%=docType%>&reportIDs=" + reportIDs;
                    }

                    //선택을 하지 않은 경우 전부 다운로드한다.
                } else {
                    //압축가능한 모든 첨부문서를 압축하시겠습니까?
                    if (confirm('<%=MoumiConfig.getMessageBundle().getString("moumi.message.popup.allDocPress")%>')) {
                       //201708 수정 by wonseok Lee
                        location.href = "/servlet/kr.co.kihyun.beans.totsys.totper.HttpFileDownLoad?saveAs=<%=URLEncoder.encode(tmpStr, "UTF-8")%>.zip&docID=<%=docID%>&listType=<%=listType%>&docType=<%=docType%>";
                    }
                }
            }

            //엑셀저장
            function excelLink() {
                var str = "/totsys/common/inc/documents/report/report_list_excel.jsp?docID=<%=docID%>&listType=<%= listType%>&accAuth=<%= accAuth%>&strPage=<%= innerStrPage%>&findOption=<%= MString.checkNull(innerFindOption)%>&findWord=<%= URLEncoder.encode(MString.checkNull(innerFindWord), "UTF-8")%>&recog=<%=recog%>&sort=<%=sort%>&howSort=<%=howSort%>";
                location.href = str;
            }

            /**
             * 페이지이동처리함수
             * @param {type} p_secu_yn
             * @returns {undefined}
             */
            function fn_goToPage(p_page) {
                document.searchForm.innerStrPage.value = p_page;
                document.searchForm.submit();
            }

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


            function popupWindow(dept, prssENG) {
                window.open('/totsys/totper/mydocbox/prssbox/reports/popup_repdept_reselect.jsp?docID=<%=docID%>&deptID=' + dept + '&prssENG=' + prssENG, 'reselect', 'toolbar=no,directories=no, scrollbars=no, resizable=no, menubar=no, status=no, location=no,width=550,height=320,top=200,left=350')
            }

            function selectAll() {
                var obj = document.getElementsByName("check");
                for (var i = 0; i < obj.length; i++) {
                    if (obj[i].disabled == false) {
                        obj[i].checked = true;
                    }
                }
            }

            function cancelAll() {
                var obj = document.getElementsByName("check");
                for (var i = 0; i < obj.length; i++) {
                    obj[i].checked = false;
                }
            }

            //부서초기화
            function changePrss() {
                //초기화는 필수이다.
                prssChange.changeReportID.value = "";
                var checkBoxList = document.getElementsByName("check"); //checkBoxList 추가. 부서초기화시 체크박스 인식 오류 수정 2021.11.4 이원석
				//alert(checkBoxList[0].checked);
                if (("<%=regID%>" == "<%=usID%>") || ("<%=deptID%>" == "<%=dpID%>" && ("<%=sysAuth%>" == "<%=MoumiConfig.SUB_TOTADM%>") || ("<%=sysAuth%>" == "<%=MoumiConfig.SUB_SYSADM%>")) || ("<%=sysAuth%>" == "<%=MoumiConfig.TOTADM%>" || "<%=sysAuth%>" == "<%=MoumiConfig.SYSADM%>")) {
                    var checkValue = 0;
                    var APPROVE = 0;
                    var docOwnerIDList = "";
                    if (<%=count%> == 1 || <%=count%> == <%=((currentPage - 1) * recordSize) + 1%>) {
                        if (checkBoxList[0].checked == true) {
                            if (typeof (checkPrss0) != 'undefined') {
                                if (prssChange.changeReportID.value.length == 0) {
                                    if (document.getElementById("checkPrss0").value != <%= MReport.APPROVE%>) {
                                        prssChange.changeReportID.value += document.getElementById("checkReportID0").value;
                                    } else {
                                        APPROVE = 1;
                                    }
                                } else if (document.getElementById("checkPrss0").value != <%= MReport.APPROVE%>) {
                                    prssChange.changeReportID.value += "," + document.getElementById("checkReportID0").value;
                                }
                            } else if (document.getElementById("changeReportID<%=((currentPage - 1) * recordSize)%>").value == <%= MReport.NOT_LIST%> || document.getElementById("changeReportID<%=((currentPage - 1) * recordSize)%>").value == <%= MReport.COMP_LIST%>) {
                                if (prssChange.changeReportID.value.length == 0) {
                                    if (document.getElementById("checkPrss<%=((currentPage - 1) * recordSize)%>").value != <%= MReport.APPROVE%>) {
                                        prssChange.changeReportID.value += document.getElementById("checkReportID<%=((currentPage - 1) * recordSize)%>").value;
                                    } else {
                                        APPROVE = 1;
                                    }
                                } else if (document.getElementById("checkPrss<%=((currentPage - 1) * recordSize)%>").value != <%= MReport.APPROVE%>) {
                                    prssChange.changeReportID.value += "," + document.getElementById("checkReportID<%=((currentPage - 1) * recordSize)%>").value;
                                } else {
                                    APPROVE = 1;
                                }
                            } else if (document.getElementById("changeReportID<%=((currentPage - 1) * recordSize)%>").value == <%= MReport.APPROVE%>) {
                                APPROVE = 1;
                            }
                            checkValue++;
                        }

                    } else if (<%=count%> != 0) {
                        tmp1 = eval(<%=((currentPage - 1) * recordSize)%>);
                        tmp2 = eval(<%=((currentPage - 1) * recordSize)%> + checkBoxList.length);
                        tmp3 = 0;

                        for (i = tmp1; i < tmp2; i++) {
                            if (checkBoxList[tmp3].checked == true) {
                                if (prssChange.changeReportID.value.length == 0) {
                                    checkValue++;
                                    //연계데이타 존재시 부서초기화 막음. MJH 추가
                                    if (document.getElementById("checkSlaveTotDoc" + i).value == "null") {
                                        document.getElementById("checkSlaveTotDoc" + i).value = "";
                                    }
                                    docOwnerIDList += document.getElementById("checkSlaveTotDoc" + i).value;

                                    if (docOwnerIDList != "") {
                                        alert("연계데이타 존재시 부서초기화를 할 수 없습니다.");
                                        checkALL(this.checked);
                                        exitFlag = true;
                                        return false;

                                    } else {
                                        prssChange.changeReportID.value += document.getElementById("checkReportID" + i).value;
                                    }

                                } else {
                                    checkValue++;
                                    //연계데이타 존재시 부서초기화 막음. MJH 추가
                                    if (document.getElementById("checkSlaveTotDoc" + i).value == "null") {
                                        document.getElementById("checkSlaveTotDoc" + i).value = "";
                                    }
                                    docOwnerIDList += document.getElementById("checkSlaveTotDoc" + i).value;

                                    if (docOwnerIDList != "") {
                                        alert("연계데이타 존재시 부서초기화를 할수 없습니다.");
                                        checkALL(this.checked);
                                        exitFlag = true;
                                        return false;

                                    } else {
                                        prssChange.changeReportID.value += "," + document.getElementById("checkReportID" + i).value;
                                    }
                                }
                            }
                            tmp3++;
                        }
                    }
            <%if (sysAuth == 9 || sysAuth == 7) {%>
                    prssChange.uri.value = "mmReportAccept";
            <%}%>
                    if (checkValue > 0 && APPROVE == 0) {
                        var exitFlag = false;
                        var $checked = $("input:checkbox[name=check]:checked");
                        var chkVal = "";
                        var okCnt = 0;

                        for (var i = 0; i < checkValue; i++) {
                            chkVal = $checked[i].value;

                            if ($("#checkPrss" + chkVal).val() == '<%= TotReportProcess.APPROVE.ordinal()%>') {         //결재진행 5
                                document.getElementById("check" + chkVal).checked = false;
                                exitFlag = true;
                            } else {
                                okCnt = okCnt + 1;
                            }
                        }
                        if (okCnt == 0) {
                            document.getElementById("checkAll").checked = false;
                        }
                        if (exitFlag == true) {
                            alert("진행상태가 [결재진행]이면 부서초기화를 할 수 없습니다.");
                            return false;
                        }

                        if (<%=listType%> == <%= MReport.ALL_LIST%> || <%=listType%> == <%= MReport.NOT_COMP_LIST%>) {
                            if (confirm(checkValue + "<%=MoumiConfig.getMessageBundle().getString("moumi.message.popup.deptSelectInt")%>")) {
                                prssChange.submit();
                            }
                        } else if (<%=listType%> == <%= MReport.TEMP%> || <%=listType%> == <%= MReport.RETURN%>) {
                            if (confirm(checkValue + "<%=MoumiConfig.getMessageBundle().getString("moumi.message.popup.deptSelectRemoteSubmit")%>")) {
                                prssChange.submit();
                            }
                        } else if (<%=listType%> == <%= MReport.ACCEPT%>) {
                        } else if (<%=listType%> == <%= MReport.RETURN%>) {
                            if (confirm("<%=TotReportProcess.RETURN%>><%=TotReportProcess.COMP%>")) {
                                                    prssChange.submit();
                                                }
                        } else if (<%=listType%> == <%= MReport.COMP%>) {
                        alert("MReport.COMP" + <%=listType%>);
                            if (confirm(checkValue + "<%=MoumiConfig.getMessageBundle().getString("moumi.message.popup.deptSelectReturn")%>")) {
                                window.open('/totsys/memo/rereport/pop_rereport.jsp', 'rereport', 'width=640, height=350,toolbar=no, directories=no, status=no, menubar=no, resizable=no');
                                prssChange.submit();
                            }
                        } else if (<%=listType%> == <%= MReport.NOT%>) {
                        alert("MReport.NOT" + <%=listType%>);
                            if (confirm(checkValue + "<%=MoumiConfig.getMessageBundle().getString("moumi.message.popup.deptSelectReturn")%>")) {
                                window.open('/totsys/memo/rereport/pop_rereport.jsp', 'rereport', 'width=640, height=350,toolbar=no, directories=no, status=no, menubar=no, resizable=no');
                                prssChange.submit();
                            }
                        } else {
                            prssChange.submit();
                        }
                                        } else if (APPROVE == 1) {
                                            alert("<%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_report.recogWaitDuring")%>");
                                        } else {
                                            alert("<%=MoumiConfig.getMessageBundle().getString("moumi.message.popup.deptStatus")%>");
                                        }

                                    } else {
                                        alert("<%=MoumiConfig.getMessageBundle().getString("moumi.message.popup.docModify")%>");
                                    }
                                }

                                //재입력 요청
                                function changePrssMore() {
                                    //초기화는 필수이다.
                                    prssChange.changeReportID.value = "";
                                    var checkBoxList = document.getElementsByName("check");	//checkBoxList 추가. 재입력 요청시 체크박스 인식 오류 수정 2021.11.4 이원석
                                    if (("<%=regID%>" == "<%=usID%>") || ("<%=deptID%>" == "<%=dpID%>" && ("<%=sysAuth%>" == "<%=MoumiConfig.SUB_TOTADM%>") || ("<%=sysAuth%>" == "<%=MoumiConfig.SUB_SYSADM%>")) || ("<%=sysAuth%>" == "<%=MoumiConfig.TOTADM%>" || "<%=sysAuth%>" == "<%=MoumiConfig.SYSADM%>"))
                                    {
                                        var checkValue = 0;
                                        var APPROVE = 0;
                                        if (<%=count%> == 1 || <%=count%> == <%=((currentPage - 1) * recordSize) + 1%>) {
                                            if (checkBoxList[0].checked == true) {
                                                if (typeof (checkPrss0) != 'undefined') {
                                                    if (prssChange.changeReportID.value.length == 0) {
                                                        if (document.getElementById("checkPrss0").value != <%= MReport.APPROVE%>) {
                                                            prssChange.changeReportID.value += document.getElementById("checkReportID0").value;
                                                        } else {
                                                            APPROVE = 1;
                                                        }
                                                    } else if (document.getElementById("checkPrss0").value != <%= MReport.APPROVE%>) {
                                                        prssChange.changeReportID.value += "," + document.getElementById("checkReportID0").value;
                                                    }

                                                } else if (document.getElementById("changeReportID<%=((currentPage - 1) * recordSize)%>").value == <%= MReport.NOT_LIST%> || document.getElementById("changeReportID<%=((currentPage - 1) * recordSize)%>").value == <%= MReport.COMP_LIST%>) {
                                                    if (prssChange.changeReportID.value.length == 0) {
                                                        if (document.getElementById("checkPrss<%=((currentPage - 1) * recordSize)%>").value != <%= MReport.APPROVE%>) {
                                                            prssChange.changeReportID.value += document.getElementById("checkReportID<%=((currentPage - 1) * recordSize)%>").value;
                                                        } else {
                                                            APPROVE = 1;
                                                        }
                                                    } else if (document.getElementById("checkPrss<%=((currentPage - 1) * recordSize)%>").value != <%= MReport.APPROVE%>) {
                                                        prssChange.changeReportID.value += "," + document.getElementById("checkReportID<%=((currentPage - 1) * recordSize)%>").value;
                                                    } else {
                                                        APPROVE = 1;
                                                    }
                                                } else if (document.getElementById("changeReportID<%=((currentPage - 1) * recordSize)%>").value == <%= MReport.APPROVE%>) {
                                                    APPROVE = 1;
                                                }
                                                checkValue++;
                                            }

                                        } else if (<%=count%> != 0) {
                                            tmp1 = eval(<%=((currentPage - 1) * recordSize)%>);
                                            tmp2 = eval(<%=((currentPage - 1) * recordSize)%> + checkBoxList.length);
                                            tmp3 = 0;

                                            for (i = tmp1; i < tmp2; i++) {
                                                if (checkBoxList[tmp3].checked == true) {
                                                    if (prssChange.changeReportID.value.length == 0) {
                                                        prssChange.changeReportID.value += document.getElementById("checkReportID" + i).value;
                                                    } else {
                                                        prssChange.changeReportID.value += "," + document.getElementById("checkReportID" + i).value;
                                                    }
                                                    checkValue++;
                                                }
                                                tmp3++;
                                            }
                                        }

            <%if (sysAuth == 9 || sysAuth == 7) {%>
                                        prssChange.uri.value = "mmReportAccept";
            <%}%>

                                        if (checkValue > 0 && APPROVE == 0) {
                                            var exitFlag = false;
                                            var $checked = $("input:checkbox[name=check]:checked");
                                            var chkVal = "";
                                            var okCnt = 0;

                                            for (var i = 0; i < checkValue; i++) {
                                                chkVal = $checked[i].value;

                                                if ($("#checkPrss" + chkVal).val() == '<%= TotReportProcess.COMP.ordinal()%>'        //제출완료 6,
                                                        || $("#checkPrss" + chkVal).val() == '<%= TotReportProcess.NOTE.ordinal()%>'     //자료회수요청 14
                                                        || $("#checkPrss" + chkVal).val() == '<%= TotReportProcess.NOT.ordinal()%>') {   //해당없음 12
                                                    okCnt = okCnt + 1;
                                                } else {
                                                    document.getElementById("check" + chkVal).checked = false;
                                                    exitFlag = true;
                                                    //break;
                                                }
                                            }
                                            if (okCnt == 0) {
                                                document.getElementById("checkAll").checked = false;
                                            }
                                            if (exitFlag == true) {
                                                alert("진행상태가 [제출완료, 자료회수요청, 해당없음]의 경우에 \n재입력요청을 할 수 있습니다.");
                                                return false;
                                            }

                                            if (confirm(checkValue + "<%=MoumiConfig.getMessageBundle().getString("moumi.message.popup.deptSelectReturn")%>")) {
                                                document.prssChange.changePrss.value = "return";
                                                window.open('/totsys/memo/rereport/pop_rereport.jsp', 'rereport', 'width=640, height=350,toolbar=no, directories=no, status=no, menubar=no, resizable=no');
                                            }
                                        } else if (APPROVE == 1) {
                                            alert("<%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_report.recogWaitDuring")%>");  //결재대기중
                                        } else {
                                            alert("<%=MoumiConfig.getMessageBundle().getString("moumi.message.popup.deptStatus")%>");  //상태변경 부서를 선택해주세요.
                                        }
                                    } else {
                                        alert("<%=MoumiConfig.getMessageBundle().getString("moumi.message.popup.docModify")%>");   //자신이 등록한 자료만 수정이 가능합니다.
                                    }
                                }

                                /**
                                 *체크박스 전체선택 해제 스크립트 추가
                                 **/
                                function checkALL(checkYn) {
                                    frm = document.approOpen;
                                    var checklist = document.getElementsByName("check");
                                    if (checklist.length > 0) {
                                        for (var i = 0; i < checklist.length; i++) {
                                            checklist[i].checked = checkYn;
                                        }
                                    }
                                }


                                function find2() {
                                    var word = document.searchForm.innerFindWord.value.length;
                                    var option = document.searchForm.innerFindOption.options[document.searchForm.innerFindOption.selectedIndex].value;

                                    document.searchForm.innerFindOption.value = option;

                                    if (document.searchForm.innerFindWord.value == "") {
                                        alert("검색 단어를 입력해 주세요");
                                        return;
                                    }

                                    if (document.searchForm.innerFindOption.value != "id" && word < 2) {
                                        alert("검색어는 2글자 이상이어야 합니다.!");
                                        return;
                                    }

                                    document.searchForm.submit();
                                }

                                function fn_onChangedAutoReturn(p_checkbox) {
                                    document.autoRtnForm.autoRtnYn.value = p_checkbox.checked ? "Y" : "N";
                                    document.autoRtnForm.submit();
                                }

                                var gEventY = 0;
                                var gEventX = 0;
                                /**
                                 * Ajax기능을 사용하여 서버에 첨부파일 리스트을 요청하는 함수
                                 * @param {type} p_deptId
                                 * @param {type} p_lov_type
                                 * @returns {undefined}
                                 */
                                function popupViewInner(p_index, obj_id, p_reportID) {
                                    gEventY = window.event.clientY + document.body.scrollTop;
                                    gEventX = window.event.clientX + document.body.scrollLeft;

                                    $.ajax({
                                        url: "/servlet/kr.co.kihyun.service.servlet.AjaxProcessServlet",
                                        type: "POST",
                                        dataType: "json",
                                        data: {
                                            proc_type: "attatch_file",
                                            index: p_index,
                                            file_index: obj_id,
                                            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);
                                        }
                                    });
                                }

                                /**
                                 * fn_getDeptLOV함수의 성공 시 호출되는 함수
                                 * @param {type} data
                                 * @returns {undefined}
                                 */
                                function fn_callBackForSuccess(data) {
                                    var fileList = "";

                                    var index = "";
                                    var fileIndex = "";
                                    var reportID = "";
                                    var docID = "";
                                    var deptID = "";
                                    var fileName = "";
                                    var fileNameEncode = "";

                                    if (data != null) {
                                        for (var i = 0; i < data.length; i++) {
                                            index = data[i].index;
                                            fileIndex = data[i].fileIndex;
                                            reportID = data[i].reportID;
                                            docID = data[i].docID;
                                            deptID = data[i].deptID;
                                            fileName = data[i].fileName;
                                            fileNameEncode = data[i].fileNameEncode;
                                            fileList += "<span style='color: #FF9C1B; font-weight: bold;'>+첨부파일 " + (i + 1) + " : </span><a onclick=\"popupClose(\'" + fileIndex + "\');\" href=\'/servlet/kr.co.kihyun.text.html.HttpViewer?saveAs=" + fileNameEncode + "\&fileName=" + fileNameEncode + "\&docID=" + docID + "&deptID=" + deptID + "\&reportID=" + reportID + "\' target=\'hiddenIframe\'>" + fileName + "</a><br/>\n";
                                        }
                                        document.getElementById("fileNameList" + index).innerHTML = fileList;
                                    }

                                    $(".ajdxjdrnfl").hide();
                                    cpt_layer = $("#" + fileIndex);

                                    if (cpt_layer.css("display") === "none") {
                                        cpt_layer.css({
                                            "margin-top": function() {
                                                return 25;
                                            },
                                            "margin-left": function() {
                                                return -parseInt(cpt_layer.width());
                                            },
                                            "width": "auto"
                                        });

                                        cpt_layer.slideDown();
                                    }
                                }

                                //
                                function findCheckInner(findForm) {
                                    if (findForm.innerFindWord.value.length < 2) {
                                        alert("검색단어는 최소 2자 이상 입력해 주세요.");
                                        findForm.innerFindWord.value = "";
                                        findForm.innerFindWord.focus();
                                        return false;
                                    }

                                    if (findForm.innerFindOption.value == "totDoc.startDate"
                                            || findForm.innerFindOption.value == "totDoc.repoEndDate"
                                            || findForm.innerFindOption.value == "startDate"
                                            || findForm.innerFindOption.value == "regDate"
                                            || findForm.innerFindOption.value == "endDate") {
                                        var str = /[0-9]{2}[\-][0-1][0-9][\-][0-3][0-9]$/;
                                        if (!str.test(findForm.innerFindWord.value)) {
                                            alert("10-12-01 형태로 입력해 주세요");
                                            findForm.innerFindWord.value = "";
                                            findForm.innerFindWord.focus();
                                            return false;
                                        }
                                    }
                                    return true;
                                }

                                function selectedGO2() {
                                    var tmpTrans = trans.value;
                                    var listType;
                                    var howSort = "";
                                    var file = "";
                                    var subDoc = "";

                                    switch (tmpTrans) {
                                        case "all":
                                            listType = <%= MReport.ALL_LIST%>;   //전체
                                            break;
                                        case "approve":
                                            listType = <%= MReport.APPROVE%>;   //결재진행
                                            break;
                                        case "comp":
                                            listType = <%= MReport.COMP_LIST%>;   //제출완료
                                            break;
                                        case "notcomp":
                                            listType = <%= MReport.NOT_COMP_LIST%>;   //미제출
                                            break;
                                        case "temp":
                                            listType = <%= MReport.TEMP_LIST%>;   //임시저장
                                            break;
                                        case "prss":
                                            listType = <%= MReport.ACCEPT_LIST%>;   //접수
                                            break;
                                        case "reprss":
                                            listType = <%= MReport.RETURN_LIST%>;   //재입력요청
                                            break;
                                        case "not":
                                            listType = <%= MReport.NOT_LIST%>;   //해당없음
                                            break;
                                        case "howSort":
                                            listType = <%= MReport.ALL_LIST%>;   //제출일시
                                            howSort = "submitDate DESC";
                                            break;
                                        case "note":
                                            listType = <%= MReport.NOTE_LIST%>;   //자료회수요청
                                            break;
                                        case "file":
                                            listType = <%= MReport.COMP_LIST%>;   //파일제출
                                            file = "attachments DESC";
                                            break;
                                        case "subDoc":
                                            listType = <%= MReport.ALL_LIST%>;   //연계자료
                                            subDoc = "downDocId DESC";
                                            break;

                                        default:
                                            alert("Select Error !!!")
                                            return false;
                                    }

                                    document.searchForm.listType.value = listType;
                                    document.searchForm.listNum.value = listNum.value;
                                    document.searchForm.sort.value = sort.value;
                                    document.searchForm.howSort.value = howSort;
                                    document.searchForm.file.value = file;
                                    document.searchForm.subDoc.value = subDoc;
            <%if (MoumiConfig.getUseRecog()) {%>
                                    document.searchForm.recog.value = recog.value;
            <%}%>

                                    document.searchForm.submit();
                                }

          //20160426 추가
          function loadKWD() {

                try {
                   $.customIndicator.show(window.self);
                } catch(e) {
                   alert(e);
                }
                var form1 = document.TransForm;
                form1.target = "hiddenIframe";
                form1.action = "/servlet/kr.co.kihyun.beans.totsys.report.CheckOPTable";
                form1.submit();
            }

           //20160426 추가
          function loadKWDExe() {
                if( confirm("교육부로 전송 하시겠습니까?") ){
                    try {
                       $.customIndicator.show(window.self);
                    } catch(e) {
                       alert(e);
                    }
                    var form1 = document.TransForm;
                form1.target = "hiddenIframe";
                    form1.action = "/servlet/kr.co.kihyun.beans.totsys.report.HttpVCMCCMC2016Send";//?reportID=<%//=reportID%>";
                    form1.submit();
                }
            }

            // 20160426 추가
            function fn_indiClose(){
                $.customIndicator.hide(window.self);
            }

            //20160426 IR 테이블의 교육청 자료 조회후 교육부 DB 업무 테이블에 INSERT
            function fn_irOfcDataSave(){
                try {
                   $.customIndicator.show(window.self);
                } catch(e) {
                   alert(e);
                }
                var form1 = document.TransForm;
                form1.target = "hiddenIframe";
                form1.callFn.value = "parent.fn_irOfcDataSaveExe()";
                form1.action = "/servlet/kr.co.kihyun.beans.totsys.report.CheckIrReportTable";
                form1.submit();
            }

            function fn_irOfcDataSaveExe(){
                if( confirm("연계 테이블의 교육청 자료 조회후 교육부 DB 업무 테이블에\r저장하시겠습니까?") ){
                    try {
                       $.customIndicator.show(window.self);
                    } catch(e) {
                       alert(e);
                    }
                    var form1 = document.TransForm;
                    form1.target = "hiddenIframe";
                    form1.action = "/servlet/kr.co.kihyun.beans.totsys.report.HttpVCMCCMC2016Receive";
                    form1.submit();
                }//end if
            }

            //20160428 IR 테이블의 교육청 연계 자료 초기화
            function fn_irDataInit(){
                try {
                   $.customIndicator.show(window.self);
                } catch(e) {
                   alert(e);
                }
                var form1 = document.TransForm;
                form1.target = "hiddenIframe";
                form1.callFn.value = "parent.fn_irDataInitExe()";
                form1.action = "/servlet/kr.co.kihyun.beans.totsys.report.CheckIrReportTable";
                form1.submit();
            }

            function fn_irDataInitExe(){

                if( confirm("연계 테이블의 교육청 자료를 초기화 하시겠습니까?") ){
                    try {
                       $.customIndicator.show(window.self);
                    } catch(e) {
                       alert(e);
                    }
                    var form1 = document.TransForm;
                    form1.target = "hiddenIframe";
                    form1.action = "/servlet/kr.co.kihyun.beans.totsys.report.HttpVCMCCMC2016Init";
                    form1.submit();
                }//end if

            }
        </script>

        <form name="listForm" method="post" action="/totsys/totper/mydocbox/prssbox/doc_list.jsp">
            <input type="hidden" name="docType"    value="<%= docType%>">
            <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="prssChange" method="post" action="/servlet/kr.co.kihyun.beans.totsys.totper.HttpReportPrssChange">
            <input type="hidden" name="docID" value="<%=docID%>" id="docID">
            <input type="hidden" name="listType" value="<%=listType%>">
            <input type="hidden" name="uri" value=""> <!-- 제출현황 수정으로 인해 임의의값 넣어서 임시사용 -->
            <input type="hidden" name="changePrss" value="accept">
            <input type="hidden" name="changeReportID" value="">
            <input type="hidden" name="checkSlaveTotDoc" value="">
            <input type="hidden" name="contents" value="">
            <input type="hidden" name="docType" value="<%=docType%>">
            <input type="hidden" name="strPage"    value="<%= currentPage%>">
            <input type="hidden" name="findOption" value="<%= MString.checkNull(findOption)%>">
            <input type="hidden" name="findWord"   value="<%= MString.checkNull(findWord)%>">
            <!-- 제출현황 수정으로 인해 임의의값 넣어서 임시사용 -->
        </form>
        <form name="autoRtnForm" method="post">
            <input type="hidden" name="proc_mode"   value="auto_return">
            <input type="hidden" name="docID"       value="<%= docID%>">
            <input type="hidden" name="accAuth"     value="<%= accAuth%>">
            <input type="hidden" name="strPage"     value="<%= strPage%>">
            <input type="hidden" name="findOption"  value="<%= findOption%>">
            <input type="hidden" name="findWord"    value="<%= findWord%>">
            <input type="hidden" name="listType"    value="<%= listType%>">
            <input type="hidden" name="recog"       value="<%= recog%>">
            <input type="hidden" name="docType"     value="<%= docType%>">
            <input type="hidden" name="listNum"     value="<%= listNum%>">
            <input type="hidden" name="sort"        value="<%= sort%>">
            <input type="hidden" name="howSort"     value="<%= howSort%>">
            <input type="hidden" name="file"     value="<%= file%>">
            <input type="hidden" name="subDoc"     value="<%= subDoc%>">
            <input type="hidden" name="autoRtnYn"   value="">
        </form>
            <table>
                <tr>
                    <td class="pading_margin_zero">
                        <table>
                            <tr class="toolbar">
                                <!-- 문서명 -->
                                <!--td height="30" valign="bottom"><img src="/totsys/common/images/search_bg_L.gif"/></td-->
                                <td>
                                    <table>
                                        <tr>
                                            <td style="width: 270px;">
                                                <select id="trans" name="trans" class="inputtxt" onchange="selectedGO2()">
                                                    <option value="all"><%=TotReportProcess.ALL%> <%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_report.progressStatus")%></option>
                                                    <option value="comp"><%=TotReportProcess.COMP%></option>
                                                    <option value="notcomp"><%=TotReportProcess.NOT_REPORT%></option>
                                                    <option value="temp"><%=TotReportProcess.TEMP%></option>
                                                    <option value="approve">결재진행</option>
                                                    <option value="prss"><%=TotReportProcess.ACCEPT%></option>
                                                    <option value="reprss"><%=TotReportProcess.RETURN%></option>
                                                    <option value="not"><%=TotReportProcess.NOT%></option>
                                                    <option value="howSort">제출일시</option>
                                                    <option value="note">자료회수요청</option>
                                                    <option value="file">파일제출</option>
                                                    <option value="subDoc">연계자료</option>
                                                </select>
                                                <select id="listNum" name="listNum" class="inputtxt" onchange="selectedGO2()">
                                                    <option value="" <%= "".equals(listNum) ? " selected" : ""%> >목록</option>
                                                    <option value="10" <%= "10".equals(listNum) ? " selected" : ""%> >10개씩</option>
                                                    <option value="20" <%= "20".equals(listNum) ? " selected" : ""%> >20개씩</option>
                                                    <option value="30" <%= "30".equals(listNum) ? " selected" : ""%> >30개씩</option>
                                                    <option value="40" <%= "40".equals(listNum) ? " selected" : ""%> >40개씩</option>
                                                    <option value="50" <%= "50".equals(listNum) ? " selected" : ""%> >50개씩</option>
                                                </select>
                                                <select id="sort" name="sort" class="inputtxt" onchange="selectedGO2()">
                                                    <option value="" <%= "".equals(sort) ? " selected" : ""%> >정렬선택</option>
                                                    <option value="1" <%= "1".equals(sort) ? " selected" : ""%> >기관별</option>
                                                    <option value="2" <%= "2".equals(sort) ? " selected" : ""%> >학교별</option>
                                                </select>
                                            <%if (MoumiConfig.getUseRecog()) { // moumi.properties 에서 moumi.use.recog = false %>
                                                <select id="recog" name="recog" class="inputtxt"	onchange="selectedGO2()">
                                                    <option value="-1"><%=TotReportProcess.ALL%> <%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_report.approvalStatus")%></option>
                                                    <option value="1"><%=Recog.PRSS%></option>
                                                    <option value="0"><%=Recog.NOT_RECOG%></option>
                                                </select>
                                            </td>
                                            <%}%>

                                            <td class="kecttep_button_td">
                                                <%if ("PRSS".equals(docType)) {%>
                                                <%
                                                    if (listType == MReport.ALL_LIST || listType == MReport.COMP_LIST) {
                                                        if (!(sysAuth == 2 && !usID.equals(userId) && docAccAuth == AccessAuth.ALL)) {
                                                %>
                                                <!--// 재입력요청 button -->
                                                <a onclick="changePrssMore()" href="javascript:void(0);">
                                                    <img alt="재입력요청" src="/totsys/common/images/bt_return2.gif" title="<%= MoumiConfig.getMessageBundle().getString("moumi.message.button_small.return")%>" />
                                                </a><!-- 재입력요청 button //-->
                                                <%}
                                                }%>
                                                <!--//부서초기화//-->
                                                <%if (listType == MReport.ALL_LIST || listType == MReport.COMP_LIST || listType == MReport.TEMP_LIST || listType == MReport.RETURN_LIST || listType == MReport.NOT_LIST) {//일반 사용자 전체 진행상태
                                                        if (!(sysAuth == 2 && !usID.equals(userId) && docAccAuth == AccessAuth.ALL)) {
                                                %>
                                                <a onclick="changePrss()" href="javascript:void(0);">
                                                    <img alt="부서초기화" src="/totsys/common/images/bt_accept.gif" title="<%=MoumiConfig.getMessageBundle().getString("moumi.message.button_small.deptInit")%>" />
                                                </a>
                                                <%}
                                                }%>
                                                <%}%>
                                                <!-- 첨부파일다운로드 button -->
                                                <a href="javascript:void(0);" onclick="fileDownLoad();"><img alt="첨부파일다운로드" src="/totsys/common/images/bt_disk.gif" title="부서를 선택하지 않고 버튼을  클릭 시 전체 부서의 자료가 저장됩니다" /></a>
                                                <!-- 엑셀저장 button -->
                                                <a href="javascript:void(0);" onclick="javascript:excelLink();"><img alt="엑셀저장" src="/totsys/common/images/bt_excel.gif" title="<%= Moumi.getMessageBundle().getString("moumi.message.button.excel")%>" /></a>
                                            	<!-- 목록 -->
                                                <a href="javascript:void(0);" onclick="javascript:fn_goToList();">
                                                    <img alt="목록" src="/totsys/common/images/bt_list.gif" title="<%= Moumi.getMessageBundle().getString("moumi.message.button.boardList")%>" />
                                                </a>
                                            	<!-- 20160426 교육부 전송 버튼 조건 추가-->
                                           		 <%if( "PRSS".equals(docType) && !dpID.contains("A00") && docID > 1700000000){%>
                                                 <a href="#" onclick="loadKWD();">
                                                     <img alt="교육부 전송" src="/totsys/common/images/bt_sendMoe.gif" title="<%= MoumiConfig.getMessageBundle().getString("moumi.message.button_small.edu") %>" />
                                                 </a>
		                                         <%}%>
	                                           <!-- 20160426 교육청 자료 조회 버튼 추가 시작-->
	                                           <%if( "PRSS".equals(docType) && dpID.contains("A00") && docID > 1700000000){%>
                                                <a href="#" onclick="javascript:fn_irOfcDataSave();">
                                                 <img alt="교육청 자료조회" src="/totsys/common/images/bt_receiveEdu.GIF" title="연계 자료를 조회한 후 업무 DB에 적용" />
                                                </a>
                                            </td>
<!--                                            <td class="kecttep_button_td">
                                                <a class="" href="#" onclick="javascript:fn_irDataInit();">
                                                     <img src="/totsys/common/images/bt_esbDataInit.GIF" title="교육부 연계 테이블의 자료를 삭제" />
                                                </a>
                                            </td>                                            -->
                                            <%}%>
                                            <!-- 20160426 교육청 자료 조회 버튼 추가 끝-->
                            </tr>
                        </table>
                    </td>

                    <td style="padding-top: 3px; padding-right: 14px; vertical-align: middle; text-align: right;">
                        <span style="">
                            <!-- 전체 -->
                            <a href="report_list.jsp?docID=<%=docID%>&listType=<%= MReport.ALL_LIST%>&accAuth=<%= accAuth%>&strPage=<%= innerStrPage%>&docType=<%=docType%>">
                                <span style="color: #009999;"><%=TotReportProcess.ALL%>: </span><%= allReportCount%>
                            </a>&nbsp;
                            <!-- 제출완료 -->
                            <a href="report_list.jsp?docID=<%=docID%>&listType=<%= MReport.COMP_LIST%>&accAuth=<%= accAuth%>&strPage=<%= innerStrPage%>&docType=<%=docType%>">
                                <span style="color: #009999;"><%=TotReportProcess.COMP%>: </span><%= sendReportCount%>
                            </a>&nbsp;
                            <!-- 해당없음 -->
                            <a href="report_list.jsp?docID=<%=docID%>&listType=<%= MReport.NOT_LIST%>&accAuth=<%= accAuth%>&strPage=<%= innerStrPage%>&docType=<%=docType%>">
                                <span style="color: #009999;"><%=TotReportProcess.NOT%>: </span><%= notReportCount%>
                            </a>&nbsp;
                            <!-- 미제출 -->
                            <a href="report_list.jsp?docID=<%=docID%>&listType=<%= MReport.NOT_COMP_LIST%>&accAuth=<%= accAuth%>&strPage=<%= innerStrPage%>&docType=<%=docType%>">
                                <span style="color: #009999;"><%=TotReportProcess.NOT_REPORT%>: </span><%= (allReportCount - sendReportCount - notReportCount)%>
                            </a>&nbsp;
                            <!-- 자료회수요청 -->
                            <a href="report_list.jsp?docID=<%=docID%>&listType=<%= MReport.NOTE_LIST%>&accAuth=<%= accAuth%>&strPage=<%= innerStrPage%>&docType=<%=docType%>">
                                ( <span style="color: #009999;"><%=TotReportProcess.NOTE%>: </span><%= noteReportCount%> )
                            </a>
                        </span>
                    </td>
                </tr>
                <tr class="toolbar">
                    <td colspan="2">
                        <table>
                            <tr>
                                <td style="width:290px;">
                                    <form name="searchForm" method="post" action="/totsys/totper/mydocbox/prssbox/reports/report_list.jsp" onsubmit="if (trans.selectedIndex != 0) {
                                            return findCheckInner(this);
                                        }" style="margin: 0;padding: 0">
                                        <span>
                                            <input type="hidden" name="docID" value="<%= docID%>">
                                            <input type="hidden" name="accAuth" value="<%= accAuth%>">
                                            <input type="hidden" name="listType" value="<%= listType%>">
                                            <input type="hidden" name="recog" value="<%= recog%>">
                                            <input type="hidden" name="docType" value="<%= docType%>">
                                            <input type="hidden" name="listNum" value="<%= listNum%>">
                                            <input type="hidden" name="sort" value="<%= sort%>">
                                            <input type="hidden" name="howSort" value="<%= howSort%>">
                                            <input type="hidden" name="file" value="<%= file%>">
                                            <input type="hidden" name="subDoc" value="<%= subDoc%>">
                                            <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="searchDepth" value="inner">
                                            <input type="hidden" name="innerStrPage" value="<%= innerStrPage%>">
                                            <select name="innerFindOption" class="inputtxt" onchange="showMSG(this.options[this.selectedIndex].value, msg)">
                                                <option value="mDept.name"<%= "mDept.name".equals(innerFindOption) ? "selected" : ""%>>
                                                    <%= Moumi.getMessageBundle().getString("moumi.message.tot_doc.process.submit")%><%= Moumi.getMessageBundle().getString("moumi.message.doc.Devision")%>
                                                </option>
                                                <option value="mOrgan.name"<%= "mOrgan.name".equals(innerFindOption) ? "selected" : ""%>>
                                                    제출기관
                                                </option>
                                                <!-- <option value="mUser.name"<%= "mUser.name".equals(innerFindOption) ? "selected" : ""%>>
                                                <%=Moumi.getMessageBundle().getString("moumi.message.menu.submit")%><%= Moumi.getMessageBundle().getString("moumi.message.tot_doc.person")%>
                                               </option> -->
                                            </select>
                                            <input name="innerFindWord" type="text" class="inputtxt" size="20" maxlength="30" value="<%=MString.checkNull(innerFindWord)%>" style="ime-mode: active;" />
                                            <img alt="검색" onclick="find2()" src="/totsys/common/images/bt_search_inquiry2.gif"/>
                                        </span>
                                    </form>
                                </td>
                                <%--
                                if ("PRSS".equals(docType)) {%>
                                <%
                                    if (!(sysAuth == 2 && !usID.equals(userId))) {
                                --%>
                                <td style="vertical-align: middle; width:70px;">
                                    <label>
                                        자동회수<input type="checkbox" onclick="fn_onChangedAutoReturn(this);" <%= MString.checkNull(totDoc.getAutoRtnYn()).equals("Y") ? "checked" : ""%>>
                                    </label>
                                </td>

                                <td style="vertical-align: middle; width: 520px;">&nbsp;
                                	<span style="color: red;">* 부서를 선택하지 않고 {첨부파일다운로드} 버튼을 클릭 시 전체 부서의 자료가 저장됩니다.</span>
                                </td>
                                <%--}%>
                                <%}--%>
                                <td><span id="msg" class="kecttep_date_search" style='display: none; padding-top: 5px;'>
                            <%-- &nbsp;&nbsp;<%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.daySearchForm")%>  <!-- 날짜 검색시 10-12-01 형식으로 입력 -->--%>
                        </span></td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </td>
    </tr>

    <!--  리스트 시작 -->
    <tr>
        <td>
            <table class="kecttep_list_table">
                <tr style="padding-top: 3px;border-bottom: 1px solid #8e86d4;" >
                    <td style="width:50px;" class="kecttep_tdmenu center" rowspan="1">
                        <input type="checkbox" name="checkAll" id="checkAll" onclick="javascript:checkALL(this.checked)"/>
                    </td>
                    <td style="width:40px;" class="kecttep_tdmenu center" rowspan="1"><span style="text-align: center;"><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.number")%></span></td>
                    <td class="kecttep_tdmenu center"><span style="text-align: center;"><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.submit")%></span><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.devision")%></td>
                    <td style="width:150px;" class="kecttep_tdmenu center"><span style="text-align: center;"><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.submit")%><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.person")%></span></td>
                    <td class="kecttep_tdmenu center" rowspan="1"><span style="text-align: center;"><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.telNumber")%> (<%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_report.depart")%>/<%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_report.person")%>)</span></td>
                    <td class="kecttep_tdmenu center" rowspan="1"><span style="text-align: center;"><%=TotDocProcess.SUBMIT%><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.dateTime")%></span></td>
                    <td style="width:90px;" class="kecttep_tdmenu center" rowspan="1"><span style="text-align: center;"><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_report.progressStatus")%></span></td>
                        <%if (MoumiConfig.is2Step()) {%>
                    <td style="width:60px;" class="kecttep_tdmenu center"><span style="text-align: center;"><%= MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.subdoc")%></span></td>
                        <%}%>
                        <%if (MoumiConfig.getUseRecog()) {%>
                    <td style="width:60px;" class="kecttep_tdmenu center"><span style="text-align: center;"><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.approval")%></span></td>
                        <%}%>
                    <td style="width:60px;" class="kecttep_tdmenu center"><span style="text-align: center;"><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.opinion")%></span></td>
                    <td style="width:60px;" class="kecttep_last_tdmenu center"><span style="text-align: center;"><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.add")%></span></td>

                </tr>
                <%
                    int index = 0;     //배열에서 값을 꺼내오는 키값
                    int nextCount = 0; //

                    if (currentPage > 1) {
                        nextCount = ((currentPage - 1) * recordSize);
                    }
                    //tx.begin();
                    //for (int i = 0; (i < recordSize) && ((nextCount + i) < reportList.size()); i++) {

                    if (count > 0 && list != null ) {
                        int listCount = list.size();

                        for (int i = 0; i < listCount; i++) {
                            index = nextCount + i;

                            PrssReportsVO prssVO = (PrssReportsVO) list.get(i);
                            TotReportProcess prss = (TotReportProcess) prssVO.getProcess();

                            TotDoc slaveTotDoc = prssVO.getSlaveTotDoc(pm);

                %>
                <tr
                    onmouseover="this.style.backgroundColor = 'F9F9F9'"
                    onmouseout="this.style.backgroundColor = 'white'">
                    <td class="kecttep_graytd center" style="width: 50px; height:25px;">
                        <%if (MoumiConfig.getUseRecog()) {%> <input type="checkbox" name="check" id="check<%=index%>" value="<%=index%>"
                               <%if (prssVO.getRecogType() != Recog.NOT_RECOG) {%>disabled <%}%> >
                        <%} else {%>
                        <input type="checkbox" name="check" id="check<%=index%>" value="<%=index%>">
                        <%}%>
                        <input type="hidden" name="checkDept<%=index%>" value="<%=prssVO.getDeptId()%>">
                        <input type="hidden" name="checkUser<%=index%>" value="<%=prssVO.getUserId() == null ? "" : prssVO.getUserId()%>">
                        <input type="hidden" name="checkPrss<%=index%>" id="checkPrss<%=index%>" value="<%=prssVO.getProcess().ordinal()%>">
                        <input type="hidden" name="checkReportID<%=index%>" value="<%=prssVO.getId()%>">
                        <input type="hidden" name="checkSlaveTotDoc<%=index%>" value="<%=slaveTotDoc%>">
                    </td>
                    <td style="height:25px;" class="kecttep_graytd center">&nbsp;<%= index + 1%></td>
                    <td class="kecttep_graytd tal">&nbsp;<%=prssVO.getUpperDeptName() == null ? "" : prssVO.getOrganName() + " - " + prssVO.getUpperDeptName() + " - "%><%= prssVO.getDeptName()%></td>
                    <td class="kecttep_graytd center">
                        &nbsp;
                        <%if (prss == TotReportProcess.READ || prss == TotReportProcess.COMP || prss == TotReportProcess.NOTE) {%>
                        <a href="#" onclick="window.open('/totsys/common/inc/documents/report/report_view.jsp?docID=<%= docID%>&reportID=<%=prssVO.getId()%>&docType=<%= docType%>', '', 'width=840,height=600,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes');">
                            <%}%><%= MString.checkNull(prssVO.getOwnerName())%><%if (prssVO.getUserId() != null) {%>(<%= MString.checkNull(prssVO.getUserId())%>) <%}%>
                            <%if (prss == TotReportProcess.READ || prss == TotReportProcess.COMP || prss == TotReportProcess.NOTE || prss == TotReportProcess.RETURN) {%>
                            <img alt="검색" src="/totsys/common/images/bt_search.jpg" /> </a>&nbsp;<%}%> 
                    </td>
                    <td class="kecttep_graytd center">&nbsp;<%= MString.checkNull(prssVO.getDeptPhone())%>/<%= MString.checkNull(prssVO.getUserPhone())%></td>
                    <!-- 제출일시 : 재입력요청, 제출완료, 해당없음 인 경우에만 표시된다  -->
                    <td class="kecttep_graytd center">&nbsp;
                        <%if (prss == TotReportProcess.RETURN || prss == TotReportProcess.COMP || prss == TotReportProcess.NOT) {%>
                        <%= prssVO.getSubmitDate() == null ? "" : new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(prssVO.getSubmitDate())%>
                        <%}%>
                    </td>
                    <!-- 진행상태 -->
                    <td class="kecttep_graytd center" id="checkProcess<%=index%>">
                        <%
                            if (TotReportProcess.ACCEPT == prss && TotReportType.NOT_REPORT_REQ == prssVO.getReportType()) {
                        %>
                        <a href="#" onclick="javascript:popupWindow(<%=prssVO.getDeptId()%>,<%=prssENG%>);"><img alt="재지정 요청" src="images/bt_not_report.gif"></a>
                            <%
                                } else {
                                	
                                	if(prss == TotReportProcess.TEMP){
                                		out.write(TotReportProcess.COMP.toString());
                                	}else{
                                        out.write(prssVO.getProcess().toString());
                                	}
                                }
                            %>
                    </td>

                    <!-- 연계자료 -->
                    <%if (MoumiConfig.is2Step()) {%>
                    <td class="kecttep_graytd center">
                        <%if (slaveTotDoc == null) {%>
                        &nbsp;
                        <%} else {%>
                        <img alt="잠금" src="/totsys/totper/mydocbox/prssbox/reports/images/checkok.gif">
                        <%}%>
                    </td>
                    <%}%>
                    <%if (MoumiConfig.getUseRecog()) {%>
                    <td class="kecttep_graytd center">
                        <%if (prss == TotReportProcess.COMP || prss == TotReportProcess.TEMP || prss == TotReportProcess.APPROVE) {%>
                        <%= prssVO.getRecogType().toString()%> <%} else {%> &nbsp;
                        <%}%>
                    </td>
                    <%}%>
                    <!-- 회수요청 -->
                    <td class="kecttep_graytd center">
                        <%if (prss == TotReportProcess.NOTE) {%>
                        <img alt="승인" style="cursor: hand;"  onclick="opener('/totsys/common/web/note/popup_note_confirm.jsp?docID=<%=docID%>&id=<%=prssVO.getId()%>&user_id=<%=prssVO.getUserId()%>'
                                    , 'preview', '430', '230', 'center', 'middle', 'no', 'no');" src="/totsys/totper/mydocbox/prssbox/reports/images/approve.gif" border="0">
                        <%} else {%> &nbsp;
                        <%}%>
                    </td>
                    <!-- 첨부 -->
                    <td class="kecttep_last_graytd center">
                        <%if ("Y".equals(prssVO.getIsAttachments()) || (null != prssVO.getAttachmentsPath() && !"".equals(prssVO.getAttachmentsPath()))) { %>
                        	<%if (prss == TotReportProcess.COMP || prss == TotReportProcess.NOTE) {%>
                        		<%if (prss == TotReportProcess.READ || prss == TotReportProcess.COMP || prss == TotReportProcess.NOTE || prss == TotReportProcess.RETURN) {%>
			                        <a href="javascript:void(0);" onclick="popupViewInner('<%=index%>', 'file<%=index%>', '<%=prssVO.getId()%>');"><img alt="첨부파일" src="/totsys/totper/mydocbox/prssbox/reports/images/disk.gif"></a>
			                        <div class="ajdxjdrnfl" id="file<%=index%>" style="display: none; position: absolute; z-index: 2;">
			                            <table style="border: 1px solid #ABBDDD;">
			                                <tr>
			                                    <td style="border-bottom: 1px solid #ABBDDD;">
			                                        &nbsp;&nbsp;<strong>첨부파일</strong>
			                                    </td>
			                                    <td style="border-bottom: 1px solid #ABBDDD;">
			                                        <a style="display: inline; border: 1px solid #abbddd; width: 15px; height: 7px; padding: 2px 0 0 0; margin: 2px 3px 2px 0; text-align: center;" href="javascript:void(0);" onclick="popupClose('file<%=index%>');" title="닫기">X</a>
			                                    </td>
			                                </tr>
			                                <tr>
			                                    <td colspan="2" style="padding: 2px;">
			                                        <span id="fileNameList<%=index%>">
			                                        </span>
			                                    </td>
			                                </tr>
			                            </table>
			                        </div>
                        		<%}%>
                        	<%} else {%>
                        		&nbsp;
                        	<%}%>
                        <%}else{%>
                         &nbsp;
                     	<%}%>
                    </td>
                </tr>
                <%
                            //20160426 reportIds 추가
                            if(i == 0){
                               report_Ids = String.valueOf( prssVO.getId() );
                            }else{
                               report_Ids = report_Ids + "|" + String.valueOf( prssVO.getId() );
                            }


                        }  //end of for list
                    }   //end of if( count > 0)
                    //tx.rollback();
                %>
            </table>
        </td>
    </tr>
    <tr>
        <td style="height: 15px;"></td>
    </tr>
    <%if (count > 0) {%>
    <tr style="padding-top: 3px;">
        <td class="kecttep_board center">
            <jsp:include page="/totsys/common/inc/board/page_module.jsp" flush="true">
                <jsp:param name="pageFunction" value="fn_goToPage" />
                <jsp:param name="pageSize" value="<%= pageSize%>" />
                <jsp:param name="currentPage" value="<%= currentPage%>" />
                <jsp:param name="currentPageSetUp" value="<%= currentPageSetUp%>" />
            </jsp:include>

            <!-- 페이지수 나오는 부분 끝 -->
        </td>
    </tr>
    <%} else {%>
    <tr>
        <td class="kecttep_none_tdmenu" colspan="15" style="height: 25px;"
            align="center"><%= MoumiConfig.getMessageBundle().getString("moumi.message.tot_report.reportDocNot")%></td>
        <%}%>
        <!--  내용 끝 -->
    </table>
<script>
    if ("<%=listType%>" == "<%=MReport.ALL_LIST%>") { // 전체진행상태
        trans.value = "all";
    } else if ("<%=listType%>" == "<%=MReport.COMP_LIST%>") { // 제출완료상태
        trans.value = "comp";
    } else if ("<%=listType%>" == "<%=MReport.NOT_COMP_LIST%>") { // 미제출상태
        trans.value = "notcomp";
    } else if ("<%=listType%>" == "<%=MReport.TEMP_LIST%>") { // 임시저장
        trans.value = "temp";
    } else if ("<%=listType%>" == "<%=MReport.ACCEPT_LIST%>") { // 접수
        trans.value = "prss";
    } else if ("<%=listType%>" == "<%=MReport.RETURN_LIST%>") { // 재입력요청
        trans.value = "reprss";
    } else if ("<%=listType%>" == "<%=MReport.NOT_LIST%>") { // 해당없음
        trans.value = "not";
    } else if ("<%=listType%>" == "<%= MReport.APPROVE%>") {
        trans.value = "approve";
    } else if ("<%=listType%>" == "<%= MReport.NOTE%>") {
        trans.value = "note";
    }

    if ("<%=howSort%>" != "") {
        trans.value = "howSort";
    }
    if ("<%=file%>" != "") {
        trans.value = "file";
    }
    if ("<%=subDoc%>" != "") {
        trans.value = "subDoc";
    }

    //검색시 넘어오는 리스트 넘값들
    if ("<%=listNum%>" == "10") {
        listNum.value = "10";
    } else if ("<%=listNum%>" == "20") {
        listNum.value = "20";
    } else if ("<%=listNum%>" == "30") {
        listNum.value = "30";
    } else if ("<%=listNum%>" == "40") {
        listNum.value = "40";
    } else if ("<%=listNum%>" == "50") {
        listNum.value = "50";
    } else {
        listNum.value = "";
    }

    if ("<%=sort%>" == "1") {
        sort.value = "1";
    } else if ("<%=sort%>" == "2") {
        sort.value = "2";
    } else {
        sort.value = "";
    }
</script>

<%if (MoumiConfig.getUseRecog()) {%>
<script>
    if (<%=recog%> == -1) {
        recog.selectedIndex = 0;
    } else if (<%=recog%> == 1) {
        recog.selectedIndex = 1;
    } else if (<%=recog%> == 0) {
        recog.selectedIndex = 2;
    }
</script>
<%}%>
<!-- 20160426 추가 -->
<form name="TransForm" method="post">
    <input type="hidden" name="reportID" value="<%=report_Ids%>">
    <input type="hidden" name="docID"  value="<%=docID%>">
    <input type="hidden" name="callFn" value="">
</form>
<iframe name="hiddenIframe" width="0" height="0" style="display: none;"></iframe>


<%
    } catch (Exception ex) {
        ex.printStackTrace();
    } finally {
        if (tx.isActive()) {
            tx.rollback();
        }
        pm.close();
    }
%>
