<%@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.approve.*,com.csc.library.databean.*"%>
<%@page import="com.csc.library.entry.*,com.csc.library.utilities.*,com.csc.library.database.*"%>
<%@page import="com.csc.library.session.*"%>
<%@page import="com.csc.library.report.*"%>
<%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","WELFARE");
	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 wf = null;
	CheckNull chkNull = new CheckNull();
	Organization og = new Masfactor(screenSingle.getUProfile());
	String subject = null;
	String remark = null;
	String step_type = null;
	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"));
	}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 = "";
	}

	//WF_STATUS 1 = รอการอนุมัติ
	//          3 = ยกเลิกการอนุมัติ
	//          4 = อนุมัติแล้ว
	//          5 = ไม่อนุมัติ
	//          6 = แก้ไขโดย HR
	//          7 = ส่งกลับ
	//          8 = ยกเลิกเอกสาร
	//          9 = ประวัติ

	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()));

			ServletContext context = pageContext.getServletContext();
			String mimeType = context.getMimeType( tu.Unicode2ASCII(f.getName()) );
			response.setContentType( mimeType );
			response.setHeader("Content-Disposition", "attachment; filename="+tu.Unicode2ASCII(f.getName()));

			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();
		}
	}
	int stepid=Integer.parseInt(chkNull.chkNullString(request.getParameter("step_id"),"1"));
	String empID=chkNull.chkNullString(request.getParameter("__wf__employeeid"),(String)screenSingle.getUProfile().get("employeeid"));
	
	 InitialEnvironment en = new InitialEnvironment(screenSingle.getUProfile().getDbName());
	 String vendor=en. getValue("datasource-dbtype");
	 
%>
<!-- End useBean -->
<% CscCalendar thisDate = new CscCalendar();%>
<HTML>
<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 type='text/JavaScript' src='../JS/DATEINPUT.js'></script>
<script type='text/JavaScript' src='../JS/VIEWCALENDAR.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/SearchDWR.js'></script>
<script type="text/javascript" src="/hr/dwr/interface/CscCalendar.js"></script>
<script type="text/javascript" src="/hr/dwr/interface/CheckRequisition.js"></script>
<script type="text/javascript" src="/hr/dwr/interface/Welwf_001_dwr.js"></script>
<script language="JavaScript">setLang('<%=screenSingle.getUProfile().get("lang")%>');</script>
<!-- <script type="text/javascript" src="../JS/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="../JS/jquery/js/jquery-ui.js"></script>
<script type="text/javascript" src="../JS/jquery.blockUI.js"></script>
<link href="../JS/jquery/css/redmond/jquery-ui-1.7.1.custom.css" rel="stylesheet" type="text/css"> -->

	<link href="../CSS/start/jquery-ui-1.9.2.custom.min.css" rel="stylesheet" type="text/css">
	<script type='text/JavaScript' src='../JS/jquery-1.7.2.js'></script>
	<script type='text/JavaScript' src='../JS/jquery-ui-1.9.2.min.js'></script>
	<script type='text/JavaScript' src='../JS/cscWFBase.js'></script>
<!-- End Import Script -->

