Sie sind auf Seite 1von 36

1

DEPARTMENT OF INFORMATION SCIENCE & TECHNOLOGY CEG CAMPUS, ANNA UNIVERSITY, CHENNAI - 600025.

DIVISION OF MCA

CASE TOOLS LAB PROJECT PAYROLL PROCESSING SYSTEM


(Using Rational Rose Software)

Submitted by: Name : MANIKANNAN.P Roll No : 2010272024 Date : 08/11/2011

PAYROLL PROCESSING SYSTEM

2
AIM: To design and develop the payroll processing system for manipulating the pay details of the employees using Rational Rose Software. (Developed in Java Servelet, Java Script, Html) DEFINITION PAYROLL:

Our Payroll Software make this complicated function look much easier. The payroll software is user-friendly, with user-definable preferences like Salary Heads and Salary structures, HR, TA, PF/ESI, Advance Register, Leave Register and calculate the gross salary, Net salary many more.
MODULAR DESCRIPTION: This System has potentially four main modules and three modules arises from a module and therefore totally constituting seven modules and they are, CALCULATE PRINT PAYROLL: This module is mainly focused with the pay details of the employees alone. The main task of this module is to compute the pay details of the concerned employee and printing it. This module needs to access the payroll databases to retrieve the pay details of the particular staff. MODIFY PAYROLL AMOUNT: This module adheres to modification made to the amount which is to be mentioned in the payroll of various employees. This modification does may be done periodically. Hence this module needs constant updation and this facility is taken care of. MANAGE TAX SALES: This module takes care of the frequent changes that are made by the government and its impact are readily absorbed by the System as it is designed in such a way to adapt to future changes. This particular module also needs frequent updation has its own impact on the entire structure of this System. MAINTAIN EMPLOYEE DETAILS: This module is responsible for maintaining the employee details of the concern (i.e. personal information) for effective manipulation of the pay details of that particular employee. This module needs utmost care and this is one of the most important modules of this entire System as its failure could have a great impact on the entire System. EDIT EMPLOYEE DETAILS: This module is used to edit employees personal details as the name implies. This particular field needs proper data feed and maintenance because if any edition is not updated properly then it may result in a poor result. ADD EMPLOYEE DETAILS: This module caters to the needs of the administrator in adding new employees entrance to that particular concern in a flexible and efficient manner. This module needs to be updated only whenever a new entry comes into role lest this module task is to ensure in any list of the concern correspond to the similar data if not it indicates that there is an error. REMOVE EMPLOYEE DETAILS: This module makes sure that whenever any employer resigns or quits or is fixed the employee database is updated approximately. This is the prime task of this module. The updation is made in such a way that it is reflected in almost all the

3
departments of the concern to make sure that the updation has resulted in a universal issues(throughout the concern).

Use-case Diagram:

Calculate & Print the payroll Add Employee

Maintain Employee details Remove Employee Modify Payroll Amount Edit Employee Payroll operator Manage Tax Rates

10

11

12

13

14

Home.HTML <HTML> <script language="javascript"> function fun() { if(lf.choice.value=="Administrator"&&lf.pass.value=="20") { window.open('Main frame.html'); } else if(lf.choice.value=="Others"&&lf.pass.value=="20") { window.open('salary.html'); } else { alert ("Invalid password"); } } </script> <Br><Br><Br><Br> <Br><Br><Br><Br> <Br><Br><Br><Br> <Center><Font Size="6" color="Red">PAYROLL PROCESSING SYSTEM</Font></Center> <Hr color="orange" width="600"> <Body Bgcolor="#888888#"> <center> <FORM name="lf"> <Table border="3" width="230"> <Tr> <Td>User Name:</Td> <Td> <SELECT NAME="choice" > <OPTION VALUE="Administrator">Administrator <OPTION VALUE="Others">Others </SELECT><Br><Br> </Td> </Tr>

15 <Tr> <Td> Password: </Td> <Td> <INPUT TYPE="password" name="pass"> </Td> </Tr> <Tr> <Td Colspan="2" align="center"> <INPUT TYPE="Button" VALUE=" Ok " onClick=fun();> <INPUT TYPE="reset"> </Td> </Tr> </Table> </FORM> <Hr color="orange" width="600"> </BOdy> </HTML>

