<%   /* *
     * **********************************************************@@ Program Name
     * : report_list.jsp Description	: /보고자/내문서함/종료함/보고자료 목록 Author	: 기현테크
     * Create Date	: 2010.11.26 History	:
     * @@***********************************************************
     */
%>

<%@ page contentType="text/html; charset=UTF-8"
         import="java.net.URLEncoder"
         import="java.util.Calendar"
         import="java.util.Date"
         import="java.util.List"
         import="java.text.SimpleDateFormat"
         import="javax.jdo.PersistenceManager"
         import="javax.jdo.Transaction"
         import="kr.co.kihyun.beans.entity.*"
         import="kr.co.kihyun.beans.entity.util.*"
         import="kr.co.kihyun.beans.user.HttpSSOLogin"
         import="kr.co.kihyun.beans.totsys.doc.Doc"
         import="kr.co.kihyun.lang.Encoder"
         import="kr.co.kihyun.lang.MInteger"
         import="java.util.*"
         import="kr.co.kihyun.lang.MString"
         import="kr.co.kihyun.service.*"
         import="kr.co.kihyun.service.vo.*"
         import="kr.co.kihyun.beans.entity.TotReportProcess"
         import="kr.co.kihyun.moumi.Moumi"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.net.URLDecoder"%>

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

<%
    PersistenceManager pm = new MPersistenceManager(PMF.get().getPersistenceManager());
    Transaction tx = pm.currentTransaction();
    try {
    	//자료삭제 업데이트
    	if(request.getParameter("delmode")!=null){
    		if(request.getParameter("delmode").equals("yes")){
				String delids=request.getParameter("delids");
				if(delids!=null){
					String[] ids=delids.split(",");
					int delcnt=0;
					tx.begin();
					for(String sid:ids){
						Long rid=Long.parseLong(ids[0]);
						TotReport vo = pm.getObjectById(TotReport.class,rid);
						vo.setDeleted("Y");
						pm.makePersistent(vo);
						delcnt++;
					}
					tx.commit();
					out.print("<script>alert('"+delcnt+"개의 자료가 삭제되었습니다.');</script>");
				}
        	}
    	}

    	if(request.getParameter("init")!=null){
    		if(request.getParameter("init").equals("yes")){
				String delids=request.getParameter("delids");
				if(delids!=null){
					String[] ids=delids.split(",");
					int delcnt=0;
					tx.begin();
					for(String sid:ids){
						Long rid=Long.parseLong(ids[0]);
						TotReport vo = pm.getObjectById(TotReport.class,rid);
						vo.setUser(null);
						vo.setData("");
						vo.setTotData("");
						vo.setProcess(TotReportProcess.ACCEPT);
						pm.makePersistent(vo);
						delcnt++;
					}
					tx.commit();
					out.print("<script>alert('"+delcnt+"개의 자료가 초기화 되었습니다.');</script>");
				}
        	}
    	}

        /**
         * ******** session내의 userId *********
         */
        String usID = HttpSSOLogin.getLoginID(request);
        String dtID = HttpSSOLogin.getDeptID(request);

        /**
         * ******** Parameter *********
         */
        int strPage = MInteger.parseInt(request.getParameter("strPage"), 1);
        String findOption = clearXSS(request.getParameter("findOption"), null);
        String findWord = clearXSS(Encoder.toJava(request.getParameter("findWord")), null);
        String reportType = clearXSS(Encoder.toJava(request.getParameter("reportType")), null);
        String tmpStrMagam;

        String method = clearXSS(request.getParameter("method"), "");
        if (method.equals("GET")) {
            findWord = URLDecoder.decode(MString.checkNull(request.getParameter("findWord")), "UTF-8");
        }
        if(findWord != null){
            String[] filter_word= {"--", "\\(", "\\)", "\\'", "\\\""};
            for(int ii=0; ii< filter_word.length;ii++){
                findWord = findWord.replaceAll(filter_word[ii], "");
            }
        }

        int wordLengthLimit = 50;

        tx.begin();

        MUser mUser = pm.getObjectById(MUser.class, usID);
        SysAuth sysAuth = mUser.getSysAuth();
        //상위기관인 경우 자료 조회 가능하도록 적용
        MDept mDept = pm.getObjectById(MDept.class, dtID);
        System.out.println("dtID  ===>>>>>>>   " + dtID);
        String upperId = mDept.getUpperDept(pm) == null ? "" : mDept.getUpperDept(pm).getId();
        
        System.out.println("upperId  ===>>>>>>>   " + upperId);

        //organId와 dtID를 비교해서 다르면 상위부서의 전체제출서류를 가져오게 수정함. by wonseok Lee 20171010
        String organId = mDept.getOrgan();
        //======================================================================


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

        currentPage = strPage;

        //======================================================================
        TotReportService reportService = new TotReportService(pm);
        //검색조건파라미터
        Map params = new HashMap();
        params.put("findOption", findOption);
        params.put("filterValue", findWord);
        params.put("deptId", dtID);
        //상위기관인 경우 자료 조회 가능하도록 적용
        params.put("upperId", upperId);
        params.put("sysAuth", sysAuth);

        //organId와 dtID를 비교해서 다르면 상위부서의 전체제출서류를 가져오게 수정함. by wonseok Lee 20171011
        params.put("organId", organId);
        //======================================================================

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

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

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

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

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

        List list = null;

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

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

            //만족하는 레코드가 존재하면 조회
            list = reportService.executeQuery(TotReportVO.class);
        }
        //======================================================================
        Date nowDate = new Date();

        tx.rollback();

