
<%
/************************************************************@@
  * Program Name	: accept_page_list.jsp
  * Description		: /
  * Author				: 조용준
  * Create Date		: 2004.11.09
  * History				:
@@************************************************************/
%>

<%@ page contentType="text/html; charset=UTF-8"
	import="java.util.Arrays" import="java.util.Date"
	import="java.util.List" import="java.util.Set"
	import="java.util.ResourceBundle" import="java.text.SimpleDateFormat"
	import="javax.jdo.PersistenceManager" import="javax.jdo.Transaction"
	import="javax.jdo.Query" import="kr.co.kihyun.beans.entity.*"
	import="kr.co.kihyun.beans.entity.util.*"
	import="kr.co.kihyun.beans.user.HttpSSOLogin"
	import="kr.co.kihyun.lang.Encoder" import="kr.co.kihyun.lang.MString"
	import="kr.co.kihyun.moumi.MoumiConfig"%>
<%
	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 wordLengthLimit = 19;

		tx.begin();

		MUser mUser = pm.getObjectById(MUser.class, usID);
		List<TotReport> reports = mUser.getUnwrittenReports(pm, null, null);
%>
<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><%= TotReportProcess.ACCEPT%><%=MoumiConfig.getMessageBundle().getString("moumi.message.doc") %></b>
		</td>
		<td width="25"><a
			href="/totsys/repoper/mydocbox/returnbox/report_list.jsp"> <img
			src="/totsys/common/images/more.jpg" alt="go" border="0"
			<%if(MoumiConfig.isOnTopMenu()){%>
			onclick="openTop(2);" <%}%>></a></td>
	</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td width="10" height="10"><img
			src="/totsys/common/images/p_box01_001.gif" width="10" height="10"></td>
		<td height="10" background="/totsys/common/images/p_box01_002.gif"></td>
		<td width="10" height="10"><img
			src="/totsys/common/images/p_box01_003.gif" width="10" height="10"></td>
	</tr>
	<tr>
		<td background="/totsys/common/images/p_box01_008.gif">&nbsp;</td>
		<td>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td>
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td height="1" bgcolor="EBEBEB"></td>
						<td bgcolor="EBEBEB"></td>
						<td bgcolor="EBEBEB"></td>
						<td bgcolor="EBEBEB"></td>
						<td bgcolor="EBEBEB"></td>
						<td bgcolor="EBEBEB"></td>
					</tr>
					<tr align="center">
						<td height="20" bgcolor="F4F4F4" class="f_11_ptl"><%=MoumiConfig.getMessageBundle().getString("moumi.message.doc") %>명</td>
						<td width="80" bgcolor="F4F4F4" class="f_11_ptl">집계자</td>
						<td width="80" bgcolor="F4F4F4" class="f_11_ptl">기관/부서</td>
						<td width="80" bgcolor="F4F4F4" class="f_11_ptl">시작일</td>
						<td width="80" bgcolor="F4F4F4" class="f_11_ptl">종료일</td>
						<td width="60" bgcolor="F4F4F4" class="f_11_ptl">비고</td>
					</tr>
				</table>
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
					<%
