<!DOCTYPE html>
<%@page contentType="text/html; charset=UTF-8" language="java" %>
<%@page import="com.csc.library.entry.HelpEntry,com.csc.library.system.*,com.csc.library.utilities.*,java.util.*"%>
<%@page import="com.csc.library.entry.*,com.csc.library.database.*,com.csc.library.session.*"  %>
<%@page import="com.csc.library.formula.FormulaString,java.text.DecimalFormat, com.csc.library.report.*"  %>
<%@ include file="../CHECKPROFILE.jsp" %>
<% request.setCharacterEncoding("UTF-8"); %>
<jsp:useBean id="EMV" class="com.csc.library.system.Task" scope="page" />
<jsp:setProperty name="EMV" property="appname" value="empview" />
<%
	EMV.setChannel(request, response);

	ThaiUtilities thaicode = new ThaiUtilities();
	CheckNull chk = new CheckNull();
	ReportUDF rt = new ReportUDF();
	String groupID = thaicode.ASCII2Unicode(chk.chkNullString(request.getParameter("__subgroupid")));
	String startDate = thaicode.ASCII2Unicode(chk.chkNullString(request.getParameter("date_start")));
	String endDate = thaicode.ASCII2Unicode(chk.chkNullString(request.getParameter("date_end")));

	CscCalendar cs1 = new CscCalendar();
	cs1.decDate(5);
	CscCalendar cs2 = new CscCalendar();
	if (request.getParameter("date_start")!=null && request.getParameter("date_end")!=null) {
		cs1 = new CscCalendar(request.getParameter("date_start"));
		cs2 = new CscCalendar(request.getParameter("date_end"));
	}

	EmvHelpEntry screen = (EmvHelpEntry) EMV.process("EmvHelpEntry", "MG_ERRORHELP");
	//String filter = "(dateid between '"+cs1.getYYYYMMDD()+"' and '"+cs2.getYYYYMMDD()+"') "+
	//	" and (warn00<>'' or warn01<>'')";
	String filter = "";
	String statusfilter = "employeeid in (select employeeid from memployee where status in (select statuscode from mempl_status where statustype = 'A'))";
	if (request.getParameter("__childFilter")!=null) {
		filter = statusfilter;
		if(!request.getParameter("__childFilter").equals("")){
			filter += " and ";
		}
		filter += request.getParameter("__childFilter");
	} else {
		//out.println("xxxxx");
		filter = statusfilter + " and (dateid between '"+cs1.getYYYYMMDD()+"' and '"+cs2.getYYYYMMDD()+"') "+
			"and (warn00 is not null or warn01 is not null or warn02 is not null or warn05 is not null or warn11 is not null)";
		//out.println(filter);
	}

	if (request.getParameter("__select_orderby")!=null) {
		screen.inq.setOrderBy(request.getParameter("__select_orderby"));
	}
	//out.println(filter);
	screen.inq.setFilter(filter);

	CscCalendar cs = new CscCalendar();
	FormulaString fs = new FormulaString();
	DecimalFormat df = new DecimalFormat("0.00");
	DecimalFormat df2 = new DecimalFormat("00.00");

	screen.setMaxLine(15);
	int beginRow=((Integer.parseInt(screen.goPage)-1)*screen.maxLine)+1;
    int endRow=(Integer.parseInt(screen.goPage))*screen.maxLine;
    screen.getInquiry().setBetween(beginRow, endRow);
	screen.process();

	screen.inq.refresh();
	screen.nextRec();
%>

