TAR11126.jsp 47.8 KB
Newer Older
Thitichaipun Wutthisak committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902
<!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.*,com.csc.library.session.*,com.csc.library.utilities.*,java.text.DecimalFormat,com.csc.library.database.*"%>
<%@ page import="java.util.*,java.io.*,java.sql.*"%>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Locale" %>
<%@ page import="java.util.Date" %>
<%@ include file="../CHECKPROFILE.jsp" %>
<%
CheckNull chk = new CheckNull();
CscCalendar c = new CscCalendar();

UProfile mypro = null;

if (session !=null){
	mypro = (UProfile)session.getAttribute("userprofile");
}

DecimalFormat dmfm1 = new DecimalFormat("#,##0.00");
DecimalFormat dmfm2 = new DecimalFormat("#,###");

CscCalendar now = new CscCalendar();
SimpleDateFormat df = new SimpleDateFormat("hh:mm a", Locale.ENGLISH);
GregorianCalendar gc= new GregorianCalendar();

String cmd = chk.chkNullString(request.getParameter("__cmd"));
String branch = chk.chkNullString(request.getParameter("__comid"));
String start_date = chk.chkNullString(request.getParameter("__start_date"),now.getDDMMYYYY());
String end_date = chk.chkNullString(request.getParameter("__end_date"),now.getDDMMYYYY());
CscCalendar start_date2 = new CscCalendar(start_date);
CscCalendar end_date2 = new CscCalendar(end_date);

String f_start_date = start_date2.getYYYYMMDD();
String f_end_date =  end_date2.getYYYYMMDD();

String branchid =chk.chkNullString(request.getParameter("__branch"));
String bu1id =chk.chkNullString(request.getParameter("__bu1"));
String bu2id =chk.chkNullString(request.getParameter("__bu2"));
String bu3id =chk.chkNullString(request.getParameter("__bu3"));
String bu4id =chk.chkNullString(request.getParameter("__bu4"));
String bu5id =chk.chkNullString(request.getParameter("__bu5"));
String shift =chk.chkNullString(request.getParameter("__shift"));
String salatype =chk.chkNullString(request.getParameter("__salatype"));
String employeeid =chk.chkNullString(request.getParameter("__employeeid"));
String emptype =chk.chkNullString(request.getParameter("__emp_type"));
String workarea =chk.chkNullString(request.getParameter("__workarea"));
String groupby =chk.chkNullString(request.getParameter("__groupby"));
String orderby = "";
String filter = "1=1";
String reportfilter = "1=1";
String reportorderby = "";

DbInquiry dbssec = new InitialInquiry(uprofile).getDbInquiry("ssecurity");
dbssec.setColumn("*");
dbssec.setFilter("employeeid = '"+uprofile.get("employeeid")+"' AND isviewall ='1'");
dbssec.refresh();

if (dbssec.recCount()>0){
	dbssec.next();

	if (dbssec.getString("isemp_position").equalsIgnoreCase("1")){
		filter +=chkMySecurity(dbssec.getString("positionstatus"),"e.emp_position",dbssec.getString("positionlist"));
		reportfilter +=chkMySecurity(dbssec.getString("positionstatus"),"emp_position",dbssec.getString("positionlist"));
	}
	if (dbssec.getString("isemp_group").equalsIgnoreCase("1")){
		filter +=chkMySecurity(dbssec.getString("empgroupstatus"),"e.emp_group",dbssec.getString("empgrouplist"));
		reportfilter +=chkMySecurity(dbssec.getString("empgroupstatus"),"emp_group",dbssec.getString("empgrouplist"));
	}

	if (dbssec.getString("isbu1").equalsIgnoreCase("1")){
		filter +=chkMySecurity(dbssec.getString("bu1status"),"e.bu1",dbssec.getString("bu1list"));
		reportfilter +=chkMySecurity(dbssec.getString("bu1status"),"bu1",dbssec.getString("bu1list"));
	}

	if (dbssec.getString("isbu2").equalsIgnoreCase("1")){
		filter +=chkMySecurity(dbssec.getString("bu2status"),"e.bu2",dbssec.getString("bu2list"));
		reportfilter +=chkMySecurity(dbssec.getString("bu2status"),"bu2",dbssec.getString("bu2list"));
	}

	if (dbssec.getString("isbu3").equalsIgnoreCase("1")){
		filter +=chkMySecurity(dbssec.getString("bu3status"),"e.bu3",dbssec.getString("bu3list"));
		reportfilter +=chkMySecurity(dbssec.getString("bu3status"),"bu3",dbssec.getString("bu3list"));
	}

	if (dbssec.getString("isbu4").equalsIgnoreCase("1")){
		filter +=chkMySecurity(dbssec.getString("bu4status"),"e.bu4",dbssec.getString("bu4list"));
		reportfilter +=chkMySecurity(dbssec.getString("bu4status"),"bu4",dbssec.getString("bu4list"));
	}

	if (dbssec.getString("isjob").equalsIgnoreCase("1")){
		filter +=chkMySecurity(dbssec.getString("jobstatus"),"e.job",dbssec.getString("joblist"));
		reportfilter +=chkMySecurity(dbssec.getString("jobstatus"),"job",dbssec.getString("joblist"));
	}

	if (dbssec.getString("isbranch").equalsIgnoreCase("1")){
		filter +=chkMySecurity(dbssec.getString("branchstatus"),"e.branch",dbssec.getString("branchlist"));
		reportfilter +=chkMySecurity(dbssec.getString("branchstatus"),"branch",dbssec.getString("branchlist"));
	}

	if (dbssec.getString("issalatype").equalsIgnoreCase("1")){
		filter +=chkMySecurity(dbssec.getString("salatypestatus"),"e.salatype",dbssec.getString("salatypelist"));
		reportfilter +=chkMySecurity(dbssec.getString("salatypestatus"),"salatype",dbssec.getString("salatypelist"));
	}

	if (dbssec.getString("ispl").equalsIgnoreCase("1")){
		filter +=chkMySecurity(dbssec.getString("plstatus"),"e.pl",dbssec.getString("pllist"));
		reportfilter +=chkMySecurity(dbssec.getString("plstatus"),"pl",dbssec.getString("pllist"));
	}

	if (dbssec.getString("isworkarea").equalsIgnoreCase("1")){
		filter +=chkMySecurity(dbssec.getString("workareastatus"),"e.workarea",dbssec.getString("workarealist"));
		reportfilter +=chkMySecurity(dbssec.getString("workareastatus"),"workarea",dbssec.getString("workarealist"));
	}
}
if( !branchid.equals("") ){
	filter += " and e.BRANCH = '"+ branchid+ "'";
	reportfilter += " and BRANCH = '"+ branchid+ "'";
}
if( !bu1id.equals("") ){
	filter += " and e.BU1 = '"+ bu1id+ "'";
	reportfilter += " and BU1 = '"+ bu1id+ "'";
}
if( !bu2id.equals("") ){
	filter += " and e.BU2 = '"+ bu2id+ "'";
	reportfilter += " and BU2 = '"+ bu2id+ "'";
}
if( !bu3id.equals("") ){
	filter += " and e.BU3 = '"+ bu3id+ "'";
	reportfilter += " and BU3 = '"+ bu3id+ "'";
}
if( !bu4id.equals("") ){
	filter += " and e.BU4 = '"+ bu4id+ "'";
	reportfilter += " and BU4 = '"+ bu4id+ "'";
}
if( !bu5id.equals("") ){
	filter += " and e.BU5 = '"+ bu5id+ "'";
	reportfilter += " and BU5 = '"+ bu5id+ "'";
}
if( !shift.equals("") ){
	filter += " and t1.TIME0ID = '"+ shift+ "'";
	reportfilter += " and TIME0ID = '"+ shift+ "'";
}
if( !employeeid.equals("") ){
	filter += " and t1.employeeid = '"+ employeeid+ "'";
	reportfilter += " and employeeid = '"+ employeeid+ "'";
}
if( !emptype.equals("") ){
	filter += " and e.emp_type = '"+ emptype+ "'";
	reportfilter += " and emp_type = '"+ emptype+ "'";
}
if( !salatype.equals("") ){
	filter += " and t1.salatype = '"+ salatype+ "'";
	reportfilter += " and salatype = '"+ salatype+ "'";
}
if( !workarea.equals("") ){
	filter += " and t1.workarea = '"+ workarea+ "'";
	reportfilter += " and workarea = '"+ workarea+ "'";
}

