<%@page contentType="text/html; charset=UTF-8"%>
<%@page import="java.util.*,java.io.*"%>
<%@page import="com.csc.library.util.download.*"%>
<%@page import="com.csc.library.util.ManageDocument"%>
<%@page import="com.csc.library.databean.util.FileUtil"%>
<%@page import="com.csc.library.approve.*,com.csc.library.databean.*"%>
<%@page import="com.csc.library.entry.*,com.csc.library.utilities.*"%>
<%@page import="com.csc.library.session.*"%>
<%@page import="com.csc.library.dwr.*"%>

<%request.setCharacterEncoding("UTF-8");%>

<!-- Begin useBean -->

<jsp:useBean id="TEMPLATE_WORKFLOW" class="com.csc.library.system.Task" scope="page"/>
<jsp:setProperty name="TEMPLATE_WORKFLOW" property="classauthen" value="WorkflowUIAuthen" />

<%
TEMPLATE_WORKFLOW.setChannel(request,response);
TEMPLATE_WORKFLOW.checkProfile();

if( TEMPLATE_WORKFLOW.getUProfile() != null ){
	TEMPLATE_WORKFLOW.getUProfile().set("appname","PSN");
	UIManager screenSingle = (UIManager) TEMPLATE_WORKFLOW.process("SingleEntry","TEMPLATE_WORKFLOW");

	/*boolean isStep1 = false;
	boolean isStep2 = false;
	boolean isStep3 = false;
	boolean isStepCancel = false;
	boolean isStepComment = false;
	boolean isStepReturn = false;
	boolean isStepCopy = false;*/
	String lang = screenSingle.getUProfile().get("lang");
	String wf = null;
	CheckNull chkNull = new CheckNull();
	Organization og = new Masfactor(screenSingle.getUProfile());
	String subject = null;
	String remark = null;
	String step_type = null;
	String emp_fullname = null;
	String bossid = og.getBoss(screenSingle.getUProfile().get("employeeid"),screenSingle.getUProfile().get("job")).get(0).toString();
	String bossjob = bossid.substring(bossid.indexOf(":")+1);
	CscCalendar calendar = new CscCalendar();
	long attach_time = Long.parseLong(chkNull.chkNullString(request.getParameter("attach_time"),String.valueOf(calendar.getTimeInMillis())));
	ManageDocument md = new ManageDocument();
	md.setUProfile(screenSingle.getUProfile());
	md.setRequest(request);
	md.setScreen(screenSingle);

	if( !chkNull.chkNullString(request.getParameter("__cmd")).equals("save") ){
		subject = chkNull.chkNullString(request.getParameter("subject"));
		remark = chkNull.chkNullString(request.getParameter("__remark"));
		emp_fullname = chkNull.chkNullString(request.getParameter("emp_fullname"));
	}else if( chkNull.chkNullString(request.getParameter("__cmd")).equals("save") ){
		/*if( chkNull.chkNullString(request.getParameter("__checkPage")).equals("true") ){
			response.sendRedirect("../MYNOTE/SENT_COMPLETE.jsp");
		}else{
			response.sendRedirect("../MYNOTE/INBOX.jsp");
		}*/
			if(chkNull.chkNullString(request.getParameter("isAdminEdit")).equals("true")){
			response.sendRedirect("../WORKFLOW_ADMIN/ADMIN_EDIT.jsp");
		}else if(chkNull.chkNullString(request.getParameter("isAdminCancel")).equals("true")){
			response.sendRedirect("../WORKFLOW_ADMIN/ADMIN_CANCEL.jsp");
		}else	if(chkNull.chkNullString(request.getParameter("isAdminClean")).equals("true")){
			response.sendRedirect("../WORKFLOW_ADMIN/ADMIN_CLEAN.jsp");
		}else if(chkNull.chkNullString(request.getParameter("isAdminDelete")).equals("true")){
			response.sendRedirect("../WORKFLOW_ADMIN/ADMIN_DELETE.jsp");
		}else{
			response.sendRedirect("../MYNOTE/SENT_COMPLETE.jsp");
		}
		//response.sendRedirect("../MYNOTE/SENT_COMPLETE.jsp");
	}else{
		subject = "";
		remark = "";
		emp_fullname = "";
	}

	bossid = bossid.substring(0,bossid.indexOf(":"));
	DbRecord memployee_dr = new InitialRecord(screenSingle.getUProfile()).getDbRecord("Memployee");
	memployee_dr.setColumn("*");
	memployee_dr.set("COMPANYID",screenSingle.getUProfile().get("companyid"));
	memployee_dr.set("EMPLOYEEID",bossid);
	memployee_dr.search();

	if( (request.getParameter("__runno") == null || request.getParameter("__runno").equals("")) &&
		(request.getParameter("__help") == null || request.getParameter("__help").equals("")) ){
		screenSingle.clean();
	}

	if( (!screenSingle.getDataLabel("WF_STATUS").equals("1")) && (!screenSingle.getDataLabel("WF_STATUS").equals("4")) &&
		(!screenSingle.getDataLabel("WF_STATUS").equals("7")) ){
		wf = "false";
	}else{
		wf = "true";
	}

	if( request.getParameter("downfile") != null ){
		ThaiUtilities tu = new ThaiUtilities();
		String filePath = request.getParameter("downfile");
		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();
		}
	}