Main Frame.HTML

<html> <frameset Rows="10%,90%"> <frameset Cols="100%"> <frame src="title.html" scrolling=No Noresize > </frameset> <frameset Cols="10%,85%"> <frame src="menu.html" Noresize> <frame src="image.html" name="n3" Noresize> </frameset> </frameset> </html>

16 Menu.HTML <html> <Body Bgcolor="#888888#"> <div align="left"> <pre> </pre> </div> <div align="left"> <table border=3 cellspacing=10 cellpading=5> <tr valign=middle> <td align="center"><b><i><a href="new.HTML" target=n3>New</a></i></b></td> </tr> <tr> <Td align="center"><b><i><a href="upfind.HTML" target=n3>Search</i></b></td> </tr> <tr> <td align="center"><B><a href="find.HTML" target=n3>Update</a></B></Td> </Tr> <Tr> <td align="center"><b><i><a href="delete.HTML" target=n3>Delete</a></i></b></td> </tr> <tr> <td align="center"><b><i><a href="home.html" target=n3>Exit</a></i></b></TD> </tr> </table> </div> </body> </html>

New.HTML <html> <script language="javascript"> //function Dep_open() //{ //window.open('Department.html'); //}

17

var startyear = "1981"; var endyear = "2021"; var dat = new Date(); var curday = dat.getDate(); var curmon = dat.getMonth()+1; var curyear = dat.getFullYear(); function checkleapyear(datea) { if(datea.getYear()%4 == 0) { if(datea.getYear()% 10 != 0) { return true; } else { if(datea.getYear()% 400 == 0) return true; else return false; } } return false; } function DaysInMonth(Y, M) { with (new Date(Y, M, 1, 12)) { setDate(0); return getDate(); } } function datediff(date1, date2) { var y1 = date1.getFullYear(), m1 = date1.getMonth(), d1 = date1.getDate(), y2 = date2.getFullYear(), m2 = date2.getMonth(), d2 = date2.getDate(); if (d1 < d2) { m1--; d1 += DaysInMonth(y2, m2); } if (m1 < m2) { y1--; m1 += 12; } return [y1 - y2, m1 - m2, d1 - d2]; } function calage() {

18 var calday = document.ef.day.options[document.ef.day.selectedIndex].value; var calmon = document.ef.month.options[document.ef.month.selectedIndex].value; var calyear = document.ef.year.options[document.ef.year.selectedIndex].value; if(curday == "" || curmon=="" || curyear=="" || calday=="" || calmon=="" || calyear=="") { alert("please fill all the values and click go -"); } else { var curd = new Date(curyear,curmon-1,curday); var cald = new Date(calyear,calmon-1,calday); var diff = Date.UTC(curyear,curmon,curday,0,0,0) Date.UTC(calyear,calmon,calday,0,0,0); var dife = datediff(curd,cald); document.ef.age.value=dife[0]; //+"/"+dife[1]+"/"+dife[2]; var monleft = (dife[0]*12)+dife[1]; var secleft = diff/1000/60; var hrsleft = secleft/60; var daysleft = hrsleft/24; } }

function onChange() { if((document.ef.dIdcho.value)=="D01") { document.ef.dName.value ="IT"; } else if((document.ef.dIdcho.value)=="D02") { document.ef.dName.value ="CS"; } else if((document.ef.dIdcho.value)=="D03") { document.ef.dName.value ="Maths"; } else if((document.ef.dIdcho.value)=="D04") { document.ef.dName.value ="PHYSIS"; }

19 else { document.ef.dName.value ="MECHANICAL"; } }

function onChangeBasic() { document.ef.mAllowence.value=(((document.ef.eBasic.value)/100)*4); document.ef.tAllowence.value=((document.ef.eBasic.value)/100)*3; document.ef.hra.value=((document.ef.eBasic.value)/100)*4; document.ef.Grosssal.value=parseInt(document.ef.eBasic.value) +parseInt(document.ef.mAllowence.value)+parseInt(document.ef.tAllowence.value) +parseInt(document.ef.hra.value); document.ef.pf.value=((document.ef.eBasic.value)/100)*4; document.ef.loan.value=((document.ef.eBasic.value)/100)*4; document.ef.netSalary.value=parseInt(document.ef.Grosssal.value)(parseInt(document.ef.pf.value)+parseInt(document.ef.loan.value)); } function distext() { //document.ef.mAllowence.disabled="true"; //document.ef.tAllowence.disabled="true"; //document.ef.hra.disabled="true"; //document.ef.Grosssal.disabled="true"; //document.ef.pf.disabled="true"; //document.ef.loan.disabled="true"; //document.ef.netSalary.disabled="true"; //document.ef.dName.disabled="true"; //document.ef.age.disabled="true"; } </Script> <Body Bgcolor="#888888#" onLoad="distext();"> <Center><Font Size="6" color="Red">PAYROLL PROCESSING SYSTEM</Font></Center> <Hr color="orange"> </Body><B>

20 <form name="ef" action="Save" method="post"> <U><Font color="Red" Size="4">Employee Details</Font></U><Br> <font size="3"> 1.Employee ID &nbsp &nbsp &nbsp:<INPUT TYPE="text" name="eId"><Br><Br> 2.Employee Name:<INPUT TYPE="text" name="eName"><Br><Br> 3.Gender &nbsp; &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp: <INPUT TYPE="radio" NAME="eRad" Value="Male" >Male <INPUT TYPE="radio" NAME="eRad" Value="Female">Female<Br><Br> 4.Date of birth &nbsp &nbsp: Date<select name="day" size="1"> <script type="text/javascript"> for(var j=1;j<32;j++) document.write("<option value="+j+">"+j+"</option>"); </script></select> Month<select name="month" size="1"> <script type="text/javascript"> for(var i=1;i<13;i++) document.write("<option value="+i+">"+i+"</option>"); </script></select> Year<select name="year" size="1"> <script type="text/javascript"> for(var k=startyear;k<endyear;k++) document.write("<option value="+k+">"+k+"</option>"); </script></select> <input name="start" onclick="calage()" value="Click(Age type="button"><br><br> 5.Age:<input name="age" size="40" value="Result"><br><br>

Calculation)"

6.Qualification : <SELECT NAME="eQuali"> <OPTION VALUE="BSC">BSC <OPTION VALUE="BCA">BCA <OPTION VALUE="BBA">BBA <OPTION VALUE="BCOM">BCOM <OPTION VALUE="MSC">MSC <OPTION VALUE="MCA">MCA <OPTION VALUE="MBA">MBA <OPTION VALUE="MCOM">MCOM

21 <OPTION VALUE="MPHL">MPHL <OPTION VALUE="PHD">PHD <OPTION VALUE="Other">Other </SELECT> <Br><Br> 7.Address :<textarea name="eAddress" row=5></textarea><Br><Br> 8.Basic Salary :<INPUT TYPE="text" onChange="onChangeBasic();"><Br><Br> </font> <Hr color="orange" Width="800" align="left">

name="eBasic"

<U><Font color="Red" Size="4">Department Details</Font></U><Br> <font size="3"> 9.Department ID &nbsp &nbsp &nbsp: <SELECT NAME="dIdcho" value="Select" onChange="onChange();"> <OPTION VALUE="D01">D01 <OPTION VALUE="D02">D02 <OPTION VALUE="D03">D03 <OPTION VALUE="D04">D04 <OPTION VALUE="D05">D05 </SELECT> <Br><Br> 10.Department Name:<INPUT TYPE="text" name="dName" value="Disabled"><Br><Br> 11.Designation : <SELECT NAME="dDesi"> <OPTION VALUE="Proffcer">Proffcer <OPTION VALUE="A.Proffcer">A.Proffcer <OPTION VALUE="Teaching">Teaching <OPTION VALUE="Non Teaching">Non Teaching <OPTION VALUE="Clerk">Clerk <OPTION VALUE="Employees">Employees <OPTION VALUE="Other">Other </SELECT> <Br>

22

<Hr color="orange" Width="800" align="left"> <U><Font color="Red" Size="4">Employee allowences</Font></U><Br> 12.Medical Allowences:<INPUT TYPE="text" name="mAllowence" value="Disabled"> 4% &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 13.Travel Allowences:<INPUT TYPE="text" name="tAllowence" value="Disabled"> 3% <Br> 14.House Rent Allowences:<INPUT TYPE="text" name="hra" value="Disabled"> 4% &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font size="5" color="Blue"> 15.Gross Salary:<INPUT TYPE="text" name="Grosssal" value="Disabled"></font> <Hr color="orange" Width="800" Align="Left"> <h7><U><Font color="Red" Size="4">Employee Deductions:</Font></U><h7><Br> 16.PF:<INPUT TYPE="text" name="pf" value="Disabled"> 4% 17.Loan:<INPUT TYPE="text" name="loan" value="Disabled"> 4% &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font size="5" color="Blue"> 18.Net salary:<INPUT TYPE="text" name="netSalary" value="Disabled"></font>

<Hr color="orange" Width="800" Align="Left">

<INPUT TYPE="reset"> <input type="Submit" value="SAVE"> </font> </form> </html>

23

Up find.Html <html> <Body Bgcolor="#888888#"> <Br><Br><Br> <Br><center> <form action="search" method="post"> <table border="3" cellspacing="5" cellpading="5"> <Tr> <Td>Employee ID &nbsp &nbsp &nbsp:<INPUT TYPE="text" name="eId"></Td> </Tr> <td> <input type="submit" value="Search"> </td> </tr> </table> </form> </Center> </body> </html>

Find.Html <html> <script language="javascript"> //function Dep_open() //{ //window.open('Department.html'); //}

var startyear = "1981"; var endyear = "2021";

24 var dat = new Date(); var curday = dat.getDate(); var curmon = dat.getMonth()+1; var curyear = dat.getFullYear(); function checkleapyear(datea) { if(datea.getYear()%4 == 0) { if(datea.getYear()% 10 != 0) { return true; } else { if(datea.getYear()% 400 == 0) return true; else return false; } } return false; } function DaysInMonth(Y, M) { with (new Date(Y, M, 1, 12)) { setDate(0); return getDate(); } } function datediff(date1, date2) { var y1 = date1.getFullYear(), m1 = date1.getMonth(), d1 = date1.getDate(), y2 = date2.getFullYear(), m2 = date2.getMonth(), d2 = date2.getDate(); if (d1 < d2) { m1--; d1 += DaysInMonth(y2, m2); } if (m1 < m2) { y1--; m1 += 12; } return [y1 - y2, m1 - m2, d1 - d2]; } function calage() { var calday = document.ef.day.options[document.ef.day.selectedIndex].value; var calmon = document.ef.month.options[document.ef.month.selectedIndex].value; var calyear = document.ef.year.options[document.ef.year.selectedIndex].value;

25 if(curday == "" || curmon=="" || curyear=="" || calday=="" || calmon=="" || calyear=="") { alert("please fill all the values and click go -"); } else { var curd = new Date(curyear,curmon-1,curday); var cald = new Date(calyear,calmon-1,calday); var diff = Date.UTC(curyear,curmon,curday,0,0,0) Date.UTC(calyear,calmon,calday,0,0,0); var dife = datediff(curd,cald); document.ef.age.value=dife[0]; //+"/"+dife[1]+"/"+dife[2]; var monleft = (dife[0]*12)+dife[1]; var secleft = diff/1000/60; var hrsleft = secleft/60; var daysleft = hrsleft/24; } }

function onChange() { if((document.ef.dIdcho.value)=="D01") { document.ef.dName.value ="IT"; } else if((document.ef.dIdcho.value)=="D02") { document.ef.dName.value ="CS"; } else if((document.ef.dIdcho.value)=="D03") { document.ef.dName.value ="Maths"; } else if((document.ef.dIdcho.value)=="D04") { document.ef.dName.value ="PHYSIS"; } else { document.ef.dName.value ="MECHANICAL";

26 } }

function onChangeBasic() { document.ef.mAllowence.value=(((document.ef.eBasic.value)/100)*4); document.ef.tAllowence.value=((document.ef.eBasic.value)/100)*3; document.ef.hra.value=((document.ef.eBasic.value)/100)*4; document.ef.Grosssal.value=parseInt(document.ef.eBasic.value) +parseInt(document.ef.mAllowence.value)+parseInt(document.ef.tAllowence.value) +parseInt(document.ef.hra.value); document.ef.pf.value=((document.ef.eBasic.value)/100)*4; document.ef.loan.value=((document.ef.eBasic.value)/100)*4; document.ef.netSalary.value=parseInt(document.ef.Grosssal.value)(parseInt(document.ef.pf.value)+parseInt(document.ef.loan.value)); } function distext() { //document.ef.mAllowence.disabled="true"; //document.ef.tAllowence.disabled="true"; //document.ef.hra.disabled="true"; //document.ef.Grosssal.disabled="true"; //document.ef.pf.disabled="true"; //document.ef.loan.disabled="true"; //document.ef.netSalary.disabled="true"; //document.ef.dName.disabled="true"; //document.ef.age.disabled="true"; } </Script> <Body Bgcolor="#888888#" onLoad="distext();"> <Center><Font Size="6" color="Red">PAYROLL PROCESSING SYSTEM</Font></Center> <Hr color="orange"> </Body><B> <form name="ef" action="update" method="post"> <U><Font color="Red" Size="4">Employee Details</Font></U><Br>

27 <font size="3"> 1.Employee ID &nbsp &nbsp &nbsp:<INPUT TYPE="text" name="eId"><Br><Br> 2.Employee Name:<INPUT TYPE="text" name="eName"><Br><Br> 3.Gender &nbsp; &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp: <INPUT TYPE="radio" NAME="eRad" Value="Male" >Male <INPUT TYPE="radio" NAME="eRad" Value="Female">Female<Br><Br> 4.Date of birth &nbsp &nbsp: Date<select name="day" size="1"> <script type="text/javascript"> for(var j=1;j<32;j++) document.write("<option value="+j+">"+j+"</option>"); </script></select> Month<select name="month" size="1"> <script type="text/javascript"> for(var i=1;i<13;i++) document.write("<option value="+i+">"+i+"</option>"); </script></select> Year<select name="year" size="1"> <script type="text/javascript"> for(var k=startyear;k<endyear;k++) document.write("<option value="+k+">"+k+"</option>"); </script></select> <input name="start" onclick="calage()" value="Click(Age type="button"><br><br> 5.Age:<input name="age" size="40" value="Result"><br><br>

Calculation)"

6.Designation : <SELECT NAME="eDesi"> <OPTION VALUE="BSC">BSC <OPTION VALUE="BCA">BCA <OPTION VALUE="BBA">BBA <OPTION VALUE="BCOM">BCOM <OPTION VALUE="MSC">MSC <OPTION VALUE="MCA">MCA <OPTION VALUE="MBA">MBA <OPTION VALUE="MCOM">MCOM <OPTION VALUE="MPHL">MPHL <OPTION VALUE="PHD">PHD <OPTION VALUE="Other">Other

28 </SELECT> <Br><Br> 7.Address :<textarea name="eAddress" row=5></textarea><Br><Br> 8.Basic Salary :<INPUT TYPE="Number" onChange="onChangeBasic();"><Br><Br> </font> <Hr color="orange" Width="800" align="left">

name="eBasic"

<U><Font color="Red" Size="4">Department Details</Font></U><Br> <font size="3"> 9.Department ID &nbsp &nbsp &nbsp: <SELECT NAME="dIdcho" value="Select" onChange="onChange();"> <OPTION VALUE="D01">D01 <OPTION VALUE="D02">D02 <OPTION VALUE="D03">D03 <OPTION VALUE="D04">D04 <OPTION VALUE="D05">D05 </SELECT> <Br><Br> 10.Department Name:<INPUT TYPE="text" name="dName" value="Disabled"><Br><Br> 11.Designation : <SELECT NAME="dDesi"> <OPTION VALUE="Proffcer">Proffcer <OPTION VALUE="A.Proffcer">A.Proffcer <OPTION VALUE="Teaching">Teaching <OPTION VALUE="Non Teaching">Non Teaching <OPTION VALUE="Clerk">Clerk <OPTION VALUE="Employees">Employees <OPTION VALUE="Other">Other </SELECT> <Br> <Hr color="orange" Width="800" align="left">

29

<U><Font color="Red" Size="4">Employee allowences</Font></U><Br> 12.Medical Allowences:<INPUT TYPE="text" name="mAllowence" value="Disabled"> 4% &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 13.Travel Allowences:<INPUT TYPE="text" name="tAllowence" value="Disabled"> 3% <Br> 14.House Rent Allowences:<INPUT TYPE="text" name="hra" value="Disabled"> 4% &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font size="5" color="Blue"> 15.Gross Salary:<INPUT TYPE="text" name="Grosssal" value="Disabled"></font> <Hr color="orange" Width="800" Align="Left"> <h7><U><Font color="Red" Size="4">Employee Deductions:</Font></U><h7><Br> 16.PF:<INPUT TYPE="text" name="pf" value="Disabled"> 4% 17.Loan:<INPUT TYPE="text" name="loan" value="Disabled"> 4% &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font size="5" color="Blue"> 18.Net salary:<INPUT TYPE="text" name="netSalary" value="Disabled"></font>

<Hr color="orange" Width="800" Align="Left">

<INPUT TYPE="reset"> <input type="Submit" value="Update"> </font> </form> </html>

30

Delete.Html <html> <Body Bgcolor="#888888#"> <Br><Br><Br> <Br><form action="delete" method="post"><center> <table border="3" cellspacing="5" cellpading="5"> <Tr> <Td>Employee ID &nbsp &nbsp &nbsp:<INPUT TYPE="text" name="eId"></Td> </Tr> <tr align="center"> <td><B><Input type="submit" value="Delete"></B></Td> </tr> </table> </Center> </form> </body> </html>

Sava.java import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.sql.*; public class Save extends HttpServlet { public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException { response.setContentType("text/html"); String eid=request.getParameter("eId"); String ename=request.getParameter("eName"); String egen=request.getParameter("eRad"); String age=request.getParameter("age"); String eQuali=request.getParameter("eQuali"); String eaddress=request.getParameter("eAddress");

31 int ebasic=Integer.parseInt(request.getParameter("eBasic")); String did=request.getParameter("dIdcho"); String dname=request.getParameter("dName"); String edesi=request.getParameter("dDesi"); String mall=request.getParameter("mAllowence"); String tall=request.getParameter("tAllowence"); String hra=request.getParameter("hra"); String grossal=request.getParameter("Grosssal"); String pf=request.getParameter("pf"); String loan=request.getParameter("loan"); String netsal=request.getParameter("netSalary"); PrintWriter out=response.getWriter(); try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); // out.println("<P> DRIVER REGISTERED</p>"); // Connection DriverManager.getConnection("jdbc:odbc:payrolldsn","",""); out.println("<p>adfkaljal</p>"); Statement statement = connection.createStatement(); out.println("<p>statement created</p>"); connection =

// // VALUES ('"+cname+"', '"+fname+"', '"+cdob+"', '"+csex+"', '"+cadd+"', '"+cph+"', '"+a+"','"+iba+"', 'no //int i = statement.executeUpdate("INSERT INTO employee(`eid`, `ename`, `gender`, `age`, `qualification`, `address`, `basic`, `did`, `dname`, `designation`, `mall`, `tall`, `hra`, `gsal`, `pf`, `loan`, `netsal`) VALUES ('e1', 'mani', 'male', '23', 'mca', 'chennai', 50000, 'd01', 'it', 'teachinh', '4', '4', '4', '6', '4', '5', '300')"); int i = statement.executeUpdate("INSERT INTO employee(`eid`, `ename`, `gender`, `age`, `qualification`, `address`, `basic`, `did`, `dname`, `designation`, `mall`, `tall`, `hra`, `gsal`, `pf`, `loan`, `netsal`) VALUES ('"+eid+"', '"+ename+"', '"+egen+"', '"+age+"', '"+eQuali+"', '"+eaddress+"', '"+ebasic+"', '"+did+"', '"+dname+"', '"+edesi+"', '"+mall+"', '"+tall+"', '"+hra+"', '"+grossal+"', '"+pf+"', '"+loan+"', '"+netsal+"')"); out.println("<Html><Body Added</h3></Body></Html>"); // out.println(" row inserted"); connection.close(); } catch(Exception exception) { String s=exception.getMessage(); out.println("<p>"+s+"<p>"); } out.close(); Bgcolor=#888888#><h3>Employee

32 } } Delete.java import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.sql.*; public class delete extends HttpServlet { public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException { response.setContentType("text/html"); String eid=request.getParameter("eId"); //String ename=request.getParameter("eName"); //String egen=request.getParameter("eRad"); //String age=request.getParameter("age"); //String eQuali=request.getParameter("eQuali"); //String eaddress=request.getParameter("eAddress"); //int ebasic=Integer.parseInt(request.getParameter("eBasic")); //String did=request.getParameter("dIdcho"); //String dname=request.getParameter("dName"); //String edesi=request.getParameter("dDesi"); //String mall=request.getParameter("mAllowence"); //String tall=request.getParameter("tAllowence"); //String hra=request.getParameter("hra"); //String grossal=request.getParameter("Grosssal"); //String pf=request.getParameter("pf"); //String loan=request.getParameter("loan"); //String netsal=request.getParameter("netSalary"); PrintWriter out=response.getWriter(); try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); // out.println("<P> DRIVER REGISTERED</p>"); Connection DriverManager.getConnection("jdbc:odbc:payrolldsn","",""); // out.println("<p>adfkaljal</p>"); Statement statement = connection.createStatement(); // out.println("<p>statement created</p>"); connection =

33

//int i = statement.executeUpdate("INSERT INTO employee(`eid`, `ename`, `gender`, `age`, `qualification`, `address`, `basic`, `did`, `dname`, `designation`, `mall`, `tall`, `hra`, `gsal`, `pf`, `loan`, `netsal`) VALUES ('"+eid+"', '"+ename+"', '"+egen+"', '"+age+"', '"+eQuali+"', '"+eaddress+"', '"+ebasic+"', '"+did+"', '"+dname+"', '"+edesi+"', '"+mall+"', '"+tall+"', '"+hra+"', '"+grossal+"', '"+pf+"', '"+loan+"', '"+netsal+"')"); int i = statement.executeUpdate("DELETE FROM employee WHERE eid='"+eid+"'"); out.println("<Html><Body Bgcolor=#888888#><h3>Details Deleted</h3></Body></Html>"); // out.println("row deleted"); connection.close(); } catch(Exception exception) { String s=exception.getMessage(); out.println("<p>"+s+"<p>"); } out.close(); } }

Search.java import java.io.*; import java.sql.*; import javax.servlet.*; import javax.servlet.http.*; public class search extends HttpServlet{ public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException{ response.setContentType("text/html"); PrintWriter pw = response.getWriter(); String eid=request.getParameter("eId"); // String connectionURL = "jdbc:mysql://localhost/zulfiqar"; // Connection connection=null; try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection connection = DriverManager.getConnection("jdbc:odbc:payrolldsn","",""); Statement st = connection.createStatement();

34 ResultSet rs = st.executeQuery("Select * from employee WHERE `eid`='"+eid+"'"); while(rs.next()){ //pw.println("EmpName" + " " + "EmpSalary" + "<br>"); pw.println("<Html><Body Bgcolor=#888888#><h3>Employee Added</h3></Body></Html>"); pw.println("Employee Id:"); pw.println(rs.getString(1)+"<br>"); pw.println("Employee name:"); pw.println(rs.getString(2)+"<br>"); pw.println("Employee Gender:"); pw.println(rs.getString(3)+"<br>"); pw.println("Employee Age:"); pw.println(rs.getString(4)+"<br>"); pw.println("Employee Qualication:"); pw.println(rs.getString(5)+"<br>"); pw.println("Employee Address:"); pw.println(rs.getString(6)+"<br>"); pw.println("Employee Basic:"); pw.println(rs.getString(7)+"<br>"); pw.println("Department Id:"); pw.println(rs.getString(8)+"<br>"); pw.println("Department Name:"); pw.println(rs.getString(9)+"<br>"); pw.println("Designation:"); pw.println(rs.getString(10)+"<br>"); pw.println("Medical Allowencess:"); pw.println(rs.getString(11)+"<br>"); pw.println("Travel allowencess:"); pw.println(rs.getString(12)+"<br>"); pw.println("House Rent allowencess:"); pw.println(rs.getString(13)+"<br>"); pw.println("Gross Salary:"); pw.println(rs.getString(14)+"<br>"); pw.println("p.F:"); pw.println(rs.getString(15)+"<br>"); pw.println("Loan:"); pw.println(rs.getString(16)+"<br>"); pw.println("Net Salary:"); pw.println(rs.getString(17)+"<br>"); } } catch (Exception e){ pw.println(e); } }

35 } Updata.java import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.sql.*; public class update extends HttpServlet { public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException { response.setContentType("text/html"); String eid=request.getParameter("eId"); String ename=request.getParameter("eName"); String egen=request.getParameter("eRad"); String age=request.getParameter("age"); String eQuali=request.getParameter("eQuali"); String eaddress=request.getParameter("eAddress"); int ebasic=Integer.parseInt(request.getParameter("eBasic")); String did=request.getParameter("dIdcho"); String dname=request.getParameter("dName"); String edesi=request.getParameter("dDesi"); String mall=request.getParameter("mAllowence"); String tall=request.getParameter("tAllowence"); String hra=request.getParameter("hra"); String grossal=request.getParameter("Grosssal"); String pf=request.getParameter("pf"); String loan=request.getParameter("loan"); String netsal=request.getParameter("netSalary"); PrintWriter out=response.getWriter(); try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); // out.println("<P> DRIVER REGISTERED</p>"); Connection DriverManager.getConnection("jdbc:odbc:payrolldsn","",""); // out.println("<p>adfkaljal</p>"); Statement statement = connection.createStatement(); // out.println("<p>statement created</p>"); connection =

36 // VALUES ('"+cname+"', '"+fname+"', '"+cdob+"', '"+csex+"', '"+cadd+"', '"+cph+"', '"+a+"','"+iba+"', 'no //int i = statement.executeUpdate("INSERT INTO employee(`eid`, `ename`, `gender`, `age`, `qualification`, `address`, `basic`, `did`, `dname`, `designation`, `mall`, `tall`, `hra`, `gsal`, `pf`, `loan`, `netsal`) VALUES ('e1', 'mani', 'male', '23', 'mca', 'chennai', 50000, 'd01', 'it', 'teachinh', '4', '4', '4', '6', '4', '5', '300')"); int i = statement.executeUpdate("UPDATE employee SET `eid`='"+eid+"', `ename`='"+ename+"', `gender`='"+egen+"', `age`='"+age+"', `qualification`='"+eQuali+"', `address`='"+eaddress+"', `basic`="+ebasic+", `did`='"+did+"', `dname`='"+dname+"', `designation`='"+edesi+"', `mall`='"+mall+"', `tall`='"+tall+"', `hra`='"+hra+"', `gsal`='"+grossal+"', `pf`='"+pf+"', `loan`='"+loan+"', `netsal`='"+netsal+"' WHERE `eid`='"+eid+"'"); out.println("<Html><Body Bgcolor=#888888#><h3>Details Updated</h3></Body></Html>"); // out.println(" row updated"); connection.close(); } catch(Exception exception) { String s=exception.getMessage(); out.println("<p>"+s+"<p>"); } out.close(); } }

Das könnte Ihnen auch gefallen