<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@page contentType="text/html; charset=UTF-8"%>
<%@page import="com.csc.library.entry.*,com.csc.library.system.*"%>
<jsp:useBean id="CI_01_21" class="com.csc.library.system.Task" scope="page" />
<%CI_01_21.setChannel(request, response);%>
<%UIManager screen = (UIManager) CI_01_21.process("SingleEntry", "CI_01_21");%>
<%
 String isSaved=request.getParameter("__cmd");
%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../CSS/TISCO.css" rel="stylesheet" type="text/css">
<link href="../CSS/bootstrap.css" rel="stylesheet"  type="text/css">
<link href="../CSS/bootstrap_csc_backend.css" rel="stylesheet"  type="text/css">
<script type="text/javascript" src="../JS/jquery-2.1.3.min.js"></script>
<script type='text/javascript' src="../JS/bootstrap.js"></script>
<link href="../CSS/bootstrap.css" rel="stylesheet"  type="text/css">
<link href="../CSS/bootstrap_csc_backend.css" rel="stylesheet"  type="text/css">
<script type="text/javascript" src="../JS/jquery-2.1.3.min.js"></script>
<script type='text/javascript' src="../JS/bootstrap.js"></script>
<script type='text/javascript' src='../JS/SCREEN.js'></script>
<script type='text/javascript' src='../JS/ICONSMENU.js'></script>
<script language='javascript'>setLang('<%=screen.getUProfile().get("lang")%>');</script>

<SCRIPT LANGUAGE="JavaScript">
var tmpwin;
function GoClean(){
	alert(MyCode[150]);
}

function GoSave(){
	setSubRight();
	with(document.cscform){
			bCon=confirm(MyCode[1]);
			if(bCon){
				__confirm.value="s";
				__cmd.value="save";
				submit();
		 }
	}
}
function GoUpdate(){GoSave();}
function GoDelete(){
	alert(MyCode[150]);

}
function GoSearch(){
	with(document.cscform){
			if (__language.value="tha")
					alert("ไม่สามารถใช้งานในหน้าจอนี้ได้");
			else
					alert("ไม่สามารถใช้งานในหน้าจอนี้ได้");
	}
}
function checkCF() {checkConfirm();}

function setSubRight(){
	  var objmyList=document.cscform.listRight;
        	for(i=objmyList.length;i > 0;i--){
			document.cscform.__subEmp.value+=objmyList.options[i-1].value+",";
			}
}

function checkConfirm(){
	var conCode="";
	var conDesc="";
	with(document.cscform){
	 conCode=getConfirmIndex(__confirm.value,"0");
	 conDesc=getConfirmIndex(__confirm.value,"1");
	 if(__confirm.value=="4")alert(MyCode[19]);
	 if(__confirm.value=="1" || __confirm.value=="2")alert(MyCode[18]);
	 //if(__confirm.value=="-1" || __confirm.value=="-2")alert(MyCode[17]);
		if(conCode=="-99"){
			updateRecord();
		}
	}
}

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Original:  Fred P -->
<!-- Begin
// Compare two options within a list by VALUES
function compareOptionValues(a, b)
{
  // Radix 10: for numeric values
  // Radix 36: for alphanumeric values
  var sA = parseInt( a.value, 36 );
  var sB = parseInt( b.value, 36 );
  return sA - sB;
}
// Compare two options within a list by TEXT

function compareOptionText(a, b)
{
  // Radix 10: for numeric values
  // Radix 36: for alphanumeric values
  var sA = parseInt( a.text, 36 );
  var sB = parseInt( b.text, 36 );
  return sA - sB;
}

