WF_EXPORT_DATA.jsp 6.06 KB
Newer Older
Thitichaipun Wutthisak committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
<%@page contentType="text/html; charset=UTF-8"%>
<%@page import="com.csc.library.entry.*,com.csc.library.system.*,com.csc.library.session.*,com.csc.library.utilities.*,com.csc.library.components.*,com.csc.library.databean.util.wfexport.*"%>
<%@page import="java.util.*,java.io.*"%>
<%@page import="com.csc.library.util.download.*"%>
<jsp:useBean id="WF_EXPORT_DATA" scope="page" class="com.csc.library.system.Task"/>
<%
	WF_EXPORT_DATA.setChannel(request ,response);
	UIManager screen=(UIManager) WF_EXPORT_DATA.process("SingleEntry","PRU1089");

	if( request.getParameter("export_file") != null && request.getParameter("export_file").equals("true") ){
		ExportWfCommandLine command_line = new ExportWfCommandLine();
		command_line.setUProfile(screen.getUProfile());
		String file = command_line.exportData();
		if( file.length() > 0 ){
			try{
				ThaiUtilities tu = new ThaiUtilities();
				String filePath = file;
				File f = new File(tu.ASCII2Unicode(filePath));
				String fileName = f.getName();
				String fileType = fileName.substring(fileName.indexOf(".")+1,fileName.length());
				if ( f.exists() && f.canRead() ) {
					response.setContentType("application/octet-stream");
					response.setHeader("Content-Disposition", "attachment; filename="+tu.Unicode2ASCII(f.getName()));
					//response.setHeader("cache-control", "no-cache");
					response.setContentLength((int) f.length());
					BufferedInputStream fileInput = new BufferedInputStream(new FileInputStream(f));
					byte buffer[] = new byte[8 * 1024];
					out.clearBuffer();
					OutputStream out_s = response.getOutputStream();
					CopyStreams.copyStreamsWithoutClose(fileInput, out_s, buffer);
					out_s.flush();
					out_s.close();
					fileInput.close();
				}
			}catch(Exception e){
				//e.printStackTrace();
			}
		}
	}
%>

<html ng-app="myHR">
<head>
<LINK HREF="../CSS/MYNOTE.css" REL="stylesheet" TYPE="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<SCRIPT TYPE='text/JavaScript' SRC='../JS/MYNOTE_SCREEN.js'></SCRIPT>
		<SCRIPT TYPE='text/JavaScript' SRC='../JS/MYNOTE_MENU.js'></SCRIPT>
<script type='text/javascript' src='../JS/SCREEN.js'></script>
<script language='javascript'>setLang('<%=screen.getUProfile().get("lang")%>');</script>
<script language="javascript">getTitleName();</script>
<script src="../JS/VIEWCALENDAR.js"></script>

<script language="JavaScript" type="text/JavaScript">

function exportData(){
	with(document.cscform){
		export_file.value = "true";
		submit();
	}
}

</script>
<title>Export  File : Business Process Management Service</title></head>
	<BODY BGCOLOR=#FFFFFF>
				<div align="center">
<form name="cscform" method="post" action="WF_EXPORT_DATA.jsp">


<!----------BEGIN CSC INITIAL ZONE ------------------------>

<%=screen.InitialVariable()%>

<!----------END CSC INITIAL ZONE -------------------------->

