Employee Details
Enter Employee Details :
PERSON INFORMATION
<%@ page import="java.sql.*"%>
<%
int ID=Integer.parseInt(request.getParameter("empid"));
String NAME=request.getParameter("ename");
String des2= request.getParameter("des");
int b3=Integer.parseInt(request.getParameter("bsal"));
int ta4=Integer.parseInt(request.getParameter("ta"));
int da5=Integer.parseInt(request.getParameter("da"));
int har6=Integer.parseInt(request.getParameter("hra"));
int pf7=Integer.parseInt(request.getParameter("pf"));
int lic8=Integer.parseInt(request.getParameter("lic"));
double TA=(ta4/100.0)*b3;
double DA=(da5/100.0)*b3;
double HRA=(har6/100.0)*b3;
double PF=(pf7/100.0)*b3;
double LIC=(lic8/100.0)*b3;
double GrossSalary=(int)b3+TA+DA+HRA;
double NetSalary=GrossSalary-(PF+LIC);
java.util.Formatter formatter = new java.util.Formatter();
formatter.format("%.2f", GrossSalary);
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:person");
PreparedStatement p;
p=con.prepareStatement("insert into table1 values('"+ID+"','"+NAME+"' ,'"+dept1+"','"+des2+"','"+b3+"','"+ta4+"','"+da5+"','"+har6+"','"+pf7+"','"+lic8+"')");
int rs=p.executeUpdate();
if(rs>0)
{
out.print("DATA INSERTED SUCCESSFULLY");
}
else
{
out.print(" NOT CONNECTED");
}
}
catch(Exception e)
{
out.println(e);
}
%>
EMPLOYEE NAME:
EMPLOYEE ID:
Department :
Designation :
Basic Salary :
TA :
DA :
HRA :
PF :
<%= PF %>
LIC:
<%= LIC %>
Gross Salary :
Net Salary :
<%= NetSalary %>