// Dual list move function
function moveDualList( srcList, destList, moveAll )
{
//if(srcList.name=="listRight")alert(srcList.name);

  // Do nothing if nothing is selected
  if (  ( srcList.selectedIndex == -1 ) && ( moveAll == false )   )
  {
    return;
  }
  /*
   if(srcList.name=="listRight")
  {

  for(var z=0;z<destList.length;z++)
  {
  			for(var y=0;y<srcList.length;y++)
			{
						alert(srcList.options[y].value+"***"+destList.options[z].value);
						if(srcList.options[y].value==destList.options[z].value)return true;
			}
  }
  }*/
  newDestList = new Array( destList.options.length );
  var len = 0;
  for( len = 0; len < destList.options.length; len++ )
  {
  //alert(destList.options[len].value);
    if ( destList.options[ len ] != null )
    {
      newDestList[ len ] = new Option( destList.options[ len ].text, destList.options[ len ].value, destList.options[ len ].defaultSelected, destList.options[ len ].selected );
    }
  }
  for( var i = 0; i < srcList.options.length; i++ )
  {
    if ( srcList.options[i] != null && ( srcList.options[i].selected == true || moveAll ) )
    {
       // Statements to perform if option is selected
       // Incorporate into new list
       newDestList[ len ] = new Option( srcList.options[i].text, srcList.options[i].value, srcList.options[i].defaultSelected, srcList.options[i].selected );

       len++;
    }
  }
  // Sort out the new destination list
  newDestList.sort( compareOptionValues );   // BY VALUES
  //newDestList.sort( compareOptionText );   // BY TEXT
  // Populate the destination with the items from the new array
  for ( var j = 0; j < newDestList.length; j++ )
  {
    if ( newDestList[ j ] != null )
    {
      destList.options[ j ] = newDestList[ j ];
    }
  }
  // Erase source list selected elements
  for( var i = srcList.options.length - 1; i >= 0; i-- )
  {
    if ( srcList.options[i] != null && ( srcList.options[i].selected == true || moveAll ) )
    {
       // Erase Source
       //srcList.options[i].value = "";
       //srcList.options[i].text  = "";
       srcList.options[i]       = null;
    }
  }
} // End of moveDualList()
//  End -->

function showHelp(page){
	window.open(page,"Help","left=150,top=150,width=700,height=500,toolbar=no,status=yes,scrollbars=no");
}

function addOption(objOption)
{
   addToOption(objOption,document.cscform.listRight) ;
} // End of addOption()

function findKey(objOption,myList){
	 for ( var j = 0 ; j < objOption.length; j++ )
		  {

			for(var i=0;i < myList.length;i++){
				if(objOption[j].value == myList.options[i].value){
					alert(myList.options[i].value+" "+MyCode[151]);
					tmpwin.focus();
					return true;
				}//if
			}//for

			//alert(window.document.cscform.listLeft.length);
			for(var i=0;i < window.document.cscform.listLeft.length;i++){
				if(objOption[j].value == window.document.cscform.listLeft.options[i].value){
				    //alert("???? " + myList.options[i].value + " ??????????????????\n??????????????????????");
					alert(window.document.cscform.listLeft.options[i].value+" มีข้อมูลแล้ว");
					return true;
				}//if
			}//for
		}	//for
		return false;
}

function delteOption(objmyList){
			for(i=objmyList.length;i > 0;i--){
				if(objmyList.options[i-1].selected == true){
					objmyList.options[i-1]  = null;
				}
			}
}


function addToOption(objOption,destList)
{
     var lengthAll=parseInt(objOption.length)+parseInt(destList.options.length);
		newDestList = new Array( lengthAll );
		var clen=0;
		  for( len = 0; len <destList.options.length; len++ )
		  {
			if ( destList.options[ len ] != null )
			{
			  newDestList[ len ] = new Option( destList.options[ len ].text, destList.options[ len ].value, destList.options[ len ].defaultSelected, destList.options[ len ].selected );
			  clen++;
			}
		  }

		  for ( var j = 0 ; j < objOption.length; j++ )
		  {
			if ( objOption[ j ] != null )
			{
			  newDestList[ clen ] = objOption[ j ];
			  clen++;
			}
		  }

		  newDestList.sort( compareOptionValues );
		  for( var i = destList.options.length - 1; i >= 0; i-- )
		  {
			if ( destList.options[i] != null  )
			{
			   destList.options[i]       = null;
			}
		  }

		  for ( var j = 0; j < newDestList.length; j++ )
		  {
			if ( newDestList[ j ] != null )
			{
			  destList.options[ j ] =new Option(newDestList[ j ].text,newDestList[ j ].value);
			}
		  }
} // End of addToOption()

