<%@page import="java.net.URLDecoder"%>
<%@ page contentType="text/html; charset=UTF-8"
	import="java.net.URLEncoder" import="java.util.Date"
	import="java.text.*" import="kr.co.kihyun.util.MDate"
	import="kr.co.kihyun.lang.MLong" import="kr.co.kihyun.lang.MString"
	import="kr.co.kihyun.moumi.Moumi" import="kr.co.kihyun.moumi.MoumiUtil"
	import="kr.co.kihyun.beans.user.HttpSSOLogin"
	import="kr.co.kihyun.beans.user.UserGroup"
	import="kr.co.kihyun.beans.user.User"
       import="kr.co.kihyun.beans.user.UserGroupList"
	import="kr.co.kihyun.beans.user.Dept"
	import="kr.co.kihyun.lang.Encoder"
	import="kr.co.kihyun.beans.entity.MUser" import="java.util.*"
	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.entity.UserPart"
       import="kr.co.kihyun.service.*" import="kr.co.kihyun.service.vo.*"
       import="java.util.HashMap"
	import="java.util.Map" import="javax.jdo.Query" import="kr.co.kihyun.moumi.MoumiConfig"
       import="org.slf4j.Logger" import="org.slf4j.LoggerFactory"
%>

<%@ include file="/totsys/common/inc/sec/secure.inc.jsp"%>
<%
//final Logger LOG = LoggerFactory.getLogger(this.getClass());
PersistenceManager pm = new MPersistenceManager(PMF.get().getPersistenceManager());
Transaction tx = pm.currentTransaction();
try{
	/********** session내의 userId **********/
	String usID = HttpSSOLogin.getLoginID(request);
        String deptID = HttpSSOLogin.getDeptID(request);
	int sysAuth = HttpSSOLogin.getSysAuth(request);

	/****** Parameter *******/
	//String strPage = clearXSS(request.getParameter("strPage"),"");
        String searchType = clearXSS(request.getParameter("searchType"),"");
        String dateType = clearXSS(request.getParameter("dateType"),"");
        String stDate = clearXSS(request.getParameter("stDate"),"");
        String edDate = clearXSS(request.getParameter("edDate"),"");
        String searchOrgan = clearXSS(request.getParameter("search_organ"),"");
        String searchDept = clearXSS(request.getParameter("search_dept"),"");
        String chkboxDept = clearXSS(request.getParameter("chkbox_dept"),"");
        String chkboxSchool = clearXSS(request.getParameter("chkbox_school"),"");
        String searchOrganName = "";

        tx.begin();

        List list = null;
        DecimalFormat numberFormat = new DecimalFormat("#,###,###");
        Long now_today = new Date().getTime();
        SimpleDateFormat dForomat = new SimpleDateFormat("yyyy-MM-dd");

        MDept mDept = pm.getObjectById(MDept.class, deptID);


//        if( LOG.isDebugEnabled() ) {
//            LOG.debug("sysAuth={}", sysAuth);
//        }

        boolean disableOrgan = false;
        boolean disableDept = false;

        DeptService deptService = new DeptService(pm);
        String sOrgan = "ALL";
        String sDept = "ALL";
        List organDeptList = null;
        List deptList = null;
        String rootDept = "";
        //===========================================================
        // 교육청, 부서, 학교에 대한 콤보박스 값 조회
        //===========================================================
        if( sysAuth == SysAuth.SYSADM.ordinal() ) {
            //9.시스템관리자
            rootDept = mDept.getRootDept(pm).getId();
            organDeptList = deptService.getLOVFromDept(DeptService.TYPE.SAME_ROOT_DEPT, rootDept);
        }else if( sysAuth == SysAuth.SUB_SYSADM.ordinal() ) {
            //7.기관시스템관리자
            sOrgan = mDept.getOrgan();
            if( deptID.equals(sOrgan) ) {
                //기관
                disableOrgan = true;
                organDeptList = new ArrayList();
                CodeVO codeVO = new CodeVO();
                codeVO.setCode(mDept.getName());
                codeVO.setValue(mDept.getId());
                organDeptList.add(codeVO);
            }else{
                //부서, 학교
                sDept = deptID;
                disableOrgan = true;
                disableDept = true;
                organDeptList = new ArrayList();
                CodeVO organCode = new CodeVO();
                MDept mOrgan = pm.getObjectById(MDept.class, sOrgan);
                organCode.setCode(mOrgan.getName());
                organCode.setValue(mOrgan.getId());
                organDeptList.add(organCode);
                deptList = new ArrayList();
                CodeVO codeVO = new CodeVO();
                codeVO.setCode(mDept.getName());
                codeVO.setValue(mDept.getId());
                deptList.add(codeVO);

                Grade grade = mDept.getGrade();
                if( grade == Grade.NULL ) {
                    //부서
                    chkboxDept = "D";
                }else{
                    //학교
                    chkboxSchool = "S";
                }
            }
        }
        //===========================================================
        if( !searchType.equals("") ) {
            sOrgan = searchOrgan;
            sDept = searchDept;
            String sDeptSchoolType = MString.checkNull(chkboxDept, chkboxSchool);

            StatisticsService service = new StatisticsService(pm);

            Map params = new HashMap();
            params.put("organId",           sOrgan);
            params.put("deptId",            sDept);
            params.put("deptSchoolType",    sDeptSchoolType);
            if( searchType.equals("all") ) {
                params.put("startDate",    stDate);
                params.put("endDate",    edDate);

                list = service.getStatisticsForAll(params);
            }else if( searchType.equals("period") ) {
                params.put("dateType",  dateType);
                params.put("stDate",    stDate);
                params.put("edDate",    edDate);
                list = service.getStatisticsByDate(params);
            }
        }
%>

<html>
<head>
<title><%=Moumi.getTitle()%></title>
<link rel="stylesheet" href="images/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">
<style>
    span.box_shape {
        height: 22px;
        width: 100px;
        background-color: #d1be91;
	font-family: Dotum;
	font-size: 12px;
	font-weight: bold;
	padding-top: 3px;
	border: 1px solid #333333;
        text-align: center;
        color: #FFFFFF;
    }

</style>
<script src="images/rollover.js"></script>
<script src="/totsys/common/js/find.js"></script>
<script src="/totsys/common/js/util.js"></script>
<script src="/totsys/common/js/calendar.js"></script>
<script type="text/javascript" src="/totsys/common/js/jquery-1.12.4.min.js"></script>
<script type="text/javascript" src="/totsys/common/js/jquery.custom.indicator.js"></script>
<script language="javascript">
    /**
     * DOM객체가 모두 로딩된 후 호출되는 함수
     * @param {type} param
     */
    $(document).ready(function() {
        //기간별, 전체에 따른 검색조건에 대한 표시 여부 결정
        var searchType = "<%=searchType%>";
        $rdSearchType = $('input[type="radio"][name="searchType"]');
        if( searchType == "period") {
            $rdSearchType[0].click();
            $rdDateType = $('input[type="radio"][name="dateType"][value="<%= dateType %>"]')[0].checked = true;
        }else if( searchType == "all") {
            $rdSearchType[1].click();
        }
        //교육청 콤보박스 선택
        $("#id_organ").val("<%= sOrgan %>");

        <% if( !MString.isNull(chkboxDept) ) { %>
        //부서 체크박스 선택 처리
        $("#id_chk_dept").attr("checked", true);
        <% }else if( !MString.isNull(chkboxSchool) ) {%>
        //학교 체크박스 선택 처리
        $("#id_chk_school").attr("checked", true);
        <% } %>
        fn_onChangeOrgan();

        <% if( disableOrgan ) { %>
        //교육청 콤보박스 비활성 처리
        $("#id_organ").attr("disabled", true);
        <% }
        if( disableDept ) {
        %>
        //부서, 학교 체크박스 및 콤보박스 비활성 처리
        $("#id_dept").attr("disabled", true);
        $("#id_chk_dept").attr("disabled", true);
        $("#id_chk_school").attr("disabled", true);
        <% } %>
    });

    /**
     * 기간별, 전체 radio button에 대한 이벤트 처리 함수
     * @param {type} obj
     * @returns {undefined}
     */
    function fn_rdChange(obj) {
        var val = obj.value;
        var display = "inline";
        $span_date = $("#span_date");

        if( val == "all" ) {
            display = "none";
        }
        $span_date.css("display", display);
    }

    /**
     * 시작일과 종료일의 정합성 체크 함수
     * @param {type} stDate
     * @param {type} edDate
     * @returns {Boolean}
     */
    function isDateTrue(stDate, edDate) {
        if(stDate <= edDate) {
                return true;
        }
        return false;
    }

    /**
     * 조회버튼 클릭 시 호출되는 함수
     * @returns {Boolean}
     */
    function fn_SearchStatistics(p_type) {
        if( !isDateTrue(document.searchForm.stDate.value, document.searchForm.edDate.value) ) {
            alert("<%= MoumiConfig.getMessageBundle().getString("moumi.message.popup.startEndDateCheck") %>");
            document.searchForm.edDate.focus();
            document.searchForm.edDate.select();
            return false;
        }

        if( p_type == "search" ) {
            document.searchForm.action = "";
        }else if( p_type == "excel" ) {
            document.searchForm.action = "statistics_excel.jsp";
        }

        document.searchForm.search_organ.value = document.searchForm.organ.value;
        document.searchForm.search_dept.value = document.searchForm.dept.value;
        return true;
    }

    /**
    * Excel 다운로드 함수
     * @returns {undefined}     */
    function fn_excelLink() {
        if( fn_SearchStatistics("excel") ) document.searchForm.submit();
    }
    //부서, 학교에 대한 구분자 변수 정의
    var lov_dept_same_organ = "<%= DeptService.TYPE.DEPT_OF_SAME_ORGAN.ordinal() %>";
    var lov_school_same_organ = "<%= DeptService.TYPE.SCHOOL_OF_SAME_ORGAN.ordinal() %>";

    /**
     * 교육청을 변경 시 호출되는 함수
     * @returns {undefined}
     */
    function fn_onChangeOrgan() {
        var organId = $("#id_organ option:selected").val();
        $("#id_dept option[value!='ALL']").remove();
        var $id_chk_dept = $("#id_chk_dept");
        var $id_chk_school = $("#id_chk_school");
        if( organId == "ALL" ) {
            $id_chk_dept.attr("checked", false);
            $id_chk_dept.attr("disabled", true);
            $id_chk_school.attr("checked", false);
            $id_chk_school.attr("disabled", true);

        }else{
            $id_chk_dept.attr("disabled", false);
            $id_chk_school.attr("disabled", false);
            if( $id_chk_dept.is(":checked") ) {
                fn_getDeptLOV(organId, lov_dept_same_organ);
            }else if( $id_chk_school.is(":checked") ) {
                fn_getDeptLOV(organId, lov_school_same_organ);
            }
        }
    }

    /**
     * Ajax기능을 사용하여 서버에 LOV값을 요청하는 함수
     * @param {type} p_deptId
     * @param {type} p_lov_type
     * @returns {undefined}
     */
    function fn_getDeptLOV(p_deptId, p_lov_type) {
        $.ajax({
            url:"/servlet/kr.co.kihyun.service.servlet.AjaxProcessServlet",
            type:"POST",
            dataType:"json",
            async: true,
            data:{
                proc_type:"dept_lov",
                lov_type:p_lov_type,
                deptId:p_deptId
            },
            success:function(data) {
                fn_callBackForSuccess(data);
            },
            error:function(e) {
            	if(p_lov_type == 1){
            		alert("부서가 없습니다.");
            	}else if(p_lov_type == 2){
            		alert("학교가 없습니다.");
            	}else{
            		alert(e);
            	}

            },
            beforeSend:function() {
                $.customIndicator.show(window.self);
            },
            complete:function() {
                $.customIndicator.hide(window.self);
            }
        });
    }

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

        // jquery 최적화 2014.11.17 Update by YOUNGJUN,CHO
        var id_deptObj = $("#id_dept"); // selector object 를 변수로 저장하여, dom 탐색 속도를 개선함.

        if( data != null ) {

            var optionHtml = "";
            for(var i = 0; i < data.length; i++ ) {
                //$("#id_dept").append("<option value='" + data[i].value + "'>" + data[i].code + "</option>");
                // option 을 동적으로 추가시 html 을 변수에 저장 후, 한꺼번에 append 처리하도록 변경.
                optionHtml = optionHtml + "<option value='" + data[i].value + "'>" + data[i].code + "</option>";
            }

            //$("#id_dept").append( optionHtml );
            id_deptObj.append( optionHtml );

            //$("#id_dept").val("<%//= sDept %>");
            id_deptObj.val("<%= sDept %>");
        }

        // select box 의 width가 바로 바뀌지 않는 현상이 있어서 select box 에 focus 를 지정하는 방법으로 해결.
        id_deptObj.focus();
    }

    /**
    * 부서, 학교 체크박스 클릭 시 호출되는 함수
     * @param {type} p_checkbox
     * @returns {undefined}     */
    function fn_onChangeCheck(p_checkbox) {
        if( p_checkbox.name == $("#id_chk_dept").attr("name") ) {
            $("#id_chk_school").attr("checked", false);
        }else if( p_checkbox.name == $("#id_chk_school").attr("name") ) {
            $("#id_chk_dept").attr("checked", false);
        }

        if( $("#id_chk_dept").is(":checked") ) {
            fn_onChangeOrgan();
        }else if( $("#id_chk_school").is(":checked") ) {
            fn_onChangeOrgan();
        }else{
            $("#id_dept option[value!='ALL']").remove();
        }
    }