<script>		
			<%
				CscCalendar cs3=new CscCalendar();
				cs3.decDate(30);
			%>
			var date30=new Date(<%=cs3.getYear()%>, <%=cs3.getMonth()%>, <%=cs3.getDate()%>);
			<%
				cs3.decDate(30);
			%>
			var date60=new Date(<%=cs3.getYear()%>, <%=cs3.getMonth()%>, <%=cs3.getDate()%>);		
			<%
				cs3.decDate(30);
			%>
			var date90=new Date(<%=cs3.getYear()%>, <%=cs3.getMonth()%>, <%=cs3.getDate()%>);					
			<%
				cs3=new CscCalendar();
				cs3.decYear(1); 
			 %>
			var lastyear=new Date(<%=cs3.getYear()%>, <%=cs3.getMonth()%>, <%=cs3.getDate()%>);

			var sCmap = {};
			$(function(){
				var bgSc = $("#blogScreen");
				bgSc.dialog({
					modal: true,
					resizable : false,
					draggable : false,
					closeOnEscape: false,
					create : function( event, ui ){
						$(this).prev().find(".ui-dialog-titlebar-close").hide();
					}
				});
				
				if( $.initLoad && $.isFunction( $.initLoad ) ){
					var result = $.initLoad();
					if( result ){
						bgSc.dialog("close");	
					}else{
						setTimeout(function(){
							bgSc.dialog("close");
						}, 4000);
					}
				}
			});

			(function( $, undefined ) {
				$.initLoad = function(){
					with( document.cscform ){
						// Begin setValue

						var isstep1 = __wf__isstep1.value;

						var isstep2 = __wf__isstep2.value;
						var isstepcancel = __wf__isstepcancel.value;
						var isstepcomment = __wf__isstepcomment.value;
						var isstepreturn = __wf__isstepreturn.value;
						var isstepcopy = __wf__isstepcopy.value;
						var isdraft = __wf__isdraft.value;

						var isstep3 = __wf__isstep3.value;
						var isadminedit = __wf__isadminedit.value;
						var isadmincancel = __wf__isadmincancel.value;
						var isadmindelete = __wf__isadmindelete.value;
						var isadminclean = __wf__isadminclean.value;
						var isarchive = __wf__isarchive.value;

						setDevSceenValue(__screen_value,sCmap);

						if( isstep1 == "true" ){
							//alert("isStep 1");
						<%
							if( request.getParameter("sendto") != null && request.getParameter("wf_next_actor") != null ){
						%>
								setValue("sendto","<%=chkNull.chkNullString(request.getParameter("sendto"),"")%>");
								setValue("wf_next_actor","<%=chkNull.chkNullString(request.getParameter("wf_next_actor"),"")%>");
						<%
								}
						if( request.getParameter("__wf__employeeid") != null){
						%>
							
							setValue("__wf__employeeid",getDevSceenValue("__wf__employeeid"));
							setValue("__wf__fullname",getDevSceenValue("__wf__fullname"));
							setValue("__wf__position",getDevSceenValue("__wf__position"));
							setValue("__wf__bu1",getDevSceenValue("__wf__bu1"));
							setValue("__wf__bu2",getDevSceenValue("__wf__bu2"));
							setValue("__wf__bu3",getDevSceenValue("__wf__bu3"));
							setValue("__wf__bu4",getDevSceenValue("__wf__bu4"));
							setValue("__wf__bu5",getDevSceenValue("__wf__bu5"));
							setValue("__wf__amountrow",getDevSceenValue("__wf__amountrow"));
							setValue("__wf__tel_ext",getDevSceenValue("__wf__tel_ext"));
							setValue("__wf__emp_startdate",getDevSceenValue("__wf__emp_startdate"));
							setValue("__wf__welid",getDevSceenValue("__wf__welid"));
							setValue("__wf__weldesc",getDevSceenValue("__wf__weldesc"));
							setValue("__wf__docgid",getDevSceenValue("__wf__docgid"));
							setValue("__wf__whouse",getDevSceenValue("__wf__whouse"));
							setValue("__wf__isedu",getDevSceenValue("__wf__isedu"));
							postReturn();
							var addval = __wf__amountrow.value * 1;
							var indexRow = "01";
							var welid = __wf__welid.value;
							for(var c=1;c<=addval;c++){		
								if(c<10){																											
									indexRow = "0"+c;
								}else{
									indexRow=""+c;
								}
								var trstyleh = eval("addWelfareH"+c+".style");
								trstyleh.display = "";
								var trstylec = eval("addWelfareC"+c+".style");
								trstylec.display = "";

								if( welid == "EDU001" ){
									setFamilyObj("family"+indexRow,"eduObj");
								} else if( welid =="MARY001" ){
									setFamilyObj("family"+indexRow,"wifeObj");
								} else if( welid == "SICK002" ){
									setFamilyObj("family"+indexRow,"sick2Obj");
								} else if( welid == "SICK003" ){
									setFamilyObj("family"+indexRow,"sick3Obj");
								} else if( welid =="SICK004" ){
									setFamilyObj("family"+indexRow,"sick4Obj");
								} else {
									setFamilyObj("family"+indexRow,"closeObj");
								}	

								setValue("__wf__mcomplain$docnum$"+indexRow, getDevSceenValue("__wf__mcomplain$docnum$"+indexRow));
								setValue("__wf__weldesc"+indexRow, getDevSceenValue("__wf__weldesc"+indexRow));
								setValue("__wf__mcomplain$welid$"+indexRow, getDevSceenValue("__wf__mcomplain$welid$"+indexRow));
								setValue("__wf__diseasedesc"+indexRow, getDevSceenValue("__wf__diseasedesc"+indexRow));
								setValue("__wf__mcomplain$diseaseid$"+indexRow, getDevSceenValue("__wf__mcomplain$diseaseid$"+indexRow));
								setValue("__wf__siteweldesc"+indexRow, getDevSceenValue("__wf__siteweldesc"+indexRow));
								setValue("__wf__mcomplain$sitewelid$"+indexRow, getDevSceenValue("__wf__mcomplain$sitewelid$"+indexRow));
								setValue("__wf__mcomplain$datesent$"+indexRow, getDevSceenValue("__wf__mcomplain$datesent$"+indexRow));
								setValue("__wf__mcomplain$amountmoney$"+indexRow, getDevSceenValue("__wf__mcomplain$amountmoney$"+indexRow));
								setValue("__wf__mcomplain$amountrealmoney$"+indexRow, getDevSceenValue("__wf__mcomplain$amountrealmoney$"+indexRow));
								setValue("__wf__mcomplain$hopital$"+indexRow, getDevSceenValue("__wf__mcomplain$hopital$"+indexRow));
								setValue("__wf__mcomplain$numberbill$"+indexRow, getDevSceenValue("__wf__mcomplain$numberbill$"+indexRow));
								setValue("__wf__mcomplain$datebill$"+indexRow, getDevSceenValue("__wf__mcomplain$datebill$"+indexRow));
								setValue("__wf__mcomplain$docgid$"+indexRow, getDevSceenValue("__wf__mcomplain$docgid$"+indexRow));
								setValue("__wf__mcomplain$attach$"+indexRow, getDevSceenValue("__wf__mcomplain$attach$"+indexRow));
								setValue("__wf__attachdesc"+indexRow, getDevSceenValue("__wf__attachdesc"+indexRow));

								setValue("__wf__mcomplain$requisid$"+indexRow, getDevSceenValue("__wf__mcomplain$requisid$"+indexRow));
								setValue("__wf__reqdesc"+indexRow, getDevSceenValue("__wf__reqdesc"+indexRow));
								setValue("__wf__mcomplain$whouse$"+indexRow, getDevSceenValue("__wf__mcomplain$whouse$"+indexRow));
								setValue("__wf__sitegname"+indexRow, getDevSceenValue("__wf__sitegname"+indexRow));
								setValue("__wf__mcomplain$terminal$"+indexRow, getDevSceenValue("__wf__mcomplain$terminal$"+indexRow));								
								setValue("__wf__mcomplain$eduyear$"+indexRow, getDevSceenValue("__wf__mcomplain$eduyear$"+indexRow));		
								setValue("__wf__receiverdesc"+indexRow, getDevSceenValue("__wf__receiverdesc"+indexRow));
								setValue("__wf__mcomplain$receiver$"+indexRow, getDevSceenValue("__wf__mcomplain$receiver$"+indexRow));		
								setValue("__wf__mcomplain$degreeid$"+indexRow, getDevSceenValue("__wf__mcomplain$degreeid$"+indexRow));		
								setValue("__wf__degreeiddesc"+indexRow, getDevSceenValue("__wf__degreeiddesc"+indexRow));
								setValue("__wf__mcomplain$curetype$"+indexRow, getDevSceenValue("__wf__mcomplain$curetype$"+indexRow));
								
								setValue("__wf__mcomplain$line_no$"+indexRow, getDevSceenValue("__wf__mcomplain$line_no$"+indexRow));			

								if( getDevSceenValue("__wf__weldesc"+indexRow) != "" && (isstep2=="true") && (isdraft != "true") ){
									setEnabledText(indexRow);	
								}
							}
							sumAmountMoney();
							sumAmountRealMoney();
							
							setValue("__wf__totalmoney",getDevSceenValue("__wf__totalmoney"));
							setValue("__wf__totalrealmoney",getDevSceenValue("__wf__totalrealmoney"));

							setValue("__wf__receivemd11", getDevSceenValue("__wf__receivemd11"));
							setValue("__wf__receivemd12", getDevSceenValue("__wf__receivemd12"));
							setValue("__wf__receivemd13", getDevSceenValue("__wf__receivemd13"));
							setValue("__wf__md11amt", getDevSceenValue("__wf__md11amt"));
							setValue("__wf__md12amt", getDevSceenValue("__wf__md12amt"));
							setValue("__wf__md13amt", getDevSceenValue("__wf__md13amt"));
							setValue("__wf__md14amt", getDevSceenValue("__wf__md14amt"));

							setValue("__wf__receivemd21", getDevSceenValue("__wf__receivemd21"));
							setValue("__wf__receivemd22", getDevSceenValue("__wf__receivemd22"));
							setValue("__wf__receivemd23", getDevSceenValue("__wf__receivemd23"));
							setValue("__wf__receivemd24", getDevSceenValue("__wf__receivemd24"));
							setValue("__wf__md21amt", getDevSceenValue("__wf__md21amt"));
							setValue("__wf__md22amt", getDevSceenValue("__wf__md22amt"));
							setValue("__wf__md23amt", getDevSceenValue("__wf__md23amt"));
							setValue("__wf__md24amt", getDevSceenValue("__wf__md24amt"));
							setValue("__wf__md25amt", getDevSceenValue("__wf__md25amt"));

							setValue("__wf__remarknote", getDevSceenValue("__wf__remarknote"));

							<%}%>

							setValue("priority","<%=chkNull.chkNullString(request.getParameter("priority"),"0")%>");
							

						}else if( (isstep2 == "true")|| (isstepcancel  == "true") || (isstepcomment == "true") || (isstepreturn == "true") || (isstepcopy == "true") || (isdraft == "true") ){
						//  Begin setValue Step 2
							setValue("__wf__employeeid",getDevSceenValue("__wf__employeeid"));
							setValue("__wf__fullname",getDevSceenValue("__wf__fullname"));
							setValue("__wf__position",getDevSceenValue("__wf__position"));
							setValue("__wf__bu1",getDevSceenValue("__wf__bu1"));
							setValue("__wf__bu2",getDevSceenValue("__wf__bu2"));
							setValue("__wf__bu3",getDevSceenValue("__wf__bu3"));
							setValue("__wf__bu4",getDevSceenValue("__wf__bu4"));
							setValue("__wf__bu5",getDevSceenValue("__wf__bu5"));
							setValue("__wf__amountrow",getDevSceenValue("__wf__amountrow"));
							setValue("__wf__tel_ext",getDevSceenValue("__wf__tel_ext"));
							setValue("__wf__emp_startdate",getDevSceenValue("__wf__emp_startdate"));
							setValue("__wf__welid",getDevSceenValue("__wf__welid"));
							setValue("__wf__weldesc",getDevSceenValue("__wf__weldesc"));
							setValue("__wf__docgid",getDevSceenValue("__wf__docgid"));
							setValue("__wf__whouse",getDevSceenValue("__wf__whouse"));
							setValue("__wf__isedu",getDevSceenValue("__wf__isedu"));

							var addval = __wf__amountrow.value * 1;
							var indexRow = "01";
							var welid = __wf__welid.value;
							for(var c=1;c<=addval;c++){		
								if(c<10){																											
									indexRow = "0"+c;
								}else{
									indexRow=""+c;
								}
								var trstyleh = eval("addWelfareH"+c+".style");
								trstyleh.display = "";
								var trstylec = eval("addWelfareC"+c+".style");
								trstylec.display = "";

								if( welid == "EDU001" ){
									setFamilyObj("family"+indexRow,"eduObj");
								} else if( welid =="MARY001" ){
									setFamilyObj("family"+indexRow,"wifeObj");
								} else if( welid == "SICK002" ){
									setFamilyObj("family"+indexRow,"sick2Obj");
								} else if( welid == "SICK003" ){
									setFamilyObj("family"+indexRow,"sick3Obj");
								} else if( welid =="SICK004" ){
									setFamilyObj("family"+indexRow,"sick4Obj");
								} else {
									setFamilyObj("family"+indexRow,"closeObj");
								}	

								setValue("__wf__mcomplain$docnum$"+indexRow, getDevSceenValue("__wf__mcomplain$docnum$"+indexRow));
								setValue("__wf__weldesc"+indexRow, getDevSceenValue("__wf__weldesc"+indexRow));
								setValue("__wf__mcomplain$welid$"+indexRow, getDevSceenValue("__wf__mcomplain$welid$"+indexRow));
								setValue("__wf__diseasedesc"+indexRow, getDevSceenValue("__wf__diseasedesc"+indexRow));
								setValue("__wf__mcomplain$diseaseid$"+indexRow, getDevSceenValue("__wf__mcomplain$diseaseid$"+indexRow));
								setValue("__wf__siteweldesc"+indexRow, getDevSceenValue("__wf__siteweldesc"+indexRow));
								setValue("__wf__mcomplain$sitewelid$"+indexRow, getDevSceenValue("__wf__mcomplain$sitewelid$"+indexRow));
								setValue("__wf__mcomplain$datesent$"+indexRow, getDevSceenValue("__wf__mcomplain$datesent$"+indexRow));
								setValue("__wf__mcomplain$amountmoney$"+indexRow, getDevSceenValue("__wf__mcomplain$amountmoney$"+indexRow));
								setValue("__wf__mcomplain$amountrealmoney$"+indexRow, getDevSceenValue("__wf__mcomplain$amountrealmoney$"+indexRow));
								setValue("__wf__mcomplain$hopital$"+indexRow, getDevSceenValue("__wf__mcomplain$hopital$"+indexRow));
								setValue("__wf__mcomplain$numberbill$"+indexRow, getDevSceenValue("__wf__mcomplain$numberbill$"+indexRow));
								setValue("__wf__mcomplain$datebill$"+indexRow, getDevSceenValue("__wf__mcomplain$datebill$"+indexRow));
								setValue("__wf__mcomplain$docgid$"+indexRow, getDevSceenValue("__wf__mcomplain$docgid$"+indexRow));
								setValue("__wf__mcomplain$attach$"+indexRow, getDevSceenValue("__wf__mcomplain$attach$"+indexRow));
								setValue("__wf__attachdesc"+indexRow, getDevSceenValue("__wf__attachdesc"+indexRow));
								setValue("__wf__mcomplain$line_no$"+indexRow, getDevSceenValue("__wf__mcomplain$line_no$"+indexRow));							

								setValue("__wf__mcomplain$requisid$"+indexRow, getDevSceenValue("__wf__mcomplain$requisid$"+indexRow));
								setValue("__wf__reqdesc"+indexRow, getDevSceenValue("__wf__reqdesc"+indexRow));
								setValue("__wf__mcomplain$whouse$"+indexRow, getDevSceenValue("__wf__mcomplain$whouse$"+indexRow));
								setValue("__wf__sitegname"+indexRow, getDevSceenValue("__wf__sitegname"+indexRow));
								setValue("__wf__mcomplain$terminal$"+indexRow, getDevSceenValue("__wf__mcomplain$terminal$"+indexRow));								
								setValue("__wf__mcomplain$eduyear$"+indexRow, getDevSceenValue("__wf__mcomplain$eduyear$"+indexRow));		
								setValue("__wf__receiverdesc"+indexRow, getDevSceenValue("__wf__receiverdesc"+indexRow));
								setValue("__wf__mcomplain$receiver$"+indexRow, getDevSceenValue("__wf__mcomplain$receiver$"+indexRow));		
								setValue("__wf__mcomplain$degreeid$"+indexRow, getDevSceenValue("__wf__mcomplain$degreeid$"+indexRow));		
								setValue("__wf__degreeiddesc"+indexRow, getDevSceenValue("__wf__degreeiddesc"+indexRow));
								setValue("__wf__mcomplain$curetype$"+indexRow, getDevSceenValue("__wf__mcomplain$curetype$"+indexRow));

								if( getDevSceenValue("__wf__weldesc"+indexRow) != "" && (isstep2=="true") && (isdraft != "true") ){
									setEnabledText(indexRow);	
								}
							}
							setValue("priority","<%=screenSingle.getDataLabel("VW_INCIDENT","PRIORITY")%>");
							sumAmountMoney();
							sumAmountRealMoney();
							
							setValue("__wf__totalmoney",getDevSceenValue("__wf__totalmoney"));
							setValue("__wf__totalrealmoney",getDevSceenValue("__wf__totalrealmoney"));

							setValue("__wf__receivemd11", getDevSceenValue("__wf__receivemd11"));
							setValue("__wf__receivemd12", getDevSceenValue("__wf__receivemd12"));
							setValue("__wf__receivemd13", getDevSceenValue("__wf__receivemd13"));
							setValue("__wf__md11amt", getDevSceenValue("__wf__md11amt"));
							setValue("__wf__md12amt", getDevSceenValue("__wf__md12amt"));
							setValue("__wf__md13amt", getDevSceenValue("__wf__md13amt"));
							setValue("__wf__md14amt", getDevSceenValue("__wf__md14amt"));

							setValue("__wf__receivemd21", getDevSceenValue("__wf__receivemd21"));
							setValue("__wf__receivemd22", getDevSceenValue("__wf__receivemd22"));
							setValue("__wf__receivemd23", getDevSceenValue("__wf__receivemd23"));
							setValue("__wf__receivemd24", getDevSceenValue("__wf__receivemd24"));
							setValue("__wf__md21amt", getDevSceenValue("__wf__md21amt"));
							setValue("__wf__md22amt", getDevSceenValue("__wf__md22amt"));
							setValue("__wf__md23amt", getDevSceenValue("__wf__md23amt"));
							setValue("__wf__md24amt", getDevSceenValue("__wf__md24amt"));
							setValue("__wf__md25amt", getDevSceenValue("__wf__md25amt"));

							setValue("__wf__remarknote", getDevSceenValue("__wf__remarknote"));
							
							if( isdraft != "true" ){
								setDisabled(true);
							}else{
								postReturn();
								setValue("__checkPage","false");
							}
							//  End setValue Step 2
						}else if( (isstep3 == "true") || (isadminedit == "true") || (isadmincancel  == "true") || (isadmindelete == "true") || (isadminclean == "true") || (isarchive == "true") ){
							setValue("__wf__employeeid",getDevSceenValue("__wf__employeeid"));
							setValue("__wf__fullname",getDevSceenValue("__wf__fullname"));
							setValue("__wf__position",getDevSceenValue("__wf__position"));
							setValue("__wf__bu1",getDevSceenValue("__wf__bu1"));
							setValue("__wf__bu2",getDevSceenValue("__wf__bu2"));
							setValue("__wf__bu3",getDevSceenValue("__wf__bu3"));
							setValue("__wf__totalmoney",getDevSceenValue("__wf__totalmoney"));
							setValue("__wf__totalrealmoney",getDevSceenValue("__wf__totalrealmoney"));
							setValue("__wf__amountrow",getDevSceenValue("__wf__amountrow"));
							setValue("__wf__tel_ext",getDevSceenValue("__wf__tel_ext"));
							setValue("__wf__emp_startdate",getDevSceenValue("__wf__emp_startdate"));
							setValue("__wf__bu4",getDevSceenValue("__wf__bu4"));
							setValue("__wf__bu5",getDevSceenValue("__wf__bu5"));
							setValue("__wf__welid",getDevSceenValue("__wf__welid"));
							setValue("__wf__weldesc",getDevSceenValue("__wf__weldesc"));
							setValue("__wf__docgid",getDevSceenValue("__wf__docgid"));
							setValue("__wf__whouse",getDevSceenValue("__wf__whouse"));
							setValue("__wf__isedu",getDevSceenValue("__wf__isedu"));			

							var addval = __wf__amountrow.value * 1;
							var indexRow = "01";
							var welid = __wf__welid.value;
							for(var c=1;c<=addval;c++){		
								if(c<10){																											
									indexRow = "0"+c;
								}else{
									indexRow=""+c;
								}

								var trstyleh = eval("addWelfareH"+c+".style");
								trstyleh.display = "";
								var trstylec = eval("addWelfareC"+c+".style");
								trstylec.display = "";
								
								setFamilyObj("family"+indexRow,"famObj");
								
								setValue("__wf__mcomplain$docnum$"+indexRow, getDevSceenValue("__wf__mcomplain$docnum$"+indexRow) );
								setValue("__wf__weldesc"+indexRow, getDevSceenValue("__wf__weldesc"+indexRow) );
								setValue("__wf__mcomplain$welid$"+indexRow, getDevSceenValue("__wf__mcomplain$welid$"+indexRow) );
								setValue("__wf__diseasedesc"+indexRow, getDevSceenValue("__wf__diseasedesc"+indexRow) );
								setValue("__wf__mcomplain$diseaseid$"+indexRow, getDevSceenValue("__wf__mcomplain$diseaseid$"+indexRow) );
								setValue("__wf__siteweldesc"+indexRow, getDevSceenValue("__wf__siteweldesc"+indexRow) );
								setValue("__wf__mcomplain$sitewelid$"+indexRow, getDevSceenValue("__wf__mcomplain$sitewelid$"+indexRow) );
								setValue("__wf__mcomplain$datesent$"+indexRow, getDevSceenValue("__wf__mcomplain$datesent$"+indexRow) );
								setValue("__wf__mcomplain$amountmoney$"+indexRow, getDevSceenValue("__wf__mcomplain$amountmoney$"+indexRow) );
								setValue("__wf__mcomplain$amountrealmoney$"+indexRow, getDevSceenValue("__wf__mcomplain$amountrealmoney$"+indexRow) );
								setValue("__wf__mcomplain$hopital$"+indexRow, getDevSceenValue("__wf__mcomplain$hopital$"+indexRow) );
								setValue("__wf__mcomplain$numberbill$"+indexRow, getDevSceenValue("__wf__mcomplain$numberbill$"+indexRow) );
								setValue("__wf__mcomplain$datebill$"+indexRow, getDevSceenValue("__wf__mcomplain$datebill$"+indexRow) );
								setValue("__wf__mcomplain$docgid$"+indexRow, getDevSceenValue("__wf__mcomplain$docgid$"+indexRow) );
								setValue("__wf__mcomplain$attach$"+indexRow, getDevSceenValue("__wf__mcomplain$attach$"+indexRow) );
								setValue("__wf__attachdesc"+indexRow, getDevSceenValue("__wf__attachdesc"+indexRow) );
								setValue("__wf__mcomplain$line_no$"+indexRow, getDevSceenValue("__wf__mcomplain$line_no$"+indexRow) );
								
								setValue("__wf__mcomplain$requisid$"+indexRow, getDevSceenValue("__wf__mcomplain$requisid$"+indexRow) );
								setValue("__wf__reqdesc"+indexRow, getDevSceenValue("__wf__reqdesc"+indexRow) );
								setValue("__wf__mcomplain$whouse$"+indexRow, getDevSceenValue("__wf__mcomplain$whouse$"+indexRow) );
								setValue("__wf__sitegname"+indexRow, getDevSceenValue("__wf__sitegname"+indexRow) );
								setValue("__wf__mcomplain$terminal$"+indexRow, getDevSceenValue("__wf__mcomplain$terminal$"+indexRow) );								
								setValue("__wf__mcomplain$eduyear$"+indexRow, getDevSceenValue("__wf__mcomplain$eduyear$"+indexRow) );
								setValue("__wf__receiverdesc"+indexRow, getDevSceenValue("__wf__receiverdesc"+indexRow) );				
								setValue("__wf__receiverdesc"+indexRow, getDevSceenValue("__wf__receiverdesc"+indexRow) );
								setValue("__wf__mcomplain$receiver$"+indexRow, getDevSceenValue("__wf__mcomplain$receiver$"+indexRow) );	
								setValue("__wf__mcomplain$degreeid$"+indexRow, getDevSceenValue("__wf__mcomplain$degreeid$"+indexRow) );		
								setValue("__wf__degreeiddesc"+indexRow, getDevSceenValue("__wf__degreeiddesc"+indexRow) );
								setValue("__wf__mcomplain$curetype$"+indexRow, getDevSceenValue("__wf__mcomplain$curetype$"+indexRow) );
							}

							sumAmountMoney();
							sumAmountRealMoney();

							setValue("__wf__receivemd11",getDevSceenValue("__wf__receivemd11") );
							setValue("__wf__receivemd12",getDevSceenValue("__wf__receivemd12") );
							setValue("__wf__receivemd13",getDevSceenValue("__wf__receivemd13") );
							setValue("__wf__md11amt",getDevSceenValue("__wf__md11amt") );
							setValue("__wf__md12amt",getDevSceenValue("__wf__md12amt") );
							setValue("__wf__md13amt",getDevSceenValue("__wf__md13amt") );
							setValue("__wf__md14amt",getDevSceenValue("__wf__md14amt") );
							 
							setValue("__wf__receivemd21",getDevSceenValue("__wf__receivemd21") );
							setValue("__wf__receivemd22",getDevSceenValue("__wf__receivemd22") );
							setValue("__wf__receivemd23",getDevSceenValue("__wf__receivemd23") );
							setValue("__wf__receivemd24",getDevSceenValue("__wf__receivemd24") );
							setValue("__wf__md21amt",getDevSceenValue("__wf__md21amt") );
							setValue("__wf__md22amt",getDevSceenValue("__wf__md22amt") );
							setValue("__wf__md23amt",getDevSceenValue("__wf__md23amt") );
							setValue("__wf__md24amt",getDevSceenValue("__wf__md24amt") );
							setValue("__wf__md25amt",getDevSceenValue("__wf__md25amt") );
							
							setValue("__wf__remarknote",getDevSceenValue("__wf__remarknote") );

							setValue("__checkPage","false");	
							setValue("priority","<%=screenSingle.getDataLabel("VW_INCIDENT","PRIORITY")%>" );
							if( isadminedit != "true" ){
								setDisabled(true);
							}
						}
						// End setValue
						return true;
					}
				}
			})(jQuery);

			function getDevSceenValue(key){
				return sCmap[key];
			}

			function setDevSceenValue(screenvalue,sChmap){
				var sCvalue = screenvalue.value;
				var arrField = sCvalue.split("#");
				for(var i = 0; i < arrField.length; i++){
					var arrdata = arrField[i].replace(",","&,#");
					var data = arrdata.split("&,#");
					sChmap[data[0]] = data[1];
				}
				return true;
			}

			var tmpSum = 0;
			function setEnabledText( index ) {
				var tmpAmountRealMoney = eval("document.cscform.__wf__mcomplain$amountrealmoney$"+index);
				var tmpAmountMoney = eval("document.cscform.__wf__mcomplain$amountmoney$"+index);
				var tmpSumAmountMoney = eval("document.cscform.__wf__totalrealmoney");
				tmpAmountRealMoney.disabled = false;
				tmpAmountRealMoney.readOnly = false;
				tmpAmountRealMoney.value = tmpAmountMoney.value;
				tmpSum += eval(delComma(tmpAmountRealMoney.value));
				tmpSumAmountMoney.value = tmpSum;
				checkNumFloat(tmpSumAmountMoney,0,0);
			}

			function setDisabled(con){
				with( document.cscform ){
					for( i = 0 ; i < elements.length ; i++ ){
						if( elements[i].type == 'text' || elements[i].type == 'textarea' || elements[i].type == 'checkbox' || elements[i].type == 'radio' || elements[i].type == 'select-one'){
							if( elements[i].name != 'sendto' && elements[i].name != 'cc' && elements[i].name != 'subject' && elements[i].name != 'wf_command' && elements[i].name != 'comments' && elements[i].name != '__remark' ){
								if(elements[i].name.indexOf("__wf__mcomplain$amountrealmoney$") != -1 && __wf__isstep2.value == "true"){
									continue;
								}
								if(elements[i].type == 'select-one'){
									elements[i].disabled = con;
								}else{
									elements[i].readOnly = con;
									elements[i].className = "disabled";
								}
							}
						}
					}
				}
			} 
			
            function chkViewCal( strobj ) {
                with(document.cscform){
                    tmpObj = eval(strobj);	
                    if (!tmpObj.disabled) {
                        viewCal(strobj);
                    }
                }
            }			

			function showDate(mypicker){ 
				if($("#"+mypicker.id).hasClass("hasDatepicker")){
					
					//$("#"+mypicker.id).datepicker( "show" );
				}else{
						$("#"+mypicker.id).datepicker({
							dateFormat: "dd-mm-yy",
							showAnim: "fadeIn",
							showOn: "focus",
							direction: "up",
							minDate: date30,
							maxDate: 0,
							beforeShow : function(){
								if(document.cscform.__wf__welid.value=="OPD001"||document.cscform.__wf__welid.value=="OPD002"){
									$("#"+mypicker.id).datepicker( "option", "minDate" , date30 );
									$("#"+mypicker.id).datepicker( "refresh" );
								}else if(document.cscform.__wf__welid.value=="MARY001"){
									$("#"+mypicker.id).datepicker( "option", "minDate" , date60 );
									$("#"+mypicker.id).datepicker( "refresh" );
								}else if(document.cscform.__wf__welid.value=="EDU001"){
									$("#"+mypicker.id).datepicker( "option", "minDate" , date90 );
									$("#"+mypicker.id).datepicker( "refresh" );
								}else{
									$("#"+mypicker.id).datepicker( "option", "minDate" , date30 );
									$("#"+mypicker.id).datepicker( "refresh" );
								}
							}
					});
					$("#"+mypicker.id).datepicker( "show" );
				}
			}

			var closeObj={};
		   function setFamilyObj(myid,objname){
				var  selectObj = document.getElementById(myid);
				selectObj.disabled=false;
				selectObj.options.length = 0;	
				selectObj.options[selectObj.options.length] = new Option('-------', '');
				if(objname!="closeObj"){
					for(index in eval(objname)) {
						selectObj.options[selectObj.options.length] = new Option(eval(objname)[index], index);
					}  
				}else{
					selectObj.disabled=true;
				}
				return true;
		   }

			function goHelp(helpName,inputName,condition){
				with( document.cscform ){
					__return_help.value=condition;
					var helpReturn;
					var temp;					
					var tmpObj;
				
						if(eval("__wf__weldesc"+condition).value.length==0){
								alert(MyCode[212]);
								helpName="MWELFAREHELP_WF";
								inputName="__wf__weldesc";
								goWelfareHelp(helpName,inputName);
					}else{		
								
					if ( inputName == "__wf__weldesc" ||  inputName == "__wf__siteweldesc"||inputName == "__wf__diseasedesc" ||inputName == "__wf__receiverdesc" ||inputName == "__wf__degreeiddesc") {
						tmpObj = eval(inputName+""+condition);
					}
					if( inputName == "sendto" ){
						temp = __fixCon.value;
						if( condition.indexOf(",") > -1 ){
							condition = condition.replace(/,/g,"','");
						}
					 	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_SendToReturn(helpName,helpReturn);
						__fixCon.value=temp;
					}else if( inputName == "__wf__receiverdesc" && !tmpObj.disabled ){
						temp = __fixCon.value;
						helpReturn="__wf__receiverdesc"+condition+":memployee.fullname,__wf__mcomplain$receiver$"+condition+":memployee.employeeid";
						linkHelp_Return(helpName,helpReturn);
						__fixCon.value=temp;						
					}else if( inputName == "__wf__weldesc" && !tmpObj.disabled ){
						temp = __fixCon.value;
						__fixCon.value=" welgid!='0003'";
						helpReturn="__wf__weldesc"+condition+":mwelfare.tdesc,__wf__mcomplain$welid$"+condition+":mwelfare.welid,__wf__mcomplain$amountmoney$"+condition+":welqty,__wf__mcomplain$amountrealmoney$"+condition+":welqty,__wf__mcomplain$docgid$"+condition+":mwelfare.docgid,__wf__mcomplain$whouse$"+condition+":mwelfare.whouse";
						linkHelp_ReturnWelfare(helpName,helpReturn);
						__fixCon.value=temp;						
					}else if( inputName == "__wf__siteweldesc" && !tmpObj.disabled){
						temp = __fixCon.value;
						//__fixCon.value="siteweltype='0'";
						if(__wf__isedu.value=='1'){
						     __fixCon.value="siteweltype='1'";
						}else{
							__fixCon.value="siteweltype='0'";
						}			
						if(__wf__welid.value=='OPD002'){
							if(__fixCon.value.length>0){
								__fixCon.value+=" and (addrbook is not null and addrbook!='')";
							}else{
								__fixCon.value="( addrbook is not null and addrbook!='' )";
							}
						}			
						helpReturn="__wf__siteweldesc"+condition+":msitewel.tdesc,__wf__mcomplain$sitewelid$"+condition+":msitewel.sitewelid,__wf__sitegname"+condition+":msitewelgrp.tdesc";
						linkHelp_Return2(helpName,helpReturn);
						__fixCon.value=temp;
					}else if( inputName == "__wf__diseasedesc" && !tmpObj.disabled){
						temp = __fixCon.value;
						helpReturn="__wf__diseasedesc"+condition+":mdisease.tdesc,__wf__mcomplain$diseaseid$"+condition+":mdisease.disid";
						linkHelp_Return(helpName,helpReturn);
						__fixCon.value=temp;
					}else if( inputName == "__wf__degreeiddesc" && !tmpObj.disabled){
						temp = __fixCon.value;
						__fixCon.value=" degreeid in ('003','006','007','008','009','010')";
						helpReturn="__wf__degreeiddesc"+condition+":mdegree.tdesc,__wf__mcomplain$degreeid$"+condition+":mdegree.degreeid";
						linkHelp_Return2(helpName,helpReturn);
						__fixCon.value=temp;
					}else if( inputName == "__wf__reqdesc" && !tmpObj.disabled){
						temp = __fixCon.value;
						helpReturn="__wf__reqdesc"+condition+":mrequisitiontype.tdesc,__wf__mcomplain$requisid$"+condition+":mrequisitiontype.requisid";
						linkHelp_Return(helpName,helpReturn);
						__fixCon.value=temp;
					}else if( inputName == "__wf__sp"){
						temp = __fixCon.value;
						helpReturn="__wf__sp:extid,__wf__sp_name:tdesc";
						linkHelp_Return(helpName,helpReturn);
						__fixCon.value=temp;
					}else if( inputName =="__wf__hospital"){
						temp = __fixCon.value;
						helpReturn="__wf__sp:extid,__wf__hospital:tdesc";
						linkHelp_Return(helpName,helpReturn);
						__fixCon.value=temp;
					}
				 }
			  }
			}
			
		function goWelfareHelp(helpName,inputName){
				with( document.cscform ){
					var helpReturn;
					var temp;					
				
					if(inputName!= "__wf__weldesc"){
						if(eval("__wf__weldesc").value.length==0){
								alert(MyCode[212]);
								helpName="MWELFAREHELP_WF";
								inputName="__wf__weldesc";
						}
					}
					
					if ( inputName == "__wf__weldesc" ) {
						tmpObj = eval(inputName);
					}
					
				
					 if( inputName == "__wf__weldesc" && !tmpObj.disabled ){
						temp = __fixCon.value;	
						__fixCon.value=" welgid not in ('0003','0004') or welid='SICK004'";	
						helpReturn="__wf__weldesc:mwelfare.tdesc,__wf__welid:mwelfare.welid,__wf__docgid:mwelfare.docgid,__wf__whouse:mwelfare.whouse,__wf__isedu:mwelfare.iseducation";
						linkHelp_ReturnWelfare(helpName,helpReturn);
						__fixCon.value=temp;						
					}
				}
			}			
			
			function goHelp2(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+")";
						__fixCon.value=condition + " AND STATUS <> 'Y'";
					 	helpReturn="wf_next_actor:EMPLOYEEID,sendto:__wf__fullname";
						linkHelp_SendToReturn(helpName,helpReturn);
						__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_Return(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_Return2(help,input){
				with( document.cscform ){
					var param="BROWSE_HELP2.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_ReturnWelfare(help,input){
				with( document.cscform ){
					var param="BROWSE_WELFAREHELP.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 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 openHelp(){
				with( document.cscform ){
					window.open("../WELFARE/HELP/3001.pdf","Help","left=150,top=150,width=700,height=570,toolbar=no,status=yes,scrollbars=yes,resizable=yes");
				}
			}
			
			function goPages(num){	
				with( document.cscform ){
					var tmpObj = eval("__wf__weldesc"+num);
					var docgid = eval("__wf__mcomplain$docgid$"+num).value;			
					var sitewel = eval("__wf__mcomplain$welid$"+num).value;
					var doclist ="";
					if( eval("__wf__mcomplain$attach$"+num+".value").length>0 &&  eval("__wf__mcomplain$attach$"+num+".value")!="-1") {
						doclist = eval("__wf__mcomplain$attach$"+num).value;					
					}
					var  pam="./WELWF001L.jsp?__num="+num+"&__fixCon=docgid='"+docgid+"'&__doclist="+doclist+"&__sitewelgid="+sitewel+"&__disabled="+__chkdisablechild.value;				
				}
				window.open(pam,"Help","left=150,top=150,width=700,height=500,toolbar=no,status=yes,scrollbars=yes"); 
			}

			function sumAmountMoney() {
				with( document.cscform ){
					__wf__totalmoney.value = "0.00";
					var indexRow="";
					for (i=1;i<=eval(__wf__amountrow.value);i++) {
						indexRow = ""+i;
						if ( i < 10 )	indexRow = "0"+i;
						var tmpfield = eval("__wf__mcomplain$amountmoney$"+indexRow);
						var tmpvalue = delComma(tmpfield.value);
						var tmptotal = delComma(__wf__totalmoney.value);

						__wf__totalmoney.value = eval(tmptotal) + eval(tmpvalue);
						insertComma(__wf__totalmoney);
						checkInputComma(__wf__totalmoney);
					}
				}
			}

			function sumAmountRealMoney() {
				with( document.cscform ){ 
					__wf__totalrealmoney.value = "0.00";
					var indexRow="";
					for (i=1;i<=eval(__wf__amountrow.value);i++) {
						indexRow = ""+i;
						if ( i < 10 )	indexRow = "0"+i;
						var tmpfield = eval("__wf__mcomplain$amountrealmoney$"+indexRow);
						var tmpvalue = delComma(tmpfield.value);
						var tmptotal = delComma(__wf__totalrealmoney.value);

						__wf__totalrealmoney.value = eval(tmptotal) + eval(tmpvalue);
						insertComma(__wf__totalrealmoney);
						checkInputComma(__wf__totalrealmoney);
					}
				}
			}

			function checkNumFloatNotBlank(obj,limitstart,limitend) {
				with( document.cscform ){
					if(obj.value != "") {
						checkNumFloat(obj,limitstart,limitend)
					} else {
						obj.value = "1.00";	
					}
				}
			}

			function checkNumFloatNotBlank2(obj,limitstart,strobjname) {
				with( document.cscform ){
					var limitend = eval("__wf__mcomplain$amountmoney$"+strobjname);
					if(obj.value != "") {
						checkNumFloat(obj,limitstart,limitend.value)
					} else {
						obj.value = "1.00";	
					}
				}
				sumAmountRealMoney();
			}

			function AddROW() {
				with(document.cscform){ 
				var indexRow;
				var countShow=0;
				if(__wf__welid.value.length==0){
								alert(MyCode[212]);
								var helpName="MWELFAREHELP_WF";
								var inputName="__wf__weldesc";
								goWelfareHelp(helpName,inputName);
					}else{	
						for(var i=1;i<=10&& countShow<1 ;i++) {
							indexRow = i;
							var trstyleh = eval("addWelfareH"+indexRow+".style");
							var trstylec = eval("addWelfareC"+indexRow+".style");
							if(trstyleh.display == "none" &&trstylec.display == "none") {
							   indexRow = "0"+i;
								countShow++;
								trstyleh.display = "";
								trstylec.display = "";
								__wf__amountrow.value = eval(__wf__amountrow.value) + 1;
								eval("__wf__mcomplain$welid$"+indexRow).value=__wf__welid.value;
								eval("__wf__weldesc"+indexRow).value=__wf__weldesc.value;
								eval("__wf__mcomplain$docgid$"+indexRow).value=__wf__docgid.value;
								eval("__wf__mcomplain$whouse$"+indexRow).value=__wf__whouse.value;	
	
								if(__wf__isedu.value=="1"){							
									eval("__wf__mcomplain$terminal$"+indexRow).readOnly=false;		
									eval("__wf__mcomplain$terminal$"+indexRow).setAttribute("class", "");
									eval("__wf__mcomplain$terminal$"+indexRow).className ="";
									
									eval("__wf__mcomplain$eduyear$"+indexRow).readOnly=false;		
									eval("__wf__mcomplain$eduyear$"+indexRow).setAttribute("class", "");
									eval("__wf__mcomplain$eduyear$"+indexRow).className ="";			
			
									eval("__wf__mcomplain$diseaseid$"+indexRow).value="";
									eval("__wf__diseasedesc"+indexRow).value="";		
									eval("__wf__diseasedesc"+indexRow).readOnly=true;				
									eval("__wf__diseasedesc"+indexRow).setAttribute("class", "disabled");
									eval("__wf__diseasedesc"+indexRow).className ="disabled";	
									//setDisabledStyle("diseasebtn",indexRow);		
										
								eval("__wf__degreeiddesc"+indexRow).readOnly=true;		
								eval("__wf__degreeiddesc"+indexRow).setAttribute("class", "");
								eval("__wf__degreeiddesc"+indexRow).className ="";		
								eval("degreebtn"+indexRow).style.display="";															
								}else{
									eval("__wf__mcomplain$terminal$"+indexRow).readOnly=true;		
									eval("__wf__mcomplain$terminal$"+indexRow).setAttribute("class", "disabled");
									eval("__wf__mcomplain$terminal$"+indexRow).className ="disabled";
									eval("__wf__mcomplain$terminal$"+indexRow).value="";
									
									eval("__wf__mcomplain$eduyear$"+indexRow).readOnly=true;		
									eval("__wf__mcomplain$eduyear$"+indexRow).setAttribute("class", "disabled");
									eval("__wf__mcomplain$eduyear$"+indexRow).className ="disabled";
									eval("__wf__mcomplain$eduyear$"+indexRow).value="";		
														
									eval("__wf__diseasedesc"+indexRow).readOnly=true;				
									eval("__wf__diseasedesc"+indexRow).setAttribute("class", "");
									eval("__wf__diseasedesc"+indexRow).className ="";
									
								eval("__wf__degreeiddesc"+indexRow).readOnly=true;		
								eval("__wf__degreeiddesc"+indexRow).setAttribute("class", "disabled");
								eval("__wf__degreeiddesc"+indexRow).className ="disabled";		
								eval("degreebtn"+indexRow).style.display="none";	
									
									//setEnabledStyle("diseasebtn",indexRow);										
								}						
								setProperties(indexRow);
								sumAmountMoney();
								sumAmountRealMoney();
							}
						}
					}
				}
			}

			function DelROW(){
				with(document.cscform){ 
					if(((__wf__amountrow.value*1)-1)>0) {
						var indexRow = (__wf__amountrow.value);
						var indexRow2 = (__wf__amountrow.value)<10?"0"+__wf__amountrow.value: __wf__amountrow.value;
						var trstyleh = eval("addWelfareH"+indexRow+".style");
						var trstylec = eval("addWelfareC"+indexRow+".style");
						if(trstyleh.display == "" &&trstylec.display == "") {
							trstyleh.display = "none";
							trstylec.display = "none";
							eval("__wf__mcomplain$docnum$"+indexRow2).value="";
							eval("__wf__mcomplain$diseaseid$"+indexRow2).value="";
							eval("__wf__mcomplain$sitewelid$"+indexRow2).value="";
							eval("__wf__mcomplain$hopital$"+indexRow2).value="";
							eval("__wf__mcomplain$line_no$"+indexRow2).value="";
							eval("__wf__mcomplain$numberbill$"+indexRow2).value="";
							eval("__wf__mcomplain$requisid$"+indexRow2).value="";
							eval("__wf__reqdesc"+indexRow2).value="";
							eval("__wf__mcomplain$amountmoney$"+indexRow2).value="0.00";
							eval("__wf__mcomplain$amountrealmoney$"+indexRow2).value="0.00";
							eval("__wf__mcomplain$whouse$"+indexRow2).value="";
							eval("__wf__mcomplain$docgid$"+indexRow2).value="";
							eval("__wf__mcomplain$attach$"+indexRow2).value="";
							eval("__wf__attachdesc"+indexRow2).value="";
							eval("__wf__sitegname"+indexRow2).value="";
							__wf__amountrow.value = (__wf__amountrow.value*1) - 1;
						}
					}
					sumAmountMoney();
					sumAmountRealMoney();
				}
			}
			
			function DelRows(){
				with(document.cscform){ 
						var countndex=0;
						for (var i=1;i<=10;i++) {
						var indexRow =i;
						var indexRow2 =i<10?"0"+i: i; 
									var trstyleh = eval("addWelfareH"+indexRow+".style");
									var trstylec = eval("addWelfareC"+indexRow+".style");
										if(eval("delchk"+indexRow2).checked==true){
											if(trstyleh.display == "" &&trstylec.display == "") {
												trstyleh.display = "none";
												trstylec.display = "none";
												eval("__wf__mcomplain$docnum$"+indexRow2).value="";
												eval("__wf__mcomplain$diseaseid$"+indexRow2).value="";
												eval("__wf__diseasedesc"+indexRow2).value="";
												eval("__wf__mcomplain$sitewelid$"+indexRow2).value="";
												eval("__wf__siteweldesc"+indexRow2).value="";
												eval("__wf__mcomplain$hopital$"+indexRow2).value="";
												eval("__wf__mcomplain$line_no$"+indexRow2).value="";
												eval("__wf__mcomplain$numberbill$"+indexRow2).value="";
												eval("__wf__mcomplain$requisid$"+indexRow2).value="";
												eval("__wf__reqdesc"+indexRow2).value="";
												eval("__wf__mcomplain$amountmoney$"+indexRow2).value="0.00";
												eval("__wf__mcomplain$amountrealmoney$"+indexRow2).value="0.00";
												eval("__wf__mcomplain$whouse$"+indexRow2).value="";
												eval("__wf__mcomplain$docgid$"+indexRow2).value="";
												eval("__wf__mcomplain$attach$"+indexRow2).value="";
												eval("__wf__attachdesc"+indexRow2).value="";
												eval("__wf__sitegname"+indexRow2).value="";
												eval("delchk"+indexRow2).checked=false;										
									}
								}
								if(trstyleh.display=="none"){
									countndex++;
								}
					sumAmountMoney();
					sumAmountRealMoney();						
					}
					__wf__amountrow.value = 10-countndex;					
				}
			}			
			
//*********************** Modified by pas
			
		var reqArray=new Array(5);
		ThaiCode[210]="กรุณารอสักครู่ ";
		EngCode[210]="Please wait !!!!! ";		
	   	ThaiCode[212]="กรุณาเลือกสวัสดิการ";
		EngCode[212]="Invalid welfare code !";
	   	ThaiCode[213]="กรุณาคลิกเอกสารแนบ";
		EngCode[213]="Invalid attach document !";
	   	ThaiCode[214] ="ใช้ไปแล้ว                                    = ";
		EngCode[214]  ="ใช้ไปแล้ว                                    = ";
	   	ThaiCode[215] ="คุณมียอดสวัสดิการ                      = ";
		EngCode[215]  ="คุณมียอดสวัสดิการ                      = ";
	   	ThaiCode[216] ="คงเหลือ                                       = ";
		EngCode[216]  ="คงเหลือ                                       = ";
	   	ThaiCode[217] ="เบิกได้ตามจริงแต่ไม่เกินครั้งละ   = ";
		EngCode[217]  ="เบิกได้ตามจริงแต่ไม่เกินครั้งละ   = ";
	   	ThaiCode[219] ="ยอดเบิกเกินครั้งนี้                       = ";
		EngCode[219]  ="ยอดเบิกเกินครั้งนี้                       = ";		
	   	ThaiCode[220] ="ยอดที่ขอเบิก                              = ";
		EngCode[220]  ="ยอดที่ขอเบิก                              = ";		
		ThaiCode[218] ="ไม่สามารถเบิกได้เต็มจำนวน !!! ";
		EngCode[218]  ="Can't request  !!!";		
		ThaiCode[211] ="กรุณาระบุเลขที่ใบเสร็จ !!! ";
		EngCode[211]  ="Please try bill no  !!!";		
		ThaiCode[221] ="กรุณาเลือกรายการเบิก !!! ";
		EngCode[221]  ="Please try requisition type  !!!";		
		ThaiCode[222] ="กรุณาระบุวันที่ใบเสร็จ !!! ";
		EngCode[222]  ="Please try bill date  !!!";	
		ThaiCode[223] ="กรุณาระบุยอดค่าใช้จ่าย !!! ";
		EngCode[223]  ="Plaese insert Amountmoney !!!";	
		ThaiCode[224] ="ไม่สามารถเบิกได้เนื่องจากเบิกเกินสิทธิ์ !!! ";
		EngCode[224]  ="Can't request  because over limit !!!";	
		ThaiCode[225] ="ยอดที่ขอครั้งนี้รวมทั้งหมด !!! ";
		EngCode[225]  ="Total request            =";	
		ThaiCode[226] ="กรุณาระบุปีการศึกษา !!! ";
		EngCode[226]  ="Please input education year !!!";	
		ThaiCode[227] ="กรุณาระบุภาคเรียน !!! ";
		EngCode[227]  ="Please input term of education !!!";	
		ThaiCode[228] ="กรุณาระบุระดับการศึกษา !!! ";
		EngCode[228]  ="Please input degree of education !!!";	
		ThaiCode[229] ="กรุณาระบุโรงพยาบาล/โรงเรียน !!! ";
		EngCode[229]  ="Please input hospital/ school !!!";	
		ThaiCode[230] ="กรุณาระบุโรค !!! ";
		EngCode[230]  ="Please input disease !!!";	
		ThaiCode[231] ="ไม่สามารถเบิกได้เนื่องจากเลือกคนในครอบครัวคนซ้ำกัน !!! ";
		EngCode[231]  ="Duplicate people in your family !!!";	
		EngCode[175]= " Please click submit button again ";
		ThaiCode[175]= "ระบบกำลังทำงานอยู่  กรุณากด Submit ใหม่อีกครั้ง ";		
		ThaiCode[232] ="ในกรณีที่ ยอดเงินที่เบิกไม่เท่ากับยอดอนุมัติ กรุณากรอกหมายเหตุ !!! ";
		EngCode[232]  ="ในกรณีที่ ยอดเงินที่เบิกไม่เท่ากับยอดอนุมัติ กรุณากรอกหมายเหตุ !!! ";	
		ThaiCode[233] ="กรุณาระบุคนในครอบครัว !!! ";
		EngCode[233]  ="กรุณาระบุคนในครอบครัว !!! ";	
		ThaiCode[234] ="กรุณาระบุประเภทผู้ป่วย !!! ";
		EngCode[234]  ="กรุณาระบุประเภทผู้ป่วย !!! ";	
		ThaiCode[235] ="เลขที่ใบเสร็จซ้ำ !!! ";
		EngCode[235]  ="เลขที่ใบเสร็จซ้ำ !!! ";			
		ThaiCode[236] ="ยอดอนุมัติ =0 ไม่สามารถเบิกได้ เนื่องจากเบิกเกินสิทธิ์ กรุณาตรวจสอบอีกครั้ง !!! ";
		EngCode[236]  ="ยอดอนุมัติ =0 ไม่สามารถเบิกได้ เนื่องจากเบิกเกินสิทธิ์ กรุณาตรวจสอบอีกครั้ง !!! ";	
		ThaiCode[237] ="กรุณาแนบเอกสารประกอบการพิจารณา !!! ";
		EngCode[237]  ="กรุณาแนบเอกสารประกอบการพิจารณา !!! ";			
	function hiddenDiv(){
		with(document.cscform){
			 btsubmit.style.display="none";
			 showtxt.innerHTML="<p align='center'><img src='./IMAGES/WAITING.gif'><BR><font color='red' ><B>"+MyCode[210]+"</H3></font><p>";
			 //$.blockUI({message: "<p align='center'><img src=./IMAGES/WAITING.gif'><BR><font color='red' ><B>"+MyCode[210]+"</H3></font></p>'"});  
		}
	}
	
	function displayDiv(){
				with(document.cscform){							
						// $.unblockUI(); 
						 btsubmit.style.display="";
						 showtxt.innerHTML="";
						
					}	
	}			
	
		var msg="";
		var msgAll="";
		var openIndexArray =new Array();
   		var openValueArray =new Array();
	
 	function checkNumFloat(obj,min,max){
		if (obj.value != "") {
			if(obj.value.indexOf(",")>-1)
			     obj.value=obj.value.replace(/,/g,""); 	
			obj.value = parseFloat(obj.value)+""; // แปลงจาก 01234.xx เป็น 1234.xx
			checkInputComma(obj);  // ถ้าพิม xxx ก็ให้เป็น xxx.00
			if (min >= 0 && max > 0) 	{
				callMaxMin(obj,min,max); // ตรวจดูว่าค่าที่กรอกเกินค่าสูงสุด หรือต่ำกว่าค่าต่ำสุดหรือไม่
			}
			insertComma(obj); //123456 ==> 123,456
		}
	}
	
	function postReturn(){
			with(document.cscform){
					var indexRow="";
					for (var i=1;i<=eval(__wf__amountrow.value);i++) {
									if(i<10){
										indexRow="0"+i;
									}else{
										indexRow=i;
									}
							//eval("__wf__mcomplain$amountmoney$"+indexRow).value="0.00";
							//eval("__wf__mcomplain$amountrealmoney$"+indexRow).value="0.00";				
							//eval("__wf__mcomplain$sitewelid$"+indexRow).value="";
							//eval("__wf__siteweldesc"+indexRow).value="";
							//eval("__wf__mcomplain$line_no$"+indexRow).value="";
							eval("__wf__mcomplain$diseaseid$"+indexRow).value="";
							//eval("__wf__diseasedesc"+indexRow).value="";
							//eval("__wf__sitegname"+indexRow).value="";
							//eval("__wf__mcomplain$line_no$"+indexRow).value="";
							eval("__wf__mcomplain$welid$"+indexRow).value=__wf__welid.value;
							eval("__wf__weldesc"+indexRow).value=__wf__weldesc.value;
							eval("__wf__mcomplain$docgid$"+indexRow).value=__wf__docgid.value;
							eval("__wf__mcomplain$whouse$"+indexRow).value=__wf__whouse.value;
							if(__wf__isedu.value=="1"){							
								eval("__wf__mcomplain$terminal$"+indexRow).readOnly=false;		
								eval("__wf__mcomplain$terminal$"+indexRow).setAttribute("class", "");
								eval("__wf__mcomplain$terminal$"+indexRow).className ="";
								
								eval("__wf__mcomplain$eduyear$"+indexRow).readOnly=false;		
								eval("__wf__mcomplain$eduyear$"+indexRow).setAttribute("class", "");
								eval("__wf__mcomplain$eduyear$"+indexRow).className ="";			

								eval("__wf__degreeiddesc"+indexRow).readOnly=true;		
								eval("__wf__degreeiddesc"+indexRow).setAttribute("class", "");
								eval("__wf__degreeiddesc"+indexRow).className ="";		
								eval("degreebtn"+indexRow).style.display="";
									
		
								eval("__wf__mcomplain$diseaseid$"+indexRow).value="";
								eval("__wf__diseasedesc"+indexRow).value="";		
								eval("__wf__diseasedesc"+indexRow).readOnly=true;				
								eval("__wf__diseasedesc"+indexRow).setAttribute("class", "disabled");
								eval("__wf__diseasedesc"+indexRow).className ="disabled";	
								//eval("diseasebtn"+indexRow).style.display="none";

															
							}else{
								//alert(document.getElementsByName("__wf__mcomplain$terminal$"+indexRow)[0].value);

								eval("__wf__mcomplain$terminal$"+indexRow).readOnly=true;		
								eval("__wf__mcomplain$terminal$"+indexRow).setAttribute("class", "disabled");
								eval("__wf__mcomplain$terminal$"+indexRow).className ="disabled";
								eval("__wf__mcomplain$terminal$"+indexRow).value="";
								
								eval("__wf__mcomplain$eduyear$"+indexRow).readOnly=true;		
								eval("__wf__mcomplain$eduyear$"+indexRow).setAttribute("class", "disabled");
								eval("__wf__mcomplain$eduyear$"+indexRow).className ="disabled";
								eval("__wf__mcomplain$eduyear$"+indexRow).value="";		
								
								eval("__wf__degreeiddesc"+indexRow).readOnly=true;		
								eval("__wf__degreeiddesc"+indexRow).setAttribute("class", "disabled");
								eval("__wf__degreeiddesc"+indexRow).className ="disabled";		
								eval("degreebtn"+indexRow).style.display="none";		
								eval("__wf__degreeiddesc"+indexRow).value ="";		
													
								eval("__wf__diseasedesc"+indexRow).readOnly=true;				
								eval("__wf__diseasedesc"+indexRow).setAttribute("class", "");
								eval("__wf__diseasedesc"+indexRow).className ="";	
								//eval("diseasebtn"+indexRow).style.display="";
	
							}
							setProperties(indexRow);													
					}
					sumAmountMoney();
					sumAmountRealMoney();
					if(__wf__welid.value=="MARY001"){
						 addbtn.style.display="none";
						 eval("delchk02").checked=true;
						 eval("delchk03").checked=true;
						 eval("delchk04").checked=true;
						 eval("delchk05").checked=true;
						 DelRows();
					}else{
					    addbtn.style.display="";					
					}
			}
	}
	
	function preGoWF(step){ 
	    checkmystep=false;
		if(step!="1"){
				if(document.cscform.wf_command[0].type=="radio" &&!document.cscform.wf_command[0].checked){
						checkmystep=true;
				}
		}
		if(checkmystep){				
				GoWF();		
		}else{				
			hiddenDiv();
			sumAmountMoney();
			sumAmountRealMoney();
			if(validData()==0){
			with(document.cscform){						
						var indexRow="";
						var wid;
						var  ch1=true;
						for (var i=1;i<=eval(__wf__amountrow.value);i++) {
									if(i<10){
										indexRow="0"+i;
									}else{
										indexRow=i;
									}
									wid=eval("__wf__mcomplain$welid$"+indexRow);
									 ch1=checkItems(wid,indexRow,ch1,(i-1),step);
					 		}														 				
								if(ch1){				
									DWREngine.beginBatch();		
									CheckRequisitionBean(reqArray,allItem);
									DWREngine.endBatch({	
										 	async:false//,
											//timeout:1000
									});
									}
				}
			}else{
				displayDiv();
			}	
		}
	}
	
	function checkItems(objval,j,faq,str2,step){
	var str=j;
	with(document.cscform){
		if(faq){
					if(objval.value.length>0){
							 reqArray[str2]=objval.value+"#"+eval("__wf__employeeid.value")+"#"+eval("__wf__mcomplain$amountrealmoney$"+j+".value")+"#"+eval("__wf__mcomplain$line_no$"+j+".value")+"#"+eval("__wf__mcomplain$datebill$"+j+".value")+"#"+''+eval("__wf__mcomplain$degreeid$"+j+".value")+"#"+"#"+eval("__wf__mcomplain$sitewelid$"+j+".value")+"#"+eval("__wf__mcomplain$amountmoney$"+j+".value")+"####"+str+"#"+eval("__wf__mcomplain$numberbill$"+j+".value");
					}//if		
		  }//if
	  return faq;
	}//with
 }	
	
	function CheckRequisitionBean(reqArray,allItem){	
			CheckRequisition.checkAllItems(reqArray,{
					 callback:allItem
					 //postHook:function(){process()}   
					});	
			//setTimeout("process()",5000);
			//  DWREngine.setPostHook(function() { ไม่ work .oversion 3rc2
			//	process();
			// });			
	}	
	
var allItem = function(data1){
	msg="";
	msgAll="";
		for(var i=0;i<data1.length;i++){
				if(data1[i]!=null){						
						var vdata=data1[i].split('#');
						chkRequisition(vdata);
				}
		}
		process();
	}	
	
	
	function  chkRequisition(data1){
		if(data1[0]!= "true")	{
		        var req;
					req=eval("document.cscform.__wf__mcomplain$amountmoney$"+data1[6]+".value");
					if( req.indexOf(",") > -1 )
							req = req.replace(/,/g,"");
				var overlimit=parseFloat(req);
				var limit=parseFloat(data1[3]);
						msg+=data1[4]+" "+MyCode[218]+" \n";
				           +MyCode[220]+parseFloat(req).toFixed(2)+"\n"
						   if(document.cscform.__wf__welid.value=="SICK001"){
						   		msg+=MyCode[215]+"Unlimited\n";						  	
				           		msg+=MyCode[217]+parseFloat(data1[5]).toFixed(2)+"\n";
								if((eval("document.cscform.__wf__mcomplain$amountrealmoney$"+data1[6]).value.replace(/,/g,"")*1) >(data1[5]	*1)){
						   				eval("document.cscform.__wf__mcomplain$amountrealmoney$"+data1[6]).value=data1[5];								
								}else {	
										eval("document.cscform.__wf__mcomplain$amountrealmoney$"+data1[6]).value=eval("document.cscform.__wf__mcomplain$amountrealmoney$"+data1[6]).value.replace(/,/g,"");							
								}								   				
						   }else{						 
				           		msg+=MyCode[215]+parseFloat(data1[2]).toFixed(2)+"\n";						  
				           		msg+=MyCode[214]+parseFloat(data1[1]).toFixed(2)+"\n";
				           		msg+=MyCode[216]+parseFloat(data1[3]).toFixed(2)+"\n";
				           		msg+=MyCode[217]+parseFloat(data1[5]).toFixed(2)+"\n";
						  					   
						   		if(overlimit>limit){
						    		msg+=MyCode[219]+((overlimit-limit).toFixed(2))+"\n";
								}
						   	
								if((eval("document.cscform.__wf__mcomplain$amountrealmoney$"+data1[6]).value.replace(/,/g,"")*1) >(data1[3]	*1)){
						   			eval("document.cscform.__wf__mcomplain$amountrealmoney$"+data1[6]).value=data1[3];								
								}else{
									eval("document.cscform.__wf__mcomplain$amountrealmoney$"+data1[6]).value=eval("document.cscform.__wf__mcomplain$amountrealmoney$"+data1[6]).value.replace(/,/g,"");
								}						   					
						   }
				           msg+="----------------------------------------\n";
						   msg+=data1[9];
						   insertComma(eval("document.cscform.__wf__mcomplain$amountrealmoney$"+data1[6]));		
	   					sumAmountRealMoney();								   
			}	
				if(msgAll.length==0){
				sumAmountRealMoney();	
				var totalmoney=document.cscform.__wf__totalrealmoney.value.replace(/,/g,"");
				var duplicateFam=0;
				/*if(document.cscform.__wf__welid.value=="SICK002" || document.cscform.__wf__welid.value=="SICK003" || document.cscform.__wf__welid.value=="SICK004"){
						duplicateFam=checkDuplicateFamily();
				}*/
				
				if(duplicateFam>0){
						msgAll+=MyCode[231]+"\n";
				}else if(totalmoney>parseFloat(data1[2])){
						if(document.cscform.__wf__welid.value!="SICK002" && document.cscform.__wf__welid.value!="SICK003" && document.cscform.__wf__welid.value!="SICK004"){
									msgAll+=data1[4]+" "+MyCode[224]+" \n";
								   if(document.cscform.__wf__welid.value=="SICK001"){
										msgAll+=MyCode[215]+"Unlimited\n";
								   }else{						 
										msgAll+=MyCode[215]+parseFloat(data1[2]).toFixed(2)+"\n"
								   }
		
							   msgAll+=MyCode[214]+parseFloat(data1[1]).toFixed(2)+"\n";
								if(document.cscform.__wf__welid.value!="SICK001"){
								   msgAll+=MyCode[216]+parseFloat(data1[3]).toFixed(2)+"\n";
								   }
							   msgAll+=MyCode[217]+parseFloat(data1[5]).toFixed(2)+"\n"
							   +MyCode[225]+parseFloat(totalmoney).toFixed(2)+"\n";							   
							   msgAll+="----------------------------------------\n";
							   msgAll+=data1[9];									
					}
				}
			}			
		} 
		
		function process(){ 
		
					setTimeout(displayDiv,1000);
					if(msg.length>0 || msgAll.length>0){
						if(msgAll.length>0){	
						 	alert(msgAll);
						 }else if(msg.length>0){	
						 	alert(msg);
						 }
					}else{
							GoWF();
				  }
	}
	
		function checkDuplicateFamily(){
				with(document.cscform){ 
						var countF=0;
						var countFam="";						
						for (var i=1;i<=10;i++) {
						var indexRow =i;
						var indexRow2 =i<10?"0"+i: i; 
									var trstyleh = eval("addWelfareH"+indexRow+".style");
									var trstylec = eval("addWelfareC"+indexRow+".style");
										if(trstyleh.display == "" &&trstylec.display == "") {
											if(countFam.indexOf(eval("__wf__mcomplain$line_no$"+indexRow2).value)>-1 && countFam.length>0){
												countF++;
											}else{
												countFam=eval("__wf__mcomplain$line_no$"+indexRow2).value;
										}
								}
						}			
				}
				return countF;
		}	
	
	function validData(){
			with(document.cscform){		
					var chk=0;
						var indexRow="";
						var  bill_str="";					
						for (var i=1;i<=eval(__wf__amountrow.value);i++){
							if(i<10){
								indexRow="0"+i;
							}else{
								indexRow =i;
							}
					 			chk+=checkValidData(eval("addWelfareH"+i+".style.display"),eval("__wf__mcomplain$welid$"+indexRow),eval("__wf__mcomplain$attach$"+indexRow));																
								if(eval("__wf__mcomplain$numberbill$"+indexRow).value.length==0){
										chk++;
										alert(MyCode[211]);
								}else if(eval("__wf__mcomplain$datebill$"+indexRow).value.length==0){
										chk++;
										alert(MyCode[222]);
								}else if(__wf__isedu.value=="1"&&eval("__wf__mcomplain$terminal$"+indexRow).value.length==0){
										chk++;
										alert(MyCode[227]);
								}else if(__wf__isedu.value=="1"&&eval("__wf__mcomplain$eduyear$"+indexRow).value.length==0){
										chk++;
										alert(MyCode[226]);
								}else if(__wf__isedu.value=="1"&&eval("__wf__degreeiddesc"+indexRow).value.length==0){
										chk++;
										alert(MyCode[228]);
								}else if(__wf__isedu.value=="1"&&eval("__wf__siteweldesc"+indexRow).value.length==0 &&eval("__wf__mcomplain$hopital$"+indexRow).value.length==0){
										chk++;
										alert(MyCode[229]);
								}else if(eval("__wf__mcomplain$amountmoney$"+indexRow).value == 0.00){
										chk++;
										alert(MyCode[223]);
								}else if(eval("__wf__mcomplain$amountrealmoney$"+indexRow).value == 0.00){
										chk++;
										alert(MyCode[236]);								
								}else if((__wf__welid.value=="OPD001")&&eval("__wf__siteweldesc"+indexRow).value.length==0 &&eval("__wf__mcomplain$hopital$"+indexRow).value.length==0){//||__wf__welid.value=="OPD002"
										chk++;
										alert(MyCode[229]);
								}else if(__wf__welid.value=="MARY001"&&eval("__wf__mcomplain$line_no$"+indexRow).value==""){
										chk++;
										alert(MyCode[233]);
								}else if(__wf__welid.value=="SICK004"&&eval("__wf__mcomplain$line_no$"+indexRow).value.length==0){
										chk++;
										alert(MyCode[233]);
								}/*else if((__wf__welid.value=="OPD001" ||__wf__welid.value=="OPD002")&&eval("__wf__diseasedesc"+indexRow).value.length==0){//||__wf__welid.value=="OPD002"
										chk++;
										alert(MyCode[230]);
								}*/else if((__wf__welid.value=="OPD001")&&eval("__wf__mcomplain$curetype$"+indexRow).value.length==0){// ||__wf__welid.value=="OPD002"
										chk++;
										alert(MyCode[234]);
								}else if(bill_str.indexOf(","+eval("__wf__mcomplain$numberbill$"+indexRow).value+",")>-1){
										chk++;
										alert(MyCode[235]);
								}else if(eval("__wf__mcomplain$amountrealmoney$"+indexRow).value!=eval("__wf__mcomplain$amountmoney$"+indexRow).value &&__remark.value.length==0 ){
										chk++;
										alert(MyCode[232]);		
										__remark.disabled=false;
										__remark.readOnly=false;																		
								}
								bill_str+=" ,"+eval("__wf__mcomplain$numberbill$"+indexRow).value+", ";
								if(chk>0){
									bill_str="";	
									break;
								}
					 	}
						if(checkAttachFile()){
								chk++;
								alert(MyCode[237]);								
						}
					   return chk;
			}
	}
	
	function checkAttachFile(){
			with(document.cscform){
					return ((typeof attach_file)=="undefined");
			}
	}
	
	function copyValue(source,dest){
						dest.value=source.value;
						sumAmountMoney();
						sumAmountRealMoney();						
	}
	
	function checkValidData(obj1,obj2,obj3){
								  if(obj1.length==0){
									if(obj2.value.length==0){
												alert(MyCode[212]);
												displayDiv();
												return 1;
									}
									/*if(obj3.value.length==0){
												alert(MyCode[213]);
												displayDiv();
												return 1;
									}*/
					   }
					   return 0;							
	}

	function goView(){
		with( document.cscform ){
			if( __wf__mcomplain$welid$01.value == "" ){
				alert(MyCode[212]);
			}else{
				Welwf_001_dwr.showView(new Array('95%',__wf__employeeid.value,__wf__mcomplain$welid$01.value),
					function(data){ 
						if( data.length > 0 ){
							$(viewWelfare).innerHTML = data[0];
						}
					}
				);
			}
		}
	}
	
	function changeVaue(obj,obj2,obj3){
			if(!obj.checked){
				obj2.value="";		
				obj2.readOnly=true;		
				obj2.setAttribute("class", "disabled");
				obj2.className ="disabled";
				if(obj3!=null){
					obj3.readOnly=true;			
					obj3.value="";	
					obj3.setAttribute("class", "disabled");
					obj3.className ="disabled";
				}
			}else{
				obj2.readOnly=false;				
				obj2.setAttribute("class", "readonly");
				obj2.className ="readonly";
				if(obj3!=null){
					obj3.readOnly=false;	
					obj3.setAttribute("class", "readonly");
					obj3.className ="readonly";					
				}
			}
	}


		function OpenPage(page){
					with(document.cscform){
						if(page=='1'){
						 var  pam="WELEXP_RH_001_PRINT.jsp?__runno="+wf_seq_no.value+"&wf_seq_no="+wf_seq_no.value+"&step_seq_no="+step_seq_no.value+"&wf_ver=1&wf_id="+wf_id.value+"&wf_doc_no="+wf_doc_no.value+"&__appname=TA&step_id="+step_id.value;	
						}else if(page=='2'){
						 var  pam="WELEXP_RH_002_PRINT.jsp?__runno="+wf_seq_no.value+"&wf_seq_no="+wf_seq_no.value+"&step_seq_no="+step_seq_no.value+"&wf_ver=1&wf_id="+wf_id.value+"&wf_doc_no="+wf_doc_no.value+"&__appname=TA&step_id="+step_id.value;	
						}else{
						 var  pam="WELEXP_RH_003_PRINT.jsp?__runno="+wf_seq_no.value+"&wf_seq_no="+wf_seq_no.value+"&step_seq_no="+step_seq_no.value+"&wf_ver=1&wf_id="+wf_id.value+"&wf_doc_no="+wf_doc_no.value+"&__appname=TA&step_id="+step_id.value;	
						}
						}
						//window.open(pam,"Help","left=150,top=150,width=720,height=600,toolbar=no,status=yes,scrollbars=yes");
						window.open(pam,"Help","");
			}
			
		function viewPrint(){
				with( document.cscform ){
				var local=window.location+"";
				var targetlink=local.substring(local.indexOf("?"),local.length);
					window.open("./WELWF001_GPF_PRINT.jsp"+targetlink,"Help","left=150,top=150,width=800,height=700,toolbar=no,status=no,scrollbars=yes,resizable=yes");
				}
			}		

		function viewPrint2(){
				with( document.cscform ){
				var local=window.location+"";
				var targetlink=local.substring(local.indexOf("?"),local.length);
					window.open("./WELWF001_GPF_PRINT2.jsp"+targetlink,"Help","left=150,top=150,width=800,height=700,toolbar=no,status=no,scrollbars=yes,resizable=yes");
				}
			}				
			
	function  setFamily(obj,index){
		with( document.cscform ){
				eval("__wf__mcomplain$familyname$"+index).value=obj.options[obj.selectedIndex].text;
		}
	}	
	
	function  setCurrency(obj,index){
		with( document.cscform ){
				eval("__wf__mcomplain$exchangename$"+index).value=obj.options[obj.selectedIndex].text;
		}
	}		
	
	function setProperties(indexRow){
			with( document.cscform ){
					if(__wf__welid.value=="EDU001"){
											setFamilyObj("family"+indexRow,"eduObj");
											setEnabledObj("__wf__mcomplain$amountmoney$",indexRow);
											setEnabledObjReadonly("__wf__siteweldesc",indexRow);
											setEnabledObj("__wf__mcomplain$hopital$",indexRow);
											setEnabledStyle("sitewelbtn",indexRow);
											setDisabledObj("__wf__mcomplain$curetype$",indexRow);
											eval("__wf__mcomplain$curetype$"+indexRow).disabled=true;
											eval("__wf__mcomplain$curetype$"+indexRow).value="";											
							}else if(__wf__welid.value=="SICK002" || __wf__welid.value=="SICK003" || __wf__welid.value=="SICK004"){
									 if(__wf__welid.value=="SICK002"){	
											setFamilyObj("family"+indexRow,"sick2Obj");
									}else if(__wf__welid.value=="SICK003"){	
											setFamilyObj("family"+indexRow,"sick3Obj");
									}else if(__wf__welid.value=="SICK004"){	
											setDisabledObj("__wf__mcomplain$amountmoney$",indexRow);
											setFamilyObj("family"+indexRow,"sick4Obj");
											eval("__wf__mcomplain$amountmoney$"+indexRow).value="5,000.00";
											eval("__wf__mcomplain$amountrealmoney$"+indexRow).value="5,000.00";		
											setEnabledObj("__wf__mcomplain$amountmoney$",indexRow);																		
									}
											setDisabledObj("__wf__mcomplain$curetype$",indexRow);
											eval("__wf__mcomplain$curetype$"+indexRow).disabled=true;
											eval("__wf__mcomplain$curetype$"+indexRow).value="";											
									
							}else {
									setFamilyObj("family"+indexRow,"closeObj");
									if(__wf__welid.value=="MARY001"){									
											setDisabledObj("__wf__mcomplain$amountmoney$",indexRow);
											setDisabledObj("__wf__diseasedesc",indexRow);
											setDisabledObj("__wf__siteweldesc",indexRow);
											setDisabledObj("__wf__mcomplain$hopital$",indexRow);
											setDisabledStyle("sitewelbtn",indexRow);
											//setDisabledStyle("diseasebtn",indexRow);
											//eval("__wf__mcomplain$amountmoney$"+indexRow).value="3,000.00";
											//eval("__wf__mcomplain$amountrealmoney$"+indexRow).value="3,000.00";
											eval("__wf__sitegname"+indexRow).value="";
											setFamilyObj("family"+indexRow,"wifeObj");
											setDisabledObj("__wf__mcomplain$curetype$",indexRow);
											eval("__wf__mcomplain$curetype$"+indexRow).disabled=true;
											eval("__wf__mcomplain$curetype$"+indexRow).value="";											
									}else if(__wf__welid.value=="OPD001"||__wf__welid.value=="OPD002"){
											setFamilyObj("family"+indexRow,"famObj");
											setEnabledObj("__wf__mcomplain$amountmoney$",indexRow);
											setEnabledObjReadonly("__wf__siteweldesc",indexRow);
											setEnabledObj("__wf__mcomplain$hopital$",indexRow);
											setEnabledStyle("sitewelbtn",indexRow);			
											setEnabledObjReadonly("__wf__diseasedesc",indexRow);
											//setEnabledStyle("diseasebtn",indexRow);	
											setEnabledObj("__wf__mcomplain$curetype$",indexRow);
											eval("__wf__mcomplain$curetype$"+indexRow).disabled=false;
											//eval("__wf__mcomplain$amountmoney$"+indexRow).value="0.00";
											//eval("__wf__mcomplain$amountrealmoney$"+indexRow).value="0.00";
									}
							}
								setDisabledObj2("__wf__mcomplain$amountrealmoney$",indexRow);
				}
	}
	
	function setDisabledObj(objname,indexRow){
		with( document.cscform ){	
			eval(objname+""+indexRow).readOnly=true;				
			eval(objname+""+indexRow).setAttribute("class", "disabled");
			eval(objname+""+indexRow).className ="disabled";
			eval(objname+""+indexRow).value="";	
		}
		return true;
	}
	
	function setDisabledObj2(objname,indexRow){
		with( document.cscform ){	
			eval(objname+""+indexRow).readOnly=true;				
			eval(objname+""+indexRow).setAttribute("class", "disabled");
			eval(objname+""+indexRow).className ="disabled";
		}							
	}	
	
	function setEnabledObj(objname,indexRow){
		with( document.cscform ){	
			eval(objname+""+indexRow).readOnly=false;				
			eval(objname+""+indexRow).setAttribute("class", "");
			eval(objname+""+indexRow).className ="";					
		}
	}
	function setEnabledObjReadonly(objname,indexRow){
		with( document.cscform ){	
			eval(objname+""+indexRow).readOnly=true;				
			eval(objname+""+indexRow).setAttribute("class", "");
			eval(objname+""+indexRow).className ="";					
		}
	}		
	
	function setEnabledStyle(objname,indexRow){		
			with( document.cscform ){	
				eval(objname+indexRow).style.display="";		
			}
	}	
	function setDisabledStyle(objname,indexRow){		
			with( document.cscform ){	
				eval(objname+indexRow).style.display="none";		
			}
	}	
	
/*$(document).ready(function() { 
    $('#btsubmit').click(function() { 
        $.blockUI({ 
            theme:     true, 
            title:    'This is your title', 
            message:  '<p>This is your message.</p>', 
            timeout:   2000 
        }); 
    });    
}); 	*/
	
	//*********************** end Modified by pas
	
		-->
		</script>
<style>
						input.readonly, select.readonly, textarea.readonly {
					background: #ffffff;
					border: 1px solid #A5ACB2;
				}
</style>
</head>
<body bgcolor=#FFFFFF onLoad="MM_preloadImages('../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif','../IMAGES/BUTTON/SWAP/CALENDAR_SWAP20.gif','../IMAGES/BUTTON/SWAP/COPY_SWAP20.gif')">
<!-- ImageReady Slices (02.psd) -->
<form name="cscform" method="post" action="WELWF001_GPF.jsp">
  <input type="hidden" name="__screen" value="WELWF001_GPF">
  <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="3001">
  <input type="hidden" name="__wf_id" value="3001">
  <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="<%=stepid%>">
  <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="<%=chkNull.chkNullString(request.getParameter("__oldDocumentID"),screenSingle.getDataLabel("DOC_NO"))%>">
  <input type="hidden" name="__oldWF" value="<%=chkNull.chkNullString(request.getParameter("__oldWF"),screenSingle.getDataLabel("WF_STATUS"))%>">
  <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_doc_no" value="<%=screenSingle.getDataLabel("DOC_NO")%>">
  <input type="hidden" name="__employeeid" value="<%=screenSingle.getUProfile().get("employeeid")%>">
  <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"))%>">
  <input type="hidden" name="__return_help" value="">
  <%=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>
  <jsp:include page="../MYNOTE/MYNOTE_HEAD.jsp" flush="true"/>
  <div align="right"> <%=md.getStepDocument("3001","1")%> 
  	<%=md.getHeadDocument()%> 
	<br>
    <%=md.getHelpDocument2("Welfare requistion form")%> <br>
    <%=md.getSendToDocumentNoSearch("Welfare requistion form")%>

	<!-- Begin CheckStep -->
	<input type="hidden" name="__wf__isstep1" id="__wf__isstep1" value="<%=md.isStep1%>">
	<input type="hidden" name="__wf__isstep2" id="__wf__isstep2" value="<%=md.isStep2%>">
	<input type="hidden" name="__wf__isstepcancel" id="__wf__isstepcancel" value="<%=md.isStepCancel%>">
	<input type="hidden" name="__wf__isstepcomment" id="__wf__isstepcomment" value="<%=md.isStepComment%>">
	<input type="hidden" name="__wf__isstepreturn" id="__wf__isstepreturn" value="<%=md.isStepReturn%>">
	<input type="hidden" name="__wf__isstepcopy" id="__wf__isstepcopy" value="<%=md.isStepCopy%>">
	<input type="hidden" name="__wf__isdraft" id="__wf__isdraft" value="<%=md.isDraft%>">
	<input type="hidden" name="__wf__isstep3" id="__wf__isstep3" value="<%=md.isStep3%>">
	<input type="hidden" name="__wf__isadminedit" id="__wf__isadminedit" value="<%=md.isAdminEdit%>">
	<input type="hidden" name="__wf__isadmincancel" id="__wf__isadmincancel" value="<%=md.isAdminCancel%>">
	<input type="hidden" name="__wf__isadmindelete" id="__wf__isadmindelete" value="<%=md.isAdminDelete%>">
	<input type="hidden" name="__wf__isadminclean" id="__wf__isadminclean" value="<%=md.isAdminClean%>">
	<input type="hidden" name="__wf__isarchive" id="__wf__isarchive" value="<%=md.isArchive%>">

	<INPUT TYPE="hidden" NAME="wf_default_actor" VALUE="true">

	<!-- draft will not be saved without this field -->
	<input type="hidden" name="priority" id="priority" value="0"> 
	<!-- End CheckStep -->

    <%
		DataSet ds=new DataSet();
		String _and="+'  '+";
			if(vendor.equalsIgnoreCase("ORACLE")){
				_and="||'  '||";
			}
		 String desc=((String)screenSingle.getUProfile().get("lang")).equals("eng")?"efname"+_and+"elname ":"fnameid"+_and+"lname ";
		 String edu=" var eduObj={ ";
		 String famAll=" var famObj={ ";
		 //'01','02','03','04','09','10','11'
		 String sql2="select  mempl_family.*,fnameid"+_and+"lname fullname  "+
				" from mempl_family   "+
				" where employeeid='"+((md.isStep1 || md.isDraft)?empID:md.getWFDataValue("__wf__employeeid"))+"' and relationid in('01','02','03','04','05','06','09')  "+
				" and line_no not in (select gainerid from mcomplain where employeeid='"+((md.isStep1 || md.isDraft)?empID:md.getWFDataValue("__wf__employeeid"))+"' and status='1'  and approvestatus='1' and welid in ('SICK002')  and budyear='"+(calendar.getYear()+543)+"' ) "+
				" order by fnameid"+_and+"lname";
		String sql1="select  mempl_family.*,"+desc+" fullname from mempl_family where  employeeid='"+((md.isStep1 || md.isDraft)?empID:md.getWFDataValue("__wf__employeeid"))+"' and relationid in('01','02','03','04','05','06','09')  order by "+desc;
		 String sql3="select mempl_family.*,fnameid"+_and+"lname fullname  "+
				" from mempl_family   "+
				" where employeeid='"+((md.isStep1 || md.isDraft)?empID:md.getWFDataValue("__wf__employeeid"))+"' and relationid in('01','02','03','04','05','06','09')  "+
				" and line_no not in (select gainerid from mcomplain where employeeid='"+((md.isStep1 || md.isDraft)?empID:md.getWFDataValue("__wf__employeeid"))+"' and status='1'  and approvestatus='1' and welid in ('SICK003')  and budyear='"+(calendar.getYear()+543)+"' ) "+
				" order by fnameid"+_and+"lname";
		 String sql4="select  mempl_family.*,fnameid"+_and+"lname fullname  "+
				" from mempl_family   "+
				" where employeeid='"+((md.isStep1 || md.isDraft)?empID:md.getWFDataValue("__wf__employeeid"))+"' and relationid in('01','02','03','04','05','06','09')  "+
				" and line_no not in (select gainerid from mcomplain where employeeid='"+((md.isStep1 || md.isDraft)?empID:md.getWFDataValue("__wf__employeeid"))+"' and status='1'  and approvestatus='1' and welid in ('SICK004')  and budyear='"+(calendar.getYear()+543)+"' ) "+
				" order by fnameid"+_and+"lname";
		
		ArrayList familyOps=new ArrayList();
				try{
				ds.setDbName(screenSingle.getUProfile().getDbName());
				ds.setTableName("mempl_family");
				ds.setSql(sql1);
				ds.initConnection(screenSingle.getUProfile());
					while(ds.next()){
					//familyOps.add(ds.getString("line_no")+","+ds.getString("fullname"));
						if(" 04 05 06 09 10 11 12 16 ".indexOf(ds.getString("relationid"))>-1){
								edu+=ds.getString("line_no")+":'"+ds.getString("fullname")+"' ,";
						}
						famAll+=ds.getString("line_no")+":'"+ds.getString("fullname")+"' ,";
					}
					edu=edu.substring(0,edu.length()-1)+"}";
					famAll=famAll.substring(0,famAll.length()-1)+"}";				
				}catch(Exception  ex){
				}finally{
					if(ds!=null){
							ds.closeConnection();
					}
				}		

				 String sick2=" var sick2Obj={ ";
				try{
				ds.setDbName(screenSingle.getUProfile().getDbName());
				ds.setTableName("mempl_family");
				ds.setSql(sql2);
				ds.initConnection(screenSingle.getUProfile());
					while(ds.next()){
						sick2+=ds.getString("line_no")+":'"+ds.getString("fullname")+"' ,";
					}
					sick2=sick2.substring(0,sick2.length()-1)+"}";			
				}catch(Exception  ex){
				}finally{
					if(ds!=null){
							ds.closeConnection();
					}
				}	
				
				 String sick3=" var sick3Obj={ ";
				try{
				ds.setDbName(screenSingle.getUProfile().getDbName());
				ds.setTableName("mempl_family");
				ds.setSql(sql3);
				ds.initConnection(screenSingle.getUProfile());
					while(ds.next()){
						sick3+=ds.getString("line_no")+":'"+ds.getString("fullname")+"' ,";
					}
					sick3=sick3.substring(0,sick3.length()-1)+"}";			
				}catch(Exception  ex){
				}finally{
					if(ds!=null){
							ds.closeConnection();
					}
				}	
				
				 String sick4=" var sick4Obj={ ";
				try{
				ds.setDbName(screenSingle.getUProfile().getDbName());
				ds.setTableName("mempl_family");
				ds.setSql(sql4);
				ds.initConnection(screenSingle.getUProfile());
					while(ds.next()){
						sick4+=ds.getString("line_no")+":'"+ds.getString("fullname")+"' ,";
					}
					sick4=sick4.substring(0,sick4.length()-1)+"}";			
				}catch(Exception  ex){
				}finally{
					if(ds!=null){
							ds.closeConnection();
					}
				}		

		 String sql5="select  mempl_family.*,fnameid"+_and+"lname fullname  "+
				" from mempl_family   "+
				" where employeeid='"+((md.isStep1 || md.isDraft)?empID:md.getWFDataValue("__wf__employeeid"))+"' and relationid in('03')  "+
				" and line_no not in (select gainerid from mcomplain where employeeid='"+((md.isStep1 || md.isDraft)?empID:md.getWFDataValue("__wf__employeeid"))+"' and status='1'  and approvestatus='1' and welid in ('SICK002')  and budyear='"+(calendar.getYear()+543)+"' ) "+
				" order by fnameid"+_and+"lname";
				 String wife=" var wifeObj={ ";
				try{
				ds.setDbName(screenSingle.getUProfile().getDbName());
				ds.setTableName("mempl_family");
				ds.setSql(sql5);
				ds.initConnection(screenSingle.getUProfile());
					while(ds.next()){
						wife+=ds.getString("line_no")+":'"+ds.getString("fullname")+"' ,";
					}
					wife=wife.substring(0,wife.length()-1)+"}";			
				}catch(Exception  ex){
				}finally{
					if(ds!=null){
							ds.closeConnection();
					}
				}														
									
%>
    <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"><font face="MS Sans Serif" size="1" color="#FFFFFF">
          <table width="100%" border="0" cellpadding="0" cellspacing="1">
            <!-- Begin User Code -->
								<%if(!screenSingle.getDataLabel("DOC_NO").equals("0")){%>										
											<tr>
												<td  class="column-title"><script language="JavaScript">swapLang('Docno')</script></td>
												<td class="column-input"><%=screenSingle.getDataLabel("DOC_NO")%></td>
											</tr>
								<%}%>			
            <tr bgColor=#efefef>
              <td bgColor=#0099cc align='Left' colspan="2" class="column-label"><div align="left"><strong>
                  <script language=JavaScript>swapLang("Employee")</script>
                  </strong></U></div></td>
            </tr>
            <tr>
              <td align="right"  bgcolor=#0099cc class="column-label" width="22%"><script language=JavaScript>swapLang("Employee")</script></td>
              <td width="78%" class="column-input">&nbsp;
                <input size="52" type="text" name="__wf__fullname" value = "<%=screenSingle.getUProfile().get("employeeid")%> <%=screenSingle.getUProfile().get("fullname")%>" readonly class="disabled"></td>
            </tr>
            <tr >
              <td align="right" bgcolor=#0099cc class="column-label"><script language=JavaScript>swapLang("Position")</script></td>
              <td class="column-input">&nbsp;
                <input size="52" type="text" name="__wf__position" value = "<%=screenSingle.getUProfile().get("positionname")%>" readonly class="disabled"></td>
            </tr>
            <tr bgcolor=#efefef>
              <td align="right" bgcolor=#0099cc class="column-label"><script language=JavaScript>swapLang("Business Unit")</script>
                1</td>
              <td class="column-input">&nbsp;
                <input size="52" type="text" name="__wf__bu1" value = "<%=screenSingle.getUProfile().get("bu1name")%>" readonly class="disabled"></td>
            </tr>
            <tr bgcolor=#efefef>
              <td align="right" bgcolor=#0099cc class="column-label"><script language=JavaScript>swapLang("Business Unit")</script>
                2</td>
              <td class="column-input">&nbsp;
                <input size="52" type="text" name="__wf__bu2" value = "<%=screenSingle.getUProfile().get("bu2name")%>" readonly class="disabled"></td>
            </tr>
            <tr bgcolor=#efefef>
              <td align="right" bgcolor=#0099cc class="column-label"><script language=JavaScript>swapLang("Business Unit")</script>
                3</td>
              <td class="column-input">&nbsp;
                <input size="52" type="text" name="__wf__bu3" value = "<%=screenSingle.getUProfile().get("bu3name")%>" readonly class="disabled"></td>
            </tr>
            <tr bgcolor=#efefef>
              <td align="right" bgcolor=#0099cc class="column-label"><script language=JavaScript>swapLang("Business Unit")</script>
                4</td>
              <td class="column-input">&nbsp;
                <input size="52" type="text" name="__wf__bu4" value = "<%=screenSingle.getUProfile().get("bu4name")%>" readonly class="disabled"></td>
            </tr>
            <tr bgcolor=#efefef>
              <td align="right" bgcolor=#0099cc class="column-label"><script language=JavaScript>swapLang("Business Unit")</script>
                5</td>
              <td class="column-input">&nbsp;
                <input size="52" type="text" name="__wf__bu5" value = "<%=screenSingle.getUProfile().get("bu5name")%>" readonly class="disabled"></td>
            </tr>
            <tr bgcolor=#efefef>
              <td align="right" bgcolor=#0099cc class="column-label"><script language=JavaScript>swapLang("startdate")</script></td>
              <td class="column-input">&nbsp;
                <input size="52" type="text" name="__wf__emp_startdate" value = "<%=new CscCalendar(screenSingle.getUProfile().get("startdate")).getDDMMYYYY()%>" readonly class="disabled"></td>
            </tr>
            <tr bgcolor=#efefef>
              <td align="right" bgcolor=#0099cc class="column-label"><script language=JavaScript>swapLang("Tel ext")</script></td>
              <td class="column-input">&nbsp;
                <input size="52" type="text" name="__wf__tel_ext" value = "<%=screenSingle.getUProfile().get("tel_ext")%>" readonly class="disabled"></td>
            </tr>
            <tr>
              <td  bgcolor="#0099CC" align="right" class="column-label" valign="baseline">&nbsp;<script language="JavaScript">swapLang('Policy of Company')</script></td>
              <td colspan="3" class="desc"><div align="left"><a  href="javascript:openHelp();"><img src="../IMAGES/MYNOTE/BUTTON/BUTTON_VIEW.gif" alt="Policy" width="89" height="37" border="0"></a></div></td>
            </tr>
            <tr>
              <td COLSPAN="2"><table width="100%" border="0" cellpadding="0" cellspacing="1" class="txt01">
                  <tr>
                    <td align="left" bgcolor="#0099cc"  colspan="9"class="column-label"><div align="left"><strong>
                        <script language=JavaScript>swapLang("Welfare list")</script>
                        &nbsp;&nbsp;&nbsp;</strong></div></td>
                  </tr>
                  <tr>
                    <td  bgcolor="#0099cc"  class="column-title"></td>
                    <td  bgcolor="#0099cc"  class="column-title"><strong>
                      <script language=JavaScript>swapLang("Welfare")</script>
                      </strong></td>
                    <td colspan="6"  bgcolor="#0099cc"  class="desc" valign="middle"><div align="left"  valign="middle" >
                        <input type="hidden" name="__wf__welid" value="<%=chkNull.chkNullString(request.getParameter("__wf__welid"))%>" readonly  >
                        <input type="hidden" name="__wf__docgid" value="<%=chkNull.chkNullString(request.getParameter("__wf__docgid"))%>" readonly  >
                        <input type="hidden" name="__wf__whouse" value="<%=chkNull.chkNullString(request.getParameter("__wf__whouse"))%>" readonly  >
                        <input type="hidden" name="__wf__isedu" value="<%=chkNull.chkNullString(request.getParameter("__wf__isedu"))%>" readonly  >
                        <input type="text" name="__wf__weldesc" size="50"  maxlength="50" value="<%=chkNull.chkNullString(request.getParameter("__wf__weldesc"))%>" readonly>
                        <%if(md.isStep1 || md.isDraft){%>
                        <a href="JavaScript: goWelfareHelp('MWELFAREHELP_WF','__wf__weldesc');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('999','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="Search" name="employee_image2" width="20" height="20" border="0" align="absmiddle"></a>
                        <%}%>
                        </div></td>
                  </tr>
                  <tr>
                    <td  bgcolor="#0099cc"  class="column-title"></td>
                    <td width="22%"  bgcolor="#0099cc"  class="column-title"><div align="left"><strong>
                        <script language=JavaScript>swapLang("Receiver")</script>
                        </strong></div></td>
                    <td width="25%"  bgcolor="#0099cc"  class="column-title"><div align="left"><strong>
                        <script language=JavaScript>swapLang("Hospital/School")</script>
                        </strong></div></td>
                    <td width="14%"  bgcolor="#0099cc"  class="column-title"><div align="left"><strong>
                        <script language=JavaScript>swapLang("Hospital/School other")</script>
                        </strong></div></td>
                    <td width="12%"  bgcolor="#0099cc"  class="column-title"><div align="left"><strong>
                        <script language=JavaScript>swapLang("Family")</script>
                        </strong></div></td>
                    <td width="4%"  bgcolor="#0099cc"  class="column-title"><div align="left"><strong>
                        <script language="javascript">swapLang("Receipt number")</script>
                        </strong></div></td>
                    <td width="13%"  bgcolor="#0099cc"  class="column-title"><div align="left"><strong>
                        <script language=JavaScript>swapLang("Receipt Date")</script>
                        </strong></div></td>
                    <td width="7%"  bgcolor="#0099cc"  class="column-title"><div align="left"><strong>
                        <script language="javascript">swapLang("Attach Document")</script>
                        </strong></div></td>
                  </tr>
                  <%
														
														String indexRow = "01";
														String famname="";		
														String exname="";
														int addval=1;
														if(md.isStep1 || md.isDraft){
																addval=Integer.parseInt(chkNull.chkNullString(request.getParameter("__wf__amountrow"),"1"));
														}else{
																	addval=Integer.parseInt(chkNull.chkNullString(md.getWFDataValue("__wf__amountrow"),"1"));
														}
														for(int c=1;c<=10;c++){		
															if(c<10){																											
																indexRow = "0"+c;
															}else{
																indexRow=""+c;
															}
															//out.print(addval +">="+ c +" "+((addval>=c)?" d ":"none"));
												%>
                  <tr  id = "addWelfareH<%=c%>" style="display:<%=(addval>=c)?"":"none"%>">
                    <td width="3%" rowspan="2" align="right" valign="middle" bgcolor=#0099cc class="column-label"><%=c%> <%if(md.isStep1 || md.isDraft){%><input type="checkbox" name="delchk<%=indexRow%>" value="<%=indexRow%>"><%}%></td>
                    <td nowrap="nowrap" class="desc"><input type="hidden" name="__wf__mcomplain$receiver$<%=indexRow%>" value="<%=screenSingle.getUProfile().get("employeeid")%>" readonly  >
                      <input type="hidden" name="__wf__mcomplain$requisid$<%=indexRow%>" value="<%=chkNull.chkNullString(request.getParameter("__wf__mcomplain$requisid$"+indexRow))%>" readonly  >
                      <input type="hidden" name="__wf__reqdesc<%=indexRow%>" value="<%=chkNull.chkNullString(request.getParameter("__wf__reqdesc"+indexRow))%>" readonly  >
                      <input type="text" name="__wf__receiverdesc<%=indexRow%>" size="30"  maxlength="50" readonly value="<%=screenSingle.getUProfile().get("fullname")%>">
                      <%if(md.isStep1 || md.isDraft){%>
                      <a href="JavaScript: goHelp('MEMPLOYEEHELP','__wf__receiverdesc','<%=indexRow%>');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('999','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="SEARCH" name="employee_image2" width="20" height="20" border="0" align="absmiddle"></a>
                      <%}%></td>
                    <td nowrap="nowrap" class="desc"><div align="left">
                        <input type="hidden" name="__wf__mcomplain$sitewelid$<%=indexRow%>" value="<%=chkNull.chkNullString(request.getParameter("__wf__mcomplain$sitewelid$"+indexRow))%>" >
                        <input type="text" size="20" name="__wf__siteweldesc<%=indexRow%>" readonly value="<%=chkNull.chkNullString(request.getParameter("__wf__siteweldesc"+indexRow))%>">
                        <%if(md.isStep1 || md.isDraft){%>
                        <a href="javascript:goHelp('MSITEWELHELP','__wf__siteweldesc','<%=indexRow%>')" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('employee_image2','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="SEARCH" name="employee_image2" width="20" height="20" border="0" align="absmiddle" id="sitewelbtn<%=indexRow%>"></a>
                        <%}%>
                        <input type="text" name="__wf__sitegname<%=indexRow%>" size="20" value="<%=chkNull.chkNullString(request.getParameter("__wf__sitegname"+indexRow))%>" readonly class="disabled">
                      </div></td>
                    <td nowrap="nowrap" class="desc"><div align="left">
                        <input type="text" size="20" name="__wf__mcomplain$hopital$<%=indexRow%>" value="<%=chkNull.chkNullString(request.getParameter("__wf__mcomplain$hopital$"+indexRow))%>">
                      </div></td>
                    <td nowrap="nowrap" class="desc"><div align="left">
                        <select name="__wf__mcomplain$line_no$<%=indexRow%>" onChange="setFamily(this,'<%=indexRow%>')" id="family<%=indexRow%>">
                          <option value="">-----</option>
                          <%					
																			famname="";		
																  			String[] tmp;	
																			String ss = "";
																			ss = chkNull.chkNullString(request.getParameter("__wf__mcomplain$line_no$"+indexRow),chkNull.chkNullString(md.getWFDataValue("__wf__mcomplain$line_no$"+indexRow),""));
																			for(int i=0;i<familyOps.size();i++){
																				tmp=((String) familyOps.get(i)).split(",");
																				
																				out.print("<option value='"+tmp[0]+"'");
																				if(md.isStep1 || md.isDraft){
																					
																					if(tmp[0].equals(ss)){
																						out.print(" selected ");	
																						famname = tmp[1];
																					}
																				}else{
																					if(md.getWFDataValue("__wf__mcomplain$line_no$"+indexRow).equals(tmp[0])){
																						out.print(" selected ");	
																						famname = tmp[1];
																					}																				
																				}
																				out.print("'>"+tmp[1]+"</option>");
																			}
																  %>
                        </select>
						
                        <input type="hidden" name="__wf__mcomplain$familyname$<%=indexRow%>" value="<%=famname%>" >
                      </div></td>
                    <td nowrap="nowrap" class="desc"><input type="text" name="__wf__mcomplain$numberbill$<%=indexRow%>" value="<%=chkNull.chkNullString(request.getParameter("__wf__mcomplain$numberbill$"+indexRow))%>" maxlength="25" size="25"></td>
                    <td nowrap="nowrap" class="desc"><input type="hidden" name="__wf__mcomplain$datesent$<%=indexRow%>" value="<%=thisDate.getDDMMYYYY()%>" >
                      <input type="text" ID="datebill_<%=indexRow%>" name="__wf__mcomplain$datebill$<%=indexRow%>" value="<%=thisDate.getDDMMYYYY()%>" size="10" maxlength="10" readonly <%if(md.isStep1 || md.isDraft){%> onClick="showDate(this);" <%}%>>
                      <%if(md.isStep1 || md.isDraft){%>
                      <a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image1112','','../IMAGES/BUTTON/SWAP/CALENDAR_SWAP20.gif',1)" onClick="chkViewCal('__wf__mcomplain$datebill$<%=indexRow%>')"></a>
                      <%}%></td>
                    <td nowrap="nowrap" class="desc"><a href="javascript:goPages('<%=indexRow%>');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image1121','','../IMAGES/BUTTON/SWAP/COPY_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/COPY20.gif" alt="Attach Document" name="Image1121" width="20"  border="0" align="absmiddle" id="Image1121" ></a></td>
                  </tr>
                  <tr  id="addWelfareC<%=c%>" style="display:<%=(addval>=c)?"":"none"%>">
                    <td colspan="8"><table width="100%">
                        <tr >
                          <td class="row-header"  id="diseasehtd<%=indexRow%>"><strong><script language=JavaScript>swapLang("Type cure")</script></strong></td>
                          <td width="15%" class="row-header"><div align="left"><strong>
                              <script language=JavaScript>swapLang("Term")</script>
                          </strong></div></td>
                          <td width="15%"  class="row-header"><div align="left"><strong>
                              <script language=JavaScript>swapLang("Edu year")</script>
                          </strong></div></td>
                          <td width="15%"  class="row-header"><div align="left"><strong>
                              <script language=JavaScript>swapLang("Degree")</script>
                          </strong></div></td>
                          <td width="10%" class="row-header"><div align="left"><strong>
                              <script language=JavaScript>swapLang("Request cost")</script>
                          </strong></div></td>
                          <td width="9%" class="row-header"><div align="left"><strong>
                              <script language="javascript">swapLang("Approve cost")</script>
                          </strong></div></td>
                        </tr>
                        <tr  >
                          <td nowrap="nowrap" class="desc" id="diseasetd<%=indexRow%>">
                              <input type="hidden" name="__wf__mcomplain$docnum$<%=indexRow%>" value="<%=c%>">
                              <input type="hidden" name="__wf__mcomplain$welid$<%=indexRow%>" value="<%=chkNull.chkNullString(request.getParameter("__wf__mcomplain$welid$"+indexRow))%>" readonly  >
                              <input type="hidden" name="__wf__weldesc<%=indexRow%>" size="20"  maxlength="50" readonly>
                              <input type="hidden" name="__wf__mcomplain$diseaseid$<%=indexRow%>"   value="<%=indexRow%>">
                              <input type="hidden" size="20" name="__wf__diseasedesc<%=indexRow%>"  value="<%=chkNull.chkNullString(request.getParameter("__wf__diseasedesc"+indexRow))%>"  class="disabled" readonly>						 
							<select name="__wf__mcomplain$curetype$<%=indexRow%>"  id="curetype<%=indexRow%>">
							  <option value="">-----</option>
							  <%					
																			ReportUDF rf=new ReportUDF();
																			String curetype[]=rf.getSystemCode("CURETYPE",screenSingle.getUProfile().get("lang"));
																  			for(int i=0;i<curetype.length;i++){
																				tmp=curetype[i].split(",");
																				out.print("<option value='"+tmp[0]+"'");
																				if(md.isStep1 || md.isDraft || md.isStepReturn){
																					if(chkNull.chkNullString(request.getParameter("__wf__mcomplain$curetype$"+indexRow)).equals(tmp[0])){
																						//out.print(" selected ");	
																					}
																				}else{
																					if(md.getWFDataValue("__wf__mcomplain$curetype$"+indexRow).equals(tmp[0])){
																						//out.print(" selected ");
																						System.out.print(md.getWFDataValue("__wf__mcomplain$curetype$"+indexRow)+"-------"+tmp[0]+"-------------------------------> Selected <--------------------------------------------");
																					}
																				}
																				out.print("'>"+tmp[0]+tmp[1]+"</option>");
																			}
																  %>
						        </select>
							  <%//=curetype.length+" "+curetype[0]+" "+curetype[1]%>							</td>
							<%
							String readOnly="";
							if(md.isStep1 || md.isDraft || md.isStep3){
									readOnly="readonly";
							}
							%>
                          <td nowrap="nowrap" class="desc"><input type="text" name="__wf__mcomplain$terminal$<%=indexRow%>" value="<%=chkNull.chkNullString(request.getParameter("__wf__mcomplain$terminal$"+indexRow))%>"  size="5" readonly class="disabled" onKeyPress="chkInteger();"  maxlength="1" ></td>
                          <td nowrap="nowrap" class="desc"><input type="text" name="__wf__mcomplain$eduyear$<%=indexRow%>" value="<%=chkNull.chkNullString(request.getParameter("__wf__mcomplain$eduyear$"+indexRow))%>"  size="7" readonly class="disabled" onKeyPress="chkInteger();" maxlength="4"></td>
                          <td nowrap="nowrap" class="desc"><input type="text" size="20" name="__wf__degreeiddesc<%=indexRow%>"  value="<%=chkNull.chkNullString(request.getParameter("__wf__degreeiddesc"+indexRow))%>" readonly class="disabled"><input type="hidden" size="10" name="__wf__mcomplain$degreeid$<%=indexRow%>" readonly value="<%=chkNull.chkNullString(request.getParameter("__wf__mcomplain$degreeid$"+indexRow))%>">
                          <a href="javascript:goHelp('MDEGREEHELP','__wf__degreeiddesc','<%=indexRow%>')" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('999','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)">
                          <%if(md.isStep1 || md.isDraft){%>
                          <img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" ALT="SEARCH" name="employee_image2" width="20" height="20" border="0" align="absmiddle" id="degreebtn<%=indexRow%>">
                          <%}%>
</a></td>
                          <td nowrap="nowrap" class="desc" align="center"><input type="text" name="__wf__mcomplain$amountmoney$<%=indexRow%>" value="<%=chkNull.chkNullString(request.getParameter("__wf__mcomplain$amountmoney$"+indexRow),"0.00")%>" maxlength="10" size="10" onBlur="checkNumFloatNotBlank(this,0,10000000); copyValue(this,__wf__mcomplain$amountrealmoney$<%=indexRow%>);" onKeypress="checkWordNumber(this.value)" onFocus="callDelComma(this)" onKeyup="checkComma(this,2)" class="right"></td>
                          <td nowrap="nowrap" class="desc" align="center"><input type="text" name="__wf__mcomplain$amountrealmoney$<%=indexRow%>" value="<%=chkNull.chkNullString(request.getParameter("__wf__mcomplain$amountrealmoney$"+indexRow),"0.00")%>" maxlength="10" size="10" onBlur="checkNumFloatNotBlank(this,0,10000000); sumAmountRealMoney();" onKeypress="checkWordNumber(this.value)" onFocus="callDelComma(this)" onKeyup="checkComma(this,2)"  class="right"  <%=readOnly%> ></td>
                        </tr>
                      </table></td>
                  </tr>
                  <!-- End User Code -->
                  <input type="hidden" name="__wf__mcomplain$whouse$<%=indexRow%>" value="<%=chkNull.chkNullString(request.getParameter("__wf__mcomplain$whouse$"+indexRow))%>">
                  <input type="hidden" name="__wf__mcomplain$docgid$<%=indexRow%>" value="<%=chkNull.chkNullString(request.getParameter("__wf__mcomplain$docgid$"+indexRow))%>">
                  <input type="hidden" name="__wf__mcomplain$attach$<%=indexRow%>" value="<%=chkNull.chkNullString(request.getParameter("__wf__mcomplain$attach$"+indexRow))%>">
                  <input type="hidden" name="__wf__attachdesc<%=indexRow%>" value="<%=chkNull.chkNullString(request.getParameter("__wf__attachdesc"+indexRow),",")%>">
                  <%}%>
                  <tr>
                    <td colspan="6" bgcolor="#0099cc"  class="column-title" align="right"><strong>
                      <script language=JavaScript>swapLang("Net total")</script>
                      </strong>
                    <td  bgcolor="#0099cc"  class="column-title"><div align="center">
                        <input type="text" name="__wf__totalmoney" value="<%=chkNull.chkNullString(request.getParameter("__wf__totalmoney"),"0.00")%>" size="10" readonly  class="right" >
                      </div></td>
                    <td  bgcolor="#0099cc"  class="column-title"><div align="center">
                        <input type="text" name="__wf__totalrealmoney" value="<%=chkNull.chkNullString(request.getParameter("__wf__totalrealmoney"),"0.00")%>" size="10" readonly  class="right">
                      </div></td>
                  </tr>
                  <input type="hidden" name="__wf__amountrow" value = "<%=chkNull.chkNullString(request.getParameter("__wf__amountrow"),"1")%>">
                  <input type="hidden" name="__wf__employeeid" value="<%=screenSingle.getUProfile().get("employeeid")%>">
                  <input type="hidden" name="__chkdisablechild" value="<%if(chkNull.chkNullString(request.getParameter("step_seq_no"),"1").equals("1") && md.isStep1){out.print("");}else{out.print("true");}%>">
                </table></td>
            </tr>
            <tr id="addbtn" style="display:">
              <td colspan="4" align="center"  bgcolor="#0099CC" class="column-data"><%if(md.isStep1 || md.isDraft){%>
                <a href="javascript:void(0);"><img src="../IMAGES/MYNOTE/BUTTON/BUTTON_ADD.gif" width="89" height="37" border="0" onClick="AddROW()"></a><a href="javascript:void(0);"><img src="../IMAGES/MYNOTE/BUTTON/BUTTON_DELETE.gif" width="89" height="37" border="0" onClick="DelRows()"></a>
                <%}%></td>
            </tr>
            <tr>
              <td colspan="4"  bgcolor="#0099CC" class="column-data"></td>
            </tr>
          </table>
          </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 -->
 <script language=JavaScript>
 <%=sick2%>
 <%=sick3%>
 <%=sick4%>
  <%=famAll%>
   <%=edu%>
   <%=wife%>

 </script>	
    <br>
    <span id="viewWelfare"></span> <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><span id="showtxt"></span>
          <div align="right"  id="btsubmit">
            <A href="JavaScript:SaveDraft();">
                                    <img src="../IMAGES/MYNOTE/BUTTON/BUTTON_DRAFT.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(<%=stepid%>);"> <img src="../IMAGES/MYNOTE/BUTTON/BUTTON_SUBMIT.gif" width="89" height="37" border="0"></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><span id="showtxt"></span>
          <div align="right"  id="btsubmit"><a href="JavaScript:preGoWF(<%=stepid%>);"><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>
    <%}else  if( md.isStep3 &&screenSingle.getDataLabel("wf_status").equals("4")){%>
    <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="1" class="txt01">
            <tr bgcolor="#0099CC">
              <td width="85%" bgcolor="#FFFFFF"><div align="center"><% if(Double.parseDouble(md.getWFDataValue("__wf__totalrealmoney").replace(",",""))>3000){%><a href="javascript:viewPrint2();"><%}else{%><a href="javascript:viewPrint();"><%}%><img src="../IMAGES/MYNOTE/BUTTON/BUTTON_PRINT.gif" alt="Print Form" width="89" height="37" border="0"></a></div></td>
            </tr>
          </table>
          </font></td>
        <td width="5" background="../IMAGES/MYNOTE/R2.gif"><font color="#FFFFFF"></font></td>
      </tr>
      <tr align="center">
        <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>
    <%}%>
    <br>
    <!-- End Workflow Button -->
    <br>
    <%=md.getRoutingDocument()%> <br>
    <%=md.getCommentDocument()%>
    <!-- Begin Set Value -->
    <%
           			
           				if( md.isStep1 ){
           				%>
    <!-- Begin Set Value Step1 -->
    <script language="JavaScript">
		
							</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">							    
		
	</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">
           						
							</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-->
  <%=screenSingle.endJSP()%>

  <div id="blogScreen" align="center"><p><img src="../IMAGES/MYNOTE/PROGRESS/loading3.gif"  border="0"  id="imgSubmit" ></p></div>
</FORM>
</BODY>
</HTML>
<%
}
%>