%>
<!-- End useBean -->

<HTML ng-app="myHR">
	<HEAD>
		<TITLE>myNOTE : Business Process Management Service</TITLE>
		<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
		<!-- Begin Link -->
		<LINK HREF="../CSS/MYNOTE.css" REL="stylesheet" TYPE="text/css">
		<LINK HREF="../CSS/MYNOTE_MENU.css" REL="stylesheet" TYPE="text/css">
		<!-- End Link -->
		<!-- Begin Import Script -->
		<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 src="../JS/angular-1.3.15/angular.js" type="text/javascript"></script>
		<script src="../JS/ANGULAR/SCREEN_ANGULAR.js" type="text/javascript"></script>
		<SCRIPT TYPE='text/JavaScript' SRC='../JS/DATEINPUT.js'></SCRIPT>
		<SCRIPT TYPE='text/JavaScript' SRC='../JS/VIEWCALENDAR.js'></SCRIPT>
		<SCRIPT TYPE='text/JavaScript' SRC='../JS/ICONSMENU.js'></SCRIPT>
		<SCRIPT LANGUAGE="JavaScript">setLang('<%=screenSingle.getUProfile().get("lang")%>');</SCRIPT>
		<!-- End Import Script -->
		<!--DWR INCLUDE-->
		<script type='text/javascript' src='/hr/dwr/interface/SearchDWR.js'></script>
		<script type='text/javascript' src='/hr/dwr/engine.js'></script>
		<script type='text/javascript' src='/hr/dwr/util.js'></script>
		<script type="text/javascript" src="/hr/dwr/interface/SystemCode.js"></script>
		<script type="text/javascript" src="/hr/dwr/interface/CscCalendar.js"></script>
		<script type="text/javascript" src="/hr/dwr/interface/Tchangeshift_nstda_dwr.js"></script>
        <script type="text/javascript" src="/hr/dwr/interface/Tchholiday_dwr.js"></script>

		<!--DWR INCLUDE-->
		<SCRIPT LANGUAGE="JavaScript" TYPE="text/JavaScript">
		<!--
			function preGoWF(){
				with( document.cscform ){
					if(__wf__document_number.value){
						setMailConfigWorkflow();
						GoWF();
					}else{
						alert(MyCode[49]);
						__wf__document_number.focus();
					}
				}
			}

			/* check condition is correct before submit form */
			function matchCondition(){
				with(document.cscform){
					if(__isHolidayOK.value == "true" && __isWorkdayOK.value == "true"){
						return true;
					}else{
						return false;
					}
				}
			}

			function chkAdjtime(){
				Tchholiday_dwr.chkChHoliday(new Array(document.cscform.__wf__employeeid.value,document.cscform.__wf__change_date2.value,document.cscform.__wf__change_date1.value),{callback:
					function(data){
						if(data){
							GoWF();
						}else{
							document.cscform.imgSubmit.style.display = "";
							document.cscform.__chkHoliday.value = false;
							var error_mes = "Can Not Change Day Off DetailsBecause This Day is Request Leave or OT";
							if(document.cscform.__language.value == "tha"){ error_mes = "ไม่สามารถเปลี่ยนวันหยุดได้ เนื่องจากได้มีการลา หรือ มีการขอโอที ในวันดังกล่าวแล้ว";}
							alert(error_mes);
							return false;
						}
					},async:true});
			}

			function openHelp(){
				with( document.cscform ){
					window.open("../TA/HELP/Leave.pdf","Help","left=150,top=150,width=700,height=570,toolbar=no,status=yes,scrollbars=yes,resizable=yes");
				}
			}

			function goHelp(helpName,inputName,condition){
                with( document.cscform ){
                    var helpReturn;
                    var temp;
                    if( inputName == "sendto" ){
                        temp = __fixCon.value;
                        //__fixCon.value="job='"+condition+"'";
                        if( condition.indexOf(",") > -1 ){
                            condition = condition.replace(/,/g,"','");
                        }
                        __fixCon.value="EMPLOYEEID IN ('"+condition+"')";
                        helpReturn="wf_next_actor:EMPLOYEEID,sendto:MEMPLOYEE@FULLNAME";
                        linkHelp_SendToReturn(helpName,helpReturn);
                        __fixCon.value=temp;
                    }else if( inputName == "cc" ){
                        temp = __fixCon.value;
                        helpReturn="wf_cc_actor:EMPLOYEEID,cc:MEMPLOYEE@FULLNAME";
                        linkHelp_CCReturn(helpName,helpReturn);
                        __fixCon.value=temp;
                    }else if( inputName=="__employeeid" ){
                        temp = __fixCon.value;
                        helpReturn="__employeeid:EMPLOYEEID,MEMPLOYEE@FULLNAME,emp_fullname:MEMPLOYEE.FULLNAME";
                        linkHelp_Return2(helpName,helpReturn);
                        __fixCon.value=temp;
                    }else if( inputName == "docno" ){
						var filter = "initiator ='<%=TEMPLATE_WORKFLOW.getUProfile().get("employeeid")%>' and wf_status='4' and wf_id!='2559' ";
                        temp = __fixCon.value;
                        helpReturn="__wf__document_number:doc_no";
                        linkHelp_Return(helpName, helpReturn, filter);
                        __fixCon.value=temp;
                    }
                }
            }

            function linkHelp_SendToReturn(help,input){
                with( document.cscform ){
                    var param = "BROWSE_USER.jsp?__helpName="+help+"&__helpReturn="+input+"&__pageCall="+__screen.value+"&__fixCon="+__fixCon.value+"&__checkVerify=off&__langOn=off";
                    window.open(param,"Help","left=150,top=150,width=530,height=370,toolbar=no,status=yes,scrollbars=yes,resizable=yes");
                }
            }
            function linkHelp_CCReturn(help,input){
                with( document.cscform ){
                    var param = "BROWSE_USER.jsp?__helpName="+help+"&__helpReturn="+input+"&__pageCall="+__screen.value+"&__fixCon="+__fixCon.value+"&__checkVerify=off&__langOn=off&wf_id=2559";
                    window.open(param,"Help","left=150,top=150,width=530,height=510,toolbar=no,status=yes,scrollbars=yes,resizable=yes");
                }
            }
            function linkHelp_Return2(help,input){
                with( document.cscform ){
                    var param="BROWSE_HELP.jsp?__helpName="+help+"&__helpReturn="+input+"&__pageCall="+__screen.value+"&__fixCon="+__fixCon.value+"&__checkVerify=off&__langOn=off";
                    window.open(param,"Help","left=150,top=150,width=530,height=370,toolbar=no,status=yes,scrollbars=yes,resizable=yes");
                }
            }


			function linkHelp_Return_CallFunction(help,input,newFunction){
				with( document.cscform ){
					var param="BROWSE_TIMEHELP.jsp?__helpName="+help+"&__helpReturn="+input+"&__pageCall="+__screen.value+"&__fixCon="+__fixCon.value+"&__checkVerify=off&__langOn=off&__callFunction="+newFunction;
					window.open(param,"Help","left=150,top=150,width=530,height=370,toolbar=no,status=yes,scrollbars=yes,resizable=yes");
				}
			}

			function linkHelpWF(help,input){
				with(document.cscform){
					var temp = __fixCon.value;
					var fix = "wf_id='"+wf_id.value+"' and wf_ver='"+wf_ver.value+"' and initiator='<%=screenSingle.getUProfile().get("actor")%>' and (wf_status<>'6' and wf_status<>'3' and wf_status<>'8' and wf_status<>'A' and wf_status<>'B' and wf_status<>'')";
					var param="BROWSE_HELP.jsp?__helpName="+help+"&__fieldSearch="+input+"&__pageCall="+__screen.value+"&__fixCon="+fix;
					window.open(param,"Help","left=150,top=150,width=530,height=370,resizable=yes,scrollbars=yes,toolbar=no,status=yes");
					__fixCon.value = temp;
				}
			}

		function chk_Time(){
			var count=0;
				with( document.cscform ){
				for (j=0;j<elements.length; j++){
					if(elements[j].name.indexOf("__wf__change_date1") > -1){
						if(!isValidDate(elements[j].value)){
							count+=1;
							elements[j].focus();
							elements[j].select();
							break;
						}
					}
					if(elements[j].name.indexOf("__wf__change_date2") > -1){
						if(!isValidDate(elements[j].value)){
							count+=1;
							elements[j].focus();
							elements[j].select();
							break;
						}
					}
				}//for
				if(count>0){
					return false;
				}else{
					return true;
				}
			}
		}

		function chk_Time2(){
			with(document.cscform){
				return dateDifference(eval("__wf__change_date1.value"),eval("__wf__change_date2.value"));
			}
		}

		function viewPages(helppage){
				 var  pam=helppage+".jsp?__fixCon=employeeid='<%= TEMPLATE_WORKFLOW.getUProfile().get("employeeid") %>'";
				window.open(pam,"Help","left=150,top=150,width=800,height=500,toolbar=no,status=yes,scrollbars=yes");
		}
		function goPages(helppage,welid,budid){
			 var  pam=helppage+".jsp?__fixCon=welid='"+welid+"' and budyear = '"+budid+"' and employeeid='<%= TEMPLATE_WORKFLOW.getUProfile().get("employeeid") %>'";
			window.open(pam,"Help","left=150,top=150,width=700,height=500,toolbar=no,status=yes,scrollbars=yes");
		}

		function goView() {
			with(document.cscform){
				Tchangeshift_nstda_dwr.getDWRData(new Array(__wf__employeeid.value,__wf__change_date1.value,__wf__change_date2.value,__wf__old_shift.value,__wf__change_date2.value),{callback:
					function(data){
						view.innerHTML=data;
					},async:true});
			}
		}

		function searchEmp(){
			//condition = " and employeeid in ("+document.cscform.__subordinate.value+")";
			condition ="";
			//searchDescEmp(eval('document.cscform.__wf__employeeid'), 'memployee.fullname:MEMPLOYEE@FULLNAME,mposition.tdesc:__position,mbu1.tdesc:__bu1,mbu2.tdesc:__bu2,mbu3.tdesc:__bu3,mbu4.tdesc:__bu4,mbu5.tdesc:__bu5,memployee.startdate:__startdate,memployee.tel_ext:__tel_ext', condition);
			//realShift();
		}



		function chkIsHoliday(date, isBoolean){
			var imgSubmit = document.getElementById("imgSubmit");
			with(document.cscform){
				imgSubmit.style.display = "none";
				Tchangeshift_nstda_dwr.isHoliday(new Array(__wf__employeeid.value,date.value),{callback:
					function(data){
						if(data == isBoolean){
							imgSubmit.style.display = "";
							__wf__chkHoliday.value = true;

							/* update condition before submit */
							if(isBoolean){
								__isHolidayOK.value = "true";
							}else{
								__isWorkdayOK.value = "true";
							}

							return true;
						}else{
							imgSubmit.style.display = "";
							__wf__chkHoliday.value = false;
							alert(swap2String("Can't Change"));

							if(isBoolean){
								__isHolidayOK.value = "false";
							}else{
								__isWorkdayOK.value = "false";
							}
							return false;
						}
					},async:true});
			}
		}

		function setMailConfigWorkflow(){
				  with(document.cscform){
					  var date , month , year;
					  var now =  new Date();
					  date =  now.getDate();
					  month = now.getMonth()+1;
					  year = now.getFullYear();
					  date = (date <10)?('0'+date):date;
					  month = (month<10)?('0'+month):month;
		 	           __wf__start_doc_date.value = date+'/'+month+'/'+year;
					 // alert(__wf__start_doc_date.value );
				  }
			}

	//-->
		</SCRIPT>
		<script type="text/javascript" src="../JS/jquery-1.3.2.min.js"></script>
		<script type="text/javascript" >
			$(function(){
				$(".column-label").css("width","25%");
			});
		</script>
		<script type="text/javascript">
			$(function(){
				$("td.column-label").css("width","25%");
			});
			var hideIframeHeader = function(){
				$("#docIframe").contents().find("body > :first-child").addClass("force-hide");
			};
			setTimeout(hideIframeHeader, 2000);

			var callback_actor_url = function(data){
				console.log(data);
				$("#docIframe").attr('src',data+'&__singledisabled=true&__readonly=true&__cancellation=true');
				setTimeout(hideIframeHeader, 2000);
			};

			function setIframe(){
				var wf_id = document.cscform.__wf__document_number.value;
				SearchDWR.search1(["actor_parameter", "actor_url", "doc_no = '"+wf_id+"' and actor_seq_no ='1' ", "actor_seq_no", "langon"], callback_actor_url);
			}
			function postReturn(){
				setIframe();
			}
	</script>
	</HEAD>
	<BODY>
	<jsp:include page="../MYNOTE_HEAD.jsp" flush="true"/>
	<div align="center">
	<!--<div align="center" name="wf_detail">-->
	<!-- ImageReady Slices (02.psd) -->
		<FORM NAME="cscform" METHOD="post" ACTION="WF2559.jsp">
			<INPUT TYPE="hidden" NAME="__screen" VALUE="WF2559">
			<INPUT TYPE="hidden" NAME="__cmd" VALUE="">
			<INPUT TYPE="hidden" NAME="__help" VALUE="">
			<INPUT TYPE="hidden" NAME="__fixCon" VALUE="">
			<INPUT TYPE="hidden" NAME="__notNull" VALUE="<%=screenSingle.getRequire()%>">
			<INPUT TYPE="hidden" NAME="__language" VALUE="<%=screenSingle.getUProfile().get("lang")%>">
			<INPUT TYPE="hidden" NAME="__companyid" VALUE="<%=screenSingle.getUProfile().get("companyid")%>">
			<INPUT TYPE="hidden" NAME="__calendar" VALUE="">

			<SCRIPT LANGUAGE="JavaScript">getInputFormatDate();</SCRIPT>

			<INPUT TYPE="hidden" NAME="wf_id" VALUE="8013">
			<INPUT TYPE="hidden" NAME="__wf_id" VALUE="8013">
			<INPUT TYPE="hidden" NAME="wf_ver" VALUE="<%=chkNull.chkNullString(request.getParameter("wf_ver"),"1")%>">
			<INPUT TYPE="hidden" NAME="__wf_ver" VALUE="<%=chkNull.chkNullString(request.getParameter("__wf_ver"),"1")%>">
			<INPUT TYPE="hidden" NAME="wf_seq_no" VALUE="<%=chkNull.chkNullString(request.getParameter("wf_seq_no"),"0")%>">
			<INPUT TYPE="hidden" NAME="step_id" VALUE="<%=chkNull.chkNullString(request.getParameter("step_id"),"0")%>">
			<INPUT TYPE="hidden" NAME="step_seq_no" VALUE="<%=chkNull.chkNullString(request.getParameter("step_seq_no"),"0")%>">
			<INPUT TYPE="hidden" NAME="wf_return_actor" VALUE="IINIT">
          <input type="hidden" name="__oldDocumentID" value="<%=(!screenSingle.getDataLabel("DOC_NO").equals("0")?screenSingle.getDataLabel("DOC_NO"):chkNull.chkNullString(request.getParameter("__oldDocumentID"),"0"))%>">
		  <input type="hidden" name="__oldWF" value="<%=(!screenSingle.getDataLabel("DOC_NO").equals("0")?screenSingle.getDataLabel("WF_STATUS"):chkNull.chkNullString(request.getParameter("__oldWF"),"0"))%>">

			<INPUT TYPE="hidden" NAME="__wf" VALUE="<%=wf%>">
			<INPUT TYPE="hidden" NAME="__wfcmd" VALUE="false">
			<INPUT TYPE="hidden" NAME="remark" VALUE="<%=remark%>">
			<INPUT TYPE="hidden" NAME="wf_default_actor" VALUE="true">

			<INPUT TYPE="hidden" NAME="draft_cmd" VALUE="">
			<INPUT TYPE="hidden" NAME="draft_no" VALUE="<%=chkNull.chkNullString(request.getParameter("draft_no"),"0")%>">
			<INPUT TYPE="hidden" NAME="admin_cmd" VALUE="">
			<INPUT TYPE="hidden" NAME="__checkPage" VALUE="true">

			<!-- Redirect Page -->
			 <INPUT TYPE="hidden" NAME="isAdminEdit" VALUE="<%=chkNull.chkNullString(request.getParameter("isAdminEdit"))%>">
			 <INPUT TYPE="hidden" NAME="isAdminCancel" VALUE="<%=chkNull.chkNullString(request.getParameter("isAdminCancel"))%>">
			 <INPUT TYPE="hidden" NAME="isAdminClean" VALUE="<%=chkNull.chkNullString(request.getParameter("isAdminClean"))%>">
			 <INPUT TYPE="hidden" NAME="isAdminDelete" VALUE="<%=chkNull.chkNullString(request.getParameter("isAdminDelete"))%>">

			<!-- used for checking condition is correct -->
			 <INPUT TYPE="hidden" NAME="__isHolidayOK" VALUE="<%=chkNull.chkNullString(request.getParameter("__isHolidayOK"))%>">
			 <INPUT TYPE="hidden" NAME="__isWorkdayOK" VALUE="<%=chkNull.chkNullString(request.getParameter("__isWorkdayOK"))%>">

			<%=screenSingle.InitialVariable()%>

			<DIV ID="toolTipLayer" STYLE="position:absolute; visibility: hidden"></DIV>
			<SCRIPT LANGUAGE="JavaScript">initToolTips();</SCRIPT>

			<TABLE WIDTH=950 BORDER=0 ALIGN="center" CELLPADDING=0 CELLSPACING=0 id="wrapper">
						<DIV ALIGN="right">