function onmyDblClick(objmyList){
			for(i=objmyList.length;i > 0;i--){
				if(objmyList.options[i-1].selected == true){
					alert(objmyList.options[i-1].text);
				}
			}
}

<!--



function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function showHelp(page){
	window.open(page,"Help","left=150,top=150,width=700,height=500,toolbar=no,status=no,scrollbars=yes");
}
//-->
function goHelp(helpName,inputName){
	var helpReturn;

	//if(inputName=="empid" )helpReturn="abc";
	if(inputName=="employeeid" )helpReturn="__employeeid:employeeid";

	//alert(helpName+"*****"+helpReturn);
	 with(document.cscform){
		if (__fixCon.value!="") __fixCon.value=__fixCon.value;
		var param="PRU085.jsp?__helpName="+helpName+"&__helpReturn="+helpReturn+"&__pageCall="+__screen.value+"&__fixCon="+__fixCon.value+"&__checkVerify=off";
		tmpwin = window.open(param,"Help","left=150,top=150,width=600,height=400,toolbar=no,status=yes,scrollbars=yes,resizable=yes");
	}
}
function saveAndSearch(){
       var isSave='<%=isSaved%>';
		   if(isSave=="save"){
	           with (document.cscform){
			  //    __cmd.value="search";
			//	  submit();
			   }
	   }
}

function showEmp(jsp){
        with(document.cscform){
		       action = jsp+".jsp";
		       __fixCon.value = "job='"+__jobcode.value+"'";
			   __jobcode.value = __jobcode.value;
			    submit();
			   }

}

</script>

<style>
  .td-nospace{
    height: 0px !important;
  }
  .full-size{
    width: 100% !important;
    height: 110px !important;
  }
</style>

</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" >
<form  METHOD="POST" name="cscform" action="CI_01_21.jsp">


<!----------BEGIN CSC INITIAL ZONE ------------------------>

<%=screen.InitialVariable()%>

<!----------END CSC INITIAL ZONE -------------------------->

<input type="hidden" name="__cmd" value="">

 <input type="hidden" name="__help" value="<%=request.getParameter("__help")%>">
 <input type="hidden" name="__employeeid" value="<%=request.getParameter("__employeeid")%>">
 <input type="hidden" name="__jobcode" value="<%=request.getParameter("__jobcode")%>">
 <input type="hidden" name="__notNull" value="">
 <input type="hidden" name="__subEmp" value="">
 <input type="hidden" name="__fixCon" value=" status<>'Y' "">
 <input type="hidden" name="__screen" value="CI_01_21">
 <input type="hidden" name="__language" value="<%=screen.getUProfile().get("lang")%>">
  <script language="JavaScript" src="../JS/HOTKEY.js">
	   </script>
		   <script language="javascript">
			 var titlename=swap2String('Command Line Definition');
			 document.write(Icons("CI_01_21,"+titlename));
		  </script>
