PROGRAM FOR PAYROLL PROCESSING USING JSP

payslipform.html


<html>
<body>
<form  action="payslipcalc.jsp" method="postt">
<h2><div style="text-align:center">TRIO TECHNOLOGIES PVT LTD</div></h2>

<table BORDER="1" >
<CAPTION><EM> PAY SLIP</EM></CAPTION>

<tr rowspan="2">
<th>Employee Name:</th>
<td><input type="text" name="ename"/></td>
</tr>

<tr>
<th> Employment ID:</th>
<td><input type="text" name="eid"/></td>
</tr>

<tr>
<th> Year of Service:</th>
<td><input type="text" name="yos"/></td>
</tr>

<tr>
<th> Enter the month for which pay slip needed:</th>
<td><input type="text" name="month"/></td>
</tr>

</table>

</br></br></br>


          <input type="submit" value="Submit" /></br></br></br>

</form>

</body>
</html>

payslipcalc.jsp


<%@ page import="java.io.*"%>
<%@ page import="java.lang.*"%>
<%@ page import="java.lang.util.*"%>
<%@ page import="javax.servlet.ServletException"%>
<%@ page import="javax.servlet.http.HttpServletRequest"%>
<%@ page import="javax.servlet.http.HttpServletResponse"%>

<html>
<body>

<%
try{


String ename1=request.getParameter("ename");
String eid1=request.getParameter("eid");
String yos1=request.getParameter("yos");
String month1=request.getParameter("month");



int eyos=Integer.parseInt(yos1);

Double basic=0.0;
Double hra=0.0;
Double da=0.0;
Double it=0.0;
Double pf=0.0;
double esi=0.0;
Double allow =0.0;
Double ded=0.0;
Double gross=0.0;
Double net=0.0;

if (eyos < 5){
basic=8500.0;
hra=(2.0/100.0)*basic;
da=(2.0/100.0)*basic;
it=0.0;
pf=0.0;
esi=0.0;
allow=hra+da;
ded=it+esi+pf;
gross=basic-ded;
net=gross+allow;
}

if ((eyos >5)&&(eyos<= 10)){
basic=18500.0;
hra=(12.0/100.0)*basic;
da=(12.0/100.0)*basic;
it=(5.0/100.0)*basic;
pf=(5.0/100.0)*basic;
esi=(2.0/100.0)*basic;
allow=hra+da;
ded=it+esi+pf;
gross=basic-ded;
net=gross+allow;
}


if ((eyos >10)&&(eyos<= 15)){
basic=27000.0;
hra=(22.0/100.0)*basic;
da=(15.0/100.0)*basic;
it=(10.0/100.0)*basic;
pf=(10.0/100.0)*basic;
esi=(5.0/100.0)*basic;
allow=hra+da;
ded=it+esi+pf;
gross=basic-ded;
net=gross+allow;
}


if (eyos >15){
basic=50000.0;
hra=(20.0/100.0)*basic;
da=(20.0/100.0)*basic;
it=(10.0/100.0)*basic;
pf=(10.0/100.0)*basic;
esi=(12.0/100.0)*basic;
allow=hra+da;
ded=it+esi+pf;
gross=basic-ded;
net=gross+allow;
}

 %>

<form target="_blank">
<h2><div style="text-align:center">TRIO TECHNOLOGIES PVT LTD</div></h2>

<table BORDER="1" >
<CAPTION><EM><b> PAY SLIP FOR THE MONTH <t><%=month1%></b></EM></CAPTION>

<tr rowspan="2">
<th>Employee Name:</th>
<td><input type="text" name="ename" value=<%=ename1%>> </td>
</tr>

<tr>
<th> Employment ID:</th>
<td><input type="text" name="eid" value=<%=eid1%>> </td>
</tr>

<tr>
<th> Year of Service:</th>
<td><input type="text" name="yos" value=<%=eyos%>> </td>
</tr>

<tr>
<th> Basic Pay:</th>
<td><input type="text" value=<%=basic%>></td>
</tr>

<tr>
<th> HRA:</th>
<td><input type="text" value=<%=hra%>></td>
</tr>

<tr>
<th> DA:</th>
<td><input type="text" value=<%=da%>></td>
</tr>

<tr>
<th> PF:</th>
<td><input type="text" value=<%=pf%>></td>
</tr>

<tr>
<th> IT:</th>
<td><input type="text" value=<%=it%>></td>
</tr>

<tr>
<th> ESI:</th>
<td><input type="text" value=<%=esi%>></td>
</tr>

<tr>
<th> GROSS PAY:</th>
<td><input type="text" value=<%=gross%>></td>
</tr>

<tr>
<th> NET PAY:</th>
<td><input type="text" value=<%=net%>></td>
</tr>

</table> 

</form>
<%
}
catch(NumberFormatException exp){
      out.println("There is something wrong:"+exp);
}
%>
</body>
</html>

OUTPUT:



No comments:

Post a Comment