
<%
/************************************************************@@
  * Program Name	: doc_view.jsp
  * Description		: /집계자/진행함/보고자료 보기
  * Author				: 강원중
  * Create Date		: 2004.10.11
  * History				:
@@************************************************************/
%>

<%@ page contentType="text/html; charset=UTF-8"
	import="java.net.URLEncoder"
	import="kr.co.kihyun.beans.user.HttpSSOLogin"
	import="kr.co.kihyun.lang.MLong" import="kr.co.kihyun.moumi.Moumi"
	import="kr.co.kihyun.moumi.doc.MDoc"
	import="kr.co.kihyun.beans.totsys.doc.Doc"
	import="kr.co.kihyun.beans.totsys.memo.MemoList"
	import="kr.co.kihyun.moumi.report.MReport"
	import="javax.jdo.PersistenceManager" import="javax.jdo.Transaction"
	import="kr.co.kihyun.beans.entity.util.*"
	import="kr.co.kihyun.beans.entity.*"%>

<%
PersistenceManager pm = new MPersistenceManager(PMF.get().getPersistenceManager());
Transaction tx = pm.currentTransaction();
try{
	/****** Parameter ******/
	Long reportID = MLong.parseLong(request.getParameter("reportID"));

	TotReport totReport = pm.getObjectById(TotReport.class, reportID);
%>

<%
session.setAttribute("reReportURI","opener.location='/totsys/totper/mydocbox/prssbox/reports/report_list.jsp?docID="+totReport.getTotDoc().getId()+"'");
%>


<%@page import="kr.co.kihyun.beans.entity.TotReport"%><HTML>
<HEAD>
<TITLE><%=Moumi.getTitle()%></TITLE>
<link rel="stylesheet" href="/totsys/common/css/kecttep.css"
	type="text/css">
<link rel="stylesheet" href="/totsys/common/css/tabs.css"
	type="text/css">
<script src="/totsys/common/js/rollover.js"></script>
<script src="/totsys/common/js/popup.js"></script>
<script language="javascript">
			function cancle(){
					reReportCan.submit();
			}
	
			function modify(){
				location.href="/totsys/sysadm/prssbox/doc_view.jsp?docID=<%= totReport.getTotDoc().getId() %>";
			}
	
			function formView(){
				location.href="/totsys/sysadm/prssbox/doc_form_view.jsp?docID=<%=totReport.getTotDoc().getId()%>";
			}
	
			function totReports(){
				location.href="/totsys/sysadm/prssbox/tot_reports/total_reports.jsp?docID=<%= totReport.getTotDoc().getId() %>";
			}
	
			function totReport(){
				location.href="/totsys/sysadm/prssbox/tot_report/total_report.jsp?docID=<%= totReport.getTotDoc().getId() %>";
			}

			function printReport() {
				var uri = '/totsys/common/inc/documents/report/report_view_print.jsp?reportID=<%=reportID%>';
				sendReport = getOpener(uri, 'sendReport', 600, 650, 'center', 'middle', 'yes', 'yes');
				sendReport.focus();
			}
		</SCRIPT>
</HEAD>

<body style='' BGCOLOR="#FFFFFF" LEFTMARGIN="0" TOPMARGIN="0"
	MARGINWIDTH="0" MARGINHEIGHT="0">
<FORM name="reReportCan"
	action="/servlet/kr.co.kihyun.beans.totsys.totper.HttpReReportCancle"
	method="post"><INPUT type="hidden" name="reportID"
	value="<%= reportID %>"></FORM>

<div>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<jsp:include page="/totsys/common/inc/totper/top/top.jsp" flush="true" />
	<jsp:include page="/totsys/common/inc/title/title.jsp" flush="true" />
</table>
</div>

<div id="header">
<ul id="primary">
	<li><a href="#" onclick="modify();">기본정보</a></li>
	<li><a href="#" onclick="formView();">양식정보</a></li>
	<li><span class="kecttep_menu_focous">제출현황</span></li>
	<li><a href="#" onclick="totReports();">집계현황</a></li>
	<li><a href="#" onclick="totReport();">집계표</a></li>
</ul>
</div>

<div id="main">
<div id="contents">

<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr valign="bottom" class="toolbar">
		<td align="left">
		<table border="0" cellpadding="0" cellspacing="0">
			<tr>
				<%
							MemoList ml = new MemoList();
							tx.begin();
							int cnt = ml.contentsNull("555",totReport.getTotDoc().getId(),totReport.getDept(pm).getId(),MReport.RETURN,totReport.getUser(pm).getId());
							if( cnt == 0 ){
						%>
				<td><a href="#"
					onclick="window.open('/totsys/memo/rereport/pop_rereport.jsp?docID=<%=totReport.getTotDoc().getId()%>&deptID=<%=totReport.getDept(pm).getId()%>&userID=<%= totReport.getUser(pm).getId() %>','rereport','width=601, height=300,toolbar=no, directories=no, status=no, menubar=no, resizable=no');"><img
					src="/totsys/common/images/bt_return.gif" border="0"></a></td>
				<%	}else{	%>
				<td align="right"><a href="#" onclick="javascript:cancle();"><img
					src="/totsys/common/images/return.gif" border="0"></a></td>
				<%	}
							tx.rollback();
						%>

				<td width="3"></td>
				<td><a
					href="/totsys/common/inc/documents/report/report_view_excel.jsp?reportID=<%= reportID %>"
					target="_parent"><img
					src="/totsys/common/images/bt_excel_save.gif" border="0"></a></td>
				<td width="3"></td>
				<td><a href="#"><img onclick="printReport();"
					src="/totsys/common/images/bt_print.gif" border="0"></a></td>
			</tr>
		</table>
		</td>
	</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr height="10">
		<td height="10"></td>
		<td></td>
		<td width="149"></td>
		<td width="331"></td>
	</tr>

	<!---- 보고자 정보 시작---->
	<jsp:include page="/totsys/common/inc/totper/tot_repoper.jsp"
		flush="true">
		<jsp:param name="reportID" value="<%= reportID %>" />
	</jsp:include>
	<!---- 보고자 정보 끝 ---->

	<tr height="10">
		<td height="10"></td>
		<td></td>
		<td></td>
		<td></td>
	</tr>

	<!---- 재보고 사유 시작 ---->
	<% tx.begin(); %>
	<jsp:include page="/totsys/common/inc/memo/reReport_Contents.jsp"
		flush="true">
		<jsp:param name="docID" value="<%= totReport.getTotDoc().getId() %>" />
		<jsp:param name="groupID" value="555" />
		<jsp:param name="prss" value="<%=MReport.RETURN%>" />
		<jsp:param name="deptID" value="<%=totReport.getDept(pm).getId()%>" />
		<jsp:param name="userID" value="<%= totReport.getUser(pm).getId() %>" />
	</jsp:include>
	<% tx.rollback(); %>
	<!------ 재보고 사유 끝 ----->

	<!---- 보고내용 시작---->
	<tr>
		<td colspan="4"><jsp:include
			page="/totsys/common/inc/documents/report/report_view.jsp"
			flush="true">
			<jsp:param name="reportID" value="<%= reportID %>" />
		</jsp:include></td>
	</tr>
	<!---- 보고내용 끝---->
</table>
</div>
</div>

<!------------------------------- top menu start ------------------------------->
<%@ include file="/totsys/common/inc/buttom/buttom.jsp"%>
<!------------------------------- top menu end ------------------------------->
</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();
}
%>