<%=md.getStepDocument("8013","1")%>
<%=md.getHeadDocument()%>
                      <br>
<%=md.getHelpDocument("WF2559")%>
                      <br>
<%=md.getSendToDocument("WF2559")%>
					  <br>
					  <!-- Begin Code -->
							<TABLE WIDTH="95%" 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"></TD>
									<TD VALIGN="middle">
										<table width="100%" border="0" cellpadding="0" cellspacing="1">
											<tr>
												<td colspan="2" class="column-title"><span swlang code='SW012820'>Document detail</span></td>
											</tr>
											<tr>
												<td class="column-label"><span swlang code='SW012812'>Document No</span></td>
												<td class="column-input" bgcolor="#EFEFEF">
													<input type="text" name="__wf__document_number" id="__wf__document_number" size="40" value="" class="txt01">
													<% if(md.isStep1){ %>
													<a href="JavaScript:goHelp('WORKFLOW_DATAHELP','docno','');" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('employee_image2','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)" id="__wf__document_number_help"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="SEARCH" name="employee_image2" width="20" height="20" border="0" align="absmiddle"></a>
													<% } %>
												</td>
											</tr>
											<%=md.getWF_Remark("8013",screenSingle.getUProfile().get("companyid"))%>
											<tr>
												<td colspan="2" class="column-input">
													<iframe id="docIframe" style="width:100%;height:600px;" src=""></iframe>
												</td>
											</tr>
										</table>
										<input type="hidden" name="priority" value="0">
									</FONT></TD>
									<TD WIDTH="5" BACKGROUND="../IMAGES/MYNOTE/R2.gif"></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>
							</TABLE>

						<!-- End Code -->
					  <br>
<%=md.getRemarkDocument()%>
                      <br>
<%=md.getWorkflowCommandDocument()%>
					<br>
<%=md.getReferenceNoteDocument()%>
					<br>
<%=md.getAttachFileDocument()%>
					<br>
					<!-- Begin Workflow Button -->
           				<%
           				if( !md.isStep3 ){
           				%>
           					<TABLE WIDTH="95%" BORDER="0" ALIGN="center" CELLPADDING="0" CELLSPACING="0">
           						<TR>
           				<%
           						if( md.isStep1 || md.isDraft){
           				%>
           							<TD><DIV ALIGN="right">
<!--                                     <A HREF="JavaScript:SaveDraft();">
                                    <IMG SRC="../IMAGES/MYNOTE/BUTTON/BUTTON_SAVE.gif" WIDTH="89" HEIGHT="37" BORDER="0"></A>
						<%   //   if( md.isDraft ){%>
									<A HREF="JavaScript:DelDraft();">
                                    <IMG SRC="../IMAGES/MYNOTE/BUTTON/BUTTON_CANCEL.gif" WIDTH="89" HEIGHT="37" BORDER="0"></A> -->
						<%		//}%>
									<A HREF="JavaScript:preGoWF();">
									<IMG SRC="../IMAGES/MYNOTE/BUTTON/BUTTON_SUBMIT.gif" WIDTH="89" HEIGHT="37" BORDER="0" ID="imgSubmit"></A></DIV></TD>
           				<%
           						}else if( md.isStepCancel || md.isAdminCancel ){
           				%>
           							<TD><DIV ALIGN="right"><A HREF="JavaScript:DelWF();"><IMG SRC="../IMAGES/MYNOTE/BUTTON/BUTTON_CANCEL.gif" WIDTH="89" HEIGHT="37" BORDER="0"></A></DIV></TD>
           				<%
           						}else if( md.isStep2 || md.isStepComment ){
           				%>
           							<TD><DIV ALIGN="right"><A HREF="JavaScript:GoWF();"><IMG SRC="../IMAGES/MYNOTE/BUTTON/BUTTON_SUBMIT.gif" WIDTH="89" HEIGHT="37" BORDER="0"></A></DIV></TD>
           				<%
           						}else if( md.isStepReturn ){
           				%>
           							<TD><DIV ALIGN="right"><A HREF="JavaScript:EditWF();"><IMG SRC="../IMAGES/MYNOTE/BUTTON/BUTTON_EDIT.gif" WIDTH="89" HEIGHT="37" BORDER="0"></A><A HREF="JavaScript:DelWF();"><IMG SRC="../IMAGES/MYNOTE/BUTTON/BUTTON_CANCEL.gif" WIDTH="89" HEIGHT="37" BORDER="0"></A></DIV></TD>
           				<%
           						}else if( md.isStepCopy ){
           				%>
           							<TD><DIV ALIGN="right"><A HREF="JavaScript:CopyWF();"><IMG SRC="../IMAGES/MYNOTE/BUTTON/BUTTON_EDIT.gif" WIDTH="89" HEIGHT="37" BORDER="0"></A></DIV></TD>
           				<%
           						}else if( md.isAdminEdit ){
           				%>
									<TD><DIV ALIGN="right"><A HREF="JavaScript:AdminEditWF();"><IMG SRC="../IMAGES/MYNOTE/BUTTON/BUTTON_SAVE.gif" WIDTH="89" HEIGHT="37" BORDER="0"></A></DIV></TD>
						<%
           						}else if( md.isAdminDelete ){
           				%>
									<TD><DIV ALIGN="right"><A HREF="JavaScript:AdminDeleteWF();"><IMG SRC="../IMAGES/MYNOTE/BUTTON/BUTTON_DELETE.gif" WIDTH="89" HEIGHT="37" BORDER="0"></A></DIV></TD>
						<%
           						}else if( md.isAdminClean ){
           				%>
									<TD><DIV ALIGN="right"><A HREF="JavaScript:AdminCleanWF();"><IMG SRC="../IMAGES/MYNOTE/BUTTON/BUTTON_CLEAN.gif" WIDTH="89" HEIGHT="37" BORDER="0"></A></DIV></TD>
						<%
           						}
           				%>

           						</TR>
           					</TABLE>
							<%}%>
           					<BR>
           				<!-- End Workflow Button -->
					<br>
<%=md.getRoutingDocument()%>
					<br>
<%=md.getCommentDocument()%>
<!-- Begin Set Value -->
           				<%

           				if( md.isStep1 ){
           				%>
           					<!-- Begin Set Value Step1 -->
           					<SCRIPT LANGUAGE="JavaScript">
								setValue('priority','<%=chkNull.chkNullString(request.getParameter("priority"),"0")%>');
								searchEmp();

           					</SCRIPT>
           					<!-- End Set Value Step1 -->
           				<%
           				}else if(md.isStep2 || md.isStepCancel || md.isStepComment || md.isStepReturn || md.isStepCopy || md.isDraft){
           				%>
           					<!-- Begin Set Value Step2 -->
           					<SCRIPT LANGUAGE="JavaScript">
								hideSendTo('<%=step_type%>');
								dwr.util.setValue("__wf__employeeid",'<%=md.getWFDataValue("__wf__employeeid")%>');
								dwr.util.setValue("__wf__document_number",'<%=md.getWFDataValue("__wf__document_number")%>');
								$("#__wf__document_number").attr('readonly', true);
								setIframe();
								//searchDescEmp(document.cscform.__wf__employeeid,  'memployee.fullname:MEMPLOYEE@FULLNAME,mposition.tdesc:__position,mbu1.tdesc:__bu1,mbu2.tdesc:__bu2,mbu3.tdesc:__bu3,mbu4.tdesc:__bu4,mbu5.tdesc:__bu5,memployee.startdate:__startdate,memployee.tel_ext:__tel_ext', "");

								setValue('priority','<%=screenSingle.getDataLabel("VW_INCIDENT","PRIORITY")%>');
								<%
									if(!md.isDraft){
								%>
								setDisabled(true);
								<%
								}else{
								%>
									setValue('__checkPage','false');
								<%
									}
								%>
           					</SCRIPT>
           					<!-- End Set Value Step2 -->
           				<%
           				}else if(md.isStep3 || md.isAdminEdit || md.isAdminCancel || md.isAdminDelete || md.isAdminClean || md.isArchive){
           				%>
           					<!-- Begin Set Value Step3 -->
           					<SCRIPT LANGUAGE="JavaScript">
								//dwr.util.setValue("__wf__employeeid",'<%=md.getWFDataValue("__wf__employeeid")%>');
								dwr.util.setValue("__wf__document_number",'<%=md.getWFDataValue("__wf__document_number")%>');
								$("#__wf__document_number").attr('readonly', true);
								setIframe();
								//searchDescEmp(document.cscform.__wf__employeeid,  'memployee.fullname:MEMPLOYEE@FULLNAME,mposition.tdesc:__position,mbu1.tdesc:__bu1,mbu2.tdesc:__bu2,mbu3.tdesc:__bu3,mbu4.tdesc:__bu4,mbu5.tdesc:__bu5,memployee.startdate:__startdate,memployee.tel_ext:__tel_ext', "");
								setValue('__checkPage','false');
								setValue('priority','<%=screenSingle.getDataLabel("VW_INCIDENT","PRIORITY")%>');
								<%
									if(!md.isAdminEdit){
								%>
								setDisabled(true);
								<%
								}
								%>
           					</SCRIPT>
           					<!-- End Set Value Step3 -->
           				<%
           				}
           				%>
           				<!-- End Set Value -->
						</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>
             <INPUT TYPE="hidden" NAME="__wf__chkHoliday" ID ="__wf__chkHoliday" VALUE="<%=(!md.getWFDataValue("__wf__chkHoliday").equals(""))?md.getWFDataValue("__wf__chkHoliday"):chkNull.chkNullString(request.getParameter("__wf__chkHoliday"),"false")%>">
            <INPUT TYPE="hidden" NAME="__wf__start_doc_date" ID ="__wf__start_doc_date" VALUE="<%=(!md.getWFDataValue("__wf__start_doc_date").equals(""))?md.getWFDataValue("__wf__start_doc_date"):request.getParameter("__wf__start_doc_date")%>">
			<%=screenSingle.endJSP()%>
		</FORM>
	</BODY>
	</div>
	<style>
		#docIframe > html > body > :first-child{
			display:none;
		}
	</style>
</HTML>
<%
}
%>