<%@ page contentType="text/html" %>
<%@ page session="true" %>
<%@ page language="java" %>
<%@ page autoFlush="true" import="com.hurix.mhlncms.*, java.util.*"%>
<%@ page import="java.util.*,java.io.*"%>
<HTML><HEAD><TITLE>Management Information System</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<STYLE type=text/css>
BODY
{
MARGIN: 0px
}
</STYLE>
<script type="text/javascript">
function formValidator()
{
if((document.empdetails.noofhours.value == "null") ||(document.empdetails.noofhours.value==""))
{
alert("Enter the Session");
document.empdetails.noofhours.focus();
return false;
}
if((document.empdetails.typeofleave.value == "null") ||(document.empdetails.typeofleave.value==""))
{
alert("Enter the Employee typeofleave");
document.empdetails.typeofleave.focus();
return false;
}
if((document.empdetails.reasonforleave.value == "null") || (document.empdetails.reasonforleave.value==""))
{
alert("Enter the reasonforleave");
document.empdetails.reasonforleave.focus();
return false;
}
if((document.empdetails.approvedby.value == "null") || (document.empdetails.approvedby.value==""))
{
alert("Enter the Approved by");
document.empdetails.approvedby.focus();
return false;
}
if((document.empdetails.authorisedby.value == "null") || (document.empdetails.authorisedby.value==""))
{
alert("Enter the Authorised by");
document.empdetails.authorisedby.focus();
return false;
}
if (document.empdetails.noofhours.value!="Halfday" || document.empdetails.noofhours.value==" ")
{
var sdate=document.empdetails.leavereqfrom.value;
var edate=document.empdetails.leavereqto.value;
var d1;
var m1;
var y1;
var y2;
if (sdate.length==10)
{
d1=sdate.substring(0,3);
m1=sdate.substring(4,5);
y1=sdate.substring(6,10);
}
else if(sdate.length==11)
{
d1=sdate.substring(0,3);
m1=sdate.substring(4,6);
y1=sdate.substring(7,11);
}
if (edate.length==10)
{
var d2=edate.substring(0,3);
var m2=edate.substring(4,5);
y2=edate.substring(6,10);
}
else if(edate.length==11)
{
var d2=edate.substring(0,3);
var m2=edate.substring(4,6);
y2=edate.substring(7,11);
}
var millennium =new Date();
var year = millennium.getYear();
if(y1<year || y2<year)
{
alert("Invalid Year ");
document.res.leavereqfrom.focus();
return false;
}
else if (Date.parse(sdate) <= Date.parse(edate))
{
}
else
{
alert(" End date should be after the Starting date.");
document.empdetails.leavereqto.focus();
return false;
}
if((document.empdetails.noofdays.value == "null") || (document.empdetails.noofdays.value==""))
{
alert("Enter the noofdays");
document.empdetails.noofdays.focus();
return false;
}
}
}
/*if (document.empdetails.noofdays.value!="Halfday" || document.empdetails.noofdays.value==" ")
{
alert("Enter the noofdays by");
document.empdetails.noofdays.focus();
return false;
} */
/*function calculatedays()
{
var totalnoofdays=0;
var noofdays=0;
var x=0;
var hours=0;
var z=0;
var totalnoofdays=document.empdetails.totalnoofdays.value;
var noofdays=document.empdetails.fullday.value;
var halfday=document.empdetails.halfday.value;
//alert("totalnoofdays"+totalnoofdays);
//alert("fullday"+noofdays);
//alert("halfday"+halfday);
var hours=8;
z=parseInt(noofdays*hours)+parseInt(halfday);
totalhours=parseInt(totalnoofdays*hours)-parseInt(z);
redays=totalhours/hours;
alert("The Remaining Days::"+redays);
// document.location.href="leaveform.jsp?redays="+redays+"";
}
window.onload = calculatedays;*/
function numbersonly(e)
{
var unicode=e.charCode? e.charCode : e.keyCode
if (unicode!=2)
{ //if the key isn't the backspace key (which we should allow)
if (unicode<48||unicode>57) //if not a number
alert("Enter only no's");
//alert(event.keycode)
if (unicode<48||unicode>57)
return false //disable key press
}
}
function limitlength(obj,length)
{
var maxlength=length
if (obj.value.length>maxlength)
obj.value=obj.value.substring(0, maxlength)
if((obj.value.length) && (maxlength) ==0 )
{
alert(obj.value.length)
alert("you Reach your max length");
return true;
}
else
return false;
}
</script>
<script type="text/javascript" src="../JavaScript/datetimepicker.js"></script>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
<link href="../css/form.css" rel="stylesheet" type="text/css">
<link href="../css/style.css" rel="stylesheet" type="text/css">
<script>
function assign()
{
var empid = document.empdetails.empid.value;
document.location.href="leaveform.jsp?empid="+empid+"&flag=1";
}
function assign1()
{
var empider = document.empdetails.empid.value;
var noofhours = document.empdetails.noofhours.value;
var remaindays = document.empdetails.remaindays.value;
var totalnoofdays=document.empdetails.totalnoofdays.value;
var noofdays=document.empdetails.fullday.value;
var halfday=document.empdetails.halfday.value;
var hours=8;
z=parseInt(noofdays*hours)+parseInt(halfday);
totalhours=parseInt(totalnoofdays*hours)-parseInt(z);
redays=totalhours/hours;
//alert("The Remaining Days::"+redays);
document.location.href="leaveform.jsp?empid="+empider+"&noofhours="+noofhours+"&flag=1&redays="+redays+"";
}
</script>
<script>
</script>
<script>
function aa()
{
var sdate=document.empdetails.leavereqfrom.value;
var edate=document.empdetails.leavereqto.value;
}
//window.onload=aa;
</script>
<%
mis.setHurixDbconnection(hdbc);
String empider=request.getParameter("empid") != null ? request.getParameter("empid") :"";
String flag=request.getParameter("flag") != null ? request.getParameter("flag") :"";
String noofhours=request.getParameter("noofhours") != null ? request.getParameter("noofhours") :"";
String empider1=request.getParameter("empid") != null ? request.getParameter("empid") :"";
String redays=request.getParameter("redays") != null ? request.getParameter("redays") :"";
String leavereqfrom=request.getParameter("leavereqfrom") != null ? request.getParameter("leavereqfrom") :"";
String flag1="hurix";
String empid ="";
String empdateofjoin = "";
String emplocation = "";
String empname ="";
String empdesignation="";
String empdepartment ="";
String empteleno ="";
String empmobileno ="";
String projectpref ="";
String mementereddate ="";
%>
<FORM name="empdetails" action="leaveformbean.jsp" method=post onsubmit="return formValidator()">
<TABLE cellSpacing=0 cellPadding=0 width=776 border=0>
<TBODY>
<TR>
<TD class=Form_Header bgColor=#999999>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD class=popheader width=25> </TD>
<TD class=popheader align=left width=222>Leave Form </TD>
<TD align=left width=242 height=25> </TD>
<TD class=toplink vAlign=center align=left width=211>
<TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%"
border=0>
<TBODY>
<TR>
<TD align=right width="18%"><LABEL></LABEL></TD>
<TD align=right width="28%"><LABEL></LABEL></TD>
<TD align=right width="25%"><LABEL></LABEL></TD>
<TD align=middle width="29%"><LABEL>
</TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD> </TD></TR>
<TR>
<TD>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR vAlign=top align=left>
<TD width="5%" height=35> </TD>
<TD class=labels borderColor=#dfeaff height=35>Memberer Code
<SPAN class=red_marker></SPAN></TD>
<TD borderColor=#dfeaff height=35><SELECT size=1 name="empid" onchange="assign()">
<option value="">--Please Choose--</option>
<%
Collection empid1 = mis.fetchempid();
if (empider==null){
if (empid1 != null)
{
Iterator itr1 = empid1.iterator();
Vector vpsid = new Vector();
while(itr1.hasNext())
{
vpsid = (Vector)itr1.next();%>
<option value=<%=vpsid.elementAt(0).toString()%>><%=vpsid.elementAt(0).toString()%></option>
<%}
}
}
else{
if (empid1 != null)
{
Iterator itr1 = empid1 .iterator();
Vector vpsid = new Vector();
while(itr1.hasNext())
{
vpsid = (Vector)itr1.next();
if((vpsid .elementAt(0).toString()).equals(empider)){%>
<option selected value=<%=vpsid.elementAt(0).toString()%>><%=vpsid.elementAt(0).toString()%></option>
<%}
else{%>
<option value=<%=vpsid.elementAt(0).toString()%>><%=vpsid.elementAt(0).toString()%></option>
<%}
}
}
}%>
</select> </TD>
<% if(flag.equals("1"))
{
Collection colEmpComdet = mis.fetchleavedetails1(empider);
if (colEmpComdet != null)
{
Iterator iter1 = colEmpComdet.iterator();
Vector vectcom = new Vector();
while(iter1.hasNext())
{
vectcom= (Vector)iter1.next();
empdateofjoin= vectcom.elementAt(0).toString();
emplocation=vectcom.elementAt(1).toString();
empname=vectcom.elementAt(2).toString();
empteleno=vectcom.elementAt(3).toString();
empmobileno=vectcom.elementAt(4).toString();
empdesignation=vectcom.elementAt(5).toString();
empdepartment=vectcom.elementAt(6).toString();
}
}
}
%>
<% if (flag.equals("1")){
%> <INPUT type="hidden" name="emp" value="<%=empider%>" > <%}
%>
<TD class=labels borderColor=#dfeaff height=35>DateofJoin</TD>
<TD borderColor=#dfeaff><SPAN class=breadcrumb><SPAN
class=fetch><INPUT maxLength=20 type="text" name="empdateofjoin" readonly value="<%=empdateofjoin%>" > </SPAN>
<a href="javascript:NewCal('empdateofjoin','mmmddyyyy')">
</a> </span> </span></TD>
<TR vAlign=top align=left>
<TD width="5%" height=35> </TD>
<TD class=labels borderColor=#dfeaff width="24%"
height=35>Employee Name <SPAN class=red_marker></SPAN></TD>
<TD class=fetch borderColor=#dfeaff width="23%"
height=35><SPAN class=breadcrumb>
<INPUT maxLength=20 type="text"
name="empname" readonly value="<%=empname%>"> </SPAN></TD>
<% if(!emplocation.equals("null")) { %>
<TD class=labels width="23%" height=35>Location </TD>
<TD class=fetch idth="25%" height=35><SPAN class=breadcrumb>
<INPUT maxLength=20 type="text" name="emplocation" class="" readonly value="<%=emplocation%>"> </SPAN></TD>
<% }
else {
%>
<TD class=labels width="23%" height=35>Location </TD>
<TD class=fetch idth="25%" height=35><SPAN class=breadcrumb>
<INPUT maxLength=20 type="text" name="emplocation" class="fetch"> </SPAN></TD></tr>
<% } %>
<TR vAlign=top align=left>
<TD width="5%" height=35> </TD>
<TD class=labels borderColor=#dfeaff width="23%"
height=35>Designation<SPAN class=red_marker></SPAN> </TD>
<TD class=fetch borderColor=#dfeaff width="25%"
height=35><SPAN class=breadcrumb><INPUT maxLength=20 name="empdesignation" readonly value= "<%=empdesignation%>"></SPAN></TD>
<TD class=labels borderColor=#dfeaff width="23%"
height=35>Department<SPAN class=red_marker></SPAN> </TD>
<TD class=fetch borderColor=#dfeaff width="25%"
height=35><SPAN class=breadcrumb><INPUT maxLength=20 name="empdepartment" readonly value= "<%=empdepartment%>"></SPAN></TD></tr>
<TR vAlign=top align=left>
<TD width="5%" height=35> </TD>
<TD class=labels borderColor=#dfeaff height=35>NoofHours<SPAN class=red_marker>*</SPAN></TD>
<TD borderColor=#dfeaff height=35><SELECT size=1 name="noofhours" onchange="assign1()">
<option value="<%=noofhours%>"><%=noofhours%></option>
<option value="Halfday"> HALFDAY</option>
<option value="FULLday"> FULLDAY</option>
</select> </TD>
<TD class=labels borderColor=#dfeaff width="24%"
height=35>Extentionno <SPAN class=red_marker></SPAN></TD>
<TD class=fetch borderColor=#dfeaff width="23%"
height=35><SPAN class=breadcrumb>
<INPUT maxLength=20 type="text" onkeyup="return limitlength(this, 10)"
name="empextentionno" onkeypress="return numbersonly(event)"> </SPAN></TD></TR>
<% if(noofhours.equals("Halfday"))
{
//flag1="value";
%>
<TR vAlign=top align=left>
<TD width="5%" height=35> </TD>
<TD class=labels borderColor=#dfeaff height=35>Mention the session<SPAN class=red_marker></SPAN></TD>
<TD borderColor=#dfeaff height=35><SELECT size=1 name="session1">
<option value="">---Please Choose----</option>
<option value="Morning"> Morning</option>
<option value="Afternoon"> Afternoon</option>
</select> </TD>
<TD class=labels borderColor=#dfeaff height=35>Session Date
<SPAN class=red_marker></SPAN></TD>
<TD borderColor=#dfeaff height=35><INPUT maxLength=20 type="text"
name="sessiondate" readonly >
<a href="javascript:NewCal('sessiondate','mmmddyyyy')">
<img src="../images/cal.gif" alt="Pick a date" width="16" height="16" border="0" align="absmiddle"></a> </span> </span> </td>
<INPUT maxLength=100 type="hidden"
name="sessionhours" value="4">
</td></tr></tr>
<% }%>
<% if(noofhours.equals("FULLday")) {
// flag1="value";
%>
<TR vAlign=top align=left>
<TD width="5%" height=35> </TD>
<TD class=labels borderColor=#dfeaff height=35>Leave Requirement From
<SPAN class=red_marker></SPAN></TD>
<TD borderColor=#dfeaff height=35><INPUT maxLength=20 type="text"
name="leavereqfrom" >
<a href="javascript:NewCal('leavereqfrom','mmmddyyyy')">
<img src="../images/cal.gif" alt="Pick a date" width="16" height="16" border="0" align="absmiddle"></a> </span> </span> </td>
<TD class=labels borderColor=#dfeaff height=35>Leave Requirement To
<SPAN class=red_marker></SPAN></TD>
<TD borderColor=#dfeaff height=35><INPUT maxLength=20 type="text"
name="leavereqto" onchange="dates()">
<a href="javascript:NewCal('leavereqto','mmmddyyyy')">
<img src="../images/cal.gif" alt="Pick a date" width="16" height="16" border="0" align="absmiddle"></a> </span> </span> </td></tr>
<TR vAlign=top align=left>
<TD width="5%" height=35> </TD>
<TD class=labels borderColor=#dfeaff width="23%"
height=35>NoofDays<SPAN class=red_marker></SPAN></TD>
<TD class=fetch borderColor=#dfeaff width="25%"
height=35><SPAN class=breadcrumb>
<INPUT maxLength=100 type="text" onkeyup="return limitlength(this, 3)"
name="noofdays" onkeypress="return numbersonly(event)"> </SPAN></TD></tr>
<% }%>
<TR vAlign=top align=left>
<TD width="5%" height=35> </TD>
<TD class=labels borderColor=#dfeaff height=35>Compensatory Off From
<SPAN class=red_marker></SPAN></TD>
<TD borderColor=#dfeaff height=35><INPUT maxLength=20 type="text"
name="Compensatoryofffrom" >
<a href="javascript:NewCal('Compensatoryofffrom','mmmddyyyy')">
<img src="../images/cal.gif" alt="Pick a date" width="16" height="16" border="0" align="absmiddle"></a> </span> </span> </td>
<TD class=labels borderColor=#dfeaff height=35>No of Hours
<td width="50%"><select name="noofhours1" size="1">
<option value="">--</option>
<option value="0">0</option>
<option value="1" >1</option>
<option value="2" >2</option>
<option value="3" >3</option>
<option value="4" >4</option>
</select>
<span class="minilabel"> HRS </span> </td></tr>
<TR vAlign=top align=left>
<TD width="5%" height=35> </TD>
<TD class=labels borderColor=#dfeaff height=35>In lieu of Days worked From
<SPAN class=red_marker></SPAN></TD>
<TD borderColor=#dfeaff height=35><INPUT maxLength=20 type="text"
name="inlieudays" >
<a href="javascript:NewCal('inlieudays','mmmddyyyy')">
<img src="../images/cal.gif" alt="Pick a date" width="16" height="16" border="0" align="absmiddle"></a> </span> </span> </td>
<TD class=labels borderColor=#dfeaff height=35>No of Hours
<td width="50%"><select name="noofhours2" size="1">
<option value="">--</option>
<option value="0">0</option>
<option value="1" >1</option>
<option value="2" >2</option>
<option value="3" >3</option>
<option value="4" >4</option>
</select>
<span class="minilabel"> HRS </span> </td></tr>
<TR vAlign=top align=left>
<TD width="5%" height=35> </TD>
<TD class=labels borderColor=#dfeaff height=35> Type of Leave<SPAN class=red_marker>*</SPAN></TD>
<TD borderColor=#dfeaff height=35><SELECT size=1 name="typeofleave">
<option value="">--Please Choose--</option>
<option value="Privilege"> Privilege</option>
<option value="Paternity">Paternity</option>
<option value="Contingency">Contingency</option>
<option value="Sick">Sick</option>
</select> </TD>
<% if(!empteleno.equals("null")){ %>
<TD class=labels borderColor=#dfeaff height=35>TelePhoneno</TD>
<TD borderColor=#dfeaff height=35><SPAN class=breadcrumb><SPAN
class=fetch><INPUT maxLength=20 name="empteleno" class="fetch" readonly value="<%=empteleno%>" >
</SPAN></SPAN></TD></TR>
<% }
else
{ %>
<TD class=labels borderColor=#dfeaff height=35>TelePhoneno</TD>
<TD borderColor=#dfeaff height=35><SPAN class=breadcrumb><SPAN
class=fetch><INPUT maxLength=20 name="empteleno">
</SPAN></SPAN></TD></TR>
<%}%>
<% if(!empmobileno.equals("null")){ %>
<TR vAlign=top align=left>
<TD width="5%" height=35> </TD>
<TD class=labels borderColor=#dfeaff height=35>Mobileno</TD>
<TD borderColor=#dfeaff height=35><SPAN class=breadcrumb><SPAN
class=fetch><INPUT maxLength=20 name="empmobileno" readonly value="<%=empmobileno%>" >
</SPAN></SPAN></TD>
<% }
else
{ %>
<TR vAlign=top align=left>
<TD width="5%" height=35> </TD>
<TD class=labels borderColor=#dfeaff height=35>Mobileno</TD>
<TD borderColor=#dfeaff height=35><SPAN class=breadcrumb><SPAN
class=fetch><INPUT maxLength=20 name="empmobileno" >
</SPAN></SPAN></TD>
<%}%>
<TD class=labels borderColor=#dfeaff width="23%"
height=35>Address while of leave <SPAN class=red_marker></SPAN></TD>
<TD class=fetch borderColor=#dfeaff width="25%"
height=35><SPAN class=breadcrumb><INPUT maxLength=100 type="text"
name="addressofwhileleave"> </SPAN></TD></tr>
<TR vAlign=top align=left>
<TD width="5%" height=35> </TD>
<TD class=labels borderColor=#dfeaff width="23%"
height=35>Reason for leave<SPAN class=red_marker>*</SPAN></TD>
<TD class=fetch borderColor=#dfeaff width="25%"
height=35><SPAN class=breadcrumb><INPUT maxLength=100 type="text"
name="reasonforleave"> </SPAN></TD>
<TD class=labels borderColor=#dfeaff height=35>Member’s EnteredDate
<SPAN class=red_marker></SPAN></TD>
<TD borderColor=#dfeaff height=35>
<INPUT maxLength="20" name="mementereddate" readonly
<% Collection colSysdate = mis.fetchSysdate();
if (colSysdate != null)
{
Iterator iter1 = colSysdate.iterator();
Vector vect = new Vector();
while(iter1.hasNext())
{
vect = (Vector)iter1.next();
%>value="<%= vect.elementAt(0).toString()%>"<%
}
}
%>>
</span> </span> </td></tr>
<TR vAlign=top align=left>
<TD width="5%" height=35> </TD>
<TD class=labels borderColor=#dfeaff height=35>Approved Head<SPAN class=red_marker>*</SPAN></TD>
<TD borderColor=#dfeaff height=35><SELECT size=1 name="approvedby">
<option value="">--Please Choose--</option>
<option value="BALA"> BALA</option>
<option value="MURUGAN">MURUGAN</option>
</select> </TD>
<TD class=labels borderColor=#dfeaff height=35>Authorised By<SPAN class=red_marker>*</SPAN></TD>
<TD borderColor=#dfeaff height=35><SELECT size=1 name="authorisedby">
<option value="">--Please Choose--</option>
<option value="SANGER">SANGER</option>
<option value="BASKER">BASKER</option>
</select> </TD></tr>
<TR vAlign=top align=left>
<TD width="5%" height=35> </TD>
<TD class=labels borderColor=#dfeaff width="23%"
height=35>Remaining Days</TD>
<TD class=fetch borderColor=#dfeaff width="25%"
height=35><SPAN class=breadcrumb><INPUT maxLength=20 type="text"
name="remaindays" readonly value="<%=redays%>"> </SPAN></TD></tr>
</span> </span> </td>
<TR vAlign=top align=left>
<TD width="5%" height=35> </TD>
<TD class=labels borderColor=#dfeaff height=35>
<SPAN class=red_marker></SPAN></TD>
<TD borderColor=#dfeaff height=35><INPUT maxLength=20 type="hidden"
name="verifieddate" >
<a href="javascript:NewCal('verifieddate','mmmddyyyy')">
</a> </span> </span> </td></tr>
<TD class=labels borderColor=#dfeaff height=35>
<SPAN class=red_marker></SPAN></TD>
<TD borderColor=#dfeaff height=35>
<INPUT maxLength="20" type="hidden" name="totalnoofdays"
<% Collection colSysdate1 = mis.fetchtotalnoofdays();
if (colSysdate1 != null)
{
Iterator iter3 = colSysdate1.iterator();
Vector vect = new Vector();
while(iter3.hasNext())
{
vect = (Vector)iter3.next();
%>value="<%= vect.elementAt(0).toString()%>"<%
}
}
%>>
</span> </span> </td></tr>
<% String aa =""; String aa1 ="";
Collection colSysdate2 = mis.fetchnoofdays(empider1);
if (colSysdate2 != null)
{
Iterator iter2 = colSysdate2.iterator();
Vector vect = new Vector();
while(iter2.hasNext())
{
vect = (Vector)iter2.next();
aa=vect.elementAt(0).toString();
}
}
if(!aa.equals("null"))
{%>
<INPUT maxLength="20" type="hidden" name="fullday" value="<%=aa%>">
<% } else {%>
<INPUT maxLength="20" type="hidden" name="fullday" value= "0" ><% }
Collection colSysdate3 = mis.fetchsessionleavedays(empider1);
if (colSysdate3 != null)
{
Iterator iter3 = colSysdate3.iterator();
Vector vect = new Vector();
while(iter3.hasNext())
{
vect = (Vector)iter3.next();
aa1=vect.elementAt(0).toString();
}
}
if(!aa1.equals("null"))
{%>
<INPUT maxLength="20" type="hidden" name="halfday" value="<%=aa1%>">
<% } else {%>
<INPUT maxLength="20" type="hidden" name="halfday" value= "0" ><% } %>
</span> </span> </td></tr>
</SPAN></SPAN></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD align=middle>
<INPUT type=submit value=submit >
</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
</FORM>
</BODY>
</HTML>