<%@page import="kr.co.kihyun.moumi.MoumiConfig"%>
<%@page import="kr.co.kihyun.beans.entity.TotDoc"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.net.URLDecoder"%>
<%
    /************************************************************@@
      * Program Name	: doc_list.jsp
      * Description		: /집계자/내문서함/진행함/문서 목록
      * Author			: 기현테크
      * Create Date		: 2010.11.18
      * History			:
    @@************************************************************/
%>
<%@ page contentType="text/html; charset=UTF-8"
	import="java.net.URLEncoder"
        import="java.util.Date"
	import="java.util.List"
        import="java.util.Set"
        import="java.util.Map"
	import="java.util.HashMap"
        import="java.text.SimpleDateFormat"
	import="javax.jdo.Query"
        import="javax.jdo.PersistenceManager"
	import="javax.jdo.Transaction"
	import="kr.co.kihyun.beans.entity.TotDocType"
	import="kr.co.kihyun.beans.user.Dept"
	import="kr.co.kihyun.beans.entity.util.QueryImpl"
	import="kr.co.kihyun.beans.user.HttpSSOLogin"
	import="kr.co.kihyun.db.DBUtil"
        import="kr.co.kihyun.util.MDate"
	import="kr.co.kihyun.lang.Encoder"
        import="kr.co.kihyun.lang.MInteger"
	import="kr.co.kihyun.lang.MString"
        import="kr.co.kihyun.moumi.Moumi"
	import="kr.co.kihyun.moumi.doc.MDoc"
	import="kr.co.kihyun.moumi.report.MReport"
	import="kr.co.kihyun.beans.totsys.doc.Doc"
	import="kr.co.kihyun.beans.totsys.report.Report"
	import="kr.co.kihyun.beans.totsys.repoper.RepoPerDocList"
	import="kr.co.kihyun.beans.entity.util.*"
	import="kr.co.kihyun.beans.entity.*"
        import="org.slf4j.Logger"
        import="kr.co.kihyun.beans.totsys.doc.HttpDelFile"
	import="org.slf4j.LoggerFactory"%>