<table width="683" align="center"  cellpadding="0"  cellspacing="0">
	   <tr><td colspan="3" class="blankspacenocolor"></td></tr>
	   <br>
  <tr >
    <td colspan="3" class="header"><script language="javascript">swapLang("Command Line Definition");</script> &nbsp;</td>
  </tr>
  <tr >
    <td  colspan="3"> <div align="center"><br>
        <table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF" class="largest">
		  <tr>
            <td " colspan="3"><div align="left">&nbsp;<strong><script language="javascript">swapLang("Name");</script> - <script language="javascript">swapLang("Lastname");</script></strong> &nbsp;<%=screen.getDataLabel("employeeid")%> &nbsp;
			<%screen.referLangOn();%>
			<%=screen.getDataLabel("efname")%> <%=screen.getDataLabel("elname")%>
			<% screen.referLangOff();%>
			</div></td>
          </tr>
		  <tr>
            <td " colspan="3"><div align="left">&nbsp;<strong><script language="javascript">swapLang('Job Description');</script></strong>&nbsp;<%=screen.getDataLabel("job")%>&nbsp;:&nbsp;<%=screen.getDataLabel("mjobcode","tdesc")%></div></td>
          </tr>
		  <tr>
            <td " colspan="3"><div align="left">&nbsp;<strong><%=screen.getLabel("mbu2","bu2id")%></strong>&nbsp;&nbsp;<%=screen.getDataLabel("bu2")%>&nbsp;:&nbsp;<%=screen.getDataLabel("mbu2","tdesc")%></div></td>
          </tr>
		   <tr>
            <td " colspan="3"><div align="left">&nbsp;<strong><%=screen.getLabel("mbu3","bu3id")%></strong>&nbsp;&nbsp;<%=screen.getDataLabel("bu3")%>&nbsp;:&nbsp;<%=screen.getDataLabel("mbu3","tdesc")%></div></td>
          </tr>
		   <tr>
            <td " colspan="3"><div align="left">&nbsp;<strong><%=screen.getLabel("mbu4","bu4id")%></strong>&nbsp;&nbsp;<%=screen.getDataLabel("bu4")%>&nbsp;:&nbsp;<%=screen.getDataLabel("mbu4","tdesc")%></div></td>
          </tr>
		  <tr>
            <td " colspan="3"><div align="left">&nbsp; </div></td>
          </tr>
		  <tr>
            <td " colspan="3"><div align="left">&nbsp; <strong><script language="javascript">swapLang("Employee List");</script></strong></div></td>
          </tr>
          <tr>
            <td class="title1" width="247"><div align="center"><script language="javascript">swapLang("Employee In Job");</script></div></td>
            <td class="title1" width="56"> <div align="center">&nbsp;</div></td>
            <td width="301" bgcolor="#666666" class="title1"><div align="center"><script language="javascript">swapLang("Employee In Command Line");</script></div></td>
          </tr>

<tr>
  <td class='td-nospace'>
    <!-- Multiple Select List with 20 rows size and 70 pixels wide -->
    <!-- Using   for SPACING and alignment -->
    <select multiple class='full-size' size="20" name="listLeft" onDblClick="onmyDblClick(this.form.listLeft);">
           <%=screen.getRecord().getString("EMP_SUB_JOB")%>
	</select>
  </td>
  <td><NOBR>
  <NOBR>  <BR>
  <NOBR>
    <a href="javascript:moveDualList( this.cscform.listLeft,  this.cscform.listRight, false );"><button type="button" class="btn btn-primary width120" swlang code="SW013165" >ADD ></button></a><BR>
    <NOBR>
    <a href="javascript:moveDualList( this.cscform.listRight, this.cscform.listLeft,  false );"> <button type="button" class="btn btn-primary width120" swlang code="SW000123" >REMOVE <</button></a><BR>
        <NOBR>
    <a href="javascript:moveDualList( this.cscform.listLeft,  this.cscform.listRight, true  );"><button type="button" class="btn btn-primary width120" swlang code="SW013165" >ADD ALL >></button></a><BR>
      <NOBR>
      <a href="javascript:moveDualList( this.cscform.listRight, this.cscform.listLeft,  true  );"> <button type="button" class="btn btn-primary width120" swlang code="SW000124" >REMOVE ALL <<</button></a><BR>
    </NOBR>
  </td>
  <NOBR>




  <td class='td-nospace'>
    <select multiple class='full-size' size="20" name="listRight" onDblClick="onmyDblClick(this.form.listRight);">
        <%=screen.getRecord().getString("SUB_EMP")%>
    </select>
  </td>
</tr>
</table>

        <div align="center">&nbsp; &nbsp;&nbsp;</div>
      </div></td>
  </tr>
  <td align="right">
    <button type="button" class="btn btn-primary width100" swlang code="SW000119" onClick="showEmp('CI_01_20');">BACK</button>&nbsp;
    <button type="button" class="btn btn-primary width100" swlang code="SW013168" onClick="goHelp('MEMPLOYEEHELP','employeeid');">SEARCH ALL</button>
		  &nbsp;
  </td>


  <tr bordercolor="0069B3">
    <td  class="bottom"></td>
  </tr>
</table>
<!----------BEGIN CSC ENDING ZONE ------------------------>

<%=screen.endJSP()%>

<!----------END CSC ENDING ZONE -------------------------->
</form>
</body>
</html>