if(reports.size() >= 3){
	int blank=0;
	for(int i=0; i<3; i++, blank++){
		if(i==0){
		%>
					<tr>
						<td height="23"><img src="/totsys/totper/images/bu_002.gif"
							width="8" height="7" hspace="5"> <a
							href="/totsys/repoper/mydocbox/tempbox/report_regist.jsp?reportID=<%= reports.get(i).getId()%>"
							class="f_12_p_L"
							<%if(MoumiConfig.isOnTopMenu()){%>
							onclick="openTop(2);" <%}%>><%=MString.getEllipsis(reports.get(i).getTotDoc().getName(), wordLengthLimit)%><img
							src="/totsys/common/images/icon_new.gif" width="10" height="10"></a>
						</td>
						<td width="80" align="center" class="f_11_site"><%= reports.get(i).getTotDoc().getOwnerName(pm) %></td>
						<td width="80" align="center" class="f_11_site"><%= reports.get(i).getTotDoc().getDept(pm).getName() %></td>
						<td width="80" align="center" class="f_11_site"><%= new SimpleDateFormat("yyyy-MM-dd").format(reports.get(i).getTotDoc().getStartDate()) %></td>
						<td width="80" align="center" class="f_11_site"><%= new SimpleDateFormat("yyyy-MM-dd").format(reports.get(i).getTotDoc().getEndDate()) %></td>
						<td width="60" align="center" class="f_11_site">
						<%
						if(reports.get(i).getProcess() == TotReportProcess.RETURN){
							%> <%= TotReportProcess.RETURN%> <%
						}
						%>
						</td>
					</tr>
					<%
		}else if((blank%2)==0){
		%>
					<tr>
						<td height="23"><img src="/totsys/totper/images/bu_002.gif"
							width="8" height="7" hspace="5"> <a
							href="/totsys/repoper/mydocbox/tempbox/report_regist.jsp?reportID=<%= reports.get(i).getId()%>"
							class="f_12_p_L"
							<%if(MoumiConfig.isOnTopMenu()){%>
							onclick="openTop(2);" <%}%>><%=MString.getEllipsis(reports.get(i).getTotDoc().getName(), wordLengthLimit)%>
						</a></td>
						<td width="80" align="center" class="f_11_site"><%= reports.get(i).getTotDoc().getOwnerName(pm) %></td>
						<td width="80" align="center" class="f_11_site"><%= reports.get(i).getTotDoc().getDept(pm).getName() %></td>
						<td width="80" align="center" class="f_11_site"><%= new SimpleDateFormat("yyyy-MM-dd").format(reports.get(i).getTotDoc().getStartDate()) %></td>
						<td width="80" align="center" class="f_11_site"><%= new SimpleDateFormat("yyyy-MM-dd").format(reports.get(i).getTotDoc().getEndDate()) %></td>
						<td width="60" align="center" class="f_11_site">
						<%
						if(reports.get(i).getProcess() == TotReportProcess.RETURN){
							%> <%= TotReportProcess.RETURN%> <%
						}
						%>
						</td>
					</tr>
					<%
		}else{		
		%>
					<tr bgcolor="F4F4F4">
						<td height="23" bgcolor="F4F4F4"><img
							src="/totsys/totper/images/bu_002.gif" width="8" height="7"
							hspace="5"> <a
							href="/totsys/repoper/mydocbox/tempbox/report_regist.jsp?reportID=<%= reports.get(i).getId()%>"
							class="f_12_p_L"
							<%if(MoumiConfig.isOnTopMenu()){%>
							onclick="openTop(2);" <%}%>><%=MString.getEllipsis(reports.get(i).getTotDoc().getName(), wordLengthLimit)%>
						</a></td>
						<td width="80" align="center" class="f_11_ptl"><%= reports.get(i).getTotDoc().getOwnerName(pm) %></td>
						<td width="80" align="center" class="f_11_ptl"><%= reports.get(i).getTotDoc().getDept(pm).getName() %></td>
						<td width="80" align="center" class="f_11_ptl"><%= new SimpleDateFormat("yyyy-MM-dd").format(reports.get(i).getTotDoc().getStartDate()) %></td>
						<td align="center" class="f_11_site"><%= new SimpleDateFormat("yyyy-MM-dd").format(reports.get(i).getTotDoc().getEndDate()) %></td>
						<td align="center" class="f_11_site">
						<%
						if(reports.get(i).getProcess() == TotReportProcess.RETURN){
							%> <%= TotReportProcess.RETURN%> <%
						}
						%>
						</td>
					</tr>
					<%
		}
	}
}else{
	int blank=0;
	for(int i=0; i<reports.size(); i++, blank++){
		if(i==0){
		%>

					<tr>
						<td height="23"><img src="/totsys/totper/images/bu_002.gif"
							width="8" height="7" hspace="5"> <%if(reports.get(i).getProcess() == TotReportProcess.RETURN){%>
						<a
							href="/totsys/repoper/mydocbox/returnbox/return_report_modify.jsp?reportID=<%= reports.get(i).getId()%>"
							class="f_12_p_L"
							<%if(MoumiConfig.isOnTopMenu()){%>
							onclick="openTop(2);" <%}%>><%=MString.getEllipsis(reports.get(i).getTotDoc().getName(), wordLengthLimit)%>
						</a> <%}else if(reports.get(i).getProcess() == TotReportProcess.ACCEPT){%>
						<a
							href="/totsys/repoper/mydocbox/tempbox/report_regist.jsp?reportID=<%= reports.get(i).getId()%>"
							class="f_12_p_L"
							<%if(MoumiConfig.isOnTopMenu()){%>
							onclick="openTop(2);" <%}%>><%=MString.getEllipsis(reports.get(i).getTotDoc().getName(), wordLengthLimit)%>
						</a> <%}%> <img src="/totsys/common/images/icon_new.gif" width="10"
							height="10"></td>
						<td width="80" align="center" class="f_11_site"><%= reports.get(i).getTotDoc().getOwnerName(pm) %></td>
						<td width="80" align="center" class="f_11_site"><%= reports.get(i).getTotDoc().getDept(pm).getName() %></td>
						<td width="80" align="center" class="f_11_site"><%= new SimpleDateFormat("yyyy-MM-dd").format(reports.get(i).getTotDoc().getStartDate()) %></td>
						<td width="80" align="center" class="f_11_site"><%= new SimpleDateFormat("yyyy-MM-dd").format(reports.get(i).getTotDoc().getEndDate()) %></td>
						<td width="60" align="center" class="f_11_site">
						<%
						if(reports.get(i).getProcess() == TotReportProcess.RETURN){
							%> <%= TotReportProcess.RETURN%> <%
						}
						%>
						</td>
					</tr>
					<%
		}else if((blank%2)==0){
		%>
					<tr>
						<td height="23"><img src="/totsys/totper/images/bu_002.gif"
							width="8" height="7" hspace="5"> <%if(reports.get(i).getProcess() == TotReportProcess.RETURN){%>
						<a
							href="/totsys/repoper/mydocbox/returnbox/report_view.jsp?reportID=<%= reports.get(i).getId()%>"
							class="f_12_p_L"
							<%if(MoumiConfig.isOnTopMenu()){%>
							onclick="openTop(2);" <%}%>><%=MString.getEllipsis(reports.get(i).getTotDoc().getName(), wordLengthLimit)%>
						</a> <%}else if(reports.get(i).getProcess() == TotReportProcess.ACCEPT){%>
						<a
							href="/totsys/repoper/mydocbox/tempbox/report_regist.jsp?reportID=<%= reports.get(i).getId()%>"
							class="f_12_p_L"
							<%if(MoumiConfig.isOnTopMenu()){%>
							onclick="openTop(2);" <%}%>><%=MString.getEllipsis(reports.get(i).getTotDoc().getName(), wordLengthLimit)%>
						</a> <%}%>
						</td>
						<td width="80" align="center" class="f_11_site"><%= reports.get(i).getTotDoc().getOwnerName(pm) %></td>
						<td width="80" align="center" class="f_11_site"><%= reports.get(i).getTotDoc().getDept(pm).getName() %></td>
						<td width="80" align="center" class="f_11_site"><%= new SimpleDateFormat("yyyy-MM-dd").format(reports.get(i).getTotDoc().getStartDate()) %></td>
						<td width="80" align="center" class="f_11_site"><%= new SimpleDateFormat("yyyy-MM-dd").format(reports.get(i).getTotDoc().getEndDate()) %></td>
						<td width="60" align="center" class="f_11_site">
						<%
						if(reports.get(i).getProcess() == TotReportProcess.RETURN){
							%> <%= TotReportProcess.RETURN%> <%
						}
						%>
						</td>
					</tr>
					<%
		}else{		
		%>
					<tr bgcolor="F4F4F4">
						<td height="23" bgcolor="F4F4F4"><img
							src="/totsys/totper/images/bu_002.gif" width="8" height="7"
							hspace="5"> <%if(reports.get(i).getProcess() == TotReportProcess.RETURN){%>
						<a
							href="/totsys/repoper/mydocbox/returnbox/report_view.jsp?reportID=<%= reports.get(i).getId()%>"
							class="f_12_p_L"
							<%if(MoumiConfig.isOnTopMenu()){%>
							onclick="openTop(2);" <%}%>><%=MString.getEllipsis(reports.get(i).getTotDoc().getName(), wordLengthLimit)%>
						</a> <%}else if(reports.get(i).getProcess() == TotReportProcess.ACCEPT){%>
						<a
							href="/totsys/repoper/mydocbox/tempbox/report_regist.jsp?reportID=<%= reports.get(i).getId()%>"
							class="f_12_p_L"
							<%if(MoumiConfig.isOnTopMenu()){%>
							onclick="openTop(2);" <%}%>><%=MString.getEllipsis(reports.get(i).getTotDoc().getName(), wordLengthLimit)%>
						</a> <%}%>
						</td>
						<td width="80" align="center" class="f_11_site"><%= reports.get(i).getTotDoc().getOwnerName(pm) %></td>
						<td width="80" align="center" class="f_11_site"><%= reports.get(i).getTotDoc().getDept(pm).getName() %></td>
						<td width="80" align="center" class="f_11_site"><%= new SimpleDateFormat("yyyy-MM-dd").format(reports.get(i).getTotDoc().getStartDate()) %></td>
						<td align="center" class="f_11_site"><%= new SimpleDateFormat("yyyy-MM-dd").format(reports.get(i).getTotDoc().getEndDate()) %></td>
						<td align="center" class="f_11_site">
						<%
						if(reports.get(i).getProcess() == TotReportProcess.RETURN){
							%> <%= TotReportProcess.RETURN%> <%
						}
						%>
						</td>
					</tr>
					<%
		}
	}
	for(int i=0; i < (3-reports.size()); i++, blank++){
		if((blank%2)==0){
		%>
					<tr>
						<td height="23"><img src="/totsys/totper/images/bu_002.gif"
							width="8" height="7" hspace="5">&nbsp;</td>
						<td width="80" align="center" class="f_11_site">&nbsp;</td>
						<td width="80" align="center" class="f_11_site">&nbsp;</td>
						<td width="80" align="center" class="f_11_site">&nbsp;</td>
						<td width="80" align="center" class="f_11_site">&nbsp;</td>
						<td width="60" align="center" class="f_11_site">&nbsp;</td>
					</tr>
					<%
		}else{		
		%>
					<tr bgcolor="F4F4F4">
						<td height="23" bgcolor="F4F4F4"><img
							src="/totsys/totper/images/bu_002.gif" width="8" height="7"
							hspace="5">&nbsp;</td>
						<td width="80" align="center" class="f_11_site">&nbsp;</td>
						<td width="80" align="center" class="f_11_site">&nbsp;</td>
						<td width="80" align="center" class="f_11_site">&nbsp;</td>
						<td width="80" align="center" class="f_11_site">&nbsp;</td>
						<td width="60" align="center" class="f_11_site">&nbsp;</td>
					</tr>
					<%
		}
	}
}
%>

					<tr>
						<td height="8" colspan="3"></td>
					</tr>
				</table>
				</td>
			</tr>
		</table>
		</td>
		<td background="/totsys/common/images/p_box01_004.gif">&nbsp;</td>
	</tr>
	<tr>
		<td width="10" height="10"><img
			src="/totsys/common/images/p_box01_007.gif" width="10" height="10"></td>
		<td height="10" background="/totsys/common/images/p_box01_006.gif"></td>
		<td height="10"><img src="/totsys/common/images/p_box01_005.gif"
			width="10" height="10"></td>
	</tr>
</table>
<%
		tx.rollback();
	}catch(Exception e){
		e.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();
	}
%>