<%@ include file="/totsys/common/inc/sec/secure.inc.jsp"%>
<%
PersistenceManager pm = new MPersistenceManager(PMF.get().getPersistenceManager());
Transaction tx = pm.currentTransaction();
try{
	Logger LOG = LoggerFactory.getLogger(this.getClass());

	/********** session내의 userId **********/
	String usID = HttpSSOLogin.getLoginID(request);
	String dpID = HttpSSOLogin.getDeptID(request);
	int sysAuth = HttpSSOLogin.getSysAuth(request);

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

        String method = clearXSS(request.getParameter("method"),"");
        if(method.equals("GET")) findWord = URLDecoder.decode(MString.checkNull(request.getParameter("findWord")), "UTF-8");
        String uri = URLEncoder.encode("doc_list.jsp?docType="+MString.checkNull(docType)+"&findOption="+MString.checkNull(findOption),"UTF-8")+"&method=GET";

	int wordLengthLimit = 20;

	/******** 보고서 제출 현황 ********/
	int allReportCount = 0;
	int sendReportCount = 0;
	int appro = 0;
	String[] repoperDeptIDList = null;
	/************ 리스트 페이지 구성 ************/

	int count = 0;
	int endPage = 0;
	int pageSize =0 ;
	int currentPage = 0;
	int absolutePage = 0;
	int currentPageSetUp = 0;
	int recordSize = 15;

	currentPage=strPage;

	tx.begin();

        Object filterValue = findWord;

        /*추가 레코드 구해오는 쿼리*/
            String[] getDeptId;
            int[] getId;
            String[] getExecCode;
            String[] getName;
            String[] getOwnerName;
            Date[] getStartDate;
            Date[] getEndDate;
            int[] getRepId;
            int getTcount;
            int getSendCount;
            int getAllCount;
            int[] getPrss;
            String[] getUserNmEncpt;
            String[] getUserId;
            int[] getMoumiAcptLimitStrategy;
            int[] getAllCnt;
            int[] getSndCnt;
            int[] upperCnt;
            int[] getNoteCnt;
            String getGradeFlag;
            String[] getDeptName;

            String[] getShareDocRegId;   //2014.08.29 Add by KWON,HAN : 집계자료의 등록자 ID
            int[] getShareUserCount;     //2014.08.29 Add by KWON,HAN : 집계자료의 사용자 공유수
            String[] getShareUserId;     //2014.08.29 Add by KWON,HAN : 집계자료의 사용자 ID

            MUser2 muser2 = new MUser2();
            HttpDelFile hdf = new HttpDelFile();

            if(findOption != null && findOption.endsWith("Date"))
            filterValue = new SimpleDateFormat("yy-MM-dd").parse(findWord);

            muser2.getGradeFlag(dpID);
            getGradeFlag = muser2.getGradeFlag();
            //System.out.println("::getGradeFlag::"+getGradeFlag);



            if("PRSS".equals(docType)){
                   muser2.getPrssRecord(usID,dpID,findOption,filterValue,sysAuth,getGradeFlag);  //getPrssRecord
                   count = muser2.getTcount();
            }else if("REG".equals(docType)){
                   muser2.getRegRecord(usID,dpID,findOption,filterValue,sysAuth,getGradeFlag);   //getRegRecord
                   count = muser2.getTcount();
            }else if("END".equals(docType)){
                   muser2.getEndRecord(usID,dpID,findOption,filterValue,sysAuth,getGradeFlag);   //getEndRecord
                   count = muser2.getTcount();
            }else{
                   LOG.error("docType is not specified.");
            }

             getUserId = muser2.getUserId();
             getDeptId = muser2.getDeptId();
             getId = muser2.getId();
             getExecCode = muser2.getExecCode();
             getName = muser2.getName();
             getOwnerName = muser2.getOwnerName();
             getStartDate = muser2.getStartDate();
             getEndDate = muser2.getEndDate();
             getRepId = muser2.getRepId();
             getTcount = muser2.getTcount();
             getPrss = muser2.getPrss();
             getMoumiAcptLimitStrategy = muser2.getMoumiAcptLimitStrategy();
             getAllCnt = muser2.getAllReqCount();
             getSndCnt = muser2.getSendReqCount();
             getNoteCnt = muser2.getNoteReqCount();
             getDeptName = muser2.getDeptName();
             getShareDocRegId  = muser2.getShareDocRegId();   //2014.08.29 Add by KWON,HAN : 집계자료의 등록자 ID
             getShareUserCount = muser2.getShareUserCount();  //2014.08.29 Add by KWON,HAN : 집계자료의 사용자 공유수
             getShareUserId    = muser2.getShareUserId();      //2014.08.29 Add by KWON,HAN : 집계자료의 공유자 ID

        /*추가 쿼리 끝*/
        tx.rollback();

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

	currentPageSetUp = (int)(currentPage/10)*10;
	if (currentPage%10 == 0){
		currentPageSetUp-=10;
	}
%>
<HTML>
<HEAD>
<TITLE><%=Moumi.getTitle()%></TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<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/SquareButtons.css" type="text/css">
<script src="/totsys/common/js/rollover.js"></script>
<script src="/totsys/common/js/popup.js"></script>
<script src="/totsys/common/js/find.js"></script>
<script src="/totsys/common/js/mouse.js"></script>
<script type="text/javascript" src="/totsys/common/js/jquery-1.12.4.min.js"></script>

<script>
            function leftAnc(){
                    for(var i=1; i<=6; 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 selectAll(){
                    var obj = document.getElementsByName("check");
                    for(var i =0; i < obj.length;i++){
                            obj[i].checked = true;
                    }
            }

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

            /*
            * 현재페이지의 검색조건을 갖고 Relead하는 함수
             */
            function fn_reload() {
                document.searchForm.submit();
            }


            function openDocument(v){
                var checkValue = 0;
                var docIDList = "";
                //var userIDList = "";
                var gubun = v;

                if(<%=count%> == 1 || <%=count%> == <%=((currentPage-1)*recordSize)+1%>){
                    if(check.checked == true){
                        if(docIDList.length == 0){
                                if(typeof(checkDocID0) == 'undefined'){
                                        docIDList += document.getElementById("checkDocID<%=((currentPage-1)*recordSize)%>").value;

                                }else{
                                        docIDList += document.getElementById("checkDocID0").value;
                                }
                        }else{
                                if(typeof(checkDocID0) == 'undefined'){
                                        docIDList += ","+document.getElementById("checkDocID<%=((currentPage-1)*recordSize)%>").value;
                                }else{
                                        docIDList += ","+document.getElementById("checkDocID0").value;
                                }
                        }
                        checkValue ++;
                        }
                }else if(<%=count%> != 0){
                        tmp1 = eval(<%=((currentPage-1)*recordSize)%>);
                        tmp2 = eval(<%=((currentPage-1)*recordSize)%>+check.length);
                        tmp3 = 0;
                        for(i=tmp1; i<tmp2; i++){
                            if(check[tmp3].checked == true){
                                if(checkValue == 0){
                                    checkValue ++;
                                    //if(docIDList.length == 0 && userIDList.length == 0)
                                    if(docIDList.length == 0)
                                            docIDList += document.getElementById("checkDocID"+i).value;
                                    else
                                            docIDList += ","+document.getElementById("checkDocID"+i).value;
                                            //userIDList +=","+ document.getElementById("userID"+i).value;
                                }else{
                                    checkValue ++;
                                    if(docIDList.length == 0)
                                        docIDList += document.getElementById("checkDocID"+i).value;
                                    else
                                        docIDList += ","+document.getElementById("checkDocID"+i).value;
                                        //userIDList += ","+document.getElementById("userID"+i).value;
                                    }
                            }
                                    tmp3 ++;
                        }
                }
                if(checkValue > 0){
                        if(confirm(checkValue+" <%= Moumi.getMessageBundle().getString("moumi.message.popup.docCounter")%>\n\n 를 공람 선택하시겠습니까?")){
                                document.approOpen.reportID.value = docIDList;
                                //document.approOpen.userID.value = userIDList;
                                document.approOpen.strGubun.value = gubun;
                                document.approOpen.submit();
                        }
                 }else{
                        alert("공람 선택하시겠습니까?");
                }
                }

            function docDelete(){
                    var checkValue = 0;
                    var docIDList = "";

                    if(<%=count%> == 1 || <%=count%> == <%=((currentPage-1)*recordSize)+1%>){
                            if(check.checked == true){
                                    if(docIDList.length == 0){
                                            if(typeof(checkDocID0) == 'undefined'){
                                                    docIDList += document.getElementById("checkDocID<%=((currentPage-1)*recordSize)%>").value;
                                            }else{
                                                    docIDList += document.getElementById("checkDocID0").value;
                                            }
                                    }else{
                                            if(typeof(checkDocID0) == 'undefined'){
                                                    docIDList += ","+document.getElementById("checkDocID<%=((currentPage-1)*recordSize)%>").value;
                                            }else{
                                                    docIDList += ","+document.getElementById("checkDocID0").value;
                                            }
                                    }
                                    checkValue ++;
                            }
                    }else if(<%=count%> != 0){
                            tmp1 = eval(<%=((currentPage-1)*recordSize)%>);
                            tmp2 = eval(<%=((currentPage-1)*recordSize)%>+check.length);
                            tmp3 = 0;
                            for(i=tmp1; i<tmp2; i++){
                                    if(check[tmp3].checked == true){
                                            if(checkValue == 0){
                                                    checkValue ++;
                                                    if(docIDList.length == 0)
                                                            docIDList += document.getElementById("checkDocID"+i).value;
                                                    else
                                                            docIDList += ","+document.getElementById("checkDocID"+i).value;

                                            }else{
                                                    checkValue ++;
                                                    if(docIDList.length == 0)
                                                            docIDList += document.getElementById("checkDocID"+i).value;
                                                    else
                                                            docIDList += ","+document.getElementById("checkDocID"+i).value;
                                            }
                                    }
                                    tmp3 ++;
                            }
                    }
                    if(checkValue > 0){
                            if(confirm(checkValue+" <%= Moumi.getMessageBundle().getString("moumi.message.popup.docCounter")%>\n\n<%=Moumi.getMessageBundle().getString("moumi.message.popup.docDelete")%>")){
                                    document.Del.docID.value = docIDList;
                                    document.Del.submit();
                            }
                    }else{
                            alert("<%= Moumi.getMessageBundle().getString("moumi.message.popup.docDeleteSelect") %>");
                    }
            }

            /*
             * 2014.08.28 Add by KWON,HAN : 사용자공유
             */
            function userShareSelect(sGubun, sReportID) {
                var $checked;
                var v_checkedCount;
                var reportID=new Array();

                if(sGubun === "check") {
                    $checked = $("input:checkbox[name=check]:checked");
                    v_checkedCount = $checked.length;

                    if(v_checkedCount===0) {
                       alert('<%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.user")%><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.share")%>' + ' ' + '<%= MoumiConfig.getMessageBundle().getString("moumi.message.popup.docSelect") %>');
                       return;
                    }

                    var val = '';
                    var usersharecount = 0;

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

                       usersharecount = document.getElementById("su" + val).value;
                       if(usersharecount > 0){
                            //명의 사용자에게 공유되어 있습니다.
                            alert(usersharecount + '<%= MoumiConfig.getMessageBundle().getString("moumi.message.popup.userShareCounter") %>');
                            return;
                        }
                    }

                    $checked.each(function(){
                        reportID.push($(this).val());
                    });
                } else if(sGubun === "select") {
                    reportID = sReportID;
                } else {
                    //[정상적인 접근방법으로 처리해주십시요]!
                    alert('<%= MoumiConfig.getMessageBundle().getString("moumi.message.popup.normalHandle") %>');
                    return;
                }

                var urlname = "";
                var height  = screen.height;
                var width   = screen.width;
                var leftpos = width / 2 - 350;
                var toppos  = height / 2 - 350;

                //docReportType:문서 구분(D:집계문서, R:제출문서)
                urlname = "/totsys/common/web/report_dept/popup_user_share_select.jsp?docID="+reportID+"&docReportType=D&userYN=Y&selfDeptYn=N&exeFlag=list";
                post= window.open(urlname, "post","width=900, height=600, toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left=" + leftpos + ",top=" + toppos);
                post.focus();
            }

            function changeDam() {
                nnn=$("input:checkbox[name=check]:checked").length;
                if(nnn==0) { alert("선택을하신후 담당변경 버튼을 클릭하세요."); return; }

                var res=new Array();
                $("input:checkbox[name=check]:checked").each(function(){
                    res.push($(this).val());
                });
                var height = screen.height;
                var width = screen.width;
                var leftpos = width / 2 - 350;
                var toppos = height / 2 - 350;
                frm=document.damdangForm;
                frm.docID.value=res;
              //2014.09.15 Update by KWON,HAN : 담당변경의 멀티선택 처리가 가능하도록 변경함.
              //frm.action="/totsys/repoper/mydocbox/returnbox/popup_rep_transfer4.jsp";
                frm.action="/totsys/repoper/mydocbox/returnbox/popup_rep_transfer6.jsp";
                frm.target='damdangForm';
                frm.method='post';
              //2014.09.15 Update by KWON,HAN
              //win= window.open('',"damdangForm","width=607, height=541, toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left=" + leftpos + ",top=" + toppos);
                win= window.open('',"damdangForm","width=572, height=725, toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left=" + leftpos + ",top=" + toppos);
                win.focus();
                frm.submit();
            }

             /**
             *체크박스 전체선택 해제 스크립트 추가
             **/
            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;
                    }
                }
            }

