<%@page contentType="text/html; charset=UTF-8"%> <%@page import="com.csc.library.entry.HelpEntry,com.csc.library.system.*,com.csc.library.utilities.*"%> <%@page import="com.csc.library.entry.*,com.csc.library.database.*,com.csc.library.session.*"%> <%@page import="com.csc.library.components.*,java.rmi.RemoteException,com.csc.library.report.*"%> <jsp:useBean id="TRA061" class="com.csc.library.system.Task" scope="page"/> <jsp:useBean id="TRA061_SEARCH" class="com.csc.library.system.Task" scope="page"/> <jsp:useBean id="TRA061_REPORT" class="com.csc.library.system.Task" scope="page"/> <% TRA061_REPORT.setChannel(request ,response); ReportEntry screen_report=(ReportEntry)TRA061_REPORT.process("ReportEntry","TRA061REPORT"); screen_report.process(); TRA061.setChannel(request ,response); ProcessEntry screen=(ProcessEntry)TRA061.process("ProcessEntry","Process"); screen.process(); TRA061_SEARCH.setChannel(request, response); screenque = (HelpEntry) TRA061_SEARCH.process("HelpEntry","TRA061HELP"); CheckNull chk = CheckNull.getInstance(); String cmd = chk.chkNullString(request.getParameter("__cmd")); String lang = screen.getUProfile().get("lang"); String screenTitle = lang.equalsIgnoreCase("tha") ? "กำหนดเงื่อนไขหลักสูตร" : "กำหนดเงื่อนไขหลักสูตร"; String tname = "โอนย้ายพนักงานเข้าหลักสูตร"; String ename = "Tranfer Training Request"; String col1 = chk.chkNullString(request.getParameter("__col1")); String col2 = chk.chkNullString(request.getParameter("__col2")); String col3 = chk.chkNullString(request.getParameter("__col3")); String col4 = chk.chkNullString(request.getParameter("__col4")); String col5 = chk.chkNullString(request.getParameter("__col5")); String col6 = chk.chkNullString(request.getParameter("__col6")); String crsid = chk.chkNullString(request.getParameter("__crsid")); String searchall = chk.chkNullString(request.getParameter("__searchall")); String searchprobation = chk.chkNullString(request.getParameter("__searchprobation")); String crsrequire = chk.chkNullString(request.getParameter("__crsrequire")); String condition = chk.chkNullString(request.getParameter("__condition")); String orderby = chk.chkNullString(request.getParameter("__orderby")); String goPage = chk.chkNullString(request.getParameter("__goPage"),"1"); goPage = goPage.replace("+",""); goPage = goPage.replace("-",""); int searchdata = 0; String crslist = ""; String filter = ""; String filter2 = ""; String mainFilter = ""; String filterEmpInCondition = ""; String filterEmpPassInCourse = ""; String filterEmpNotInCourse = ""; int empInCondition = 0; int empPassInCourse = 0; int empNotInCourse = 0; inqHtraintrnee = new InitialInquiry(screenque.getUProfile()).getDbInquiry("htraintrnee"); mcourseconfig = new InitialRecord(screenque.getUProfile()).getDbRecord("MCOURSECONFIG"); mcourseconfig.setColumn("*"); mcourseconfig.set("CRSID", crsid); if (cmd.equalsIgnoreCase("generatedata") || cmd.equalsIgnoreCase("saveconfig") || cmd.equalsIgnoreCase("cleanconfig") || cmd.equalsIgnoreCase("save") || cmd.equalsIgnoreCase("exportdata")) { mcourseconfig.set("searchall", searchall); mcourseconfig.set("searchprobation", searchprobation); mcourseconfig.set("crsrequire", crsrequire); mcourseconfig.set("condition", condition); mcourseconfig.set("orderby", orderby); mcourseconfig.set("col1", col1); mcourseconfig.set("col2", col2); mcourseconfig.set("col3", col3); mcourseconfig.set("col4", col4); mcourseconfig.set("col5", col5); mcourseconfig.set("col6", col6); if (cmd.equalsIgnoreCase("saveconfig")) { mcourseconfig.save(); String msg = lang.equalsIgnoreCase("tha") ? "บันทึกข้อมูลเรียบร้อย" : "Save data completely."; out.println("<script>alert('"+msg+"');</script>"); searchdata = 1; } } else if (cmd.equalsIgnoreCase("searchconfig") || cmd.equalsIgnoreCase("deleteconfig")) { searchdata = mcourseconfig.search(); if (cmd.equalsIgnoreCase("deleteconfig") && searchdata == 1) { mcourseconfig.delete(); String msg = lang.equalsIgnoreCase("tha") ? "ลบข้อมูลเรียบร้อย" : "Delete data sucessfully."; out.println("<script>alert('"+msg+"');</script>"); searchdata = 0; } else if (cmd.equalsIgnoreCase("deleteconfig") && searchdata == 0) { String msg = lang.equalsIgnoreCase("tha") ? "ลบข้อมูลไม่ได้ เนื่องจากไม่มีข้อมูล" : "Data not found, Unable to delete."; out.println("<script>alert('"+msg+"');</script>"); searchdata = 0; } } filter = "select traineeid from htraintrnee where trainingid in (select trainingid from htraining where crsid = '"+mcourseconfig.getString("crsid")+"') and trstatid in (select trstatid from mtrainstat where trsuccess = 'Y')"; mainFilter = "employeeid not in (" + filter + ")"; filterEmpPassInCourse = "employeeid in (" + filter + ")"; filterEmpNotInCourse = "employeeid not in (" + filter + ")"; if (!mcourseconfig.getString("crsrequire").equals("")) { filter2 = "select traineeid from htraintrnee where trainingid in (select trainingid from htraining where " + getFilterCourseRequire(mcourseconfig.getString("crsrequire")) + ") and trstatid in (select trstatid from mtrainstat where trsuccess = 'Y')"; //filterEmpInCondition = chkFilter(filterEmpInCondition) + "employeeid in (" + filter2 + ")"; filterEmpPassInCourse = chkFilter(filterEmpPassInCourse) + "employeeid in (" + filter2 + ")"; filterEmpNotInCourse = "employeeid not in (select employeeid from memployee where employeeid in (" + filter + ") and employeeid in (" + filter2 + "))"; mainFilter = "employeeid not in (select employeeid from memployee where employeeid in (" + filter + ") and employeeid in (" + filter2 + "))"; } if(mcourseconfig.getString("searchall").equals("")) { //mainFilter = chkFilter(mainFilter) + "employeeid in (" + filter + ")"; //filterEmpInCondition = chkFilter(filterEmpInCondition) + "employeeid in (" + filter + ")"; //filterEmpPassInCourse = chkFilter(filterEmpPassInCourse) + "employeeid in (" + filter + ")"; //filterEmpNotInCourse = chkFilter(filterEmpNotInCourse) + "employeeid not in (" + filter + ")"; } else if(mcourseconfig.getString("searchall").equals("1")) { mainFilter = ""; } if(mcourseconfig.getString("searchprobation").equals("")) { CscCalendar today = new CscCalendar(); mainFilter = chkFilter(mainFilter) + "status in (select statuscode from mempl_status where statustype = 'A' and statuscode != 'V')"; filterEmpInCondition = chkFilter(filterEmpInCondition) + "status in (select statuscode from mempl_status where statustype = 'A' and statuscode != 'V')"; filterEmpPassInCourse = chkFilter(filterEmpPassInCourse) + "status in (select statuscode from mempl_status where statustype = 'A' and statuscode != 'V')"; filterEmpNotInCourse = chkFilter(filterEmpNotInCourse) + "status in (select statuscode from mempl_status where statustype = 'A' and statuscode != 'V')"; } else if(mcourseconfig.getString("searchprobation").equals("1")) { mainFilter = chkFilter(mainFilter) + "status in (select statuscode from mempl_status where statustype = 'A')"; filterEmpInCondition = chkFilter(filterEmpInCondition) + "status in (select statuscode from mempl_status where statustype = 'A')"; filterEmpPassInCourse = chkFilter(filterEmpPassInCourse) + "status in (select statuscode from mempl_status where statustype = 'A')"; filterEmpNotInCourse = chkFilter(filterEmpNotInCourse) + "status in (select statuscode from mempl_status where statustype = 'A')"; } if (!mcourseconfig.getString("condition").equals("")) { mainFilter = chkFilter(mainFilter) + "(" + mcourseconfig.getString("condition").replaceAll("workage.","") + ")"; filterEmpInCondition = chkFilter(filterEmpInCondition) + "(" + mcourseconfig.getString("condition").replaceAll("workage.","") + ")"; filterEmpPassInCourse = chkFilter(filterEmpPassInCourse) + "(" + mcourseconfig.getString("condition").replaceAll("workage.","") + ")"; filterEmpNotInCourse = chkFilter(filterEmpNotInCourse) + "(" + mcourseconfig.getString("condition").replaceAll("workage.","") + ")"; } /*out.println("##filter ==> "+filter); out.println("<BR>##filter2 ==> "+filter2); out.println("<BR>##filterEmpInCondition ==> "+filterEmpInCondition); out.println("<BR>##filterEmpPassInCourse ==> "+filterEmpPassInCourse); out.println("<BR>##filterEmpNotInCourse ==> "+filterEmpNotInCourse); out.println("<BR>##mainFilter ==> "+mainFilter);*/ inqEmp = new InitialInquiry(screenque.getUProfile()).getDbInquiry("memployee"); inqEmp.setColumn("*"); inqEmp.setFilter(filterEmpInCondition); inqEmp.refresh(); empInCondition = inqEmp.recCount(); inqEmp.setFilter(filterEmpPassInCourse); inqEmp.refresh(); empPassInCourse = inqEmp.recCount(); inqEmp.setFilter(filterEmpNotInCourse); inqEmp.refresh(); empNotInCourse = inqEmp.recCount(); screenque.getInquiry().setColumn("*"); screenque.getInquiry().setFilter(mainFilter); screenque.getInquiry().setOrderBy(mcourseconfig.getString("orderby")); int maxLine = 50; int beginRow=((Integer.parseInt(goPage)-1)*maxLine)+1; int endRow=(Integer.parseInt(goPage))*maxLine; //screenque.setMaxLine(maxLine); screenque.getInquiry().refresh(); screenque.getInquiry().referLangOff(); //screenque.getInquiry().setBetween(beginRow, endRow); screenque.getInquiry().clearOldCondition(); screenque.countRec(screenque.getInquiry()); screenque.getInquiry().setRefreshBeforeNext(true); %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html ng-app="myHR"> <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 rel="stylesheet" href="../JS/QueryBuilder/dist/css/query-builder.default.min.css"/> <link rel="stylesheet" href="../JS/QueryBuilder/bootstrap-3.3.5/css/bootstrap.min.css"/> <link rel="stylesheet" href="../JS/QueryBuilder/bootstrap-3.3.5/css/bootstrap-theme.min.css"/> <link rel="stylesheet" href="../JS/QueryBuilder/dist/css/custom.css"/> <link rel="stylesheet" href="../JS/jquery-ui-1.11.4.custom/jquery-ui.css"/> <script type='text/javascript' src='../JS/SCREEN.js'></script> <script language="javascript" src="../JS/DATEINPUT.js"></script> <script language="javascript" src="../JS/VIEWCALENDAR.js"></script> <script type='text/javascript' src='../JS/ICONSMENU.js'></script> <script type='text/javascript' src='../JS/jquery-1.11.3.min.js'></script> <script type='text/javascript' src="../JS/jquery-ui-1.11.4.custom/jquery-ui.js"></script> <script language="javascript" src="../JS/CscBase.js"></script> <script language="javascript" src="../JS/CscCalendarV3.js"></script> <script type='text/javascript' src='../JS/QueryBuilder/bootstrap-3.3.5/js/bootstrap.min.js'></script> <script type='text/javascript' src='../JS/QueryBuilder/dist/js/query-builder.standalone-mod-inmodule.js'></script> <script type='text/javascript' src='../JS/QueryBuilder/dist/js/sql-parser.js'></script> <script type='text/javascript' src='../JS/QueryBuilder/dist/js/moment.js'></script> <script type="text/javascript" src="../JS/angular-1.3.15/angular.js"></script> <script type="text/javascript" src="../JS/ANGULAR/SCREEN_ANGULAR.js"></script> <script language='javascript'>setLang('<%=lang%>');</script> <style type="text/css"> img[height="20"] { padding: 0px; vertical-align: middle; } label { font-weight: normal; } .btn { padding: 2px 12px; font-size: 11px; vertical-align: top; } .title1 { font-weight: bold !important; } #tabledata { border-spacing: 1px; border-collapse: separate; background-color: grey; } .form-control { height: 34px !important; } /*.rule-value-container > img[height="20"] { vertical-align: middle; }*/ </style> <script language="JavaScript" > function GoSave(){ with(document.cscform){ if (chkReq()) { __cmd.value = "saveconfig"; submit(); } } } function GoDelete(){ with(document.cscform){ if (chkReq()) { __cmd.value = "deleteconfig"; submit(); } } } function GoSearch(){ with(document.cscform){ if (chkReq()) { __cmd.value = "generatedata"; submit(); } } } function GoClean(){ with(document.cscform){ __cmd.value = "cleanconfig"; __crsid.value = ""; __orderby.value = "employeeid"; __searchall.checked = false; __condition.value = ""; __col1.value = ""; __col2.value = ""; __col3.value = ""; __col4.value = ""; __col5.value = ""; __col6.value = ""; submit(); } } function GoExport(){ with(document.cscform){ var searchall = $('input[name=__searchall]').is(':checked')?"1":""; var searchprobation = $('input[name=__searchprobation]').is(':checked')?"1":""; var param = "TRA061EXP.jsp?" + "__cmd=exportdata" + "&__col1="+__col1.value + "&__col2="+__col2.value + "&__col3="+__col3.value + "&__col4="+__col4.value + "&__col5="+__col5.value + "&__col6="+__col6.value + "&__col1name="+$('select[name=__col1]').find('option:selected').text() + "&__col2name="+$('select[name=__col2]').find('option:selected').text() + "&__col3name="+$('select[name=__col3]').find('option:selected').text() + "&__col4name="+$('select[name=__col4]').find('option:selected').text() + "&__col5name="+$('select[name=__col5]').find('option:selected').text() + "&__col6name="+$('select[name=__col6]').find('option:selected').text() + "&__col1data="+$('select[name=__col1]').val() + "&__col2data="+$('select[name=__col2]').val() + "&__col3data="+$('select[name=__col3]').val() + "&__col4data="+$('select[name=__col4]').val() + "&__col5data="+$('select[name=__col5]').val() + "&__col6data="+$('select[name=__col6]').val() + "&__crsid="+__crsid.value + "&__searchall="+searchall + "&__searchprobation="+searchprobation + "&__crsrequire="+__crsrequire.value + "&__condition="+__condition.value + "&__orderby="+__orderby.value; window.open(param); } } function GoProcess() { with(document.cscform){ GenEmployeeList(); if (__condition$employeelist.value !== "") { bCon=confirm("Generate Training Request"); if (bCon==true) { __condition$crsid.value = __crsid.value; __cmd.value = "save"; submit(); } } else { var msg = getLang() === "tha"?"กรุณาเลือกพนักงาน" : "Please Select Employee."; alert(msg); } } } function GenEmployeeList(){ with(document.cscform){ var employeelist = ""; $('.cbdata:checked').each(function() { if (employeelist !== "") employeelist += ","; employeelist += $(this).val(); }); __condition$employeelist.value = employeelist; } } function chkReq(){ var chk = true; with(document.cscform){ if (__crsid.value === "") { var msg = getLang() === "tha" ? "กรุณาเลือก รหัสหลักสูตร" : "Please select Course ID."; alert(msg); chk = false; } } return chk; } function goPage(page){ with(document.cscform){ __cmd.value = "generatedata"; __goPage.value = page; submit(); } } function goHelp(helpName,inputName,targetReturn,multiple){ var helpReturn; var fixCon = ""; var oldvalue = ""; if(inputName=="__crsid" ){ document.cscform.selectcourse.value = "1"; helpReturn="__crsid:crsid,MCOURSE@CRSDESC"; linkHelp_Return(helpName,helpReturn,fixCon); } if(inputName=="__crsrequire" ){ helpReturn="__crsrequire:crsid"; oldvalue = document.cscform.__crsrequire.value; openHelp(helpName,helpReturn,fixCon,oldvalue); } if(inputName=="empInCondition"){ fixCon = document.cscform.filterEmpInCondition.value; helpReturn = "a"; openHelp(helpName,helpReturn,fixCon); } if(inputName=="empPassInCourse"){ fixCon = document.cscform.filterEmpPassInCourse.value; helpReturn = "a"; openHelp(helpName,helpReturn,fixCon); } if(inputName=="empNotInCourse"){ fixCon = document.cscform.filterEmpNotInCourse.value; helpReturn = "a"; openHelp(helpName,helpReturn,fixCon); } if(inputName.indexOf("conditionparam") !== -1 ){ document.getElementById("searchstatus").value="1"; helpReturn=inputName+":"+targetReturn; linkHelp_Return(helpName,helpReturn,fixCon); } if( inputName.indexOf("builder_rule_") > -1 ){ helpReturn=inputName+":"+targetReturn; document.getElementById("searchstatus").value="1"; document.getElementById("inputname").value=inputName; var $rule_container = $('input[name="'+inputName+'"]').closest('.rule-container'); var rule_filter = $rule_container.find('.rule-filter-container > select').val(); var rule_operator = $rule_container.find('.rule-operator-container > select').val(); openHelp(helpName,helpReturn,fixCon,"",multiple,rule_filter,rule_operator); } } function sysHelp(input,data) { with(document.cscform){ var param="../SYSHELP_STD.jsp?__input="+input+"&__helpName="+data; window.open(param,"Help","left=150,top=150,width=600,height=400,toolbar=no,status=yes,scrollbars=yes,resizable=yes"); } } function postReturn(){ with(document.cscform){ if ( selectcourse.value == "1" ){ selectcourse.value = ""; __cmd.value = "searchconfig"; submit(); } if ( document.getElementById("searchstatus").value == "1") { document.getElementById("searchstatus").value = ""; $.setcondition('1'); } } } function viewCalSTD(objName){ with(document.cscform){ __calendar.value = objName; } win = window.open("CALENDARSTD.htm","CALENDAR","left=350,top=250,width=280,height=220,toolbar=no,status=no,scrollbars=no"); if(window.focus){win.focus();} } function postCalendarSTD(data){ with(document.cscform){ document.getElementById("inputname").value=data; $.setcondition('1'); } } function openHelp(help,input,fixCon,oldvalue,selectmode,rule_filter,rule_operator){ with(document.cscform){ var filter = fixCon || __fixCon.value; var oldval = oldvalue || ""; var selectitmode = selectmode || ""; var rulefilter = rule_filter || ""; var ruleoperator = rule_operator || ""; var param="TRA061HELP.jsp?__helpName="+help+"&__helpReturn="+input+"&__fixCon="+filter+"&__oldValue="+oldval+"&__selectitmode="+selectitmode+"&__rule_filter="+rulefilter+"&__rule_operator="+ruleoperator; win = window.open(param,"Help","left=150,top=150,width=800,height=400,toolbar=no,status=yes,scrollbars=yes,resizable=yes"); if(window.focus){win.focus();} } } </script> <script> var options = { filters: [] } $.reset = function(){ $('#builder').queryBuilder('reset'); $('#condition').val(''); } $.setOption = function(){ var module=$("#__module").val(); var field=$("#fieldtable").val(); var data = field.split(","); //console.log(data); for(var i=0;i<data.length;i++){ var field = data[i].split("@"); var fieldid = field[0].split(":"); if(field[4]!="date"){ options.filters.push({id: fieldid[0],label: fieldid[0]+" : "+fieldid[1],type: field[4] , operators: ['equal', 'not_equal','less','less_or_equal','greater','greater_or_equal','contains','is_null', 'is_not_null'],help:field[1],linkhelp:field[2],validcode:field[3]}) }else{ options.filters.push({id: fieldid[0],label: fieldid[0]+" : "+fieldid[1],type: field[4] , operators: ['equal', 'not_equal','less','less_or_equal','greater','greater_or_equal','contains','is_null', 'is_not_null'],validation:{format: 'yyyy-mm-dd'},module:module}) } } var lang = $("#__lang").val(); if(lang=="tha"){ options.lang_code='th'; }else{ options.lang_code='en'; } } $.setSearch = function(){ var condition = $('#condition').val().toUpperCase(); if((condition !=='')){ //console.log("Search"); $('#builder').queryBuilder('setRulesFromSQL', condition); } } $.setcondition = function(data){ if(data=='1'){ var input = $('#inputname').val(); $('input[name="'+input+'"]').change(); } var sql=$('#builder').queryBuilder('getSQL',false, false).sql; $('#condition').val(sql); } $.checkstatus=function(){ var cmd = $('#__cmd').val(); if(cmd=='saveconstd'){ alert(MyCode[18]); }else if(cmd=='delconstd'){ alert(MyCode[19]); } } $.setmodule=function (){ var path = window.parent.location.pathname; var module = path.split("/"); $('#__module').val(module[2]); } $.showdialog=function(type){ $( "#dialog" ).dialog({ dialogClass: "no-close", title: MyCode[225], width: 400, buttons: [ { text: "OK", click: function() { $("#__passwordtext").val($("#inputpassword").val()) checkpassword(type); $(this).dialog( "close" ); } },{ text: "CANCEL", click: function() { $(this).dialog( "close" ); } } ] }); } $(function(){ $.setmodule(); $.setOption(); $('#builder').queryBuilder(options); $.checkstatus(); $.setSearch(); $('#builder').on('afterDeleteRule.queryBuilder', function(e, rule, error, value) { $.setcondition('0'); }); $('#builder').on('afterDeleteGroup.queryBuilder', function(e, rule, error, value) { $.setcondition('0'); }); $('#builder').on('afterUpdateRuleOperator.queryBuilder', function(e, rule, error, value) { $.setcondition('0'); }); $('#builder').on('afterUpdateGroupCondition.queryBuilder', function(e, rule, error, value) { $.setcondition('0'); }); $('form[name=cscform]').on('click', '#configsave', function() { GoSave(); }).on('click', '#configdelete', function() { GoDelete(); }).on('click', '#configclear', function() { GoClean(); }).on('click', '#generatedata', function() { GoSearch(); }).on('click', '#exportdata', function() { GoExport(); }).on('click', '#tranferdata', function() { GoProcess(); }).on('click', '#refreshbuilder', function() { refresh(); }).on('click', '#conditionsingle', function() { var param = $(this).attr('value').split(','); goHelp(param[0],param[1],param[2],param[3]); }).on('click', '#conditionmulti', function() { var param = $(this).attr('value').split(','); goHelp(param[0],param[1],param[2],param[3]); }).on('change', '#selectall', function() { $('.cbdata').prop('checked', $(this).prop('checked')); }).on('change', '.cbdata', function() { if (!$(this).prop('checked')) $('#selectall').prop('checked', false); }); $('.colhead1').text( $('select[name=__col1]').find('option:selected').text() ); $('.colhead2').text( $('select[name=__col2]').find('option:selected').text() ); $('.colhead3').text( $('select[name=__col3]').find('option:selected').text() ); $('.colhead4').text( $('select[name=__col4]').find('option:selected').text() ); $('.colhead5').text( $('select[name=__col5]').find('option:selected').text() ); $('.colhead6').text( $('select[name=__col6]').find('option:selected').text() ); }); function refresh(){ var condition = $('#condition').val().toUpperCase(); if(condition !==''){ //console.log(condition); $('#builder').queryBuilder('setRulesFromSQL', condition); } } function setcon(input,e){ with(document.cscform){ if (e.keyCode == 13) { inputname.value=input.name; $.setcondition(1); } } } </script> </head> <body leftmargin="0" topmargin="0"> <div id="toolTipLayer" style="position:absolute; visibility: hidden"></div> <script language="javascript">initToolTips();</script> <form name="cscform" method="post" action="#"> <!----------BEGIN CSC INITIAL ZONE ------------------------> <%=screen.InitialVariable()%> <!----------END CSC INITIAL ZONE --------------------------> <input type="hidden" name="__screen" value="TRA061"/> <input type="hidden" name="__fixCon" value=""/> <input type="hidden" name="__help" value=""/> <input type="hidden" name="__cmd" value=""/> <input type="hidden" name="__calendar"/> <input type="hidden" name="__goPage" value=""/> <input type="hidden" name="__referPage" value=""/> <input type="hidden" name="__language" id="__lang" value="<%=lang%>"/> <input type="hidden" name="__companyid" value="<%=screen.getUProfile().get("companyid")%>"/> <input type="hidden" name="__notNull" value=""/> <input type="hidden" name="__process" value=""/> <input type="hidden" name="__tname" value="<%=tname%>"/> <input type="hidden" name="__ename" value="<%=ename%>"/> <input type="hidden" name="__ptype" value=""/> <input type="hidden" name="__prclass" value="GenerateTrainingNeedByUser"/> <input type="hidden" name="selectcourse" value=""/> <input type="hidden" name="filterEmpInCondition" value="<%=filterEmpInCondition%>"/> <input type="hidden" name="filterEmpPassInCourse" value="<%=filterEmpPassInCourse%>"/> <input type="hidden" name="filterEmpNotInCourse" value="<%=filterEmpNotInCourse%>"/> <input type="hidden" name="__condition$crsid" value=""/> <input type="hidden" name="__condition$employeelist" value=""/> <!--<input type="hidden" id="systemcode_emp_type" value='<%//=getSystemcode(new ReportUDF().getSystemCode("EMPTYPE", lang))%>'/>--> <input type="hidden" id="oparetorselected" value="AND"/> <input type="hidden" id="line" value="0"/> <input type="hidden" id="searchstatus" value=""/> <input type="hidden" name="fieldtable" id="fieldtable" value="<%=screen_report.getFieldTableSTD("memployee")%>"/> <input type="hidden" name="__module" id="__module" value=""/> <input type="hidden" name="inputname" id="inputname" value="0"/> <input type="hidden" name="__dateformat" value="YYYY-MM-DD"/> <div align="center"> <br/> <table cellpadding="0" cellspacing="0" class="largest"> <tr> <td class="header">TRA061, <%=screenTitle%> </td> </tr> <tr> <td colspan="2"> <div align="center"> <table class="maxsize" cellpadding="0" cellspacing="0" border="1"> <tr> <td colspan="8" class="blankspace"></td> </tr> <tr> <td class="columnlabel" width="100"><%=mcourseconfig.getField("CRSID").getDescription()%> </td> <td colspan="7"> <input type="text" name="__crsid" size="15" maxlength="10" value="<%=mcourseconfig.getString("CRSID")%>" onkeypress="chkSpecialStr(event);" onkeyup="sysIsEdit();" onblur="trimValue(this);" onfocus="this.select();"> <a href="javascript:goHelp('MCOURSEHELP','__crsid');" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('__crsid_image','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="SEARCH" name="__crsid_image" width="20" height="20" border="0" align="absmiddle"></a> <input name="MCOURSE@CRSDESC" type="text" disabled="true" size="50" value="<%=mcourseconfig.getString("COURSENAME")%>" readonly=""> <button type="button" class="btn btn-primary" id="configsave">Save</button> <button type="button" class="btn btn-primary" id="configdelete">Delete</button> <button type="button" class="btn btn-primary" id="configclear">Clear</button> </td> </tr> <tr> <td class="columnlabel" width="100"><%=mcourseconfig.getField("CRSREQUIRE").getDescription()%> </td> <td colspan="7"> <input type="text" name="__crsrequire" size="30" maxlength="10" value="<%=mcourseconfig.getString("CRSREQUIRE")%>" onkeypress="chkSpecialStr(event);" onkeyup="sysIsEdit();" onblur="trimValue(this);" onfocus="this.select();"> <a href="javascript:goHelp('MCOURSEHELP','__crsrequire');" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('__crsrequire_image','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="SEARCH" name="__crsrequire_image" width="20" height="20" border="0" align="absmiddle"></a> </td> </tr> <tr> <td class="columnlabel" width="100"> </td> <td colspan="7"> <input type="checkbox" name="__searchall" value="1" onchange="sysIsEdit();" <%if(mcourseconfig.getString("SEARCHALL").equalsIgnoreCase("1")){%>checked<%}%>> <%=mcourseconfig.getField("SEARCHALL").getDescription()%> </td> </tr> <tr> <td class="columnlabel" width="100"> </td> <td colspan="7"> <input type="checkbox" name="__searchprobation" value="1" onchange="sysIsEdit();" <%if(mcourseconfig.getString("SEARCHPROBATION").equalsIgnoreCase("1")){%>checked<%}%>> <%=mcourseconfig.getField("SEARCHPROBATION").getDescription()%> </td> </tr> <tr> <td colspan="8" class="blankspace"></td> </tr> <tr> <td class="columnlabel" width="100"><%=mcourseconfig.getField("ORDERBY").getDescription()%> </td> <td colspan="7"> <select name="__orderby" onchange="sysIsEdit();"> <option value="employeeid" <%if(mcourseconfig.getString("ORDERBY").equalsIgnoreCase("employeeid")){%>selected<%}%>><%=screenque.getLabel("employeeid")%></option> <option value="fname" <%if(mcourseconfig.getString("ORDERBY").equalsIgnoreCase("fname")){%>selected<%}%>><%=screenque.getLabel("fname")%></option> <option value="lname" <%if(mcourseconfig.getString("ORDERBY").equalsIgnoreCase("lname")){%>selected<%}%>><%=screenque.getLabel("lname")%></option> <option value="efname" <%if(mcourseconfig.getString("ORDERBY").equalsIgnoreCase("efname")){%>selected<%}%>><%=screenque.getLabel("efname")%></option> <option value="elname" <%if(mcourseconfig.getString("ORDERBY").equalsIgnoreCase("elname")){%>selected<%}%>><%=screenque.getLabel("elname")%></option> <option value="emp_position" <%if(mcourseconfig.getString("ORDERBY").equalsIgnoreCase("emp_position")){%>selected<%}%>><%=screenque.getLabel("emp_position")%></option> <option value="startdate" <%if(mcourseconfig.getString("ORDERBY").equalsIgnoreCase("startdate")){%>selected<%}%>><%=screenque.getLabel("startdate")%></option> <option value="pl" <%if(mcourseconfig.getString("ORDERBY").equalsIgnoreCase("pl")){%>selected<%}%>><%=screenque.getLabel("pl")%></option> <option value="bu1" <%if(mcourseconfig.getString("ORDERBY").equalsIgnoreCase("bu1")){%>selected<%}%>><%=screenque.getLabel("bu1")%></option> <option value="bu2" <%if(mcourseconfig.getString("ORDERBY").equalsIgnoreCase("bu2")){%>selected<%}%>><%=screenque.getLabel("bu2")%></option> <option value="bu3" <%if(mcourseconfig.getString("ORDERBY").equalsIgnoreCase("bu3")){%>selected<%}%>><%=screenque.getLabel("bu3")%></option> <option value="bu4" <%if(mcourseconfig.getString("ORDERBY").equalsIgnoreCase("bu4")){%>selected<%}%>><%=screenque.getLabel("bu4")%></option> <option value="bu5" <%if(mcourseconfig.getString("ORDERBY").equalsIgnoreCase("bu5")){%>selected<%}%>><%=screenque.getLabel("bu5")%></option> <option value="branch" <%if(mcourseconfig.getString("ORDERBY").equalsIgnoreCase("branch")){%>selected<%}%>><%=screenque.getLabel("branch")%></option> <option value="job" <%if(mcourseconfig.getString("ORDERBY").equalsIgnoreCase("job")){%>selected<%}%>><%=screenque.getLabel("job")%></option> </select> </td> </tr> <tr> <td class="columnlabel"><%=mcourseconfig.getField("CONDITION").getDescription()%> </td> <td colspan="5"> <div id="builder"><!-- Condition Parameter in here form JqueryฺBuilder --></div></td> <td colspan="2"> </td> </tr> <tr> <td></td> <td colspan="7"> <textarea name="__condition" id="condition" cols="100" rows="5"><%=mcourseconfig.getString("CONDITION")%></textarea> </td> </tr> <tr> <td colspan="8" class="blankspace"></td> </tr> <tr> <td align="right" width="10%"><%=mcourseconfig.getField("COL1").getDescription()%></td> <td width="10%"> <select name="__col1" size="0" onchange="sysIsEdit();"> <option value=""> </option> <%=getColumnList(mcourseconfig.getString("COL1"))%> </select> </td> <td align="right" width="10%"><%=mcourseconfig.getField("COL4").getDescription()%></td> <td width="10%"> <select name="__col4" size="0" onchange="sysIsEdit();"> <option value=""> </option> <%=getColumnList(mcourseconfig.getString("COL4"))%> </select> </td> <td align="right" swlang code='SW013078'>Employee In Condition</td> <td width="3%" align="center"> <%=(cmd.equalsIgnoreCase("generatedata") || searchdata == 1) && empInCondition != 0 ? "<a href=\"javascript:goHelp('TRA061HELP','empInCondition');\">" + empInCondition + "</a>" : 0 %> </td> <td width="10%" align="left" swlang code='SW001697'>Persons</td> </tr> <tr> <td align="right"><%=mcourseconfig.getField("COL2").getDescription()%></td> <td> <select name="__col2" size="0" onchange="sysIsEdit();"> <option value=""> </option> <%=getColumnList(mcourseconfig.getString("COL2"))%> </select> </td> <td align="right"><%=mcourseconfig.getField("COL5").getDescription()%></td> <td> <select name="__col5" size="0" onchange="sysIsEdit();"> <option value=""> </option> <%=getColumnList(mcourseconfig.getString("COL5"))%> </select> </td> <td align="right" swlang code='SW003090'>Trained</td> <td align="center"> <%=(cmd.equalsIgnoreCase("generatedata") || searchdata == 1) && empPassInCourse != 0 ? "<a href=\"javascript:goHelp('TRA061HELP','empPassInCourse');\">" + empPassInCourse + "</a>" : 0 %> </td> <td align="left" swlang code='SW001697'>Persons</td> </tr> <tr> <td align="right"><%=mcourseconfig.getField("COL3").getDescription()%></td> <td> <select name="__col3" size="0" onchange="sysIsEdit();"> <option value=""> </option> <%=getColumnList(mcourseconfig.getString("COL3"))%> </select> </td> <td align="right"><%=mcourseconfig.getField("COL6").getDescription()%></td> <td> <select name="__col6" size="0" onchange="sysIsEdit();"> <option value=""> </option> <%=getColumnList(mcourseconfig.getString("COL6"))%> </select> </td> <td align="right" swlang code='SW002235'>Not Trained</td> <td align="center"> <%=(cmd.equalsIgnoreCase("generatedata") || searchdata == 1) && empNotInCourse != 0 ? "<a href=\"javascript:goHelp('TRA061HELP','empNotInCourse');\">" + empNotInCourse + "</a>" : 0 %> </td> <td align="left" swlang code='SW001697'>Persons</td> </tr> <tr> <td colspan="8" class="blankspace"></td> </tr> <tr> <td colspan="8" align="center"> <button type="button" class="btn btn-primary" id="generatedata">Generate</button> <button type="button" class="btn btn-primary" id="exportdata">Export</button> </td> </tr> <tr> <td colspan="8" class="blankspace"></td> </tr> </table> <% if (cmd.equalsIgnoreCase("generatedata") || searchdata == 1) { %> <BR/> <div align="center"><img src="../IMAGES/loading2.gif" id="loading"></div> <table class="maxsize" cellpadding="0" cellspacing="3" border="1" id="tabledata" bgcolor="#808080"> <tr> <td class="row3" align="center">เลือก<br><input type="checkbox" id="selectall" value="<%=screenque.getDataLabel("employeeid")%>"></td> <td class="row3" align="center"><%=screenque.getLabel("employeeid")%></td> <td class="row3" align="center"><%=screenque.getLabel("fullname")%></td> <td class="row3" align="center"><%=screenque.getLabel("positionname")%></td> <td class="row3" align="center"><%=screenque.getLabel("startdate")%></td> <%if(!mcourseconfig.getString("COL1").equals("")){%><td class="row3 colhead1" align="center"><!--use jquery--></td><%}%> <%if(!mcourseconfig.getString("COL2").equals("")){%><td class="row3 colhead2" align="center"><!--use jquery--></td><%}%> <%if(!mcourseconfig.getString("COL3").equals("")){%><td class="row3 colhead3" align="center"><!--use jquery--></td><%}%> <%if(!mcourseconfig.getString("COL4").equals("")){%><td class="row3 colhead4" align="center"><!--use jquery--></td><%}%> <%if(!mcourseconfig.getString("COL5").equals("")){%><td class="row3 colhead5" align="center"><!--use jquery--></td><%}%> <%if(!mcourseconfig.getString("COL6").equals("")){%><td class="row3 colhead6" align="center"><!--use jquery--></td><%}%> </tr> <script>showColHead();</script> <% screenque.getInquiry().referLangOn(); while(screenque.nextRec()){ %> <tr> <td align="center"><input type="checkbox" class="cbdata" value="<%=screenque.getDataLabel("employeeid")%>"></td> <td align="center"><%=screenque.getDataLabel("employeeid")%></td> <td align="center"><%=screenque.getDataLabel("fullname")%></td> <td align="center"><%=screenque.getDataLabel("positionname")%></td> <td align="center"><%=screenque.getDataLabel("startdate")%></td> <%if(!mcourseconfig.getString("COL1").equals("")){%><td align="center"><%=showData(mcourseconfig.getString("COL1"))%></td><%}%> <%if(!mcourseconfig.getString("COL2").equals("")){%><td align="center"><%=showData(mcourseconfig.getString("COL2"))%></td><%}%> <%if(!mcourseconfig.getString("COL3").equals("")){%><td align="center"><%=showData(mcourseconfig.getString("COL3"))%></td><%}%> <%if(!mcourseconfig.getString("COL4").equals("")){%><td align="center"><%=showData(mcourseconfig.getString("COL4"))%></td><%}%> <%if(!mcourseconfig.getString("COL5").equals("")){%><td align="center"><%=showData(mcourseconfig.getString("COL5"))%></td><%}%> <%if(!mcourseconfig.getString("COL6").equals("")){%><td align="center"><%=showData(mcourseconfig.getString("COL6"))%></td><%}%> </tr> <% } %> </table> <BR/> <div align="center"> <button type="button" class="btn btn-primary" id="tranferdata">Tranfer</button> </div> <BR/> <% } %> </div> </td> </tr> <tr> <td class="bottom"></td> </tr> </table> </div> <!----------BEGIN CSC ENDING ZONE ------------------------> <%=screen.endJSP()%> <script>$('#loading').hide();</script> <!----------END CSC ENDING ZONE --------------------------> </form> </body> </html> <%! DbInquiry inqEmp = null; HelpEntry screenque = null; DbRecord mcourseconfig = null; DbInquiry inqHtraintrnee = null; private String getColumnList(String selectdata){ StringBuilder sb = new StringBuilder(); sb.append( getOption(selectdata, "mpersonallevel.tdesc", "ระดับพนักงาน PL") ); //sb.append( getOption(selectdata, "mposition.tdesc", screenque.getLabel("emp_position")) ); sb.append( getOption(selectdata, "mbu1.tdesc", screenque.getLabel("bu1")) ); sb.append( getOption(selectdata, "mbu2.tdesc", screenque.getLabel("bu2")) ); sb.append( getOption(selectdata, "mbu3.tdesc", screenque.getLabel("bu3")) ); sb.append( getOption(selectdata, "mbu4.tdesc", screenque.getLabel("bu4")) ); sb.append( getOption(selectdata, "mbu5.tdesc", screenque.getLabel("bu5")) ); sb.append( getOption(selectdata, "workage.eff_position", "อายุงานในตำแหน่ง") ); sb.append( getOption(selectdata, "workage.eff_pl", "อายุงานในระดับ") ); sb.append( getOption(selectdata, "workage.firsthiredate", "อายุงานในบริษัท (First Hire Date)") ); sb.append( getOption(selectdata, "workage.startdate", "อายุงานในบริษัท (Strating Date)") ); sb.append( getOption(selectdata, "mjobgroup.tdesc", screenque.getLabel("mjobcode","jobgroup")) ); sb.append( getOption(selectdata, "mbranch.tdesc", screenque.getLabel("branch")) ); sb.append( getOption(selectdata, "memployment_type.tdesc", screenque.getLabel("emp_type")) ); //sb.append( getOption(selectdata, "systemcode.emp_type", screenque.getLabel("emp_type")) ); sb.append( getOption(selectdata, "mgroup.tdesc", screenque.getLabel("emp_group")) ); sb.append( getOption(selectdata, "mworkarea.tdesc", screenque.getLabel("workarea")) ); sb.append( getOption(selectdata, "mjobcode.tdesc", "ลักษณะงาน") ); sb.append( getOption(selectdata, "mjobcode_level.tdesc", screenque.getLabel("mjobcode","jobcode_level")) ); sb.append( getOption(selectdata, "mjobgrade0.tdesc", "Job Grade") ); sb.append( getOption(selectdata, "probation_pass", "สถานะผ่านทดลองงาน") ); sb.append( getOption(selectdata, "course_req", "หลักสูตรก่อนหน้า") ); sb.append( getOption(selectdata, "course_pass", "ผ่านการอบรมมาแล้ว") ); return sb.toString(); } private String getOption(String selectdata, String value, String label){ StringBuilder sb = new StringBuilder(); sb.append("<option value=\""+value+"\" "); if(selectdata.equalsIgnoreCase(value)) { sb.append("selected"); } sb.append(">" + label + "</option>"); return sb.toString(); } private String getLangLabel(String thai, String eng){ if (screenque.getUProfile().get("lang").equalsIgnoreCase("tha")) { return thai; } else { return eng; } } private String showData(String column) throws RemoteException{ if(!column.equalsIgnoreCase("")){ if(column.equalsIgnoreCase("probation_pass")){ CscCalendar probationdate = new CscCalendar(screenque.getDataLabel("APPROVE_DATE")); CscCalendar today = new CscCalendar(); if (probationdate.beforeEqualsDate(today) && !screenque.getDataLabel("STATUS").equalsIgnoreCase("V")) { return getLangLabel("ผ่านทดลองงาน","Probation Pass"); } else { return getLangLabel("ไม่ผ่านทดลองงาน","Probation Not Pass"); } } else if(column.equalsIgnoreCase("course_req")){ if (mcourseconfig.getString("crsrequire").equals("")) { return getLangLabel("ผ่านการอบรม","Course Pass"); } else { inqHtraintrnee.setColumn("*"); inqHtraintrnee.setFilter("traineeid = '"+screenque.getDataLabel("employeeid")+"' and trainingid in (select trainingid from htraining where "+getFilterCourseRequire(mcourseconfig.getString("crsrequire"))+") and trstatid in (select trstatid from mtrainstat where trsuccess = 'Y')"); inqHtraintrnee.refresh(); if (inqHtraintrnee.recCount() > 0) { return getLangLabel("ผ่านการอบรม","Course Pass"); } else { return getLangLabel("ไม่ผ่านการอบรม","Course Not Pass"); } } } else if(column.equalsIgnoreCase("course_pass")){ inqHtraintrnee.setColumn("*"); inqHtraintrnee.setFilter("traineeid = '"+screenque.getDataLabel("employeeid")+"' and trainingid in (select trainingid from htraining where crsid = '"+mcourseconfig.getString("crsid")+"') and trstatid in (select trstatid from mtrainstat where trsuccess = 'Y')"); inqHtraintrnee.refresh(); if (inqHtraintrnee.recCount() > 0) { return getLangLabel("ผ่านการอบรม","Course Pass"); } else { return getLangLabel("ไม่ผ่านการอบรม","Course Not Pass"); } } else { String table = column.split("\\.")[0]; String field = column.split("\\.")[1]; if(table.equalsIgnoreCase("workage")){ CscCalendar startDate = new CscCalendar(screenque.getDataLabel(field)); CscCalendar endDate = new CscCalendar(); return new CountAge(screenque.getUProfile().get("lang")).getCountAges(startDate,endDate,true) ; } else if(table.equalsIgnoreCase("systemcode")) { return screenque.getSystemCode(field); } else { return screenque.getDataLabel(table, field); } } } return ""; } private String chkFilter(String str){ if (!str.equals("")) { str += " AND "; } return str; } private String getFilterCourseRequire(String crsrequire){ String str = ""; if(!crsrequire.equals("")){ String[] crs = crsrequire.split(","); for (int i = 0; i < crs.length; i++) { str = chkFilter(str) + "crsid = '"+crs[i]+"'"; } } return str; } private String getSystemcode(String[] systemcode){ String str = ""; for (int i=0; i<systemcode.length; i++){ if (!str.equals("")) str += ","; str += systemcode[i].replace(",","#"); } return str; } %>