employeeEntryProccess.jsp
<%--processes the varibles entered for the new employee in EmployeeEntry--%>
Main Menu
<%@ page import= "java.sql.*" %> <%@ page import = "com.PrintToFile"%> <%@ page import= "java.io.*" %> <%@ page import= "com.ConnectionPool2" %> <% String one = request.getParameter("one"); String two = request.getParameter("two"); String three = request.getParameter("three"); String four = request.getParameter("four"); String lastName = request.getParameter("lastName"); String paySoFar = request.getParameter("paySoFar"); String hourlyWage = request.getParameter("hourlyWage"); String hourlyWageOver1 = request.getParameter("hourlyWageOver1"); String hourlyWageOver2 = request.getParameter("hourlyWageOver2"); String hourlyWageOver3 = request.getParameter("hourlyWageOver3"); String Dob = request.getParameter("DOB"); String address = request.getParameter("Address"); String sortCode = request.getParameter("sortCode"); String accountNumber = request.getParameter("AccountNumber"); String taxCode = request.getParameter("TaxCode"); String NICTable = request.getParameter("NICtable"); String phoneNum = request.getParameter("PhoneNum"); String weekMonthBasis = request.getParameter("weekMonthBasis"); String payPeriod = request.getParameter("payPeriod"); int WMbasis; if(weekMonthBasis != null) WMbasis = 1; else WMbasis = 0; int emp = 1; int threeInt = (int)Integer.parseInt(three); double hourlyWageOverDouble1 = (double)Double.parseDouble(hourlyWageOver1); double hourlyWageOverDouble2 = (double)Double.parseDouble(hourlyWageOver2); double hourlyWageOverDouble3 = (double)Double.parseDouble(hourlyWageOver3); double hourlyWageDouble = (double)Double.parseDouble(hourlyWage); double fourDouble = (double)Double.parseDouble(four); double paySoFarDouble = (double)Double.parseDouble(paySoFar); Connection connection = ConnectionPool2.getConnection(); String companyName = (String)session.getAttribute("company"); //Checks that the session is still valid if the session is not the user is returned directed to loggin // again if the users details were entered into the system without a session the null could be entered //into the company column. if(companyName == null) { %>
<% } //The two SQL statements send the data to two seperate tables. //String query = "INSERT INTO perse3(CompanyName, FirstName, NIC, Surname, WageHour, WageHoursOver1, WageHoursOver2, WageHoursOver3, DOB, Address, Sortcode, AccountNumber, PAYEcode, NICtable, PhoneNumber, WMbasis, MonthWeek, employed)VALUES('"+companyName+"', '"+one+"', '"+two+"', '"+lastName+"', "+hourlyWageDouble+", "+hourlyWageOverDouble1+", "+hourlyWageOverDouble2+", "+hourlyWageOverDouble3+", '"+Dob+"', '"+address+"', '"+sortCode+"', '"+accountNumber+"', '"+taxCode+"', '"+NICTable+"', '"+phoneNum+"', "+WMbasis+", '"+payPeriod+"', "+emp+")"; String query = "INSERT INTO perse3(CompanyName, FirstName, NIC, Surname, WageHour, WageHoursOver1, WageHoursOver2, WageHoursOver3, DOB, Address, Sortcode, AccountNumber, PAYEcode, NICtable, PhoneNumber, WMbasis, MonthWeek, employed)VALUES('"+companyName+"', '"+one+"', '"+two+"', '"+lastName+"', "+hourlyWageDouble+", "+hourlyWageOverDouble1+", "+hourlyWageOverDouble2+", "+hourlyWageOverDouble3+", '"+Dob+"', '"+address+"', '"+sortCode+"', '"+accountNumber+"', '"+taxCode+"', '"+NICTable+"', '"+phoneNum+"', "+WMbasis+", '"+payPeriod+"', "+emp+")"; Statement statement = connection.createStatement(); statement.executeUpdate( query ); statement.close(); Connection connection2 = ConnectionPool2.getConnection(); String company = (String)session.getAttribute("company"); String query3 = "select uniq from perse3 where NIC like '"+two+"'"; Statement statement3 = connection.createStatement(); ResultSet resultSet = statement3.executeQuery( query3 ); resultSet.next(); int uneac = resultSet.getInt(1); statement3.close(); ConnectionPool2.returnConnection(connection2); String query2 = "INSERT INTO PerseWeekly (periodNum, NIC, TaxSofar, paySoFar, uniq)VALUES(" +threeInt+", '"+two+"', "+fourDouble+", "+paySoFarDouble+", '"+uneac+"')"; Statement statement2 = connection.createStatement(); statement2.executeUpdate( query2 ); statement2.close(); %>
<%--The form with button below returns the client to Employee Entry where a new employees data can be entered--%>
<%--The form with button below returns the client to the main menu where a new employee can be entered--%>