<html xmlns="http://www.w3.org/1999/xhtml" ng-app="myHR">
	<head>

		<title>Employee View</title>

		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

	</head>
	<body>
		<div class="bg-com"></div>
		<jsp:include page="EMV_HEADMENU.jsp" flush="true" />

		<script>
			setLang("<%=screen.getUProfile().get("lang")%>");
			var swap = new swaplang();
            var titlename = swap.swap2String("SW012373");
			setPageTitle(titlename);

			$(document).ready(function(){


				//datepicker function
				var myLang='<%=screen.getUProfile().get("lang")%>';
				if (myLang=="tha"){
					$.datepicker.setDefaults($.datepicker.regional['tha']);
				}

				$("input[name=date_start]").hover(function(){
					$("input[name=date_start]").datepicker({
						dateFormat:"dd-mm-yy",
						maxDate:-1,
						defaultDate:-1,
						changeMonth: true,
						changeYear: true
					});
					$("input[name=date_end]").datepicker("destroy");
				});


				$("input[name=date_end]").change(function(){
					if ($("input[name=date_start]").val()>$("input[name=date_end]").val()){
						$("input[name=date_start]").val($("input[name=date_end]").val());
					} else if ($("input[name=date_start]").val()==""){
						$("input[name=date_start]").val($("input[name=date_end]").val());
					}
				});


				$("input[name=date_end]").hover(function(){
					$("input[name=date_end]").datepicker({
						minDate: new Date(ConvertDate($("input[name=date_start]").val())),
						dateFormat:"dd-mm-yy",
						changeMonth: true,
						changeYear: true
					});
				});
			});

			function goHelp(helpName,inputName){
				//alert(helpName+" "+inputName);
				with(document.cscform){
					var helpReturn="";
					var fcon=__fixCon.value;
					var sub_value = "";
					if (inputName=="__subgroupid") {
						__fixCon.value = "employeeid='<%=EMV.getUProfile().get("employeeid")%>'";
						helpReturn = inputName+":groupid,__desc:edesc"
						linkHelp_Return(helpName,helpReturn);
					}
					__fixCon.value = "";
				}
			}

			function chkAll(){
				with (document.cscform){
					for (i=0;i<elements.length;i++){
						if (elements[i].name.indexOf("error_") > -1){
							if(errorall.checked){
							//alert(i);
								elements[i].checked=true;
							}else{
								elements[i].checked=false;
							}
						}
					}
				}
			}

			function GoSearch() {
				with(document.cscform){
					setChildFilter();

					//กรองข้อผิดพลาดที่ต้องการ
					var etype = "";
					var err = "";
					for (j=0; j<elements.length; j++){
						if (elements[j].name.indexOf("error_") > -1){
							if (elements[j].checked){
								if (etype != ""){
									etype +=" or ";
								}
								if(elements[j].value=="absent"){
									etype += "eventgrp = 'J' ";
								}else{
									etype += elements[j].value+" is not null ";
								}
								//etype += elements[j].value+" != '' ";
								err += elements[j].value+",";
							}
						}
					}
						//alert(etype);
					if (!etype==""){
						__error.value = err;
						__childFilter.value += " and ("+etype+")";
						search();
					} else {
						if(__language.value=="tha") {
							alert("กรุณาเลือกเงื่อนไขข้อผิดพลาดที่ต้องการอย่างน้อย 1 ประเภท");
						} else alert("Please select error type less 1 type");
						//return false;
					}
				} //end with
			}

			function setChildFilter(){
				with(document.cscform){
					var sqlDate="";
					if (date_start.value.length>0 && date_end.value.length>0)
						sqlDate = " (dateid between '"+chkDateTime1(date_start.value)+"' and '"+chkDateTime1(date_end.value)+"') ";
					else if (date_start.value.length>0 && date_end.value.length==0)
						sqlDate = " dateid='"+chkDateTime1(date_start.value)+"' ";
					else if (__date2.value.length>0 && date_start.value.length==0)
						sqlDate = " dateid='"+chkDateTime1(date_end.value)+"' ";

					if (sqlDate!="") {
						__childFilter.value = sqlDate;
					} else __childFilter.value = "";
				}
			}

			//Override Method in Screen
			function goPage(page){
				with(document.cscform){
					setChildFilter();
					__goPage.value=page;
					submit();
				}
			}

			/*function GoSearch(){
				with(document.cscform){
					if (__subgroupid.value=="") {
						__desc.value = "";
					}
					search();
				}
			}*/

			function getOrderByDesc(m){
				//alert(m);
				with(document.cscform){
					var orderName = "";
					var engOrder = new Array("Date","EmployeeID","Date [Max->Min]","EmployeeID  [Max->Min]");
					var thaiOrder = new Array("วันที่","รหัสพนักงาน","วันที่ [มาก->น้อย]","รหัสพนักงาน [มาก->น้อย]");
					if (m=='dateid') {
						m = 1;
					} else if (m=='employeeid') {
						m = 2;
					} else if (m=='dateid desc') {
						m = 3;
					} else if (m=='employeeid desc') {
						m = 4;
					}
					if (__language.value=='tha') {
						orderName = thaiOrder[parseInt(m)-1];
					} else orderName = engOrder[parseInt(m)-1];
					//alert(m+" "+engDate);
					document.write(orderName);
				}
			}

			function pageDesc(empid, dateid, sequence){
				with(document.cscform) {
					var d=chkDateTime1(dateid);
					var filterCon = "employeeid='"+empid+"' and (dateid='"+d+"') and sequence='"+sequence+"'";

					//alert(filterCon);
					window.open("PI_ERROR_DESC.jsp?__cmd="+
						"&__fixCon="+filterCon,
						"ShowWarning","left=50,top=50,width=920,height=500,toolbar=no,status=yes,scrollbars=yes,resizable=yes"
					);
				}
			}

		</script>

		<section>
			<div class="container csc-content">
				<form name="cscform" class="form-horizontal" method="post" action="MG_ERROR.jsp">
					<%=screen.InitialVariable()%>
					<input type="hidden" name="__cmd" value="">
					<input type="hidden" name="__screen"  value="MG_ERROR">
					<input type="hidden" name="__help" value="">
					<input type="hidden" name="__helpReturn" value="">
					<input type="hidden" name="__helpName" value="">
					<input type="hidden" name="__goPage" value="" />
					<input type="hidden" name="__pageCall" >
					<input type="hidden" name="__referPage" value="">
					<input type="hidden" name="__calendar">
					<script language="javascript">getInputFormatDate();</script>
					<input type="hidden" name="__companyid"  value="<%=screen.getUProfile().get("companyid")%>">
					<input type="hidden" name="__fixCon"  >
					<input type="hidden" name="__language" value="<%=screen.getUProfile().get("lang")%>">
					<input type="hidden" name="__childFilter" >
					<input type="hidden" name="__error" value="<%=request.getParameter("__error")%>">
					<div id="toolTipLayer" style="position:absolute; visibility: hidden"></div>
					<script>initToolTips();</script>

					<%
						/*
						 * Error_Type
						 *		ลืมรูดเข้า = FORGOT-IN ---> 0
						 * 		ลืมรูดออก = FORGOT-OUT ---> 1
						 * 		สาย = LATE ---> 2
						 * 		โอทีก่อนเวลา = OT-BEFORE ---> 3
						 * 		โอทีหลังเวลา = OT-AFTER ---> 4
						 * 		ออกก่อนเวลา = OUT-ABSENT ---> 5
						 * 		เข้าช้า = IN-ABSENT ---> 6
						 * 		//รูดเข้าหลายครั้ง = IN-MORE ---> 7 NOT USE
						 * 		//รูดออกหลายครั้ง = OUT-MORE ---> 8 NOT USE
						 * 		//ทำงานก่อนเวลางาน WK-BEFORE ---> 9 NOT USE
						 * 		//ทำงานหลังเวลางาน WK-AFTER ---> 10 NOT USE
						 * 		รูดบัตรในวันหยุดงาน WK-HOLIDAY ---> 11
						 * 		โอทีเกินก่อนเวลา OT-OVER-BEFORE ---> 12
						 * 		โอทีเกินหลังเวลา OT-OVER-AFTER ---> 13
						 *    	โอทีขาดก่อนเวลา OT-LESS-BEFORE ---> 14
						 * 		โอทีขาดหลังเวลา OT-LESS-AFTER ---> 15
						 */
						TreeMap hmErrorType = new TreeMap();
						String[][] sysCode = SystemCode.getContent("ERROR_TYPE");
						for(int i=0;i<sysCode.length;i++){
							String key = sysCode[i][0];
							if (Integer.parseInt(key)>=7 && Integer.parseInt(key)<=10) {
								continue;
							}

							if (Integer.parseInt(key)<10) {
								key = "warn0"+key;
							} else {
								key = "warn"+key;
							}

							String value = sysCode[i][1];
							if (((String)screen.getUProfile().get("lang")).equals("tha")) {
								value = value.substring(value.indexOf(",") + 1);
							} else {
								value = value.substring(0, value.indexOf(","));
							}
							hmErrorType.put(key, value);
						}

						String date1="", date2="", warn_c01="", warn_c02="", warn_c03="", warn_c04="", warn_c05="";
						if (request.getParameter("date_start")!=null) date1=request.getParameter("date_start");
						if (request.getParameter("date_end")!=null) date2=request.getParameter("date_end");
						if (request.getParameter("warn_col01")!=null) warn_c01=request.getParameter("warn_col01");
						if (request.getParameter("warn_col02")!=null) warn_c02=request.getParameter("warn_col02");
						if (request.getParameter("warn_col03")!=null) warn_c03=request.getParameter("warn_col03");
						if (request.getParameter("warn_col04")!=null) warn_c04=request.getParameter("warn_col04");
						if (request.getParameter("warn_col05")!=null) warn_c05=request.getParameter("warn_col05");

						HashMap hm = new HashMap();
						String type = "";
						String error = "";
						if (request.getParameter("__error")==null) {
							error = "warn00,warn01,warn02,warn05,warn11";
						} else error = chk.chkNullString(request.getParameter("__error"));
						StringTokenizer str = new StringTokenizer(error,",");
						while (str.hasMoreTokens()) {
							type = str.nextToken();
							hm.put(type,type);
						}

					%>

					<div class="csc-block">
						<div class="center">
							<h2 class="csc-block-head" swlang code='SW012373'>Daily Statistic</h2>
						</div>

						<div class="form-horizontal">
							<div class="row">
								<div class="form-group">
									<div class="col-md-2 col-sm-2 col-xs-2"></div>
									<div class="col-md-2 col-sm-2 col-xs-2">
										<label class="control-label label-right" swlang code='SW002085'>Subordinate Group </label>
									</div>

									<div class="col-md-2 col-sm-2 col-xs-2">
										<% if (request.getParameter("__subgroupid")!=null && !request.getParameter("__subgroupid").equals("")) { %>
										<div class="input-group">
											<input class="form-control" name="__subgroupid" type="text" class="text" size="15" value="<%=request.getParameter("__subgroupid")%>"/>
											<a class="input-group-addon" href="javascript:goHelp('MSUBORDINATE_GRPHELP','__subgroupid')">
												<i class="fa fa-search"></i>
											</a>
										</div>
										<% } else { %>
										<div class="input-group">
											<input class="form-control" name="__subgroupid" type="text" class="text" size="15" />
											<a class="input-group-addon" href="javascript:goHelp('MSUBORDINATE_GRPHELP','__subgroupid')">
												<i class="fa fa-search"></i>
											</a>
										</div>
										<% } %>
									</div>
									<div class="col-md-3 col-sm-3 col-xs-3">
										<% if (request.getParameter("__desc")!=null && !request.getParameter("__desc").equals("")) { %>
										<input class="form-control" name="__desc" type="text" class="text" size="60" value="<%=request.getParameter("__desc")%>"/>
										<% } else { %>
										<input class="form-control" name="__desc" type="text" class="text" size="60" value="" />
										<% } %>
									</div>
								</div>
							</div>

							<div class="row">
								<div class="form-group">
									<div class="col-md-2 col-sm-2 col-xs-2"></div>
									<div class="col-md-2 col-sm-2 col-xs-2">
										<label class="control-label label-right" swlang code='SW000275'>Begin Date</label>
									</div>
									<div class="col-md-2 col-sm-2 col-xs-2">
										<% if (request.getParameter("date_start")==null) { %>
										<input class="form-control" name="date_start" type="text" value="<%=cs1.getDDMMYYYY()%>" size="9" maxlength="10" onkeyup = "formatDate(this)" onblur = "chkInputDate2(this,date_end)" onkeypress = "chkIntegerOfDate(this.value)" >
										<% } else {%>
										<input class="form-control" name="date_start" type="text" value="<%=request.getParameter("date_start")%>" size="9" maxlength="10" onkeyup = "formatDate(this)" onblur = "chkInputDate2(this,date_end)" onkeypress = "chkIntegerOfDate(this.value)" >
										<% }%>
									</div>
									<div class="col-md-1 col-sm-1 col-xs-1">
										<label class="control-label label-right" swlang code='SW002379'>To Date</label>
									</div>
									<div class="col-md-2 col-sm-2 col-xs-2">
										<% if (request.getParameter("date_end")==null) { %>
										<input class="form-control" name="date_end" type="text" value="<%=cs2.getDDMMYYYY()%>" size="9" maxlength="10" onkeyup = "formatDate(this)" onblur = "chkInputDate2(date_start,this)" onkeypress = "chkIntegerOfDate(this.value)">
										<% } else {%>
										<input class="form-control" name="date_end" type="text" value="<%=request.getParameter("date_end")%>" size="9" maxlength="10" onkeyup = "formatDate(this)" onblur = "chkInputDate2(date_start,this)" onkeypress = "chkIntegerOfDate(this.value)">
										<% }%>
									</div>
								</div>
							</div>

							<div class="row">
								<div class="form-group">
									<div class="col-md-2 col-sm-2 col-xs-2"></div>
									<div class="col-md-2 col-sm-2 col-xs-2">
										<label class="control-label label-right"><span swlang code='SW002184'>Column</span> 1 </label>
									</div>

									<div class="col-md-2 col-sm-2 col-xs-2">
										<select class="form-control" name="warn_col01">
											<%
												Iterator it = hmErrorType.keySet().iterator();
												while (it.hasNext()) {
													String key = (String) it.next();
													String value = (String) hmErrorType.get(key);

													if (warn_c01.equals("") && key.equals("warn00")) {
											%>
													<option value="<%=key%>" selected><%=value%></option>
											<%
													} else {
											%>
													<option value="<%=key%>" <% if (warn_c01.equals(key)) out.println("selected");%>><%=value%></option>
											<%
													}
												} //end while
											%>
										</select>
									</div>

									<div class="col-md-1 col-sm-1 col-xs-1">
										<label class="control-label label-right"><span swlang code='SW002184'>Column</span> 2 </label>
									</div>

									<div class="col-md-2 col-sm-2 col-xs-2">
										<select class="form-control" name="warn_col02">
											<%
												it = hmErrorType.keySet().iterator();
												while (it.hasNext()) {
													String key = (String) it.next();
													String value = (String) hmErrorType.get(key);
													if (warn_c02.equals("") && key.equals("warn01")) {
											%>
													<option value="<%=key%>" selected><%=value%></option>
											<%
													} else {
											%>
													<option value="<%=key%>" <% if (warn_c02.equals(key)) out.println("selected");%>><%=value%></option>
											<%
													}
												} //end while
											%>
										</select>
									</div>
								</div>
							</div>

							<div class="row">
								<div class="form-group">
									<div class="col-md-2 col-sm-2 col-xs-2"></div>
									<div class="col-md-2 col-sm-2 col-xs-2">
										<label class="control-label label-right"><span swlang code='SW002184'>Column</span> 3 </label>
									</div>

									<div class="col-md-2 col-sm-2 col-xs-2">
										<select class="form-control" name="warn_col03">
											<%
												it = hmErrorType.keySet().iterator();
												while (it.hasNext()) {
													String key = (String) it.next();
													String value = (String) hmErrorType.get(key);
													if (warn_c03.equals("") && key.equals("warn02")) {
											%>
													<option value="<%=key%>" selected><%=value%></option>
											<%
													} else {
											%>
													<option value="<%=key%>" <% if (warn_c03.equals(key)) out.println("selected");%>><%=value%></option>
											<%
													}
												} //end while
											%>
										</select>
									</div>

									<div class="col-md-1 col-sm-1 col-xs-1">
										<label class="control-label label-right"><span swlang code='SW002184'>Column</span> 4 </label>
									</div>

									<div class="col-md-2 col-sm-2 col-xs-2">
										<select class="form-control" name="warn_col04">
											<%
												it = hmErrorType.keySet().iterator();
												while (it.hasNext()) {
													String key = (String) it.next();
													String value = (String) hmErrorType.get(key);
													if (warn_c04.equals("") && key.equals("warn05")) {
											%>
													<option value="<%=key%>" selected><%=value%></option>
											<%
													} else {
											%>
													<option value="<%=key%>" <% if (warn_c04.equals(key)) out.println("selected");%>><%=value%></option>
											<%
													}
												} //end while
											%>
										</select>
									</div>
								</div>
							</div>

							<div class="row">
								<div class="form-group">
									<div class="col-md-2 col-sm-2 col-xs-2"></div>
									<div class="col-md-2 col-sm-2 col-xs-2">
										<label class="control-label label-right" swlang code='SW002014'>Order By </label>
									</div>
									<div class="col-md-2 col-sm-2 col-xs-2">
										<select class="form-control" name="__select_orderby">
											<%
												String s_order = "";
												if (request.getParameter("__select_orderby")!=null) {
													s_order = request.getParameter("__select_orderby");
												}
											%>
											<option value="dateid" <% if (s_order.equals("dateid")) { %> selected <%}%>><script>getOrderByDesc('dateid')</script></option>
											<option value="employeeid" <% if (s_order.equals("employeeid")) { %> selected <%}%>><script>getOrderByDesc('employeeid')</script></option>
											<option value="dateid desc" <% if (s_order.equals("dateid desc")) { %> selected <%}%>><script>getOrderByDesc('dateid desc')</script></option>
											<option value="employeeid desc" <% if (s_order.equals("employeeid desc")) { %> selected <%}%>><script>getOrderByDesc('employeeid desc')</script></option>
										</select>
									</div>
								</div>
							</div>

							</br>
							<div class="row">
								<div class="form-group">
									<div class="col-md-2 col-sm-2 col-xs-2"></div>
									<div class="col-md-3 col-sm-3 col-xs-3">
										<label class="control-label">
											<input name="error_00" type="checkbox" value="warn00" <% if (hm.containsKey("warn00")) out.println("checked");%>><%=rt.getSystemCode("ERROR_TYPE",screen.getUProfile().get("lang"),"0")%>
										</label>
									</div>
									<div class="col-md-3 col-sm-3 col-xs-3">
										<label class="control-label">
											<input name="error_01" type="checkbox" value="warn01" <% if (hm.containsKey("warn01")) out.println("checked");%>><%=rt.getSystemCode("ERROR_TYPE",screen.getUProfile().get("lang"),"1")%>
										</label>
									</div>
									<div class="col-md-3 col-sm-3 col-xs-3">
										<label class="control-label">
											<input name="error_02" type="checkbox" value="warn02" <% if (hm.containsKey("warn02")) out.println("checked");%>><%=rt.getSystemCode("ERROR_TYPE",screen.getUProfile().get("lang"),"2")%>
										</label>
									</div>
								</div>
							</div>

							<div class="row">
								<div class="form-group">
									<div class="col-md-2 col-sm-2 col-xs-2"></div>
									<div class="col-md-3 col-sm-3 col-xs-3">
										<label class="control-label">
											<input name="error_03" type="checkbox" value="warn03" <% if (hm.containsKey("warn03")) out.println("checked");%>><%=rt.getSystemCode("ERROR_TYPE",screen.getUProfile().get("lang"),"3")%>
										</label>
									</div>
									<div class="col-md-3 col-sm-3 col-xs-3">
										<label class="control-label">
											<input name="error_04" type="checkbox" value="warn04" <% if (hm.containsKey("warn04")) out.println("checked");%>><%=rt.getSystemCode("ERROR_TYPE",screen.getUProfile().get("lang"),"4")%>
										</label>
									</div>
									<div class="col-md-3 col-sm-3 col-xs-3">
										<label class="control-label">
											<input name="error_05" type="checkbox" value="warn05" <% if (hm.containsKey("warn05")) out.println("checked");%>><%=rt.getSystemCode("ERROR_TYPE",screen.getUProfile().get("lang"),"5")%>
										</label>
									</div>
								</div>
							</div>


							<div class="row">
								<div class="form-group">
									<div class="col-md-2 col-sm-2 col-xs-2"></div>
										<div class="col-md-3 col-sm-3 col-xs-3">
										<label class="control-label">
											<input name="error_06" type="checkbox" value="warn06" <% if (hm.containsKey("warn06")) out.println("checked");%>><%=rt.getSystemCode("ERROR_TYPE",screen.getUProfile().get("lang"),"6")%>
										</label>
									</div>
									<div class="col-md-3 col-sm-3 col-xs-3">
										<label class="control-label">
											<input name="error_11" type="checkbox" value="warn11" <% if (hm.containsKey("warn11")) out.println("checked");%>><%=rt.getSystemCode("ERROR_TYPE",screen.getUProfile().get("lang"),"11")%>
										</label>
									</div>
									<div class="col-md-3 col-sm-3 col-xs-3">
										<label class="control-label">
											<input name="error_12" type="checkbox" value="warn12" <% if (hm.containsKey("warn12")) out.println("checked");%>><%=rt.getSystemCode("ERROR_TYPE",screen.getUProfile().get("lang"),"12")%>
										</label>
									</div>
								</div>
							</div>



							<div class="row">
								<div class="form-group">
									<div class="col-md-2 col-sm-2 col-xs-2"></div>
									<div class="col-md-3 col-sm-3 col-xs-3">
										<label class="control-label">
											<input name="error_13" type="checkbox" value="warn13" <% if (hm.containsKey("warn13")) out.println("checked");%>><%=rt.getSystemCode("ERROR_TYPE",screen.getUProfile().get("lang"),"13")%>
										</label>
									</div>
									<div class="col-md-3 col-sm-3 col-xs-3">
										<label class="control-label">
											<input name="error_14" type="checkbox" value="warn14" <% if (hm.containsKey("warn14")) out.println("checked");%>><%=rt.getSystemCode("ERROR_TYPE",screen.getUProfile().get("lang"),"14")%>
										</label>
									</div>
									<div class="col-md-3 col-sm-3 col-xs-3">
										<label class="control-label">
											<input name="error_15" type="checkbox" value="warn15" <% if (hm.containsKey("warn06")) out.println("checked");%>><%=rt.getSystemCode("ERROR_TYPE",screen.getUProfile().get("lang"),"15")%>
										</label>
									</div>
								</div>
							</div>

							<div class="row">
								<div class="form-group">
									<div class="col-md-2 col-sm-2 col-xs-2"></div>
									<div class="col-md-3 col-sm-3 col-xs-3">
										<label class="control-label">
											<input name="error_absent" type="checkbox" value="absent" <% if (hm.containsKey("absent")) out.println("checked");%>><%=screen.getUProfile().get("lang").equalsIgnoreCase("THA")?"ขาดงาน":"Absent"%>
										</label>
									</div>
									<div class="col-md-3 col-sm-3 col-xs-3">
										<label class="control-label">
											<input name="errorall" type="checkbox" value="warn16" onclick="javascript:chkAll();" ><span swlang code='SW002185'>Select All</span>
										</label>
									</div>
								</div>
							</div>
							<div class="center">
								<a class="btn btn-primary" swlang code="SW003537" href="javascript:GoSearch();">Search</a>
							</div>
						</div>
					</div>

					<span class="detail-table">
						<span swlang code='SW001771'>Found Data</span> :&nbsp;&nbsp;<%= screen.getInquiry().recCount() %>&nbsp;
						<span swlang code='SW001780'>records</span>
					</span>
					<span class="detail-table label-right">
						<span swlang code='SW001120'>Page</span> : <%=screen.getPageTagNew()%>
					</span>

					<div class="table-responsive">
						<table class="table table-head table-hover table-bordered table-title-left table-content-center">
							<%
								int i = 0;
								String tmpEmp = "";
								String empID = "", empName = "";
								DbInquiry child = screen.inq;
								if (child.recCount()>0) {
									do {
										DbRecord rec = child.getCurrentDbRecord();
										CscCalendar cDate = new CscCalendar(rec.getString("dateid"));
										if (tmpEmp.equals(rec.getString("employeeid"))) {
											empID = "";
											empName = "";
										} else {
											empID = rec.getString("employeeid");
											empName = rec.getString("employeeid") + " : " + rec.getChild("memployee").getString("fullname");
										}
							%>
							<% if (i==0) { %>
							<div align = "right" swlang code='SW013247'>unit : HH.MM</div>
								<tr>
									<th swlang code="SW007745">Name Surname</th>
									<th swlang code="SW000002">Date</th>
									<th><%=rec.getField("warn_col01").getDescription()%></th>
									<th><%=rec.getField("warn_col02").getDescription()%></th>
									<th><%=rec.getField("warn_col03").getDescription()%></th>
									<th><%=rec.getField("warn_col04").getDescription()%></th>
									<th><%=rec.getField("warn_col06").getDescription()%></th>
								</tr>

								<% } %>

								<tr>
									<td class="table-title table-title-mini"><%=empName%></td>
									<td><%=cDate.getDDMMYYYY()%></td>
									<% if (warn_c01.equals("warn00") || warn_c01.equals("warn01")) { %>
									<td class="week"><%=rec.getString("warn_col01")%></td>
									<% } else { %>
									<td><%=rec.getString("warn_col01")%></td>
									<% }%>
									<% if (warn_c02.equals("warn00") || warn_c02.equals("warn01")) { %>
									<td class="week"><%=rec.getString("warn_col02")%></td>
									<% } else { %>
									<td><%=rec.getString("warn_col02")%></td>
									<% }%>
									<% if (warn_c03.equals("warn00") || warn_c03.equals("warn01")) { %>
									<td class="week"><%=rec.getString("warn_col03")%></td>
									<% } else { %>
									<td><%=rec.getString("warn_col03")%></td>
									<% }%>
									<% if (warn_c04.equals("warn00") || warn_c04.equals("warn01")) { %>
									<td class="week"><%=rec.getString("warn_col04")%></td>
									<% } else { %>
									<td><%=rec.getString("warn_col04")%></td>
									<% }%>
									<td>
										<%
											if (rec.getString("warn_col06").equals("YES") || rec.getString("warn_col06").equals("มี")) {
										%>
										<a href="javascript:pageDesc('<%=rec.getString("employeeid")%>','<%=cDate.getDDMMYYYY()%>','<%=rec.getString("sequence")%>')">
											<i class="changepage-icon fa fa-info"></i>
										</a>
										<%
											}  else { out.println("-"); }
										%>
									</td>
								</tr>
								<%
											tmpEmp = rec.getString("employeeid");
											i++;
										} while (child.next());
									}
								%>
						</table>
					</div>
				</form>
			</div>
			<a href="#top" id="top-button">
				<i class="fa fa-angle-up"></i>
				<div class="top-word">Back to top</div>
			</a>
		</section>
		<jsp:include page="FOOTER.jsp" flush="true" />
	</body>
</html>