<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%@ page import="com.csc.library.entry.EmvHelpEntry, com.csc.library.system.*, com.csc.library.utilities.CheckNull" %>
<%@ page import="com.csc.library.report.ReportUDF, java.util.*"%>
<% request.setCharacterEncoding("UTF-8"); %>
<%@ include file="../CHECKPROFILE.jsp" %>
<jsp:useBean id="EMV" class="com.csc.library.system.Task" scope="page" />
<jsp:setProperty name="EMV" property="appname" value="EMPVIEW" />
<%
	EMV.setChannel( request, response );
	EmvHelpEntry screen = (EmvHelpEntry)EMV.process("EmvHelpEntry", "MG-SUBORDINATEHELP");
	if(screen==null){
		return;
	}
	screen.setMaxLine(15);
	//out.print(screen.inq.getFilter());

	CheckNull chk = new CheckNull();
	String bu1 = chk.chkNullString( request.getParameter("__bu1"));
	String bu2 = chk.chkNullString( request.getParameter("__bu2"));
	String bu3 = chk.chkNullString( request.getParameter("__bu3"));
	String bu4 = chk.chkNullString( request.getParameter("__bu4"));
	String bu5 = chk.chkNullString( request.getParameter("__bu5"));
	String position = chk.chkNullString( request.getParameter("__emp_position"));
	String fname = chk.chkNullString( request.getParameter("__fname"));
	String lname = chk.chkNullString( request.getParameter("__lname"));
	screen.getInquiry().setFilter("status in (select statuscode from mempl_status where statustype = 'A')");
	 if( !bu1.equals("") ){
		screen.getInquiry().setFilter( "bu1", bu1, "", "=" );
	}
	if( !bu2.equals("") ){
		screen.getInquiry().setFilter( "bu2", bu2, "", "=" );
	}
	if( !bu3.equals("") ){
		screen.getInquiry().setFilter( "bu3", bu3, "", "=" );
	}
	if( !bu4.equals("") ){
		screen.getInquiry().setFilter( "bu4", bu4, "", "=" );
	}
	if( !bu5.equals("") ){
		screen.getInquiry().setFilter( "bu5", bu5, "", "=" );
	}
	if( !position.equals("") ){
		screen.getInquiry().setFilter( "emp_position", position, "", "=" );
	}
	if( !fname.equals("") ){
		screen.getInquiry().setFilter( "fname", "%"+fname +"%", "", "like" );
	}
	if( !lname.equals("") ){
		screen.getInquiry().setFilter( "lname", "%"+lname +"%", "", "like" );
	}
	screen.process();
	//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 type="text/javascript">
			setLang("<%=screen.getUProfile().get("lang")%>");
			var swap = new swaplang();
            var titlename = swap.swap2String("SW001805");
			setPageTitle(titlename);

			function goHelp(helpName,inputName) {
				var helpReturn;
				var fixCon = "";
				if(inputName=="__bu1" ) {
					helpReturn="__bu1:bu1id,MBU1@TDESC";
				} else if(inputName=="__bu2" ) {
					helpReturn="__bu2:bu2id,MBU2@TDESC";
				} else if(inputName=="__bu3" ) {
					helpReturn="__bu3:bu3id,MBU3@TDESC";
				}else if(inputName=="__bu4" ) {
					helpReturn="__bu4:bu4id,MBU4@TDESC";
				}else if(inputName=="__bu5" ) {
					helpReturn="__bu5:bu5id,MBU5@TDESC";
				}
				else if(inputName=="__emp_position" ) {
					helpReturn="__emp_position:positionid,MPOSITION@TDESC";
				} else if(inputName=="__subgroupid" ) {
					fixCon = "employeeid='<%=screen.getUProfile().getEmvEmpId()%>'";
					helpReturn="__subgroupid:groupid,MSUBORDINATE_GRP@TDESC";
				}

				linkHelp_Return(helpName,helpReturn, fixCon);
			}

			function GoSearch(){
				search();
			}

			function linkSubordinate(subordinate){
				with(document.cscform){
					__subordinateid.value = subordinate;
					action = "SUB_PROFILE_GPF.jsp";
					submit();
				}
			}

			$(document).ready(function(){
				$(".form-group select").addClass("form-control");
			});
		</script>

		<section>
			<div class="container csc-content">
				<form name="cscform" class="form-horizontal" method="post" action="?">
					<!-- BEGIN CSC INITIAL ZONE -->
					<%=screen.InitialVariable()%>
					<!-- END CSC INITIAL ZONE -->
					<input type="hidden" name="__screen" value="MG_SUBORDINATE">
					<input type="hidden" name="__cmd" value="" />
					<input type="hidden" name="__help" value="" />
					<input type="hidden" name="__goPage" value="" />
					<input type="hidden" name="__language" value="<%=screen.getUProfile().get("lang")%>" />
					<input type="hidden" name="__orderBy" value="<%=request.getParameter("__orderBy")%>" />
					<input type="hidden" name="__helpName" value="<%=request.getParameter("__helpName")%>" />
					<input type="hidden" name="__pageCall" value="<%=request.getParameter("__screen")%>" />
					<input type="hidden" name="__fixCon" value="<%=request.getParameter("__fixCon")%>" />
					<input type="hidden" name="__subordinateid" value="" />

					<div class="csc-block">
						<div class="center">
							<h2 swlang code='SW001805' class="csc-block-head">Subordinate List</h2>
						</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='SW000135'>Subordinate</label>
								</div>

								<div class="col-md-2 col-sm-2 col-xs-6">
									<div class="input-group">
										<input type="text" class="form-control" name="__subgroupid" size="10" 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-xs-4"></div>
								<div class="col-md-3 col-sm-3 col-xs-6">
									<input name="MSUBORDINATE_GRP@TDESC" type="text" class="form-control" size="40" readonly="readonly" value="<%=chk.chkNullString(request.getParameter("MSUBORDINATE_GRP@TDESC")) %>">
								</div>
							</div>
						</div><!-- end row -->

						<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-2 col-sm-2 col-xs-6">
									<div class="input-group">
										<input name="__bu1" type="text" class="form-control" 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-xs-4"></div>
								<div class="col-md-3 col-sm-3 col-xs-6">
									<input type="text" class="form-control" name="MBU1@TDESC" size=40 readonly="readonly" value="<%=chk.chkNullString(request.getParameter("MBU1@TDESC"))%>">
								</div>
							</div>
						</div><!-- end row -->

						<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-2 col-sm-2 col-xs-6">
									<div class="input-group">
										<input name="__bu2" type="text" class="form-control" 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-xs-4"></div>
								<div class="col-md-3 col-sm-3 col-xs-6">
									<input type="text" class="form-control" name="MBU2@TDESC" size=40 readonly="readonly" value="<%=chk.chkNullString(request.getParameter("MBU2@TDESC"))%>">
								</div>
							</div>
						</div><!-- -end row -->

						<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-2 col-sm-2 col-xs-6">
									<div class="input-group">
										<input name="__bu3" type="text" class="form-control" 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-xs-4"></div>
								<div class="col-md-3 col-sm-3 col-xs-6">
									<input type="text" name="MBU3@TDESC" size="40" class="form-control" readonly="readonly" value="<%=chk.chkNullString(request.getParameter("MBU3@TDESC"))%>">
								</div>
							</div>
						</div><!-- end row -->

						<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("bu4")%></label>
								</div>
								<div class="col-md-2 col-sm-2 col-xs-6">
									<div class="input-group">
										<input name="__bu4" type="text" class="form-control" value="<%=chk.chkNullString(request.getParameter("__bu4"))%>">
										<a class="input-group-addon" href="javascript:goHelp('MBU4HELP','__bu4');">
											<i class="fa fa-search"></i>
										</a>
									</div>
								</div>
								<div class="col-xs-4"></div>
								<div class="col-md-3 col-sm-3 col-xs-6">
									<input name="MBU4@TDESC" type="text" size="40" class="form-control" readonly="readonly" value="<%=chk.chkNullString(request.getParameter("MBU4@TDESC"))%>">
								</div>
							</div>
						</div><!-- end row -->

						<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("bu5")%></label>
								</div>
								<div class="col-md-2 col-sm-2 col-xs-6">
									<div class="input-group">
										<input name="__bu5" type="text" class="form-control" value="<%=chk.chkNullString(request.getParameter("__bu5"))%>">
										<a class="input-group-addon" href="javascript:goHelp('MBU5HELP','__bu5');">
											<i class="fa fa-search"></i>
										</a>
									</div>
								</div>
								<div class="col-xs-4"></div>
								<div class="col-md-3 col-sm-3 col-xs-6">
									<input type="text" class="form-control" name="MBU5@TDESC" readonly="readonly" size="40" value="<%=chk.chkNullString(request.getParameter("MBU5@TDESC"))%>">
								</div>
							</div>
						</div><!-- end row -->

						<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("emp_position")%></label>
								</div>
								<div class="col-md-2 col-sm-2 col-xs-6">
									<div class="input-group">
										<input name="__emp_position" type="text" class="form-control" value="<%=chk.chkNullString(request.getParameter("__emp_position"))%>">
										<a class="input-group-addon" href="javascript:goHelp('MPOSITIONHELP','__emp_position')">
											<i class="fa fa-search"></i>
										</a>
									</div>
								</div>
								<div class="col-xs-4"></div>
								<div class="col-md-3 col-sm-3 col-xs-6">
									<input type="text" class="form-control" name="MPOSITION@TDESC" readonly="readonly" size="40" value="<%=chk.chkNullString(request.getParameter("MPOSITION@TDESC"))%>">
								</div>
							</div>
						</div><!-- end row-->

						<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='SW000195'>Name</label>
								</div>

								<div class="col-md-2 col-sm-2 col-xs-6">
									<input type="text" name="__fname" class="form-control" value="<%=chk.chkNullString(request.getParameter("__fname"))%>">
								</div>
								<div class="col-md-1 col-sm-1 col-xs-4">
									<label class="control-label label-right" swlang code='SW000214'>Surname</label>
								</div>
								<div class="col-md-2 col-sm-2 col-xs-6">
									<input type="text" name="__lname" class="form-control" value="<%=chk.chkNullString(request.getParameter("__lname"))%>">
								</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='SW002014'>Order By</label>
								</div>
								<div class="col-md-2 col-sm-2 col-xs-6">
									<%=screen.getTagOrder()%>
								</div>
							</div>
						</div><!-- end row -->

						<div class="row">
							<div class="form-group">
								<div class="center">
									<a href="Javascript:GoSearch();" class="btn btn-primary" swlang code='SW003537'>Search</a>
								</div>
							</div>
						</div>

					</div><!-- end csc-block -->
				</form>

				<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">
						<thead>
							<tr>
								<th swlang code='SW000193'>Seq</th>
								<th><%=screen.getLabel("employeeid")%></th>
								<th><%=screen.getLabel("fullname")%></th>
								<th><%=screen.getLabel("emp_position")%></th>
								<th><%=screen.getLabel("bu1")%></th>
								<th><%=screen.getLabel("bu2")%></th>
								<th><%=screen.getLabel("bu3")%></th>
								<th><%=screen.getLabel("bu4")%></th>
								<th><%=screen.getLabel("bu5")%></th>
							</tr>
						</thead>
						<tbody>
							<%
								screen.getInquiry().refresh();
								int i=1;
								if (screen.getInquiry().recCount()>0){
									while(screen.nextRec()){
										screen.referLangOn();
							%>
										<tr>
											<td><center><%=i%></center></td>
											<td><center><a href="javascript:linkSubordinate('<%=screen.getString("employeeid")%>')"><%=screen.getString("employeeid")%></a><center></td>
											<td><%=screen.getString("fullname")%></td>
											<td><%=chk.chkNullString(screen.getString("mposition","tdesc"),"-")%></td>
											<td><%=chk.chkNullString(screen.getString("mbu1","tdesc"),"-")%></td>
											<td><%=chk.chkNullString(screen.getString("mbu2","tdesc"),"-")%></td>
											<td><%=chk.chkNullString(screen.getString("mbu3","tdesc"),"-")%></td>
											<td><%=chk.chkNullString(screen.getString("mbu4","tdesc"),"-")%></td>
											<td><%=chk.chkNullString(screen.getString("mbu5","tdesc"),"-")%></td>
										</tr>
							<%
										i++;
									}
								}
							%>
						</tbody>
					</table>
				</div>
			</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>