String mainorderby = "";
if(uprofile.getDbType().equalsIgnoreCase("MSSQL")){
	mainorderby = "LEN(t1.employeeid),t1.employeeid,t1.dateid,t1.sequence";
	reportorderby = "LEN(employeeid),employeeid,dateid,time0id,eventgrp";
} else {
	mainorderby = "LENGTH(t1.employeeid),t1.employeeid,t1.dateid,t1.sequence";
	reportorderby = "LENGTH(employeeid),employeeid,dateid,time0id,eventgrp";
}

if(groupby.equalsIgnoreCase("bu1")) {
	orderby = " order by t1.bu1,"+mainorderby;
	reportorderby = "bu1,"+reportorderby;
} else if(groupby.equalsIgnoreCase("bu2")) {
	orderby = " order by t1.bu2,"+mainorderby;
	reportorderby = "bu2,"+reportorderby;
} else if(groupby.equalsIgnoreCase("bu3")) {
	orderby = " order by t1.bu3,"+mainorderby;
	reportorderby = "bu3,"+reportorderby;
} else if(groupby.equalsIgnoreCase("bu4")) {
	orderby = " order by t1.bu4,"+mainorderby;
	reportorderby = "bu4,"+reportorderby;
} else if(groupby.equalsIgnoreCase("bu5")) {
	orderby = " order by t1.bu5,"+mainorderby;
	reportorderby = "bu5,"+reportorderby;
} else {
	orderby = " order by "+mainorderby;
}

filter += " and t1.DATEID between '" + f_start_date + "' and '" +f_end_date+"'" + orderby;
reportfilter += " and DATEID between '" + f_start_date + "' and '" +f_end_date+"'";


DbRecord dbrec = new InitialRecord(mypro).getDbRecord("memployee");
dbrec.setColumn("*");

//************** Start Export Report *************************
ThaiUtilities th = new ThaiUtilities();
UProfile uf = uprofile;
String reportPath = new InitialEnvironment("GLOBAL").getValue("report-path");
String dbName = uf.getDbName();
String comname = uf.get("companyname");
String comTname = th.ASCII2Unicode(uf.get("com_tname"));
String comEname = uf.get("com_ename");
String companyid = uf.get("companyid");
String userId = uf.getUserId();
String app_name = uf.get("appname");
String schemaName = uf.getSchemaName();
String password = uf.getPassword();
String userlevel = uf.getLevel();
String format_date = uf.get("formatdate");
String lang = uf.get("lang").toUpperCase();
String ufullname = uf.get("fullname");
String bu1desc = dbrec.getField("bu1").getDescription();
String bu2desc = dbrec.getField("bu2").getDescription();
String bu3desc = dbrec.getField("bu3").getDescription();
String bu4desc = dbrec.getField("bu4").getDescription();
String bu5desc = dbrec.getField("bu5").getDescription();

DbInquiry evdesc = new InitialInquiry(uprofile).getDbInquiry("MEVENTGRP");
evdesc.setColumn("*");
evdesc.setFilter("EVENTGRPID='EAL'");
evdesc.refresh();
evdesc.next();

String evd = (uprofile.get("lang").equalsIgnoreCase("tha"))?evdesc.getString("tsdesc"):evdesc.getString("esdesc");

//************** End Export Report *************************
%>

