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

	CheckNull chk = new CheckNull();
	if(chk.chkNullString(request.getParameter("__goPage")).equals("") && chk.chkNullString(request.getParameter("__fixCon")).equals("")){
		screen.getInquiry().setFilter("status in (select statuscode from mempl_status where statustype = 'A') and employeeid in (select employeeid from msupervisor where supervisor like '%"+screen.getUProfile().get("employeeid")+"%' )");
	} else {
		screen.getInquiry().setFilter("status in (select statuscode from mempl_status where statustype = 'A')");
	}
	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.referLangOn();
	//out.print("filter : "+screen.getInquiry().getFilter());
%>
<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("SW012371");
			setPageTitle(titlename);

			function viewEmp(empid){
				var tmp = empid;
				with(document.cscform){
					action="TREMP001.jsp?empid="+tmp;
					submit();
				}
			}
			function GoSearch(){
				with(document.cscform){
					__fixCon.value = " employeeid in (select employeeid from msupervisor where supervisor like '%"+__empid.value+"%' ) ";
					if(__employeeid.value != ""){
						__fixCon.value += ((__fixCon.value != "")?" and ":"")+"employeeid = '"+__employeeid.value+"'";
					}
				/*	if(__bu4.value != ""){
						__fixCon.value += ((__fixCon.value != "")?" and ":"")+"bu4 = '"+__bu4.value+"'";
					}*/
					if(__bu3.value != ""){
						__fixCon.value += ((__fixCon.value != "")?" and ":"")+"bu3 = '"+__bu3.value+"'";
					}
					if(__bu2.value != ""){
						__fixCon.value += ((__fixCon.value != "")?" and ":"")+"bu2 = '"+__bu2.value+"'";
					}
					if(__bu1.value != ""){
						__fixCon.value += ((__fixCon.value != "")?" and ":"")+"bu1 = '"+__bu1.value+"'";
					}
					if(__positionid.value != ""){
						__fixCon.value += ((__fixCon.value != "")?" and ":"")+"emp_position = '"+__positionid.value+"'";
					}
					search();
				}
			}
			function goHelp(helpName,inputName){
				with(document.cscform){
					var helpReturn="";
					var fcon=__fixCon.value;
					if (inputName=="__subgroupid") {
						__fixCon.value = "employeeid='"+<%=screen.getUProfile().get("employeeid")%>+"'";
						helpReturn = inputName+":groupid,__desc:edesc"
					}else if (inputName=="__employeeid") {
						helpReturn = inputName+":employeeid,MEMPLOYEE_FULLNAME:fullname";
				/*	}else if (inputName=="__bu4") {
						helpReturn = inputName+":bu4id,MBU4_TDESC:tdesc";*/
					}else if (inputName=="__bu3") {
						helpReturn = inputName+":bu3id,MBU3_TDESC:tdesc";
					}else if (inputName=="__bu2") {
						helpReturn = inputName+":bu2id,MBU2_TDESC:tdesc";
					}else if (inputName=="__bu1") {
						helpReturn = inputName+":bu1id,MBU1_TDESC:tdesc";
					}else if (inputName=="__positionid") {
						helpReturn = inputName+":positionid,MPOSITION_TDESC:tdesc";
					}
					linkHelp_Return(helpName,helpReturn);
					__fixCon.value = "";
				}
			}
		</script>

		<section>
			<div class="container csc-content">
				<form name="cscform" class="form-horizontal" method="post" action="TREMP005.jsp">
					<%=screen.InitialVariable()%>
					<input type="hidden"name="__screen"  value="TREMP005">
					<input type="hidden" name="__fixCon" value="">
					<input type="hidden" name="__help" value="">
					<input type="hidden" name="__keyList" value="">
					<input type="hidden" name="__cmd"  value="">
					<input type="hidden" name="__chkReq"  value="">
					<input type="hidden" name="__calendar">
					<input type="hidden" name="__childFilter">
					<input type="hidden" name="__goPage" value="" />
					<script>getInputFormatDate();</script>
					<input type="hidden" name="__language" value="<%=screen.getUProfile().get("lang")%>">
					<input type="hidden" name="__user" value="<%=screen.getUProfile().getUserId()%>">
					<input type="hidden" name="__companyid" value="<%=screen.getUProfile().get("companyid")%>">
					<input type="hidden" name="__backpage" value="<%=request.getParameter("__backpage")%>">
					<input type="hidden" name="__empid" value="<%=screen.getUProfile().get("employeeid")%>">

					<div class="csc-block">
						<div class="center">
							<h2 class="csc-block-head" swlang code='SW012371'>Training</h2>
						</div>

						<div class="form-horizontal">
							<div class="row">
								<div class="form-group">
									<div class="col-md-4 col-sm-4 col-xs-4">
										<label class="control-label label-right" swlang code='SW000350'>Employee ID</label>
									</div>
									<div class="col-md-8 col-sm-8 col-xs-8">
										<div class="col-md-3 col-sm-3 col-xs-3">
											<div class="input-group">
												<input class="form-control" name="__employeeid" type="text" value="<%=chk.chkNullString(request.getParameter("__employeeid"))%>"/>
												<a class="input-group-addon" href="javascript:goHelp('MEMPLOYEEHELP','__employeeid')">
													<i class="fa fa-search"></i>
												</a>
											</div>
										</div>

										<div class="col-md-5 col-sm-5 col-xs-5">
											<input class="form-control" name="MEMPLOYEE_FULLNAME" type="text" value="<%=chk.chkNullString(request.getParameter("MEMPLOYEE_FULLNAME"))%>"/>
										</div>
									</div>
								</div>
							</div>

							<div class="row">
								<div class="form-group">
									<div class="col-md-4 col-sm-4 col-xs-4">
										<label class="control-label label-right" swlang code='SW002085'>Subordinate Group </label>
									</div>
									<div class="col-md-8 col-sm-8 col-xs-8">
										<div class="col-md-3 col-sm-3 col-xs-3">
											<div class="input-group">
												<input class="form-control" name="__subgroupid" type="text" value="<%=chk.chkNullString(request.getParameter("__subgroupid"))%>"/>
												<a class="input-group-addon" href="javascript:goHelp('MSUBORDINATE_GRPHELP','__subgroupid')">
													<i class="fa fa-search"></i>
												</a>
											</div>
										</div>

										<div class="col-md-5 col-sm-5 col-xs-5">
											<input class="form-control" name="__desc" type="text" value="<%=chk.chkNullString(request.getParameter("__desc"))%>"/>
										</div>
									</div>
								</div>
							</div>

							<div class="row">
								<div class="form-group">
									<div class="col-md-4 col-sm-4 col-xs-4">
										<label class="control-label label-right"><%=screen.getLabel("bu1")%></label>
									</div>
									<div class="col-md-8 col-sm-8 col-xs-8">
										<div class="col-md-3 col-sm-3 col-xs-3">
											<div class="input-group">
												<input class="form-control" name="__bu1" type="text" value="<%=chk.chkNullString(request.getParameter("__bu1"))%>"/>
												<a class="input-group-addon" href="javascript:goHelp('MBU1HELP','__bu1')">
													<i class="fa fa-search"></i>
												</a>
											</div>
										</div>

										<div class="col-md-5 col-sm-5 col-xs-5">
											<input class="form-control" name="MBU1_TDESC" type="text" value="<%=chk.chkNullString(request.getParameter("MBU1_TDESC"))%>"/>
										</div>
									</div>
								</div>
							</div>

							<div class="row">
								<div class="form-group">
									<div class="col-md-4 col-sm-4 col-xs-4">
										<label class="control-label label-right" ><%=screen.getLabel("bu2")%></label>
									</div>
									<div class="col-md-8 col-sm-8 col-xs-8">
										<div class="col-md-3 col-sm-3 col-xs-3">
											<div class="input-group">
												<input class="form-control" name="__bu2" type="text" value="<%=chk.chkNullString(request.getParameter("__bu2"))%>"/>
												<a class="input-group-addon" href="javascript:goHelp('MBU2HELP','__bu2')">
													<i class="fa fa-search"></i>
												</a>
											</div>
										</div>

										<div class="col-md-5 col-sm-5 col-xs-5">
											<input class="form-control" name="MBU2_TDESC" type="text" value="<%=chk.chkNullString(request.getParameter("MBU2_TDESC"))%>"/>
										</div>
									</div>
								</div>
							</div>

							<div class="row">
								<div class="form-group">
									<div class="col-md-4 col-sm-4 col-xs-4">
										<label class="control-label label-right" ><%=screen.getLabel("bu3")%></label>
									</div>
									<div class="col-md-8 col-sm-8 col-xs-8">
										<div class="col-md-3 col-sm-3 col-xs-3">
											<div class="input-group">
												<input class="form-control" name="__bu3" type="text" value="<%=chk.chkNullString(request.getParameter("__bu3"))%>"/>
												<a class="input-group-addon" href="javascript:goHelp('MBU3HELP','__bu3')">
													<i class="fa fa-search"></i>
												</a>
											</div>
										</div>

										<div class="col-md-5 col-sm-5 col-xs-5">
											<input class="form-control" name="MBU3_TDESC" type="text" value="<%=chk.chkNullString(request.getParameter("MBU3_TDESC"))%>"/>
										</div>
									</div>
								</div>
							</div>

							<div class="row">
								<div class="form-group">
									<div class="col-md-4 col-sm-4 col-xs-4">
										<label class="control-label label-right" swlang code='SW000057'>Position</label>
									</div>
									<div class="col-md-8 col-sm-8 col-xs-8">
										<div class="col-md-3 col-sm-3 col-xs-3">
											<div class="input-group">
												<input class="form-control" name="__positionid" type="text" value="<%=chk.chkNullString(request.getParameter("__positionid"))%>"/>
												<a class="input-group-addon" href="javascript:goHelp('MPOSITIONHELP','__positionid')">
													<i class="fa fa-search"></i>
												</a>
											</div>
										</div>

										<div class="col-md-5 col-sm-5 col-xs-5">
											<input class="form-control" name="MPOSITION_TDESC" type="text" value="<%=chk.chkNullString(request.getParameter("MPOSITION_TDESC"))%>"/>
										</div>
									</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">
							<thead>
								<tr>
									<th swlang code="SW000350">Employee ID</th>
									<th swlang code="SW007745">Name Surname</th>
									<th swlang code="SW000057">Position</th>
									<th><%=screen.getLabel("memployee","bu1")%></th>
									<th><%=screen.getLabel("memployee","bu2")%></th>
									<th><%=screen.getLabel("memployee","bu3")%></th>
								</tr>
							</thead>
							<tbody>
								<%
									while(screen.nextRec()){
								%>
								<tr>
									<td><center><a href="javascript:viewEmp('<%=screen.getString("employeeid")%>');"><%=screen.getString("employeeid")%></a></center></td>
									<td><%=screen.getString("fullname")%></td>
									<td><%=screen.getString("positionname")%></td>
									<td><%=screen.getString("bu1name")%></td>
									<td><%=screen.getString("bu3name")%></td>
									<td><%=screen.getString("bu2name")%></td>
								</tr>
								<%
									}
								%>
							</tbody>
						</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>