
<%
/************************************************************@@
  * Program Name	: main.jsp
  * Description		: /보고자/보고자 메인
  * Author				: 강원중
  * Create Date		: 2004.10.12
  * History				:
@@************************************************************/
%>

<%@ page contentType="text/html; charset=UTF-8"
	import="java.net.URLEncoder"
        import="java.util.Iterator"
	import="java.util.List"
        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.user.User"
        import="kr.co.kihyun.moumi.MoumiConfig"
	import="kr.co.kihyun.moumi.report.MReport"
	import="kr.co.kihyun.moumi.doc.MDoc"
        import="java.util.ResourceBundle"%>
<%@page import="javax.jdo.Query"%>

<%
PersistenceManager pm = new MPersistenceManager(PMF.get().getPersistenceManager());
Transaction tx = pm.currentTransaction();
try{
	/********** session내의 userId **********/
	String usID = HttpSSOLogin.getLoginID(request);
	String dpID = HttpSSOLogin.getDeptID(request);
	int sysAuth = new User().getSysAuth(usID);
	
	/************ top value ************/
	String dirPath = "";
	
	/********* home taget url ***************/
	session.setAttribute("homeTagetURL", "/totsys/repoper/main.jsp");
	session.setAttribute("envTagetURL", "/totsys/common/inc/repoper/top/top.jsp");

	tx.begin();

	List<Category> categoryList = pm.getObjectById(Category.class, Category.ID_BOARD).getChildCategories();
	MUser mUser = pm.getObjectById(MUser.class, usID);
	List<TotDoc> filterDoc = mUser.getOnGoingDocs(pm, "", null);
	List<TotReport> tempReports = mUser.getSavedReports(pm, "", null);
	List<TotReport> acceptReports = mUser.getUnwrittenReports(pm, "", null);
	List<TotReport> returnReports2 = null;
	
	Query q = null;
	q = pm.newQuery(TotReport.class, acceptReports);
	StringBuilder filter = new StringBuilder(150)
	.append("process == TotReportProcess.RETURN");
	q.setFilter(filter.toString());
	//q.declareImports("import kr.co.kihyun.beans.entity.*;");
	//q.declareParameters("TotDocType docType, Date sysdate, MUser user");
	q.setOrdering("id DESC");
	returnReports2 = (List<TotReport>) q.execute();

	tx.rollback();
%>

<html>
<head>
<title><%=MoumiConfig.getTitle()%></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="/totsys/common/css/style.css" rel="stylesheet" type="text/css">

<script>
	
function openTop(topType){
	parent.topx.topForm.topStat.value = topType;
	parent.topx.topForm.submit();
	parent.topx.menuView(topType,<%=sysAuth%>);
}

function repoperLocation(page){
	if(page == "prssbox"){
		location.href="/totsys/totper/mydocbox/prssbox/doc_list.jsp?docType=PRSS";
	}else if(page == "tempbox"){
		location.href="/totsys/repoper/mydocbox/tempbox/report_list.jsp?reportType=TEMP";
	}else if(page == "returnbox"){
		location.href="/totsys/repoper/mydocbox/returnbox/report_list.jsp";
	}
}

</script>


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

<table border="0" cellpadding="0" cellspacing="0"
	style="padding-top: 3px;">
	<tr>
		<td><!--모우미 서브 메인 페이지 컨텐츠 시작-->
		<table width="100%" height="25" border="0" cellpadding="0"
			cellspacing="0">
			<tr>
				<td align="left" style="font-size: 13pt; color: black"><img
					align="bottom" src="/totsys/common/images/title.jpg" border="0">&nbsp;&nbsp;<b>처리<%= MoumiConfig.getMessageBundle().getString("moumi.message.doc") %></b>
				</td>
			</tr>
		</table>
		<table width="100%" border="0" cellpadding="0" cellspacing="0"
			bgcolor="#e5edf7">
			<tr>
				<td width="16" height="16"><img src="images/pw_box01_1.gif"
					width="16" height="16"></td>
				<td background="images/pw_box01_2.gif">&nbsp;</td>
				<td width="16"><img src="images/pw_box01_3.gif" width="16"
					height="16"></td>
			</tr>
			<tr>
				<td background="images/pw_box01_8.gif">&nbsp;</td>
				<td align="center">
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td>
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td align="center">
								<table width="100%" border="0" cellspacing="0" cellpadding="0">
									<tr align="center">
										<td><img src="images/m_bu02.gif" width="11" height="7"><a
											href="#"
											onclick="<%if(MoumiConfig.isOnTopMenu()){%>openTop(1);<%}%>repoperLocation('prssbox');">
										<%= TotDocType.TOT_DOC%><%=TotDocProcess.PRSS%> <%= MoumiConfig.getMessageBundle().getString("moumi.message.doc") %>
										: <strong><span class="f_12_orange"><%= filterDoc.size() %>
										</span></strong>건</a></td>
										<td><img src="images/m_bu02.gif" width="11" height="7"><a
											href="#"
											onclick="<%if(MoumiConfig.isOnTopMenu()){%>openTop(2);<%}%>repoperLocation('tempbox');"><%= TotReportProcess.TEMP%>
										<%= MoumiConfig.getMessageBundle().getString("moumi.message.doc") %>
										: <strong><span class="f_12_orange"><%= tempReports.size() %>
										</span></strong>건</a></td>
										<td><img src="images/m_bu02.gif" width="11" height="7"><a
											href="#"
											onclick="<%if(MoumiConfig.isOnTopMenu()){%>openTop(2);<%}%>repoperLocation('returnbox');"><%= TotReportProcess.RETURN%>
										<%= MoumiConfig.getMessageBundle().getString("moumi.message.doc") %>
										: <strong><span class="f_12_orange"><%= returnReports2.size() %>
										</span></strong>건 </a></td>
									</tr>
								</table>
								</td>
							</tr>
						</table>
						</td>
					</tr>
				</table>
				</td>
				<td background="images/pw_box01_4.gif">&nbsp;</td>
			</tr>
			<tr>
				<td height="16"><img src="images/pw_box01_7.gif" width="16"
					height="16"></td>
				<td background="images/pw_box01_6.gif">&nbsp;</td>
				<td><img src="images/pw_box01_5.gif" width="16" height="16"></td>
			</tr>
		</table>
		<br>

		<!--include페이지를 묶어놓은 테이블-->
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td width="100%" valign="top" colspan="2"><jsp:include
					page="/totsys/common/inc/repoper/accept_page_list.jsp" flush="true" />
				</td>
			</tr>
			<% for(Iterator<Category> iter = categoryList.iterator(); iter.hasNext(); ) { %>
			<tr style="padding-top: 10px;">
				<td width="50%"><jsp:include
					page="/totsys/common/inc/board/whole/board_list.jsp" flush="true">
					<jsp:param name="boardGroupID" value="<%= iter.next().getId() %>" />
				</jsp:include></td>
				<td width="50%" style="padding-left: 17px;">
				<% if(iter.hasNext()) { %> <jsp:include
					page="/totsys/common/inc/board/whole/board_list.jsp" flush="true">
					<jsp:param name="boardGroupID" value="<%= iter.next().getId() %>" />
				</jsp:include> <% } else { %> &nbsp; <% } %>
				</td>
			</tr>
			<% } %>
		</table>
<!--test 진행 하는 것입니다. 끝-->
		<!--모우미 서브 메인 페이지 컨텐츠 끝--></td>
	</tr>
</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();
}
%>