<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 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 language="JavaScript" src="../JS/SCREEN.js"></script>
		<SCRIPT TYPE='text/JavaScript' SRC='../JS/DATEINPUT.js'></SCRIPT>
		<SCRIPT TYPE='text/JavaScript' SRC='../JS/VIEWCALENDAR.js'></SCRIPT>
		<script type="text/javascript" src="../JS/jquery-2.1.3.min.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('<%=uprofile.get("lang")%>');</script>
		<script language="JavaScript" type="text/JavaScript">
		function goHelp(helpName,inputName){
			var helpReturn;
			if(inputName=="__branch" ){
				helpReturn="__branch:branchid,__branch_desc:tdesc";
			}else if(inputName=="__bu1" ){
				helpReturn="__bu1:bu1id,__bu1_desc:tdesc";
			}else if(inputName=="__bu2" ){
				helpReturn="__bu2:bu2id,__bu2_desc:tdesc";
			}else if(inputName=="__bu3" ){
				helpReturn="__bu3:bu3id,__bu3_desc:tdesc";
			}else if(inputName=="__bu4" ){
				helpReturn="__bu4:bu4id,__bu4_desc:tdesc";
			}else if(inputName=="__bu5" ){
				helpReturn="__bu5:bu5id,__bu5_desc:tdesc";
			}else if(inputName=="__employeeid" ){
				helpReturn="__employeeid:employeeid,__employeeid_desc:fullname";
			}else if(inputName=="__shift" ){
				helpReturn="__shift:time0id,__shift_desc:tdesc";
			}else if(inputName=="__salatype" ){
				helpReturn="__salatype:codeid,__salatype_desc:tdesc";
			}else if(inputName=="__emp_type" ){
				helpReturn="__emp_type:codeid,__emp_type_desc:tdesc";
			}else if(inputName=="__workarea" ){
				helpReturn="__workarea:workareaid,__workarea_desc:tdesc";
			}
			linkHelp_Return(helpName, helpReturn);
		}

		function back(unit){
			with(window.opener.document.cscform){
				locateId.value =unit;
			}
			window.close();
		}

		function GoExport(){
			with(document.cscform){
				var param = "TAR11126_EXP.jsp?__filter="+__filter.value+"&__groupby="+__groupby.value;
				window.open(param);
			}
		}

		function GoProcess(){
			with( document.cscform){
				__cmd.value = "search"
				submit();
			}
		}

		function goPrint(){
			with(document.cscform){
				goPreview1();
			}
		}

		function goPreview1(){
			with(document.cscform){
				var reportName = getLang()==="tha"?"รายงานสรุปขาด ลา สาย":"Summary Absent Leave Late Report";
				var path = "<%=reportPath%>";
				var a = path.substring(0,path.length)+
				"?uprofile$dbname=<%=dbName%>"+
				"&com_tname=<%=comTname%>"+
				"&com_ename=<%=comEname%>"+
				"&uprofile$companyid=<%=companyid%>"+
				"&uprofile$userid=<%=userId%>"+
				"&uprofile$lang=<%=lang%>"+
				"&uprofile$appname=<%=app_name%>"+
				"&uprofile$schemaname=<%=schemaName%>"+
				"&uprofile$emp_level=<%=userlevel%>"+
				"&uprofile$formatdate=<%=format_date%>"+
				"&__COMPANY=<%=comname%>"+
				"&__screen=TAR11126"+
				"&__REPORT_XML=TAR11126"+
				"&__reportname="+reportName+
				"&thaiHeader=รายงานสรุปขาด ลา สาย"+
				"&engHeader=Summary Absent Leave Late Report"+
				"&__startPage=1"+
				"&__fixfilterttime_current1=<%=reportfilter%>"+
				"&__conditionid="+
				"&__classname=ReportResultSet"+
				"&__mmxml="+
				"&__expxml="+
				"&__export_type=EXPORT"+
				"&__file_type=.pdf"+
				"&__template=TAR11126.jasper$"+
				"&__cmd="+
				"&__orderText=<%=reportorderby%>"+
				"&__language=<%=lang%>"+
				"&__groupText="+
				"&__groupby=<%=groupby%>"+
				"&__ACTORNAME=<%=ufullname%>"+
				"&__datethai=วัน<%=now.getLongThiDOW()%>ที่ <%=now.getDate()%> <%=now.getThaiLongMonth()%> พ.ศ. <%=now.getThaiYYYY()%> <%=now.getHHMM()%> น."+
				"&__dateeng=<%=now.getEngFull()%> <%=df.format((Date)gc.getTime())%>"+
				"&__BU1DESC=<%=bu1desc%>"+
				"&__BU2DESC=<%=bu2desc%>"+
				"&__BU3DESC=<%=bu3desc%>"+
				"&__BU4DESC=<%=bu4desc%>"+
				"&__BU5DESC=<%=bu5desc%>"+
				"&__reportHeader="+reportName+
				"&__evd=<%=evd%>";

				window.open(a);
			}
		}
		</script>
	</head>
	<%
	String helpReturn="";
	if(request.getParameter("__helpReturn")!=null){
		helpReturn=request.getParameter("__helpReturn");
	}
	String fieldSearch="";
	if(request.getParameter("__fieldSearch")!=null){
		fieldSearch=request.getParameter("__fieldSearch");
	}
	%>
	<body leftmargin="0" topmargin="0">
		<form name="cscform" method="post" action="TAR11126.jsp">

			<input type="hidden" name="__cmd" value=""/>
			<input type="hidden" name="__screen" value="TAR11126"/>
			<input type="hidden" name="__help" value=""/>
			<input type="hidden" name="__goPage" value=""/>
			<input type="hidden" name="__language" value="<%=uprofile.get("lang")%>"/>
			<input type="hidden" name="__orderBy" value="<%=request.getParameter("__orderBy")%>"/>
			<input type="hidden" name="__helpReturn" value="<%=helpReturn%>"/>
			<input type="hidden" name="__fieldSearch" value="<%=fieldSearch%>"/>
			<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="__export" value=""/>
			<input type="hidden" name="__calendar" value=""/>
			<input type="hidden" name="__filter" value="<%=filter%>"/>
			<script language="javascript">getInputFormatDate()</script>

			<br/>
			<div align="center">
				<table class="large" cellpadding="0"  cellspacing="1">
					<tr>
						<td colspan=2 class="header">TAR11126, <%=uprofile.get("lang").equalsIgnoreCase("THA")?"รายงานสรุปขาด ลา สาย":"Summary Attendance Report"%></td>
					</tr>
					<tr>
						<td colspan=2>
							<table border="0" cellpadding="0" cellspacing="1"   align="center" class="largest">
								<tr>
									<td colspan=2 class="blankspace"></td>
								</tr>
								<tr>
									<td width="40%" align="right"><script language="javascript">swapLang("Employeeid")</script>&nbsp;</td>
									<td width="60%">
										<input type="text" name="__employeeid" size="10" value="<%=chk.chkNullString(request.getParameter("__employeeid"))%>" onkeypress="chkSpecialKey(event);" onkeyup="sysIsEdit();" onblur="trimValue(this);" onfocus="this.select();" alt="หน่วยงานระดับ">&nbsp;
										<a href="javascript:goHelp('MEMPLOYEEHELP','__employeeid');" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('__employeeid_image','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="SEARCH" name="__employeeid_image" width="20" height="20" border="0" align="absmiddle"></a>&nbsp;&nbsp;
										<input type="text" name="__employeeid_desc" value="<%=chk.chkNullString(request.getParameter("__employeeid_desc"))%>" readonly class="diabled"/>
									</td>
								</tr>
								<tr>
									<td width="40%" align="right"><script language="javascript">swapLang("Employment Type")</script>&nbsp;</td>
									<td width="60%">
										<input type="text" name="__emp_type" size="10" value="<%=chk.chkNullString(request.getParameter("__emp_type"))%>" onkeypress="chkSpecialKey(event);" onkeyup="sysIsEdit();" onblur="trimValue(this);" onfocus="this.select();" alt="หน่วยงานระดับ">&nbsp;
										<a href="javascript:goHelp('MEMPLOYMENT_TYPEHELP','__emp_type');" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('__employeeid_image','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="SEARCH" name="__employeeid_image" width="20" height="20" border="0" align="absmiddle"></a>&nbsp;&nbsp;
										<input type="text" name="__emp_type_desc" value="<%=chk.chkNullString(request.getParameter("__emp_type_desc"))%>" readonly class="diabled">
									</td>
								</tr>
								<tr>
									<td width="40%" align="right"><%=dbrec.getField("branch").getDescription()%>&nbsp;</td>
									<td width="60%">
										<input type="text" name="__branch" size="10" maxlength="5" value="<%=chk.chkNullString(request.getParameter("__branch"))%>" onkeypress="chkSpecialKey(event);" onkeyup="sysIsEdit();" onblur="trimValue(this);" onfocus="this.select();" alt="บริษัท">&nbsp;
										<a href="javascript:goHelp('MBRANCHHELP','__branch');" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('__branch_image','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="SEARCH" name="__branch_image" width="20" height="20" border="0" align="absmiddle"></a>&nbsp;&nbsp;
										<input type="text" name="__branch_desc" value="<%=chk.chkNullString(request.getParameter("__branch_desc"))%>" readonly class="diabled">
									</td>
								</tr>
								<tr>
									<td width="40%" align="right"><%=dbrec.getField("bu1").getDescription()%>&nbsp;</td>
									<td width="60%">
										<input type="text" name="__bu1" size="10" maxlength="5" value="<%=chk.chkNullString(request.getParameter("__bu1"))%>" onkeypress="chkSpecialKey(event);" onkeyup="sysIsEdit();" onblur="trimValue(this);" onfocus="this.select();" alt="หน่วยงานระดับ">&nbsp;
										<a href="javascript:goHelp('MBU1HELP','__bu1');" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('__bu1_image','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="SEARCH" name="__bu1_image" width="20" height="20" border="0" align="absmiddle"></a>&nbsp;&nbsp;
										<input type="text" name="__bu1_desc" value="<%=chk.chkNullString(request.getParameter("__bu1_desc"))%>" readonly class="diabled">
									</td>
								</tr>
								<tr>
									<td width="40%"  align="right"><%=dbrec.getField("bu2").getDescription()%>&nbsp;</td>
									<td width="60%">
										<input type="text" name="__bu2" size="10" maxlength="5" value="<%=chk.chkNullString(request.getParameter("__bu2"))%>" onkeypress="chkSpecialKey(event);" onkeyup="sysIsEdit();" onblur="trimValue(this);" onfocus="this.select();" alt="หน่วยงานระดับ">&nbsp;
										<a href="javascript:goHelp('MBU2HELP','__bu2');" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('__bu2_image','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="SEARCH" name="__bu2_image" width="20" height="20" border="0" align="absmiddle"></a>&nbsp;&nbsp;
										<input type="text" name="__bu2_desc" value="<%=chk.chkNullString(request.getParameter("__bu2_desc"))%>" readonly class="diabled">
									</td>
								</tr>
								<tr>
									<td width="40%"  align="right"><%=dbrec.getField("bu3").getDescription()%>&nbsp;</td>
									<td width="60%">
										<input type="text" name="__bu3" size="10" maxlength="5" value="<%=chk.chkNullString(request.getParameter("__bu3"))%>" onkeypress="chkSpecialKey(event);" onkeyup="sysIsEdit();" onblur="trimValue(this);" onfocus="this.select();" alt="หน่วยงานระดับ">&nbsp;
										<a href="javascript:goHelp('MBU3HELP','__bu3');" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('__bu3_image','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="SEARCH" name="__bu3_image" width="20" height="20" border="0" align="absmiddle"></a>&nbsp;&nbsp;
										<input type="text" name="__bu3_desc" value="<%=chk.chkNullString(request.getParameter("__bu3_desc"))%>" readonly class="diabled">
									</td>
								</tr>
								<tr>
									<td width="40%"  align="right"><%=dbrec.getField("bu4").getDescription()%>&nbsp;</td>
									<td width="60%">
										<input type="text" name="__bu4" size="10" maxlength="5" value="<%=chk.chkNullString(request.getParameter("__bu4"))%>" onkeypress="chkSpecialKey(event);" onkeyup="sysIsEdit();" onblur="trimValue(this);" onfocus="this.select();" alt="หน่วยงานระดับ">&nbsp;
										<a href="javascript:goHelp('MBU4HELP','__bu4');" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('__bu4_image','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="SEARCH" name="__bu4_image" width="20" height="20" border="0" align="absmiddle"></a>&nbsp;&nbsp;
										<input type="text" name="__bu4_desc" value="<%=chk.chkNullString(request.getParameter("__bu4_desc"))%>" readonly class="diabled">
									</td>
								</tr>
								<tr>
									<td width="40%"  align="right"><%=dbrec.getField("bu5").getDescription()%>&nbsp;</td>
									<td width="60%">
										<input type="text" name="__bu5" size="10" maxlength="5" value="<%=chk.chkNullString(request.getParameter("__bu5"))%>" onkeypress="chkSpecialKey(event);" onkeyup="sysIsEdit();" onblur="trimValue(this);" onfocus="this.select();" alt="หน่วยงานระดับ">&nbsp;
										<a href="javascript:goHelp('MBU5HELP','__bu5');" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('__bu5_image','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="SEARCH" name="__bu5_image" width="20" height="20" border="0" align="absmiddle"></a>&nbsp;&nbsp;
										<input type="text" name="__bu5_desc" value="<%=chk.chkNullString(request.getParameter("__bu5_desc"))%>" readonly class="diabled">
									</td>

								</tr>
								<tr>
									<td width="40%" align="right"><script language="javascript">swapLang('Shift')</script>&nbsp;</td>
									<td width="60%">
										<input type="text" name="__shift" size="10" maxlength="5" value="<%=chk.chkNullString(request.getParameter("__shift"))%>" onkeypress="chkSpecialKey(event);" onkeyup="sysIsEdit();" onblur="trimValue(this);" onfocus="this.select();" alt="หน่วยงานระดับ">&nbsp;
										<a href="javascript:goHelp('MTIME0HELP','__shift');" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('__shift_image','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="SEARCH" name="__shift_image" width="20" height="20" border="0" align="absmiddle"></a>&nbsp;&nbsp;
										<input type="text" name="__shift_desc" value="<%=chk.chkNullString(request.getParameter("__shift_desc"))%>" readonly class="diabled">
									</td>
								</tr>
								<tr>
									<td width="40%" align="right"><script language="javascript">swapLang('Salatype')</script>&nbsp;</td>
									<td width="60%">
										<input type="text" name="__salatype" size="10" maxlength="5" value="<%=chk.chkNullString(request.getParameter("__salatype"))%>" onkeypress="chkSpecialKey(event);" onkeyup="sysIsEdit();" onblur="trimValue(this);" onfocus="this.select();" alt="ระยะเวลาการจ่ายเงินเดือน">&nbsp;
										<a href="javascript:goHelp('MSALATYPE0HELP','__salatype');" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('__salatype_image','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="SEARCH" name="__salatype_image" width="20" height="20" border="0" align="absmiddle"></a>&nbsp;&nbsp;
										<input type="text" name="__salatype_desc" value="<%=chk.chkNullString(request.getParameter("__salatype_desc"))%>" readonly class="diabled">
									</td>
								</tr>
								<tr>
									<td width="40%" align="right"><script language="javascript">swapLang('Workarea')</script>&nbsp;</td>
									<td width="60%">
										<input type="text" name="__workarea" size="10" maxlength="5" value="<%=chk.chkNullString(request.getParameter("__workarea"))%>" onkeypress="chkSpecialKey(event);" onkeyup="sysIsEdit();" onblur="trimValue(this);" onfocus="this.select();" alt="ระยะเวลาการจ่ายเงินเดือน">&nbsp;
										<a href="javascript:goHelp('MWORKAREAHELP','__workarea');" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('__workarea_image','','../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/SEARCH20.gif" alt="SEARCH" name="__workarea_image" width="20" height="20" border="0" align="absmiddle"></a>&nbsp;&nbsp;
										<input type="text" name="__workarea_desc" value="<%=chk.chkNullString(request.getParameter("__workarea_desc"))%>" readonly class="diabled">
									</td>
								</tr>
								<tr>
									<td width="40%" align="right"><script language="javascript">swapLang('Date Between')</script>&nbsp;</td>
									<td width="60%">
										<input type="text" size="10" name="__start_date" maxlength="10" value="<%=chk.chkNullString(request.getParameter("__start_date"),start_date2.getDDMMYYYY())%>" class="txt01" onKeyup = "formatDate(this)" onKeypress = "chkIntegerOfDate(this.value)" onBlur="chkInputDate2(this,__end_date);">&nbsp;<a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image1311','','../IMAGES/BUTTON/SWAP/CALENDAR_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/CALENDAR20.gif" alt="Calendar" name="Image1311" width="20"  border="0" align="absmiddle" id="Image1311" onClick="viewCal('__start_date')"></a>&nbsp;-&nbsp;
										<input type="text" size="10" name="__end_date" maxlength="10" value="<%=chk.chkNullString(request.getParameter("__end_date"),end_date2.getDDMMYYYY())%>" class="txt01" onKeyup = "formatDate(this)" onKeypress = "chkIntegerOfDate(this.value)" onBlur="chkInputDate2(__start_date,this);">&nbsp;<a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image1311','','../IMAGES/BUTTON/SWAP/CALENDAR_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/CALENDAR20.gif" alt="Calendar" name="Image1311" width="20"  border="0" align="absmiddle" id="Image1311" onClick="viewCal('__end_date')"></a>
									</td>
								</tr>
								<tr>
									<td width="40%" align="right">Group By&nbsp;</td>
									<td width="60%">
										<select name="__groupby">
											<option value=""></option>
											<option value="bu1" <%if(groupby.equalsIgnoreCase("bu1")){%>selected<%}%>><%=dbrec.getField("bu1").getDescription()%></option>
											<option value="bu2" <%if(groupby.equalsIgnoreCase("bu2")){%>selected<%}%>><%=dbrec.getField("bu2").getDescription()%></option>
											<option value="bu3" <%if(groupby.equalsIgnoreCase("bu3")){%>selected<%}%>><%=dbrec.getField("bu3").getDescription()%></option>
											<option value="bu4" <%if(groupby.equalsIgnoreCase("bu4")){%>selected<%}%>><%=dbrec.getField("bu4").getDescription()%></option>
											<option value="bu5" <%if(groupby.equalsIgnoreCase("bu5")){%>selected<%}%>><%=dbrec.getField("bu5").getDescription()%></option>
										</select>
									</td>
								</tr>
								<tr>
									<td  class="buttonline" colspan="2">
										<div align="center">
											<button type="button" class="btn btn-primary width100" swlang code="SW013168" onClick="GoProcess();">SEARCH</button>
										</div>
									</td>
								</tr>

								<%
								if(cmd.equals("search")){
									%>
									<tr>
										<td colspan="2">
											<table height="" align="center" cellpadding="0" cellspacing="1" class="maxsize" border="0" width="100%">
												<tr bgcolor="#3366CC">
													<td colspan=2>
														<table class="maxsize tablewithborder" border="1" cellpadding="0" cellspacing="1" cols=11 bgcolor="#CCCCCC">
															<tr>
																<td  class="row1" rowspan=2><div align="center" swlang code="SW000274"><b>รหัสพนักงาน</b></div></td>
																<td  class="row1" rowspan=2><div align="center" swlang code="SW012526"><b>ชื่อพนักงาน</b></div></td>
																<td  class="row1" rowspan=2><div align="center"><b><%=dbrec.getField("bu2").getDescription()%></b></div></td>
																<td  class="row1" rowspan=2><div align="center"><b><%=dbrec.getField("bu3").getDescription()%></b></div></td>
																<td  class="row1" rowspan=2><div align="center" swlang code="SW001033"><b>วันที่</b></div></td>
																<td  class="row1" rowspan=2><div align="center" swlang code="SW000262"><b>วัน</b></div></td>
																<td  class="row1" rowspan=2><div align="center" swlang code="SW000019"><b>สถานะ</b></div></td>
																<td  class="row1" rowspan=2><div align="center" swlang code="SW000766"><b>จำนวนชม.ทำงานต่อวัน</b></div></td>
																<td  class="row1" colspan=3><div align="center" swlang code="SW012527"><b>แผนการทำงาน</b></div></td>
																<td  class="row1" colspan=2><div align="center" swlang code="SW012530"><b>การปฏิบัติงาน</b></div></td>
																<td  class="row1" rowspan=2><div align="center" swlang code="SW000055"><b>สาย</b></div></td>
																<td  class="row1" rowspan=2><div align="center" swlang code="SW012800"><b>ลล</b></div></td><!--- np -->
																<td  class="row1" rowspan=2><div align="center" swlang code="SW012531"><b>ขาด</b></div></td>
																<td  class="row1" rowspan=2><div align="center" swlang code="SW000299"><b>ลา</b></div></td>
																<td  class="row1" colspan=4><div align="center" swlang code="SW012532"><b>ค่าล่วงเวลา</b></div></td>
																<td  class="row1" rowspan=2 nowrap><div align="center" swlang code="SW012533"><b>ค่ากะ</b></div></td>
																<td  class="row1" rowspan=2><div align="center" swlang code="SW000299"><b>ลา</b></div></td>
																<td  class="row1" rowspan=2><div align="center" swlang code="SW012534"><b>ไม่มีเข้า</b></div></td>
																<td  class="row1" rowspan=2><div align="center" swlang code="SW012535"><b>ไม่มีออก</b></div></td>
															</tr>
															<tr>
																<td  class="row1" ><div align="center" swlang code="SW012529"><b>กะการทำงาน</b></div></td>
																<td  class="row1" ><div align="center" swlang code="SW012536"><b>เวลาเข้า</b></div></td>
																<td  class="row1" ><div align="center" swlang code="SW012537"><b>เวลาออก</b></div></td>
																<td  class="row1" ><div align="center" swlang code="SW012536"><b>เวลาเข้า</b></div></td>
																<td  class="row1" ><div align="center" swlang code="SW012537"><b>เวลาออก</b></div></td>
																<td  class="row1" ><div align="center"><b>1</b></div></td>
																<td  class="row1" ><div align="center"><b>1.5</b></div></td>
																<td  class="row1" ><div align="center"><b>2</b></div></td>
																<td  class="row1" ><div align="center"><b>3</b></div></td>
															</tr>

															<%
															int i=1;
															String empid ="";
															String prefix ="";
															String fname ="";
															String lname ="";
															String date ="";
															String tbu2 ="";
															String tbu3 ="";
															String time0 ="";
															String C_TM_BG ="";
															String C_TM_EN ="";
															String M_TM_BG ="";
															String M_TM_EN ="";
															String lt ="";
															String absent ="";
															String TABSENT ="";
															String w0 ="";
															String w1 ="";
															String w5 ="";
															String ot1 ="";
															String ot5 ="";
															String ot2 ="";
															String ot3 ="";
															String unused1 ="";
															String eventgrp ="";
															String approvestatus ="";
															String eventgrp1desc = "";
															String empbranch = "";
															String hour_d = "";
															String showgroup = "";
															String chkgroup = "";
															String oldgroup = "";
															int countgroup = 0;
															boolean isfirstgroup = true;

															String V_sdesc = (uprofile.get("lang").equalsIgnoreCase("tha"))?"tsdesc":"esdesc";
															String V_desc = (uprofile.get("lang").equalsIgnoreCase("tha"))?"tdesc":"edesc";
															String V_fname = (uprofile.get("lang").equalsIgnoreCase("tha"))?"fname":"efname";
															String V_lname = (uprofile.get("lang").equalsIgnoreCase("tha"))?"lname":"elname";

															StringBuffer sql = new StringBuffer();
															sql.append("select t1.employeeid as employeeid,et."+V_desc+" as emptype,p."+V_desc+" as prefix,e."+V_fname+" as fname,e."+V_lname+" as lname,bu1."+V_desc+" as tbu1,bu2."+V_desc+" as tbu2,bu3."+V_desc+" as tbu3,bu4."+V_desc+" as tbu4,bu5."+V_desc+" as tbu5,t1.DATEID as date ");
															sql.append(",t1.bu1 as bu1id,t1.bu2 as bu2id,t1.bu3 as bu3id,t1.bu4 as bu4id,t1.bu5 as bu5id ");
															sql.append(",t1.time0id as time0,t1.C_TM_BG as c_tm_bg,t1.C_TM_EN as c_tm_en,t1.M_TM_BG as m_tm_bg,t1.M_TM_EN as m_tm_en,t1.LT as lt,t1.SOURCE_IN,t1.SOURCE_OUT ");
															sql.append(",t1.M_LV as absent,t1.hour_d as hour_d ");
															sql.append(",t1.WARN00 as w0,t1.WARN01 as w1,ev."+V_sdesc+" as tabsent,t1.OT1,t1.OT5,t1.OT2,t1.OT3,t1.UNUSED1");
															sql.append(",t1.eventgrp as eventgrp,t1.forget_in,t1.forget_out,t1.m_lv,ts.approve as ApproveStatus,ev1."+V_desc+" as event1desc,e.branchid as branchid ,t1.warn05 as w5 ");
															sql.append("from ttime_current1 t1 ");
															sql.append("left join memployee e on t1.employeeid=e.employeeid ");
															sql.append("left join memployment_type et on e.emp_type = et.codeid ");
															sql.append("left join mprefix p on e.emp_prefix=p.prefixid ");
															sql.append("left join mbu1 bu1 on t1.bu1=bu1.bu1id ");
															sql.append("left join mbu2 bu2 on t1.bu2=bu2.bu2id ");
															sql.append("left join mbu3 bu3 on t1.bu3=bu3.bu3id ");
															sql.append("left join mbu4 bu4 on t1.bu4=bu4.bu4id ");
															sql.append("left join mbu5 bu5 on t1.bu5=bu5.bu5id ");
															sql.append("left join MEVENTGRP ev on t1.EVENTGRP = ev.EVENTGRPID ");
															sql.append("left join MEVENTGRP1 ev1 on e.branchid = ev1.branchid and t1.EVENTGRP = ev1.EVENTGRPID  ");
															sql.append("left join TLEAVE_SUMMARY ts on t1.employeeid = ts.employeeid and t1.dateid = ts.dateid and ts.TABLE_NAME = 'TTIME_CURRENT1' and ts.doctype=t1.eventgrp where ");
															sql.append(filter);

															//out.print("</br> "+filter);
															//String dbName = uprofile.getDbName();
															String tableName = "ttime_current1";
															DataSet ds = new DataSet(sql.toString(), dbName, tableName );
															ds.initConnection(uprofile);
															while(ds.next()){
																empid = chk.chkNullString(ds.getString("employeeid"));
																prefix = chk.chkNullString(ds.getString("prefix"));
																fname = chk.chkNullString(ds.getString("fname"));
																lname = chk.chkNullString(ds.getString("lname"));
																date = chk.chkNullString(ds.getString("date"));
																tbu2 = chk.chkNullString(ds.getString("tbu2"));
																tbu3 = chk.chkNullString(ds.getString("tbu3"));
																time0 = chk.chkNullString(ds.getString("time0"));
																C_TM_BG = chk.chkNullString(ds.getString("c_tm_bg"));
																C_TM_EN = chk.chkNullString(ds.getString("c_tm_en"));
																M_TM_BG = chk.chkNullString(ds.getString("forget_in").equals("1")?"0.00":(ds.getString("source_in").equals("A"))?"-":ds.getString("m_tm_bg"));
																M_TM_EN = chk.chkNullString(ds.getString("forget_out").equals("1")?"0.00":(ds.getString("source_out").equals("A"))?"-":ds.getString("m_tm_en"));
																lt = chk.chkNullString(ds.getString("lt"),"0.00");
																absent = chk.chkNullString(ds.getString("absent"),"0.00");
																TABSENT = chk.chkNullString(ds.getString("tabsent"));
																approvestatus = chk.chkNullString(ds.getString("ApproveStatus"));
																ot1 = chk.chkNullString(ds.getString("ot1"));
																ot5 = chk.chkNullString(ds.getString("ot5"));
																ot2 = chk.chkNullString(ds.getString("ot2"));
																ot3 = chk.chkNullString(ds.getString("ot3"));
																unused1 = chk.chkNullString(ds.getString("unused1"));
																w0 = chk.chkNullString(ds.getString("w0"));
																w1 = chk.chkNullString(ds.getString("w1"));
																w5 = chk.chkNullString(ds.getString("w5"));
																eventgrp = chk.chkNullString(ds.getString("eventgrp"));
																eventgrp1desc = chk.chkNullString(ds.getString("event1desc"));
																empbranch = chk.chkNullString(ds.getString("branchid"));
																hour_d = chk.chkNullString(ds.getString("hour_d"));
																CscCalendar cscdate = new CscCalendar(date);

																if(!groupby.equals("")) {
																	if(groupby.equalsIgnoreCase("bu1")) {
																		showgroup = chk.chkNullString(ds.getString("bu1id")) + " :: " + chk.chkNullString(ds.getString("tbu1"));
																	} else if(groupby.equalsIgnoreCase("bu2")) {
																		showgroup = chk.chkNullString(ds.getString("bu2id")) + " :: " + chk.chkNullString(ds.getString("tbu2"));
																	} else if(groupby.equalsIgnoreCase("bu3")) {
																		showgroup = chk.chkNullString(ds.getString("bu3id")) + " :: " + chk.chkNullString(ds.getString("tbu3"));
																	} else if(groupby.equalsIgnoreCase("bu4")) {
																		showgroup = chk.chkNullString(ds.getString("bu4id")) + " :: " + chk.chkNullString(ds.getString("tbu4"));
																	} else if(groupby.equalsIgnoreCase("bu5")) {
																		showgroup = chk.chkNullString(ds.getString("bu5id")) + " :: " + chk.chkNullString(ds.getString("tbu5"));
																	}

																	if(!showgroup.equals(chkgroup)) {
																		oldgroup = chkgroup;
																		chkgroup = showgroup;
																		if(isfirstgroup){
																			isfirstgroup = false;
																		} else {
																			String showcount = (uprofile.get("lang").equalsIgnoreCase("tha"))?"รวม " + countgroup + " รายการ":"Total " + countgroup + " Record(s)";
																			%>
																			<tr>
																				<td colspan="25">&nbsp;&nbsp;<%=showcount%></td>
																			</tr>
																			<%
																		}
																		%>
																		<tr>
																			<td colspan="25">&nbsp;&nbsp;<%=showgroup%></td>
																		</tr>
																		<%
																		countgroup = 0;
																	}
																}
																countgroup++;
																%>
																<tr>
																	<td  nowrap ><div align="center"><%=empid%></div></td>
																	<td  nowrap ><div align="center"><%=prefix%><%=fname%>&nbsp;&nbsp;&nbsp;<%=lname%></div></td>
																	<td  nowrap ><div align="center"><%=tbu2%></div></td>
																	<td  nowrap ><div align="center"><%=tbu3%></div></td>
																	<td  nowrap ><div align="center"><%=cscdate.getDD()+"/"+cscdate.getMM()+"/"+cscdate.getYear()%></div></td>
																	<td  nowrap ><div align="center"><%=uprofile.get("lang").equalsIgnoreCase("tha")?cscdate.getShortThiDOW():cscdate.getShortEngDOW()%></div></td>
																	<td  nowrap ><div align="center">
																		<%
																		if(eventgrp.equals("J") && !w5.equals("")) {
																			out.print(evd);
																		}else if(Double.parseDouble(lt)>0.00){
																			out.print((uprofile.get("lang").equalsIgnoreCase("tha"))?"สาย":"Late");
																		}else{
																			out.print(TABSENT);
																		}
																		%>
																	</div></td>
																	<td  nowrap ><div align="center"><%=hour_d%></div></td>
																	<td  nowrap ><div align="center"><%=time0%></div></td>
																	<td  nowrap ><div align="center"><%=C_TM_BG%></div></td>
																	<td  nowrap ><div align="center"><%=C_TM_EN%></div></td>
																	<td  nowrap ><div align="center">
																		<%
																		if(M_TM_BG.equals("0.00") && !eventgrp.equals("T")){
																			out.print("-");
																		}else{
																			out.print(M_TM_BG);
																		}
																		%>
																	</div></td>
																	<td  nowrap ><div align="center">
																		<%
																		if(M_TM_EN.equals("0.00") && !eventgrp.equals("T")){
																			out.print("-");
																		}else{
																			out.print(M_TM_EN);
																		}
																		%>
																	</div></td>
																	<td  nowrap ><div align="center">
																		<%
																		if(lt.equals("0.00")){
																			out.print("");
																		}else{
																			out.print(lt);
																		}
																		%>
																	</div></td>
																	<td  nowrap ><div align="center"><!--- np -->
																		<%
																		if(absent.equals("0.00")){
																			out.print("");
																		}else{
																			if(eventgrp.equals("NP")){
																				out.print(absent);
																			}
																		}
																		%>
																	</div></td>
																	<td  nowrap ><div align="center">
																		<%
																		if(absent.equals("0.00")){
																			out.print("");
																		}else{
																			if(eventgrp.equals("J")){
																				out.print(absent);
																			}
																		}
																		%>
																	</div></td>
																	<td  nowrap ><div align="center">
																		<%
																		if(absent.equals("0.00")){
																			out.print("");
																		}else{
																			if(!eventgrp.equals("J") && !eventgrp.equals("NP")){
																				out.print(absent);
																			}
																		}
																		%>
																	</div></td>
																	<td  nowrap ><div align="center"><%=ot1%></div></td>
																	<td  nowrap ><div align="center"><%=ot5%></div></td>
																	<td  nowrap ><div align="center"><%=ot2%></div></td>
																	<td  nowrap ><div align="center"><%=ot3%></div></td>
																	<td  nowrap ><div align="center"><%=unused1%></div></td>
																	<td  nowrap ><div align="center"><%=notLeave(eventgrp,approvestatus)?"":getAbsent(empid,date,C_TM_BG,uprofile)%></div></td><!--- ลา -->
																	<td  nowrap ><div align="center">
																		<%
																		if(!w0.equals("") && eventgrp.equalsIgnoreCase("NP")){
																			out.print((uprofile.get("lang").equalsIgnoreCase("tha"))?"ลืมบันทึกเข้า":"Not Punch In");
																		}
																		%>
																	</div></td>
																	<td  nowrap ><div align="center">
																		<%
																		if(!w1.equals("") && eventgrp.equalsIgnoreCase("NP")){
																			out.print((uprofile.get("lang").equalsIgnoreCase("tha"))?"ลืมบันทึกออก":"Not Punch Out");
																		}
																		%>
																	</div></td>
																</tr>
																<%
																i++;
															}

															if(!groupby.equals("")) {
																String showcount = (uprofile.get("lang").equalsIgnoreCase("tha"))?"รวม " + countgroup + " รายการ":"Total " + countgroup + " Record(s)";
																%>
																<tr>
																	<td colspan="25">&nbsp;&nbsp;<%=showcount%></td>
																</tr>
																<%
															}
															%>
														</table>
													</td>
												</tr>

											</table>
										</td>
									</tr>

									<tr>
										<td colspan=2 class="blankspace"></td>
									</tr>
									<tr>
										<td colspan=2>
											<table class="maxsize" align="center" cellpadding="0" cellspacing="0" class="large">

												<tr>
													<td class="buttonline" colspan="7">
														<div align="center">
															<button type="button" class="btn btn-primary width100" swlang code="SW013178" onClick="GoExport();">EXPORT</button>&nbsp;
															<button type="button" class="btn btn-primary width100" swlang code="SW013180" onClick="goPrint();">PRINT</button>
														</div>
													</td>
												</tr>
											</table>
										</td>
									</tr>
									<%
								}
								%>
							</table>
						</td>
					</tr>
					<tr>
						<td colspan=2 class="blankspace"></td>
					</tr>
					<tr bordercolor="0069B3">
						<td colspan=2 class="bottom"></td>
					</tr>
				</table>
			</div>
		</form>
	</body>
</html>
<%!
public boolean notLeave(String eventgrp,String approvestatus){
	try {
		if(eventgrp.equals("T") || eventgrp.equals("I") || eventgrp.equals("H") || eventgrp.equals("J")
		|| eventgrp.equals("O") || approvestatus.equals("w")){
			return true ;
		}
	}catch(Exception e){
		e.printStackTrace();
	}
	return false ;
}

private String getAbsent(String employeeid,String date,String time,UProfile uprofile){
	String absent="";
	CheckNull chk = new CheckNull();
	CscCalendar date2 = new CscCalendar(date+" "+time.replace(".",":")+":00");
	String sql ="select ev.tdesc as tdesc,ev.edesc as edesc,tab.start_date , tab.end_date as end_date,tab.start_time,tab.end_time from TABSENT_NSTDA tab left join MEVENTGRP ev on tab.TYPE_ABSENT = ev.EVENTGRPID  where EMPLOYEEID='"+employeeid+"'";
	String dbName = uprofile.getDbName();
	String tableName = "TABSENT_NSTDA";
	try{
		DataSet ds = new DataSet(sql, dbName, tableName );
		ds.initConnection(uprofile);
		while(ds.next()){
			CscCalendar st = new CscCalendar(chk.chkNullString(ds.getString("start_date"))+" "+chk.chkNullString(ds.getString("start_time"),"0.00").replace(".",":")+":00");
			CscCalendar en = new CscCalendar(chk.chkNullString(ds.getString("end_date"))+" "+chk.chkNullString(ds.getString("end_time"),"0.00").replace(".",":")+":00");
			if(date2.afterEqualsDateTime(st)&&date2.beforeEqualsDateTime(en)){
				absent = chk.chkNullString((uprofile.get("lang").equalsIgnoreCase("tha"))?ds.getString("tdesc"):ds.getString("edesc"));
			}
		}
	}catch(Exception e){
		e.printStackTrace();
	}
	return absent;
}

private String chkMySecurity(String p_status,String p_field,String p_data){
	String mfilter = "";
	if (p_status.equalsIgnoreCase("1")){
		mfilter =" AND "+p_field+" NOT IN (";
	}else if (p_status.equalsIgnoreCase("0")){
		mfilter = " AND "+p_field+" IN (";
	}
	if (!p_data.equalsIgnoreCase("")){
		String mdata[] = p_data.split(",");

		for (int i=0;i<mdata.length; i++){
			mfilter += "'"+mdata[i]+"',";
		}

		mfilter = mfilter.substring(0,mfilter.length()-1);

		mfilter += ")";
	}

	return mfilter;
}
%>