%>

<!DOCTYPE html>
<html lang="ko">
	<head>
		<meta charset="UTF-8">
		<title><%=Moumi.getTitle()%></title>
        <script src="/totsys/common/js/jquery-1.12.4.min.js"></script>
        <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/contentStyle.css" type="text/css">
		<link rel="stylesheet" href="/totsys/common/css/basic.css" type="text/css">
        <script src="/totsys/common/js/rollover.js"></script>
        <script src="/totsys/common/js/find.js"></script>
        <script src="/totsys/common/js/popup.js"></script>
        <script src="/totsys/common/js/mouse.js"></script>
        
        <script>
            function leftAnc()
            {
                for (var i = 1; i <= 4; i++) {
                    top.frames['left'].document.all["link" + i].style.fontWeight = "";
                }
                top.frames['left'].link2.style.fontWeight = "bold";
            }

            function leftIncReload()
            {
                top.left.incFrame.location.reload();
            }
            function goEndPage(ttmp1, ttmp2)
            {
                var str = "/totsys/totper/mydocbox/prssbox/reports/report_list.jsp?docType=" + ttmp1 + "&docID=" + ttmp2 + "&deptID=<%= dtID%>";
                parent.topx.menuSelect(1);
                location.href = str;
            }

            /*
             * 검색조건폼에 대한 submit처리함수
             * @param {type} p_findForm
             * @returns {Boolean}
             */
            function fn_onFindSubmit(p_findForm) {
                if (!findCheck(p_findForm))
                    return false;
                p_findForm.strPage.value = 1;
                return true;
            }
            /*
             * 페이지이동처리함수
             */
            function fn_goToPage(p_page) {
                document.findForm.strPage.value = p_page;
                document.findForm.submit();
            }

            /*
             * 상세보기페이지로 이동처리하는 함수
             * @param {type} p_reportId
             * @param {type} p_endDate
             * @param {type} p_submitDate
             * @returns {undefined}
             */
            function fn_goToView(p_doctName, p_reportId, p_reportType, p_tmpStrMagam, p_tmpSubStrEndDate) {
                document.viewForm.doctName.value = p_doctName;
                document.viewForm.reportID.value = p_reportId;
                document.viewForm.reportType.value = p_reportType;
                document.viewForm.tmpStrMagam.value = p_tmpStrMagam;
                document.viewForm.tmpSubStrEndDate.value = p_tmpSubStrEndDate;
                document.viewForm.submit();
            }
             //삭제함수
             var selids=[];
             function delsel(){
            	 selids=[];
				$('.delids').each(function(){
					if(this.checked)selids.push(this.value);
				});
				if(selids.length==0){
					alert('선택된 항목이 없습니다.');
					return;
				}
            	if(!confirm('정말 선택된 항목을 삭제하시겠습니까?')){
            		return;
            	}
				selids=selids.join(',');
				$('<form method="post"><input type="hidden" name="delmode" value="yes"/>'+
						'<input type="hidden" name="strPage" value="<%=currentPage%>"/>'+
						'<input type="hidden" name="delids" value="'+selids+'"/></form>').appendTo('body').submit();
             }

             function initialization(){
            	selids=[];
				$('.delids').each(function(){
					if(this.checked)selids.push(this.value);
				});
				if(selids.length==0){
					alert('선택된 항목이 없습니다.');
					return;
				}
            	if(!confirm('정말 선택된 항목을 초기화 하시겠습니까?')){
            		return;
            	}
				selids=selids.join(',');
				$('<form method="post"><input type="hidden" name="init" value="yes"/>'+
						'<input type="hidden" name="strPage" value="<%=currentPage%>"/>'+
						'<input type="hidden" name="delids" value="'+selids+'"/></form>').appendTo('body').submit();
             }
        </script>
    </head>

    <body>
        <form name="viewForm" method="post" action="./report_view.jsp">
            <input type="hidden" name="reportID" value="">
            <input type="hidden" name="reportType" value="">
            <input type="hidden" name="totperInfo" value="true">
            <input type="hidden" name="tmpStrMagam" value="">
            <input type="hidden" name="tmpSubStrEndDate" value="">
            <input type="hidden" name="doctName" value="">
            <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>
        <table>
            <%--<jsp:include page="/totsys/common/inc/repoper/top/top.jsp" flush="true" />--%>
            <tr>
                <td></td>
                <td>
                    <table>
                        <%--if("TEMP".equals(reportType)){%>
                            <jsp:include page="/totsys/common/inc/title/title.jsp" flush="true" />
                        <%}else if("RECOG".equals(reportType)){--%>
                        <jsp:include page="/totsys/common/inc/title/title.jsp" flush="true" />
                        <%--}--%>
                        <tr>
                            <td>
                                <table>
                                    <tr valign="top" class="toolbar">
                                        <td>
                                            <table>
                                                <tr>
                                                    <td style="width: 500px;">
                                                        <form name="findForm" method="post" action="./report_list.jsp" onsubmit="return fn_onFindSubmit(this);" style="margin: 0px">
                                                            <input type="hidden" name="strPage" value="<%= currentPage%>">
                                                            <select name="findOption" class="inputtxt" onchange="showMSG(this.options[this.selectedIndex].value, msg)">
                                                                <option value="totDoc.name"<%= "totDoc.name".equals(findOption) ? " selected" : ""%>><%= Moumi.getMessageBundle().getString("moumi.message.tot_doc.doc")%><%= Moumi.getMessageBundle().getString("moumi.message.tot_doc.name")%></option>
                                                                <option value="totDoc.executionCode"<%= "totDoc.executionCode".equals(findOption) ? " selected" : ""%>><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.executionCode")%></option>
                                                                <option value="totDoc.mUser.name"<%= "totDoc.mUser.name".equals(findOption) ? " selected" : ""%>>담당자</option>
                                                                <option value="totDoc.mUser.name2"<%= "totDoc.mUser.name2".equals(findOption) ? " selected" : ""%>>제출자</option>
                                                            </select>
                                                            <input name="findWord" value="<%=MString.checkNull(findWord)%>" type="text" class="inputtxt" size="30" maxlength="30" style="ime-mode: active;">
                                                            <input name="reportType" value="<%=MString.checkNull(reportType)%>" type="hidden">
                                                            <input type="image" src="/totsys/common/images/bt_search_inquiry2.gif">
                                                        	<!-- 삭제버튼 -->

                                                        </form>
                                                    </td>
                                                    <td colspan="2" class="tar">
	                                                    <span class="pl_5">
	                                                    	<img src="/totsys/common/images/bt_remove.gif" style="cursor: pointer;" onclick="initialization();"/>
	                                                    </span>
	                                                    <span>
	                                                    	<img src="/totsys/common/images/bt_redell.gif" style="cursor: pointer;" onclick="delsel();"/>
	                                                    </span>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="height: 31px; vertical-align: top;">
                                            <table class="kecttep_list_table">
                                                <tr style="vertical-align: middle;">
                                                <!-- 선택 토글 -->
                                                	<td class="kecttep_tdmenu" style="text-align: center; width: 25px;"><input type="checkbox" class="checktoggle" onclick="$('.kecttep_list_table input:checkbox').prop('checked',this.checked);"/></td>
                                                    <td class="kecttep_tdmenu center" style="width: 60px;">
                                                        <%=Moumi.getMessageBundle().getString("moumi.message.tot_report.section")%>
                                                    </td>
                                                    <td style="width: 130px;" class="kecttep_tdmenu center"><%= Moumi.getMessageBundle().getString("moumi.message.tot_doc.executionCode")%></td>
                                                    <td class="kecttep_tdmenu center" rowspan="1"><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.doc")%><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.name")%></td>
                                                    <td style="width: 140px;" class="kecttep_tdmenu center"><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.request")%><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.coporation")%></td>
                                                    <td style="width: 97px;" class="kecttep_tdmenu center"><%=TotDocType.TOT_DOC%><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.request")%><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.person")%></td>
                                                    <td style="width: 105px;" class="kecttep_tdmenu center" rowspan="1"><%=Moumi.getMessageBundle().getString("moumi.message.tot_report.submit")%><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.person")%></td>
                                                    <td style="width: 97px;" class="kecttep_tdmenu center"><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.startDate")%></td>
                                                    <td style="width: 120px;" class="kecttep_tdmenu center"><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.endDate")%></td>
                                                    <td style="width: 97px;" class="kecttep_last_tdmenu center"  rowspan="1"><%=Moumi.getMessageBundle().getString("moumi.message.tot_report.status")%></td>
                                                </tr>
                                                <%
                                                    if (count > 0) {
                                                        int listCount = list.size();
                                                        for (int i = 0; i < listCount; i++) {
                                                            TotReportVO reportVO = (TotReportVO) list.get(i);

                                                            //Long limitCount = reports.get(index).getTotDoc().getAcceptanceLimitStrategy().getLimitCount();
                                                            int tmpMoumiAcptLimitStrategy = reportVO.getSubmitLimitCnt();
                                                            String tmp2 = null;
                                                            String tstr = "시";
                                                            String tcnt;
                                                             //선착순 집계의 현재 제출수, 총집계수를 출력하도록 수정. 2014.11.26 by YOUNGJUN,CHO
                                                            //tcnt = "("+Integer.toString(reportVO.getSubmitLimitCnt())+"개 기관)";
                                                            tcnt = "<br /><span title='총 " + Integer.toString(reportVO.getSubmitLimitCnt()) + " 개 기관 중 " + Integer.toString(reportVO.getCompleteReportCount()) + " 개 기관에서 제출하였습니다.'>제출기관  (" + Integer.toString(reportVO.getCompleteReportCount()) + " / " + Integer.toString(reportVO.getSubmitLimitCnt()) + ")" + "</span>";

                                                            if (tmpMoumiAcptLimitStrategy == 0) {
                                                                tmp2 = new SimpleDateFormat("yyyy-MM-dd HH").format(reportVO.getEndDate());
                                                                tcnt = "";
                                                            } else {
                                                                tmp2 = Moumi.getMessageBundle().getString("moumi.message.tot_doc.endBySubmitTotal");                           //선착순집계
                                                                tstr = "";
                                                            }
                                                            if (tmp2.contains("9999-12-30")) {
                                                                tmp2 = Moumi.getMessageBundle().getString("moumi.message.tot_doc.docGethering");    //집계진행중
                                                            }
                                                            if (tmp2.equals(Moumi.getMessageBundle().getString("moumi.message.tot_doc.docGethering"))) {
                                                                tstr = "";              //집계진행중
                                                            }
                                                            tmpStrMagam = tmp2;

                                                            String tempYymmddhh = tmp2;
                                                             //System.out.println("  tempYymmddhh:::::"+tempYymmddhh);
                                                %>
                                                <tr style="padding-top: 3px; vertical-align: middle; background-color: #ffffff;"
                                                    onmouseover="this.style.backgroundColor = 'F9F9F9'"
                                                    onmouseout="this.style.backgroundColor = 'white'">
                                                    <!-- 종료일때 체크박스 -->
                                                    <td class="kecttep_graytd center">
													<%=((reportVO.getEndDate().getTime() < nowDate.getTime()) && (reportVO.getDocPrss() == 2 || reportVO.getDocPrss() != 2 )|| reportVO.getPrss() == 4)?"<input type='checkbox' class='delids' value='"+reportVO.getId()+"'/>":""%>
													<%System.out.println("prss" + reportVO.getPrss());
													%>
													</td>
                                                    <td class="kecttep_graytd center" style="height: 25px; width: 60px;">
                                                        <%
                                                    // 2014.09.23 by youngjun cho (문서 구분방식에 따라 색상차별화 추가)
                                                    if (reportVO.isPeriodicalDoc() && reportVO.isDocCollection()) {%>
                                                        <span class="kecttep_doc_append_type kecttep_doc_append_type_periodical_collection"><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.create.periodical") + "/" + Moumi.getMessageBundle().getString("moumi.message.tot_doc.collection")%></span>
                                                        <%} else if (reportVO.isPeriodicalDoc() && !reportVO.isDocCollection()) {%>
                                                        <span class="kecttep_doc_append_type kecttep_doc_append_type_periodical_file"><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.create.periodical") + "/" + Moumi.getMessageBundle().getString("moumi.message.tot_doc.file")%></span>
                                                        <%} else if (!reportVO.isPeriodicalDoc() && reportVO.isDocCollection()) {%>
                                                        <span class="kecttep_doc_append_type kecttep_doc_append_type_random_collection"><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.create.random") + "/" + Moumi.getMessageBundle().getString("moumi.message.tot_doc.collection")%></span>
                                                        <%} else if (!reportVO.isPeriodicalDoc() && !reportVO.isDocCollection()) {%>
                                                        <span class="kecttep_doc_append_type kecttep_doc_append_type_random_file"><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.create.random") + "/" + Moumi.getMessageBundle().getString("moumi.message.tot_doc.file")%></span>
                                                        <%}%>
                                                    </td>
                                                     <!-- 시행번호 -->
                                                    <td style="width: 130px; height: 25px;" class="kecttep_graytd center"><%=MString.checkNull(reportVO.getExecCode())%>&nbsp;</td>
                                                    <%
                                                        String name = reportVO.getDocName();
                                                        String filterName = name.replaceAll("\'","");
                                                        int tmpb = -1;
                                                        String iid = reportVO.getUserId();
                                                        if (iid != null) {
                                                            if (iid.equals(usID)) {
                                                                tmpb = 1;
                                                            } else {
                                                                tmpb = 0;
                                                            }
                                                        } else {
                                                            tmpb = -1;
                                                        }
                                                    %>
                                                    <%if (tmpb == 1 || tmpb == -1 || sysAuth.equals(SysAuth.SUB_SYSADM) || sysAuth.equals(SysAuth.SUB_TOTADM) || sysAuth.equals(SysAuth.SYSADM) || sysAuth.equals(SysAuth.REPOADM)) {%>    <!--제출자아이디와 파라미터로받아온 값 비교 같으면 링크 sysAuth값 5,7,9 이면 링크-->
                                                    <!-- 자료명 -->
                                                    <td class="kecttep_graytd">&nbsp;&nbsp;
                                                        <a onmouseover="balloon_on('<%= MString.getEllipsis(filterName, wordLengthLimit)%>', this, 10, 4)"  onmouseout="balloon_off()"
                                                           <%if (reportVO.getEndDate().getTime() < nowDate.getTime()) {%> style="color: red;" <%}%>
                                                           href="javascript:fn_goToView('<%=filterName%>', '<%= reportVO.getId()%>', '<%=reportType%>', '<%=tmpStrMagam%>', '<%=tempYymmddhh%>');">
                                                            <%= MString.getEllipsis(name, wordLengthLimit)%>
                                                        </a>
                                                    </td>
                                                    <%} else {%>
                                                    <td onmouseover="balloon_on('<%= MString.getEllipsis(filterName, wordLengthLimit)%>', this, 10, 4)"  onmouseout="balloon_off()" class="kecttep_graytd"
                                                        <%if (reportVO.getEndDate().getTime() < nowDate.getTime()) { %>
                                                        style="color: red;"
                                                        <%}%> >&nbsp;&nbsp;  <%= MString.getEllipsis(name, wordLengthLimit)%></td>
                                                    <%}%>
                                                    <!-- 요청기관 -->
                                                    <td style="width: 140px;" class="kecttep_graytd center"><%= reportVO.getDeptName()%></td>
                                                    <!-- 요청자 -->
                                                    <td style="width: 97px;" class="kecttep_graytd center"><%= reportVO.getDocOwnerName()%></td>
                                                    <!-- 제출자 -->
                                                    <td style="width: 105px;" class="kecttep_graytd center">
                                                        <%if (name == null && iid == null) {%>
                                                        &nbsp;</td>
                                                        <%} else {%>
                                                        <%= reportVO.getOwnerName()%><br>(<%=iid%>)</td>
                                                    <%}%>
                                                    <!-- 시작일 -->
                                                    <td style="width: 97px;" class="kecttep_graytd center">
                                                        <%= reportVO.getStartDate() == null ? "&nbsp;" : new SimpleDateFormat("yyyy-MM-dd").format(reportVO.getStartDate())%>
                                                    </td>
                                                    <!-- 마감일 -->
                                                    <td style="width: 120px;" class="kecttep_graytd center">
                                                        <%
                                                            out.write(tmp2 + tstr + tcnt);
                                                        %>
                                                    </td>
                                                    <!-- 비고 -->
                                                    <td style="width: 97px;" class="kecttep_last_graytd center">
                                                        <%if (reportVO.getPrss() == 4) {%>
                                                        <%if ((reportVO.getEndDate().getTime() < nowDate.getTime()) && (reportVO.getDocPrss() == 2 || reportVO.getDocPrss() != 2)) {%>
                                                        <%="종료"%>
                                                        <%} else {%>
                                                        <%="집계진행"%>
                                                        <%}%>
                                                        <%} else {%>
                                                        <%=Moumi.getMessageBundle().getString("moumi.message.tot_report.recogWaitDuring")%>
                                                        <%}%>
                                                        <%if (reportVO.getDownDocId() != 0) {
                                                            String ttmp = "";
                                                            int tmp = reportVO.getSubDocPrss();
                                                            if (tmp == 4) {
                                                                ttmp = "END";
                                                            } else if (tmp == 0) {
                                                                ttmp = "FROM";
                                                            } else if (tmp == 1) {
                                                                ttmp = "REG";
                                                            } else if (tmp == 2) {
                                                                ttmp = "PRSS";
                                                            } else if (tmp == 3) {
                                                                ttmp = "SUBMIT";
                                                            } else if (tmp == 4) {
                                                                ttmp = "END";
                                                            } else if (tmp == 5) {
                                                                ttmp = "CANCEL";
                                                            } else if (tmp == 6) {
                                                                ttmp = "READ";
                                                            }
                                                    %>
                                                    <br/>
                                                    <%if (tmpb == 1 || tmpb == -1 || sysAuth.equals(SysAuth.SUB_SYSADM) || sysAuth.equals(SysAuth.SYSADM) || sysAuth.equals(SysAuth.REPOADM)) {%>    <!--제출자아이디와 파라미터로받아온 값 비교 같으면 링크 sysAuth값 5,7,9 이면 링크-->
                                                    <a href="javascript:goEndPage('<%=ttmp%>','<%= reportVO.getDownDocId()%>');">[<%=TotDocType.SUB_DOC_LIST%>]</a><br>
                                                </td>
                                                <%} else {%>
                                                [<%=TotDocType.SUB_DOC_LIST%>]
                                                <%} %>
                                                <%}%>
                                        </td>
                                    </tr>
                                    <%
                                            }       //end of for list
                                        }       //end of if( count > 0)
                                        //tx.commit();
                                    %>
                                </table>
                            </td>
                        </tr>

                        <tr>
                            <td style="height: 15px;"></td>
                        </tr>
                        <%if (count > 0) {%>
                        <tr style="padding-top: 3px; vertical-align: middle;">
                            <td class="kecttep_board center" colspan="10"><!-- 페이지수 나오는 부분 시작 -->
                                <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 center" colspan="10" style="height: 25px;">
                            	<%= Moumi.getMessageBundle().getString("moumi.message.tot_report.tempStatus")%>
                                <%= Moumi.getMessageBundle().getString("moumi.message.tot_doc.doc")%><%=Moumi.getMessageBundle().getString("moumi.message.tot_report.noOne")%>
                            </td>
                        </tr>
                        <%}%>

                        <tr>
                            <td style="height: 2px;"></td>
                        </tr>
                        <input type="hidden" id="tmpFind" name="tmpFind"
                               value="<%=MString.checkNull(findOption)%>">
                        <script>
                            if (tmpFind.value == "totDoc.docName") {
                                findForm.findOption.selectedIndex = 0;
                            } else if (tmpFind.value == "totDoc.mDept.name") {
                                findForm.findOption.selectedIndex = 1;
                            } else if (tmpFind.value == "totDoc.mUser.name") {
                                findForm.findOption.selectedIndex = 2;
                            } else if (tmpFind.value == "totDoc.startDate") {
                                findForm.findOption.selectedIndex = 3;
                            } else if (tmpFind.value == "totDoc.repoEndDate") {
                                findForm.findOption.selectedIndex = 4;
                            } else if (tmpFind.value == "totDoc.mUser.name2") {
                                findForm.findOption.selectedIndex = 3;
                            }
                        </script>
                    </table>
                </td>
                <td style="width: 10px;"></td>
            </tr>
        </table>
    </td>
</tr>
<!-- top menu start -->
<%--<%@ include file="/totsys/common/inc/buttom/buttom.jsp"%>--%>
<!-- top menu end -->
</table>
</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();
    }
%>