<script language="javascript">getInputFormatDate();</script>
	<input name="__cmd" type="hidden" value="">
	<input name="__screen" type="hidden" value="WF_EXPORT_DATA">
	<input name="__calendar" type="hidden">
	<input name="__notNull" type="hidden" value="">
	<input name="__help" type="hidden" >
	<input name="__fixCon" type="hidden" >
	<input name="__ack" type="hidden" value="">
	<input name="__language" type="hidden" value="<%=screen.getUProfile().get("lang")%>">
	<input name="export_file" type="hidden" value="">
			<TABLE WIDTH="950" BORDER="0" ALIGN="center" CELLPADDING="0" CELLSPACING="0">
				<jsp:include page="../MYNOTE_HEAD.jsp" flush="true"/>
					<DIV ALIGN="right">
			    		<DIV ALIGN="right">
                        <BR>

								<TABLE WIDTH="100%" BORDER="0" ALIGN="center" CELLPADDING="0" CELLSPACING="0">
            		    		<TR>
	                		  		<TD WIDTH="5" HEIGHT="5"><IMG SRC="../IMAGES/MYNOTE/C-T-L.gif" WIDTH="5" HEIGHT="5"></TD>
    	              				<TD HEIGHT="5"><IMG SRC="../IMAGES/MYNOTE/T.gif" WIDTH="100%" HEIGHT="5"></TD>
        	          				<TD WIDTH="5" HEIGHT="5"><IMG SRC="../IMAGES/MYNOTE/C-T-R.gif" WIDTH="5" HEIGHT="5"></TD>
		    	            	</TR>
    		    	        	<TR>
        		    	      		<TD WIDTH="5" BACKGROUND="../IMAGES/MYNOTE/L2.gif"><font color="#FFFFFF"></font></TD>
            		    	  		<TD VALIGN="middle"><FONT FACE="MS Sans Serif" SIZE="1" COLOR="#FFFFFF">

          					<TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="txt01" align="center">
									<TR BGCOLOR="#FFFFFF">
									<TD COLSPAN="2" BGCOLOR="#0099CC" CLASS="style3"><FONT FACE="MS Sans Serif" SIZE="2" COLOR="#FFFFFF"><B>&nbsp;
									<span swlang code='SW003556'>Export Data</span> :</B></FONT> </TD>
									</TR>
                                    <TR BGCOLOR="#EFEFEF">
                                    <td>&nbsp;</td>
                                    </TR>

      						<TR BGCOLOR="#EFEFEF">
								<TD><DIV ALIGN="center"><A HREF="javascript:exportData();"><IMG SRC="../IMAGES/MYNOTE/BUTTON/BUTTON_EXPORT.gif" WIDTH="89" HEIGHT="37" BORDER="0"></A></DIV></TD>
      						</TR>
                                     <TR BGCOLOR="#EFEFEF">
                                    <td>&nbsp;</td>
                                    </TR>
      					</TABLE>

									 </FONT> </TD>
                                  <TD WIDTH="5" BACKGROUND="../IMAGES/MYNOTE/R2.gif"><FONT COLOR="#FFFFFF"></FONT></TD>
		        	        	</TR>
        		    		   	<TR>
                		  			<TD WIDTH="5" HEIGHT="5"><IMG SRC="../IMAGES/MYNOTE/C-B-L.gif" WIDTH="5" HEIGHT="5"></TD>
		                  			<TD HEIGHT="5"><IMG SRC="../IMAGES/MYNOTE/B.gif" WIDTH="100%" HEIGHT="5"></TD>
	    		              		<TD WIDTH="5" HEIGHT="5"><IMG SRC="../IMAGES/MYNOTE/C-B-R.gif" WIDTH="5" HEIGHT="5"></TD>
    	        		    	</TR>
                                <TR><TD>&nbsp;</TD>
                                </TR>
		        	      	</TABLE>
				    	</DIV>
	      			</DIV>
				</td>
					<TD VALIGN="top" BACKGROUND="../IMAGES/MYNOTE/BPM_07.jpg">&nbsp;</TD>
				</TR>
				<TR>
					<TD COLSPAN="2" HEIGHT="20" BACKGROUND="../IMAGES/MYNOTE/BPM_09.jpg"><DIV ALIGN="center"> <SPAN CLASS="txt02">&nbsp;</SPAN></DIV></TD>
				</TR>
			</TABLE>

		</FORM>
		</div>
	</BODY>
</HTML>