</script>
</HEAD>
<body style='' BGCOLOR="#FFFFFF" LEFTMARGIN="0" TOPMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0">

    <form name="damdangForm" method="post" >
        <input type="hidden" name="reportID" value="">
        <input type="hidden" name="docID" value="">
        <input type="hidden" name="boxName" value="returnbox">
        <input type="hidden" name="hideUser" value="false">
        <input type="hidden" name="docReportType" value="D">
        <input type="hidden" name="exeFlag" value="list">
    </form>
    <FORM name="approOpen" action="/servlet/kr.co.kihyun.beans.user.HttpApproSet" method="post">
       <input type="hidden" name="reportID" value="<%=getId%>">
       <input type="hidden" name="docType" value="<%=docType%>">
       <input type="hidden" name="userID">
       <input type="hidden" name="strGubun">
    </FORM>
    <table width="100%" height="70" border="0" cellpadding="0" cellspacing="0">
	<jsp:include page="/totsys/common/inc/totper/top/top.jsp" flush="true" />
	<tr>
            <td nowrap width="0"></td>
            <td>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <jsp:include page="/totsys/common/inc/title/title.jsp" flush="true" />

                    <!-- // Begin : 검색 & 버튼영역 -->
                    <tr class="toolbar">
                        <td valign="top">
                            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <!----// 검색 시작 ---->
                                    <td valign="top">
                                        <form name="searchForm" method="post" action="./doc_list.jsp" onsubmit="return findCheck(this);" style="margin: 0px">
                                            <span style="width: 340px;">
                                                <input type="hidden" name="accAuth">
                                                <select name="findOption" class="inputtxt" onchange="showMSG(this.options[this.selectedIndex].value, msg)">
                                                    <option value="name"<%= "name".equals(findOption) ? " selected" : "" %>><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.doc")%><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.name")%></option>
                                                    <option value="executionCode"<%= "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>
                                                </select>
                                                <input name="findWord" value="<%=MString.checkNull(findWord)%>" type="text" class="inputtxt" size="30" maxlength="30" />
                                                <input name="docType" value="<%=MString.checkNull(docType)%>" type="hidden" />
                                                <input type="image"  src="/totsys/common/images/bt_search_inquiry2.gif" border="0" align="middle" style="margin: 0px 0px 0px 0px" />
                                            </span>
                                        </form>
                                    </td><!---- 검색 끝 //---->
                                    <td>
                                        <span id="msg" class="kecttep_date_search" style='display: none; width: 210px'>&nbsp;&nbsp;&nbsp;<%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.daySearchForm")%></span>
                                    </td>
                            <%
                            if(!"PRSS".equals(docType)) {
                            %>
                                    <!--//
                                    <td valign="top" width="8%">
                                        <a class="simplebutton" href="#">
                                            <span onclick="selectAll()" style="cursor: hand; width: 70px" class="check"><%=Moumi.getMessageBundle().getString("moumi.message.button_small.selectAll")%></span>
                                        </a>
                                    </td>
                                    <td class="kecttep_button_td" valign="top" width="8%">
                                        <a class="simplebutton" href="#">
                                            <span onclick="cancelAll()" style="cursor: hand; width: 70px" class="no"><%=Moumi.getMessageBundle().getString("moumi.message.button_small.selectCancel")%></span>
                                        </a>
                                    </td>
                                    //-->

                                    <td class="kecttep_button_td" align="right" valign="top" width="*">
                                        <!-- // Begin : 부서공유지정 -->
                                        <a href="javascript:openDocument(1);">
                                            <img src="/totsys/common/images/bt_deptselect.jpg" alt="<%=Moumi.getMessageBundle().getString("moumi.message.tot_report.approSet")%>" />
                                        </a><!-- // End : 부서공유지정 -->
                                        <!-- // Begin : 부서공유취소 -->
                                        <a href="javascript:openDocument(0);">
                                            <img src="/totsys/common/images/bt_deptcancel.jpg" alt="<%=Moumi.getMessageBundle().getString("moumi.message.tot_report.approCancel")%>" />
                                        </a><!-- // End : 부서공유취소 -->
                            <%
                                // 종료함 인경우. (docType = "END")
                                if(docType.equals("END")) {
                            %>
                                    <!-- 2014.08.28 Add by KWON,HAN : 사용자공유 -->
                                        <a href="javascript:userShareSelect('check','');" >
                                            <img src="/totsys/common/images/bt_user_share.jpg" alt='<%= Moumi.getMessageBundle().getString("moumi.message.tot_doc.user")%><%= Moumi.getMessageBundle().getString("moumi.message.tot_doc.share")%>' />
                                        </a>
                                    <!-- --------------------------- -->

                                        <!-- // Begin : 담당변경 -->
                                        <a href="javascript:changeDam();" >
                                            <img src="/totsys/common/images/bt_damdang.gif" alt="<%=Moumi.getMessageBundle().getString("moumi.message.button.trans")%>" />
                                        </a><!-- // End : 담당변경 -->
                            <%
                                }
                            %>
                                        <!-- // Begin : 서식삭제 -->
                                        <a href="javascript:docDelete();">
                                            <img src="/totsys/common/images/bt_formdel.gif" alt="<%=Moumi.getMessageBundle().getString("moumi.message.button_small.formRemove")%>" />
                                        </a><!-- // End : 서식삭제 -->
                                    </td>
                            <%
                            }
                            %>
                                </tr>
                            </table>
                        </td>
                    </tr><!-- // End : 검색 & 버튼영역 -->
                    <tr>
                        <td height="31" valign="top"><!----  내용 ---->
                            <table border="1px" class="kecttep_list_table" width="100%" padding="0" cellspacing="0">
                                <tr valign="middle" style="padding-top: 3">
                            <%if(!"PRSS".equals(docType)){%>
                                    <td align="center" nowrap class="kecttep_tdmenu" width="35">
                                        <!--//%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.select")%>//-->
                                        <input type="checkbox" name="check0" onclick="javascript:checkALL(this.checked)"/>
                                    </td>
                            <%}%>
                                    <td width="135" align="center" nowrap class="kecttep_tdmenu"><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.executionCode")%></td>
                                    <td width="*" align="center" nowrap class="kecttep_tdmenu"><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.doc")%><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.name")%></td>
                                    <td width="97" align="center" nowrap class="kecttep_tdmenu"><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.request")%><%=Moumi.getMessageBundle().getString("moumi.message.totsys.sysadm.part.part_list_jsp")%></td>
                                    <td width="97" align="center" nowrap class="kecttep_tdmenu"><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.request")%><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.person")%></td>
                                    <td width="97" align="center" nowrap class="kecttep_tdmenu"><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.startDate")%></td>
                                    <td width="135" align="center" nowrap class="kecttep_tdmenu"><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.endMethod")%></td>
                                    <td width="120" align="center" nowrap class="kecttep_tdmenu"><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_report.compSnd")%>/<%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.all") %>/<%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.noteRecall")%></td>
                                    <td width="97" align="center" class="kecttep_last_tdmenu" nowrap><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.remark")%></td>
                                    <!-- 2014.08.29 Add by KWON,HAN -->
                                    <td width="70" align="center" nowrap class="kecttep_last_tdmenu">
                                    <%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.user")%><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.share")%>
                                    </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) < count); i++) {
                                index = nextCount+i;
                            %>
                                <tr style="padding-top: 3" valign="middle">
                            <%
                                if(!"PRSS".equals(docType)) {
                            %>
                                    <td nowrap class="kecttep_graytd" height="25" align="center" width="35">
                                        <input type="checkbox" name="check" id="checkBox" value=<%=getId[index]%> <%if(getUserId[index]!=null && !getUserId[index].equals(usID) && sysAuth == Moumi.TOTPER){%>disabled<%}%> />
                                        <input type="hidden" name="checkDocID<%=index%>" value="<%=getId[index]%>" />
                                        <input type="hidden" id="su<%=getId[index]%>" name="shareUserCount<%=index%>" value="<%=getShareUserCount[index]%>">
                                    </td>
                            <%
                                }
                            %>
                                    <td width="135" align="center" nowrap class="kecttep_graytd"><%= getExecCode[index] %>&nbsp;</td>
                                    <td id="div_name" nowrap class="kecttep_graytd">
                            <%
                                if("PRSS".equals(docType)){
                            %>
                                        &nbsp;&nbsp;<a onmouseover="balloon_on('<%= getName[index] %>',this,10,4)"  onmouseout="balloon_off()"
                                            href="./reports/report_list.jsp?docID=<%= getId[index] %>&deptID=<%= getDeptId[index]%>&docType=<%=docType %>&findOption=all&findWord=all&reportID=<%=getId[index]%>"><%= MString.getEllipsis(getName[index],wordLengthLimit) %></a>
                            <%
                                }else{
                            %>
                                        &nbsp;&nbsp;<a onmouseover="balloon_on('<%= getName[index] %>',this,10,4)"  onmouseout="balloon_off()"
                                            href="./tot_reports/total_reports.jsp?docID=<%= getId[index]%>&deptID=<%=getDeptId[index]%>&docType=<%=docType %>&reportID=<%=getId[index]%>"><%= MString.getEllipsis(getName[index],wordLengthLimit) %></a>
                            <%
                                }
                            %>
                                    </td>
                                    <td width="110" align="center" nowrap class="kecttep_graytd"><%= MString.checkNull(getDeptName[index]) %>&nbsp;</td>
                                    <td width="100" align="center" nowrap class="kecttep_graytd"><%= getOwnerName[index] %></td>
                                    <!--	미진행자료 시작일  -->
                                    <td align="center" nowrap class="kecttep_graytd"><%= docType.equals("REG") ? new SimpleDateFormat("yyyy-MM-dd :HH:mm").format(getStartDate[index]) : new SimpleDateFormat("yyyy-MM-dd").format(getStartDate[index]) %></td>
                                    <td width="130" align="center" nowrap class="kecttep_graytd"
                            <%
                                String tmpMoumiAcptLimitStrategy = Integer.toString(getMoumiAcptLimitStrategy[index]);
                                String tmp2= null;
                                String tstr = "시 종료";
                                String tcnt;
                                tcnt = "("+Integer.toString(getMoumiAcptLimitStrategy[index])+"개 기관)";
                                if(tmpMoumiAcptLimitStrategy.equals("0")){
                                   tmp2 = new SimpleDateFormat("yyyy-MM-dd HH").format(getEndDate[index]);
                                   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 = "";
                            %>>
                            <%
                                out.write(tmp2+tstr+tcnt);
                            %>
                                    </td>
                                    <td align="center" nowrap class="kecttep_graytd">
                            <%
                                String tmpAllcnt = Integer.toString(getAllCnt[index]);
                                String tmpSndcnt = Integer.toString(getSndCnt[index]);
                                String tmpNoteSndcnt = Integer.toString(getNoteCnt[index]);
                                out.write(tmpAllcnt +"/"+tmpSndcnt+"("+tmpNoteSndcnt+")");
                            %>
                                    </td>
                                    <td width="100" nowrap class="kecttep_graytd" align="center">
                                        <span style="padding-left:inherit">
                                        <%if(getRepId[index] != 0){
                                            out.print(Moumi.getMessageBundle().getString("moumi.message.tot_doc.subDoc")); //연계등록자료 표시
                                        }%>&nbsp;
                                        </span>
                                    </td>
                                    <!-- 2014.08.29 Add by KWON,HAN -->
                                    <td align="center" nowrap valign="middle" nowrap class="kecttep_last_graytd">
                                        <%if(getShareUserCount[index] > 0){
                                        %>
                                           <%if(usID.equals(getShareDocRegId[index])){%>
                                            <a href="javascript:userShareSelect('select','<%= getId[index] %>');">
                                           <%}%>
                                                <%=getShareUserCount[index]%><%=Moumi.getMessageBundle().getString("moumi.message.doc.Name") %>
                                           <%if(usID.equals(getShareDocRegId[index])){%>
                                            </a>
                                           <%}%>
                                        <%
                                        }else {%>
                                            &nbsp;
                                        <%}%>
                                    </td>
                                    <!-- ---------------------------- -->
                                </tr>
                            <%
                            }
                            tx.rollback();
                            %>
                            <!----  내용 끝 ---->
                            </table>
                        </td>
                    </tr>

                    <tr>
                        <td height="15"></td>
                    </tr>
                <%if(count > 0){%>
                    <tr style="padding-top: 3" valign="middle">
                        <td height="25" colspan="8" align="center" class="kecttep_board">
                            <!------------------------------- 페이지수 나오는 부분 시작 ------------------------------->
                            <jsp:include page="/totsys/common/inc/board/page.jsp" flush="true">
                                <jsp:param name="uri" value="<%= uri %>" />
                                <jsp:param name="pageSize" value="<%= pageSize %>" />
                                <jsp:param name="currentPage" value="<%= currentPage %>" />
                                <jsp:param name="currentPageSetUp" value="<%= currentPageSetUp %>" />
                                <jsp:param name="findWord" value='<%=URLEncoder.encode(MString.checkNull(findWord),"UTF-8")%>' />
                            </jsp:include> <!------------------------------- 페이지수 나오는 부분 끝 -----------------------ㄱ-------->
                        </td>
                    </tr>
                <%}else{%>
                    <tr>
                        <td class="kecttep_none_tdmenu" colspan="14" height="25" align="center"><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.notDoc")%></td>
                <%}%>
                    </tr>
                    <input type="hidden" name="tmpFind" value="<%=MString.checkNull(findOption)%>">
                    <FORM name="Del" action="/servlet/kr.co.kihyun.beans.totsys.totper.HttpDocDel" method="post">
                        <INPUT type="hidden" name="docID" value="">
                        <INPUT type="hidden" name="url" value="endDoc">
                        <INPUT type="hidden" name="docType" value="<%= docType %>">
                    </FORM>
                    <script>
                        if(tmpFind.value == "name"){
                            searchForm.findOption.selectedIndex=0;
                        }else if(tmpFind.value == "startDate"){
                            searchForm.findOption.selectedIndex=1;
                        }else if(tmpFind.value == "endDate"){
                            searchForm.findOption.selectedIndex=2;
                        }else if(tmpFind.value == "totDoc.mUser.name"){
                                searchForm.findOption.selectedIndex=2;
                        }
                    </script>
		</table>
            </td>
            <td nowrap width="10"></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();
}
%>