</script>
</head>
<body style='' BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
    <%--<jsp:include page="/totsys/common/inc/totper/top/top.jsp" flush="true"/>--%>
    <tr>
        <td nowrap width="10"></td>
        <td valign="top">
            <!--------------------------------------------------------------------------------------------------------------------------->
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <jsp:include page="/totsys/common/inc/title/title.jsp" flush="true" />
                <tr class="toolbar">
                    <td>
                    <!-------------------------------------검색조건시작------------------------------------------------->
                    <form name="searchForm" method="post" style="margin: 0px" onsubmit="return fn_SearchStatistics('search');">
                        <input type="hidden" name="search_organ" value="">
                        <input type="hidden" name="search_dept" value="">
                    <table width="100%" border="0" cellpadding="0" cellspacing="0" style="margin: 0px;border-color: #3366ff;">
                        <tr class="toolbar" valign="middle" style="height:30px;">
                            <td align="left" width="100%" nowrap style="padding-top: 4px;padding-bottom: 0px;margin: 0px; vertical-align: middle;">

                                <label for="" style="vertical-align: middle;">
                                    <strong><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.date")%></strong>
                                </label>

                                &nbsp;
                                <!--// 검색 시작일 -->
                                <input name="stDate" type="text" size="10" value="<%=stDate.equals("") ? dForomat.format(now_today) : stDate%>" readonly onclick="showSetWin('searchForm.stDate');" style="cursor: pointer;  vertical-align: middle;" class="inputtxt">
                                <a href="#" onclick="showSetWin('searchForm.stDate');">
                                    <img src="/totsys/common/images/date.gif" align="middle">
                                </a><!-- 검색 시작일 //-->
                                ~
                                <!--// 검색 종료일 -->
                                <input name="edDate" type="text" size="10" value="<%=edDate.equals("") ? dForomat.format(now_today) : edDate%>" readonly onclick="showSetWin('searchForm.edDate');" style="cursor: pointer;  vertical-align: middle;" class="inputtxt">
                                <a href="#" onclick="showSetWin('searchForm.edDate');">
                                    <img src="/totsys/common/images/date.gif" align="middle">
                                </a><!-- 검색 종료일 //-->

                                &nbsp;
                                <!--// 기간별 -->
                                <label for="" style="vertical-align: middle;">
                                    <input type="radio" name="searchType" value="period" checked onclick="fn_rdChange(this);" style="vertical-align: middle;">
                                    <%=Moumi.getMessageBundle().getString("moumi.message.statistics.period")%>
                                </label><!-- 기간별 //-->


                                <span id="span_date" style="margin: 0 0 0 5px; padding: 1px 6px 1px 3px; border:1px solid #BABABA; vertical-align: middle;">
                                    <!--// 기간별(일간) -->
                                    <label for="">
                                        <input type="radio" name="dateType" value="day" checked>&nbsp;<%=Moumi.getMessageBundle().getString("moumi.message.statistics.period.day")%>
                                    </label><!-- 기간별(일간) //-->
                                    <!--// 기간별(월간) -->
                                    <label for="">
                                        <input type="radio" name="dateType" value="month">&nbsp;<%=Moumi.getMessageBundle().getString("moumi.message.statistics.period.month")%>
                                    </label><!-- 기간별(월간) //-->
                                    <!--// 기간별(년간) -->
                                    <label for="">
                                        <input type="radio" name="dateType" value="year">&nbsp;<%=Moumi.getMessageBundle().getString("moumi.message.statistics.period.year")%>
                                    </label><!-- 기간별(년간) //-->
                                </span>
                                &nbsp;
                                <label for="" style="vertical-align: middle;">
                                    <input type="radio" name="searchType" value="all" onclick="fn_rdChange(this);" style="vertical-align: middle;">&nbsp;<%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.all")%>
                                </label>

                            </td>
                        </tr>
                        <tr class="toolbar" valign="middle" >
                            <td align="left" width="100%" nowrap style="padding-bottom: 0px;margin: 0px; vertical-align: middle;">

                                <label for="" style="vertical-align: middle;">
                                    <strong><%=Moumi.getMessageBundle().getString("moumi.message.doc.Coporation")%></strong>
                                </label>

                                &nbsp;
                                <!--// 기관 select box -->
                                <select id="id_organ" name="organ" class="inputtxt" onchange="fn_onChangeOrgan();" style="vertical-align: middle;">
                                    <option value="ALL"><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.all")%></option>
                                    <%
                                    if( organDeptList != null && organDeptList.size() > 0 ) {
                                        for(Object obj : organDeptList) {
                                            CodeVO codeVO = (CodeVO)obj;
                                            %>
                                            <option value="<%= codeVO.getValue()%>"><%= codeVO.getCode() %></option>
                                            <%
                                        }
                                    }
                                    %>
                                </select><!-- 기관 select box //-->

                                &nbsp;
                                <!--// 부서 checkbox -->
                                <label for="" style="vertical-align: middle;">
                                    <%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.devision")%><input type="checkbox" id="id_chk_dept" name="chkbox_dept" value="D" onclick="fn_onChangeCheck(this);">
                                </label><!-- 부서 checkbox //-->

                                &nbsp;
                                <!--// 학교 checkbox -->
                                <label for="" style="vertical-align: middle;">
                                    <%=Moumi.getMessageBundle().getString("moumi.message.statistics.school")%><input type="checkbox" id="id_chk_school" name="chkbox_school" value="S" onclick="fn_onChangeCheck(this);">
                                </label><!-- 학교 checkbox //-->

                                &nbsp;
                                <!--// 부서 or 학교 select box -->
                                <select id="id_dept" name="dept" class="inputtxt" onchange="fn_onChangeDept(this);">
                                    <option value="ALL"><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.all")%></option>
                                    <%
                                    if( deptList != null && deptList.size() > 0 ) {
                                        for(Object obj : deptList) {
                                            CodeVO codeVO = (CodeVO)obj;
                                            %>
                                            <option value="<%= codeVO.getValue()%>"><%= codeVO.getCode() %></option>
                                            <%
                                        }
                                    }
                                    %>
                                </select><!-- 부서 or 학교 select box //-->
                                 &nbsp;&nbsp;&nbsp;
                                <input type="image" src="/totsys/common/images/bt_search_inquiry2.gif" border="0" align="middle" style="vertical-align: middle;">
                                <!--// 엑셀저장 button -->
                                <a href="javascript:void(0);" onclick="javascript:fn_excelLink();" style="vertical-align: middle;">
                                    <img src="/totsys/common/images/bt_excel.gif" alt="엑셀저장" />
                                </a><!-- 엑셀저장 button //-->
                            </td>
                        </tr>
                    </table>
                    </form>
                    <!-------------------------------------검색조건끝------------------------------------------------->
                    </td>
                </tr>
                <% if( !searchType.equals("") ) { %>
                <tr>
                    <td valign="top">
                        <!-------------------------------------목록시작------------------------------------------------->
                        <% if( searchType.equals("") || searchType.equals("period") ) { %>
                        <!------------------------------기간별 조회 시작----------------------------------->
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr width="100%">
                                <td>
                                    <table border="1px" class="kecttep_list_table" bordercolor="#e3e3e3" width="100%" cellpadding="0" cellspacing="0">
                                        <tr valign="middle" style="padding-top: 3px">
                                            <td style="text-align: center;" class="kecttep_tdmenu"><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.day")%> <%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.person")%></td>
                                            <td width="17%" align="center" class="kecttep_tdmenu"><%=MoumiConfig.getMessageBundle().getString("moumi.message.statistics.tot_doc")%> <%=MoumiConfig.getMessageBundle().getString("moumi.message.statistics.temp")%></td>
                                            <td width="17%" align="center" class="kecttep_tdmenu"><%=MoumiConfig.getMessageBundle().getString("moumi.message.statistics.tot_doc")%> <%=MoumiConfig.getMessageBundle().getString("moumi.message.statistics.complete")%></td>
                                            <td width="17%" align="center" class="kecttep_tdmenu"><%=MoumiConfig.getMessageBundle().getString("moumi.message.statistics.accept")%></td>
                                            <td width="17%" align="center" class="kecttep_tdmenu"><%=MoumiConfig.getMessageBundle().getString("moumi.message.statistics.tot_report")%> <%=MoumiConfig.getMessageBundle().getString("moumi.message.statistics.temp")%></td>
                                            <td width="17%" align="center" class="kecttep_last_tdmenu"><%=MoumiConfig.getMessageBundle().getString("moumi.message.statistics.tot_report")%> <%=MoumiConfig.getMessageBundle().getString("moumi.message.statistics.complete")%></td>
                                        </tr>
                                        <%
                                        int prssTot = 0;        //집계진행합계
                                        int endTot = 0;         //집계완료합계
                                        int acceptTot = 0;      //접수합계
                                        int tempTot = 0;        //제출진행합계
                                        int compTot = 0;        //제출완료합계
                                        for(int i = 0; i < list.size(); i++ ) {
                                            Object[] row = (Object[])list.get(i);
                                            prssTot += Integer.parseInt(row[1].toString());
                                            endTot += Integer.parseInt(row[2].toString());
                                            acceptTot += Integer.parseInt(row[3].toString());
                                            tempTot += Integer.parseInt(row[4].toString());
                                            compTot += Integer.parseInt(row[5].toString());
                                        %>
                                        <tr style="padding-top: 3px" valign="middle" onmouseover="this.style.backgroundColor='F9F9F9'" onmouseout="this.style.backgroundColor='white'">
                                            <td nowrap class="kecttep_graytd" style="text-align: center;"><%= row[0] %></td>
                                            <td nowrap class="kecttep_graytd statistics_number"><%= numberFormat.format(row[1]).trim() %></td>
                                            <td nowrap class="kecttep_graytd statistics_number"><%= numberFormat.format(row[2]).trim() %></td>
                                            <td nowrap class="kecttep_graytd statistics_number"><%= numberFormat.format(row[3]).trim() %></td>
                                            <td nowrap class="kecttep_graytd statistics_number"><%= numberFormat.format(row[4]).trim() %></td>
                                            <td nowrap class="kecttep_last_graytd statistics_number"><%= numberFormat.format(row[5]).trim() %></td>
                                        </tr>
                                        <%
                                        }
                                        %>
                                        <tr style="padding-top: 3px" valign="middle" onmouseover="this.style.backgroundColor='F9F9F9'" onmouseout="this.style.backgroundColor='white'">
                                            <td nowrap  class="kecttep_tdmenu" style="text-align: center;"><%=MoumiConfig.getMessageBundle().getString("moumi.message.total")%></td>
                                            <td nowrap class="kecttep_tdmenu statistics_number"><%= numberFormat.format(prssTot).trim() %></td>
                                            <td nowrap class="kecttep_tdmenu statistics_number"><%= numberFormat.format(endTot).trim() %></td>
                                            <td nowrap class="kecttep_tdmenu statistics_number"><%= numberFormat.format(acceptTot).trim() %></td>
                                            <td nowrap class="kecttep_tdmenu statistics_number"><%= numberFormat.format(tempTot).trim() %></td>
                                            <td nowrap class="kecttep_last_tdmenu statistics_number"><%= numberFormat.format(compTot).trim() %></td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                            <!------------------------------기간별 조회 끝----------------------------------->
                            <%
                            }else if( searchType.equals("all") ) {
                                Object[] row = (Object[])list.get(0);
                            %>
                            <!------------------------------전체 조회 시작----------------------------------->

                            <!--// 전체 통계 - 집계 -->
                            <br />
                            <img src="/totsys/common/images/ico_3.gif" border="0" align="absmiddle">&nbsp;<strong><%=MoumiConfig.getMessageBundle().getString("moumi.message.statistics.tot_doc")%></strong>

                            <table class="kecttep_list_table" width="300" border="1" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td width="100" class="kecttep_tdmenu" align="center"><%=MoumiConfig.getMessageBundle().getString("moumi.message.statistics.tot_doc")%> <%=MoumiConfig.getMessageBundle().getString("moumi.message.statistics.temp")%></td>
                                    <td class="kecttep_last_graytd" align="right" nowrap style="padding-right: 10px;"><strong><%= numberFormat.format(row[0]).trim() %></strong> <%=MoumiConfig.getMessageBundle().getString("moumi.message.statistics.job")%></td>
                                </tr>
                                <tr onmouseover="this.style.backgroundColor='F9F9F9'" onmouseout="this.style.backgroundColor='white'">
                                    <td width="100" class="kecttep_tdmenu" align="center"><%=MoumiConfig.getMessageBundle().getString("moumi.message.statistics.tot_doc")%> <%=MoumiConfig.getMessageBundle().getString("moumi.message.statistics.complete")%></td>
                                    <td class="kecttep_last_graytd" align="right" nowrap style="padding-right: 10px;"><strong><%= numberFormat.format(row[1]).trim() %></strong> <%=MoumiConfig.getMessageBundle().getString("moumi.message.statistics.job")%></td>
                                </tr>
                            </table><!-- 전체 통계 - 집계 //-->

                            <!--// 전체 통계 - 제출 -->
                            <br />
                            <img src="/totsys/common/images/ico_3.gif" border="0" align="absmiddle">&nbsp;<strong><%=MoumiConfig.getMessageBundle().getString("moumi.message.statistics.tot_report")%></strong>

                            <table class="kecttep_list_table" width="300" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td width="100" class="kecttep_tdmenu" align="center"><%=MoumiConfig.getMessageBundle().getString("moumi.message.statistics.accept")%> </td>
                                    <td class="kecttep_last_graytd" align="right" nowrap style="padding-right: 10px;"><strong><%= numberFormat.format(row[2]).trim() %></strong> <%=MoumiConfig.getMessageBundle().getString("moumi.message.statistics.job")%></td>
                                </tr>
                                <tr>
                                    <td width="100" class="kecttep_tdmenu" align="center"><%=MoumiConfig.getMessageBundle().getString("moumi.message.statistics.tot_report")%> <%=MoumiConfig.getMessageBundle().getString("moumi.message.statistics.temp")%></td>
                                    <td class="kecttep_last_graytd" align="right" nowrap style="padding-right: 10px;"><strong><%= numberFormat.format(row[3]).trim() %></strong> <%=MoumiConfig.getMessageBundle().getString("moumi.message.statistics.job")%></td>
                                </tr>
                                <tr>
                                    <td width="100" class="kecttep_tdmenu" align="center"><%=MoumiConfig.getMessageBundle().getString("moumi.message.statistics.tot_report")%> <%=MoumiConfig.getMessageBundle().getString("moumi.message.statistics.complete")%></td>
                                    <td class="kecttep_last_graytd" align="right" nowrap style="padding-right: 10px;"><strong><%= numberFormat.format(row[4]).trim() %></strong> <%=MoumiConfig.getMessageBundle().getString("moumi.message.statistics.job")%></td>
                                </tr>
                            </table><!-- 전체 통계 - 제출 //-->



                            <!------------------------------전체 조회 끝----------------------------------->
                            <% } %>
                        <!-------------------------------------목록끝------------------------------------------------->
                    </td>
                </tr>
                <% } %>
                <!------------------------------- top menu start ------------------------------->
                <%@ include file="/totsys/common/inc/buttom/buttom.jsp"%>
                <!------------------------------- top menu end ------------------------------->
            </table>
            <!--------------------------------------------------------------------------------------------------------------------------->
        </td>
        <td nowrap width="10"></td>
    </tr>
</table>
<div id="SetWin" style="position: absolute; z-index: 10; visibility: hidden; width: 100px; background: silver; border: 1px #333333 solid; line-height: 1.4em; padding: 3px 3px; v"></div>
</body>
</html>
<%
    tx.commit();
}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();
}
%>
