function chkDateTime1(valueSearch){ var tmpval=""; with(document.cscform){ var valueSearch1=valueSearch.split("-"); if(valueSearch1.length==3){ if(valueSearch1[1].length==1){ valueSearch1[1]="0"+valueSearch1[1]; } if(valueSearch1[0].length==1){ valueSearch1[0]="0"+valueSearch1[0]; } valueSearch1[2]=parseInt(valueSearch1[2]); return valueSearch=valueSearch1[2]+"-"+valueSearch1[1]+"-"+valueSearch1[0]; } } } function addOption(objOption,objList) { //alert(">>>>>"+objOption+":"+objList); addToOption(objOption,objList) ; } // End of addOption() function addToOption(objOption,destList) { //alert(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 findKey(objOption,myList){ //alert("in 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[83]); return true; }//if }//for } //for return false; } function goHelp(helpName,inputName,listName){ var helpReturn; var key; var tdesc="tdesc",edesc="edesc"; if (listName=='') { helpReturn = inputName+":employeeid" linkHelp_Return(helpName,helpReturn,""); } else { if (inputName=="bu1" ) { helpReturn="bu1"; key="bu1id"; } else if (inputName=="bu2" ) { helpReturn="bu2"; key="bu2id"; } else if (inputName=="bu3" ) { helpReturn="bu3"; key="bu3id"; } else if (inputName=="bu4" ) { helpReturn="bu4"; key="bu4id"; } else if (inputName=="bu5" ) { helpReturn="bu5"; key="bu5id"; } else if (inputName=="branch" ) { helpReturn="branch"; key="branchid"; } else if (inputName=="position" ) { helpReturn="position"; key="positionid"; } else if (inputName=="salatype" ) { helpReturn="salatype"; key="codeid"; } else if (inputName=="workarea" ) { helpReturn="workarea"; key="workareaid"; } else if (inputName=="emp_level" ) { helpReturn="emp_level"; key="levelid"; } else if (inputName=="time0" ) { helpReturn="time0"; key="time0id"; } else if (inputName=="empgroup" ) { helpReturn="empgroup"; key="groupid"; } else if (inputName=="job" ) { helpReturn="job"; key="jobcodeid"; } else if (inputName=="branch" ) { helpReturn="branch"; key="branchid"; } else if (inputName=="employee" ) { helpReturn="employeeid"; key="employeeid"; tdesc="fullname"; edesc="fullname"; } with(document.cscform){ if (__fixCon.value!="") __fixCon.value=__fixCon.value; var param="PRU086.jsp?__helpName="+helpName+"&__helpReturn="+helpReturn +"&__pageCall="+__screen.value+"&__fixCon="+__fixCon.value+"&__checkVerify=off" +"&__listName="+listName+"&__key="+key+"&__tdesc="+tdesc+"&__edesc="+edesc; window.open(param,"Help1","left=150,top=150,width=600,height=400,toolbar=no,status=yes,scrollbars=yes,resizable=yes",false); } } } function listDblClick(objmyList){ for(i=objmyList.length;i > 0;i--){ if(objmyList.options[i-1].selected==true){ bCon=confirm(MyCode[84]+" "+objmyList.options[i-1].text+" ?"); if (bCon==true){ objmyList.options[i-1] = null; } } } } function setCondition(){ var obj_bu1List=document.cscform.bu1List; for(i=obj_bu1List.length;i >0;i--){ document.cscform.__condition$bu1Select.value+=obj_bu1List.options[i-1].value+","; } var obj_bu2List=document.cscform.bu2List; for(i=obj_bu2List.length;i >0;i--){ document.cscform.__condition$bu2Select.value+=obj_bu2List.options[i-1].value+","; } var obj_bu3List=document.cscform.bu3List; for(i=obj_bu3List.length;i >0;i--){ document.cscform.__condition$bu3Select.value+=obj_bu3List.options[i-1].value+","; } var obj_bu4List=document.cscform.bu4List; for(i=obj_bu4List.length;i >0;i--){ document.cscform.__condition$bu4Select.value+=obj_bu4List.options[i-1].value+","; } /* var obj_bu5List=document.cscform.bu5List; for(i=obj_bu5List.length;i >0;i--){ document.cscform.__condition$bu5Select.value+=obj_bu5List.options[i-1].value+","; }*/ var obj_employeeList=document.cscform.employeeList; for(i=obj_employeeList.length;i >0;i--){ document.cscform.__condition$employeeSelect.value+=obj_employeeList.options[i-1].value+","; } var obj_positionList=document.cscform.positionList; for(i=obj_positionList.length;i >0;i--){ document.cscform.__condition$positionSelect.value+=obj_positionList.options[i-1].value+","; } /* var obj_branchList=document.cscform.branchList; for(i=obj_branchList.length;i >0;i--){ document.cscform.__condition$branchSelect.value+=obj_branchList.options[i-1].value+","; }*/ var obj_salatypeList=document.cscform.salatypeList; for(i=obj_salatypeList.length;i >0;i--){ document.cscform.__condition$salatypeSelect.value+=obj_salatypeList.options[i-1].value+","; } /* var obj_workareaList=document.cscform.workareaList; for(i=obj_workareaList.length;i >0;i--){ document.cscform.__condition$workareaSelect.value+=obj_workareaList.options[i-1].value+","; } var obj_emp_levelList=document.cscform.emp_levelList; for(i=obj_emp_levelList.length;i >0;i--){ document.cscform.__condition$emp_levelSelect.value+=obj_emp_levelList.options[i-1].value+","; }*/ var obj_time0List=document.cscform.time0List; for(i=obj_time0List.length;i >0;i--){ document.cscform.__condition$time0Select.value+=obj_time0List.options[i-1].value+","; } with(document.cscform){ for(i=0;i<elements.length;i++){ if(elements[i].type=="checkbox"){ if (elements[i].checked){ elements[i].value="1"; } else elements[i].value="0"; } } } //check (empStart-empEnd)+employeeSelect if ((document.cscform.empStart.value.length>0)&&(document.cscform.empEnd.value.length>0)){ document.cscform.__condition$employeeBetween.value = "(employeeid between '"+document.cscform.empStart.value+"' and '"+document.cscform.empEnd.value+"')"; } else if ((document.cscform.empStart.value.length>0)&&(document.cscform.empEnd.value.length==0)){ document.cscform.__condition$employeeBetween.value = "(employeeid between '"+document.cscform.empStart.value+"' and '"+document.cscform.empStart.value+"')"; } else if ((document.cscform.empStart.value.length==0)&&(document.cscform.empEnd.value.length>0)){ document.cscform.__condition$employeeBetween.value = "(employeeid between '"+document.cscform.empEnd.value+"' and '"+document.cscform.empEnd.value+"')"; } } function clearCondition(){ with(document.cscform){ __condition$employeeSelect.value=""; __condition$positionSelect.value=""; __condition$bu1Select.value=""; __condition$bu2Select.value=""; __condition$bu3Select.value=""; __condition$bu4Select.value=""; //__condition$bu5Select.value=""; //__condition$branchSelect.value=""; __condition$salatypeSelect.value=""; //__condition$workareaSelect.value=""; //__condition$emp_levelSelect.value=""; __condition$time0Select.value=""; __condition$cmdValue.value=""; } } function chk_Date(){ with(document.cscform){ var altDate="Please insert date."; if(__language.value=="tha"){altDate="กรุณากรอกวันที่"; } if(__condition$startDate.value != "" && __condition$endDate.value != ""){ if(dateDifference(__condition$startDate.value,__condition$endDate.value)){ return true; }else{ return false; }// end if chk null }else{ __condition$startDate.focus(); alert(altDate); return false; } }// end with } function chkCondition(){ with(document.cscform){ var j=0; altNull="Please insert condition."; if(__language.value=="tha"){altNull="กรุณาเลือกเงื่อนไข";} for(i=0; i<elements.length; i++){ if((elements[i].name.indexOf("__condition$") > -1) && (elements[i].name!="__condition$employeeProcess" && elements[i].name!="__condition$cmdValue" && elements[i].name!="__condition$endDate" && elements[i].name!="__condition$startDate")){ //alert(elements[i].name+" : "+elements[i].value); if(elements[i].value != ""){ j++; } }//end chk elements name == select }// end for all elements //alert(j); if(j == 0){ alert(altNull); return false; } else return true; } }