TAU_LVALLOWANCE.jsp 8.5 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
<%@page contentType="text/html; charset=UTF-8"%>
<%@page import="com.csc.library.entry.HelpEntry,com.csc.library.system.*,com.csc.library.utilities.*,com.csc.library.formula.*"%>
<%@page import="com.csc.library.entry.*,com.csc.library.database.*,com.csc.library.session.*"  %>
<%@page import="com.csc.library.timeattendance.MyBudgetYear" %>
<%@page import="java.text.DecimalFormat,com.csc.library.utility.DHMConvert"%>
<jsp:useBean id="TAU_ALLOWANCE" class="com.csc.library.system.Task" scope="page"/>
<%
try {
	ThaiUtilities thaicode = new ThaiUtilities();
	DecimalFormat df = new DecimalFormat("#0.00");

	CheckNull chk = new CheckNull();
	FormulaString fs = new FormulaString();
	DHMConvert dhm = new DHMConvert();

	double dHourd = 8d;
	String empName = thaicode.ASCII2Unicode(chk.chkNullString(request.getParameter("__empName")));
	String empID = thaicode.ASCII2Unicode(chk.chkNullString(request.getParameter("__empID")));
	String yearid = chk.chkNullString(request.getParameter("__yearid"),"0");
	String ldesc = thaicode.ASCII2Unicode(chk.chkNullString(request.getParameter("__ldesc")));
	String fixcon = chk.chkNullString(request.getParameter("__fixCon"),"0");
	

	TAU_ALLOWANCE.setChannel(request,response);
	HelpEntry screen = (HelpEntry) TAU_ALLOWANCE.process("HelpEntry","TAU_LVALLOWANCEHELP");
	screen.referLangOff();

	MyBudgetYear mby = new MyBudgetYear(screen.getUProfile());
	CscCalendar cs[] = mby.getBudgetYearPeriod(Integer.parseInt(yearid));

	if(!fixcon.equals("")){
		screen.inq.setFilter(fixcon + " and dateid between '" + cs[0].getYYYYMMDD() + "' and '" + cs[1].getYYYYMMDD() + "'");
	}else{
		screen.inq.setFilter("employeeid = '"+ empID +"' and dateid between '" + cs[0].getYYYYMMDD() + "' and '" + cs[1].getYYYYMMDD() + "'");
	}
	//out.print(fixcon + " and dateid between '" + cs[0].getYYYYMMDD() + "' and '" + cs[1].getYYYYMMDD() + "'");
	screen.process();

	DbRecord db = new InitialRecord(screen.getUProfile()).getDbRecord("Memployee");
	db.setParam("rsc_skip", "true");
	db.setColumn("employeeid,companyid,time0");
	db.set("employeeid", empID);
	if(db.search()==1) {
		DbRecord dbMtime0 = new InitialRecord(screen.getUProfile()).getDbRecord("Mtime0");
		dbMtime0.setColumn("time0,companyid,hour_d");
		dbMtime0.set("time0id", db.getString("time0"));
		if(dbMtime0.search()==1){
			System.out.print("Mtime0 found"); 
			dHourd = dbMtime0.getDouble("hour_d");
		}else{
			System.out.print("!! Hourd not found " + empID);
		}
	}else{
		System.out.print("!! Hourd not found " + empID);
	}

	

%>
<!DOCTYPE HTML>
<html ng-app="myHR">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Employee View</title>
		
		<link rel="stylesheet" href="<%=request.getContextPath()%>/CSS/font-awesome.css">
		<link rel="stylesheet" type="text/css" href="../CSS/Bootstrap/css/bootstrap.css" />
		<link rel="stylesheet" type="text/css" href="../CSS/EMPVIEW_LAYOUT.min.css" />
		
		<script type="text/javascript" src="../JS/SCREEN.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 type="text/javascript" src="../JS/VIEWCALENDAR.js"></script>	

		<script language="javascript">
		<!--
			setLang('<%=screen.getUProfile().get("lang")%>');
			
			function MM_swapImgRestore() { //v3.0
			  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
			}

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

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

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

	</head>
	<body>
		<div class="bg-com"></div>
		
		<div class="container csc-content">
			<form name="cscform" method="post" >
 

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

				<%=screen.InitialVariable()%>

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

				<input type="hidden"name="__screen"  value="TAU_ALLOWANCE">
				<input type="hidden" name="__fixCon" value="<%=request.getParameter("__fixCon")%>">
				<input type="hidden" name="__cmd"  value="">
				<input type="hidden" name="__language" value="<%=screen.getUProfile().get("lang")%>">
				<input name="__companyid" type="hidden" value='<%=screen.getUProfile().get("companyid")%>'>
				<input type="hidden" name="__employeeid" value="<%=empID%>">
				<input type="hidden" name="__referPage" value="">
				<input type="hidden" name="__childFilter">
				<input type="hidden" name="__date_start" value="<%=cs[0].getYYYYMMDD()%>">
				<input type="hidden" name="__date_end" value="<%=cs[1].getYYYYMMDD()%>">
				<input type="hidden" name="date_start" value="<%=cs[0].getYYYYMMDD()%>">
				<input type="hidden" name="date_end" value="<%=cs[0].getYYYYMMDD()%>">
				<input type="hidden" name="__pageCall" value="<%=request.getParameter("__screen")%>">
				<input type="hidden" name="__gorec">
  
				<div class="csc-block">
					<div class="center">
						<h3 class="csc-block-head">Leave allowance</h3>
					</div></br>
					
					<div class="row">
						<div class="form-group">
							<div class="col-md-3 col-sm-3 col-xs-3">
								<label class="control-label label-right" swlang code='SW000274'>Employee ID</label>
							</div>
							<div class="col-md-2 col-sm-2 col-xs-2">
								<label class="control-label"><%=empID%></label>
							</div>
							<div class="col-md-3 col-sm-3 col-xs-3">
								<label class="control-label label-right" swlang code='SW000195'>Name</label>
							</div>
							<div class="col-md-3 col-sm-3 col-xs-3">
								<label class="control-label"><%=empName%></label>
							</div>
						</div>
					</div>
					<div class="row">
						<div class="form-group">
							<div class="col-md-3 col-sm-3 col-xs-3">
								<label class="control-label label-right" swlang code='SW005161'>Leave Description</label>
							</div>
							<div class="col-md-2 col-sm-2 col-xs-2">
								<label class="control-label"><%=ldesc%></label>
							</div>
							<div class="col-md-3 col-sm-3 col-xs-3">
								<label class="control-label label-right" swlang code='SW000702'>Date Between</label>
							</div>
							<div class="col-md-3 col-sm-3 col-xs-3">
								<label class="control-label"><%=cs[0].getDDMMYYYY()%>&nbsp;-&nbsp;<%=cs[1].getDDMMYYYY()%></label>
							</div>
						</div>
					</div></br>
				</div>
				
				<table class="table table-head table-hover table-bordered table-title-left table-content-center">
					<thead>
						<tr>
							<th swlang code='SW000193'>Seq</th>
							<th swlang code='SW001033'>Date</th>
							<th><label swlang code='SW000024'>Total</label> ( <label swlang code='SW011233'>HH MM</label> )</th>
						</tr>
					</thead>
					<tbody>
						<% 
							 screen.inq.first(); 
							 int i=0;	
							 while (screen.inq.next()) {	
								i++;		 
								try {
									/*
									StringBuffer sb = new StringBuffer();
									sb.append(new CscCalendar(screen.getString("start_date")).getDDMMYYYY()).append(" ");
									sb.append(df.format(Double.parseDouble(screen.getString("start_time"))));
									sb.append(" - ");
									sb.append(new CscCalendar(screen.getString("end_date")).getDDMMYYYY()).append(" ");
									sb.append(df.format(Double.parseDouble(screen.getString("end_time"))));
									*/
									
						%>
						<tr>
							<td><%=i%></td>
							<td><%=screen.getString("dateid")%></td>
							<td><%=dhm.MinToDHM(dhm.timeToMin(Double.parseDouble(screen.getString("hour"))), dHourd)%></td>
						</tr>
						<%
								}catch(Exception e){
									e.printStackTrace();
								}
							}
						%>
					</tbody>
				</table>
				<div class="center">
					<a href="javascript:close();" class="btn btn-primary" swlang code='SW012104'>Close</a>
				</div>
			</form>
		</div>
		<%
			screen.referLangOff();
			}catch(Exception e){
				e.printStackTrace();
			}
		%>
	</body>
</html>