The Existing System For Payslip Generation
The purpose of the proposed project is to automate the Payslip generation process which replaces the traditional system of Payslip generation that used to print the employee salary details onto a paper.
This project includes a single user who is authorized to initiate the application. The privileges are given only to the individual in a department who is responsible for generating the PaySlips for the employees.
The application takes in the Excel Spreadsheet as input and generates an encrypted PDF PaySlip for each employee. This PDF PaySlip is mailed to the respective employee by using their mail-id which is provided in the Excel sheet.
This application generates PaySlips of each employee every month. The PaySlip spreadsheet is uploaded to the system. The application uses an excel parser to read this spreadsheet. The excel parser parses the excel sheet in a row-wise fashion and generates an xml string for each row. This xml string contains the salary data of each employee. The salary data is converted into a password-protected PDF document as per a pre-defined template. These salary statements (in PDF) are emailed to respective users. The email process is logged.
1.2 Existing System:
The existing System for PaySlip generation includes manual entry of the pay details of all the employees in an excel sheet and converting them to word document. Each row from the excel sheet is taken and then converted into the word document. This word document contains the Pay details of the employee. This document is printed on to a paper and then distributed to all the employees.
The Existing System requires manual effort in converting the excel sheet data into the word document. The word document which contains the salary details should be generated for all the employees which in turn delays the whole process of distributing the payslips. As the paper is used in distributing the payslips this even includes the wastage of paper. This is till the part of generation of pyslips itself. When talking about distribution each and every paslip has to be signed by the authority, stamped and then folded which is placed in the envelope.this has to be distributed to all the employee’s near the desk has to take an acknowledgement that the employee has received by signing on paper. If the employee is not at the desk or out of station then distribution has to be postponed for that employee till he is available. That is he can’t check it immediately after its been issued. Making it remotely accessible is also another aspect of it.
1.3 Proposed System:
The proposed System for generating the PaySlips is a Web based Automated System for generation and distribution of PaySlips.
Proposed System is efficient enough as it includes Less Manual effort. Manual effort is needed in only logging into the application and uploading the appropriate excel sheet into the application. Just a click on the upload button is sufficient, then the application itself will generate the payslips and distribute them to the respective employee’s mailid. Optimal performance of the application is achieved as delay is reduced in generation of Payslips with the existing system. Paper conservation is achieved, as the PaySlips are sent to the employees through mails, This makes the payslip remotely accessible
2.1 Functional Requirements
Modules:
Authentication/Authorization
Upload File
Excel Parser
PDF Generation
Module Description:
Authentication/Authorization Module:
This application is used to generate payslips of the employees for every month. Payslips, that depict all the salary details, is very confidential and hence this work should be carried out by an authorized person. For this purpose the user is presented with a login and is granted access to the application only after supplying a valid username and password. This needs database connectivity that stores all the details of the users who can use the application with their password.
This module is implemented using Struts. As this partitions the presentation and implementation the login UI is built using Java server pages. When the user submits the user name and password the servlet gets invoked handling the process that connects to the database, verifies and accordingly an action is taken that forwards to another UI.
Upload File:
This module uploads the Excel spread sheet into the application in which details of all the employees are present with the present month’s salary details. The details of the employee includes the name, empid, designation etc .The Excel spread sheet that is needed to be uploaded should be in a specified format i.e., all the details should be in the same chronological order according to the specifications. The uploaded spread sheet will not be saved any where as the data in the Excel sheet is very confidential.
This module is implemented using Struts. The File Upload UI is built using Java server pages. When the user uploads an Excel file a servlet gets invoked handling the process that directs an action.
Excel Parser:
This module takes the uploaded excel sheet as input and parses it in a row wise fashion, organizes the data in xml format For this a special software tool is used In this module we also retrieve the employee-id, mail-id and month for which the payslip is generated.
The software tool used for parsing the Excel document is POI. This needs a POI.jar added in the library where some predefined methods are defined. The POI consists of APIs for manipulating various file formats based upon Microsoft’s OLE 2 Compound Document format, and Office OpenXML format, using pure Java. In short, you can read and write MS Excel files using Java. In addition, you can read and write MS Word and MS PowerPoint files using Java. POI is your Java Excel solution (for Excel 97-2007).
However, we have a complete API for porting other OLE 2 Compound Document formats and welcome others to participate.
OLE 2 Compound Document Format based files include most Microsoft Office files such as XLS and DOC as well as MFC serialization API based file formats. Office OpenXML Format based files include the new (2007+) xml based file formats, including Microsoft office files such as XLSX, DOCX and PPTX.
PDF Generation:
This module creates a PDF file per employee based on pre-defined template and a randomly generated Password is used to encrypt the PDF file. This password is used by the employees to retrieve the PaySlips. The template is designed using XSL independently and values are taken from the Excel and filled into PDF using java. The PDF is encrypted using a random generated password and the password is attached to the mail. The encrypted PDF document is mailed to the employee.
The software tool used for generating a PDF document is XSL-FO. XSL-FO is a language for formatting XML data . XSL-FO stands for Extensible Stylesheet Language Formatting Objects . XSL-FO is a W3C Recommendation . XSL-FO is now formally named XSL . XSL-FO is an XML-based markup language describing the formatting of XML data for output to screen, paper or other media. Styling is both about transforming and formatting information. When the World Wide Web Consortium (W3C) made their first XSL Working Draft, it contained the language syntax for both transforming and formatting XML documents. Later, the XSL Working Group at W3C split the original draft into separate Recommendations. XSLT, a language for transforming XML documents . XSL or XSL-FO, a language for formatting XML documents. XPath, a language for navigating through elements and attributes in XML documents.
This is more advantageous because this seperates the presentation or template of the PDF and the implementation how the data is filled in.
Email Module:
This Module emails the Payslips (Password protected PDF files) to the respective employee by using their mail id. The mailing details are saved in a batch log with the time and date at which the mail is sent to the employee for verification. This module sets the mail attributes like the subject, from_address, to_address and message body. Also a partial random generated password is sent in the mails which need to be personalized by the employee. This module also inserts values into the email log with the details of mailing.
The Protocol used for mailing the PDF document to a particular employee is SMTP. The JavaMail API provides a platform-independent and protocol-independent framework to build mail and messaging applications.This is binded with Simple Mail Transfer Protocol for mailing.
2.2 Non-Functional Requirements
Accessibility
This application is easily accessible by the user who is authorized to use the system for generating PaySlips every month.
Performance
This system can generate PaySlips for any number of employees considering the same speed.
Reliability
This system is consistent and performs required functions under stated conditions.
Security
Unauthorized access to the system and its data is not allowed.
The person who wants to access the system is authenticated against a username and password. The PaySlip mailed to the employee is also password protected. This ensures unauthorized access of the PaySlip.
Usability
This system enhances usability by incorporating well structured user interfaces, end-user interactions, informative error messages etc.
2.3 System Requirement Specification:
Software Requirements:
Language: Java/J2EE
Operating system: Win 2000/XP or higher
Web Server: Apache Tomcat Server
Excel Parsers: POI(Poor Obfuscation Implementation)
PDF Generator Tools: XSL-FO(Extensible Style sheet Language-Formatting Object)
Back End: MySQL Database
Hardware Requirements:
Processor: P4 or higher
RAM: 1 GB or higher
Hard disk: 10 GB
3.1 Technical Architecture
A Technical Architecture breaks down operational (business) processes into functional components and capabilities. It describes the structure and behaviour of the technology infrastructure of an enterprise, solution or system.
The following diagram depicts functional components of the application.
Browser
Web Container
(Tomcat)
MySQL
PaySlip Generation System
The web container in detail handles the following operations as depicted in the following diagram
As the web container receives the request from the browser it invokes the parser functionality and does the excel parsing row-wise and generates an xml String. The string data is used in generating the PDF. These PDF’s which are generated are mailed to the respective employee’s by the mailer component. The entire email process is logged in a file.
Once the application is deployed in the server we can access it locally or from remote using public IP or giving some domain name to the application.
3.2 Software Architecture
Software architecture alludes to the overall structure of the software and the ways in which the structure provides conceptual integrity for a system. In the simplest form software architecture is the hierarchical structure of program components (modules), the manner in which these components interact and structure of data that are used by these components. The software architecture of a program or computing system is the structure or structures of the system, which comprise software components, the externally visible properties of those components, and the relationships between them.
4.1 Design Objectives:
Design is the first step in the development phase of a process or system in sufficient details to permit its physical realization.
Without design specifications, the design will be unguided.
It is difficult to know when the process is complete and to measure the progress.
Design is used to plan what information needs to be displayed and entered and how it relates to other information.
Design is the only way to translate the requirements into a finished system.
A well designed program will be easier to implement, distribute and maintain.
4.2 UML Diagrams
4.2.1 Usecase Diagram:
4.2.2 Class Diagram:
4.2.3 Sequence Diagram:
4.2.4 Collaboration Diagram:
4.2.5 Activity Diagram:
4.3 Data Flow Diagrams:
Level – 1
4.4 Database Design:
4.4.1 E-R Diagrams
4.4.2 Database Tables:
Database Tables:
5.1 Pseudo Code
Login Module
Login form:
public class LoginForm extends ActionForm
{
/**Declare two string variables that holds the username and password values entered in the form
Define getter and setter methods **/
}
Login Action:
public class LoginAction extends Action
{
Public ActionForward execute(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception
{
/**Create an object to the login form
Retrieve the username and password entered in the form and save in some variables
Create an object for the implementation and call the function validate() with the retrieved username and password as arguments
Savetoken()
Depending on its return value forward the action to success page or failure page**/
}
Login Interface:
public interface LoginDAO
{
/**Declare th method validate(string , string)**/
}
Interface Implementation:
public class LoginDAOimpl extends BaseDAO implements LoginDAO
{
Constructor()
{
}
Validate ()
{
/**Declare two string variables that holds the values of the username and password from he database
Get the connection to the database using the predefined method in java
Retrieve the username and password from the database using a SQL query(select)
Compare both username, password from form and database
Return a Boolean value according to the comparision**/
}
}
Login.jsp:
<%@ page contentType=”text/html;charset=UTF-8″ language=”java” %>
<%@ taglib uri=”/WEB-INF/struts-bean.tld” prefix=”bean” %>
<%@ taglib uri=”/WEB-INF/struts-html.tld” prefix=”html” %>
<%@ taglib uri=”/WEB-INF/struts-logic.tld” prefix=”logic” %>
<html:html>
<head>
<title>CTE Pay Slip Generation System – Employee Login</title>
<link href=”css/common.css” type=”text/css” rel=”stylesheet”>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
<link href=”css/styles.css” rel=”stylesheet” type=”text/css”>
<script language=”JavaScript” type=”text/JavaScript” src=”js/custom.js”></script>
<script>
function validateLogin(){
if(document.loginForm.username.value!=””&& document.loginForm.password.value!=””)
{
return true;
}
else
{
alert(“Please Enter UserName and Password.”);
return false;} }
</script>
</head>
<body leftmargin=”0″ topmargin=”0″ marginwidth=”0″ marginheight=”0″>
<form method=”POST” name=”loginForm” action=”login.do” onSubmit=”return validateLogin();”>
<table width=”100%” border=”0″ cellpadding=”0″ cellspacing=”0″ class=”MainTable100Percent”>
<tr>
<td height=”110″ valign=”top” >
<table width=”100%” height=”100%” border=”0″ cellpadding=”0″ cellspacing=”0″>
<tr>
<td class=”headerbg”><img src=”images/logo_sales_report1.gif”></td>
</tr>
</table>
</td>
</tr><tr>
<td class=”loginbg”>
<table width=”30%” border=”0″ align=”center” cellpadding=”0″ cellspacing=”0″ class=”tableborder” >
<tr>
<td height=”162″ valign=”top”>
<table width=”100%” height=”100%” border=”1″ cellpadding=”2″ cellspacing=”0″>
<tr>
<td class=”tablehead”>Login</td>
</tr><tr>
<td>
<table width=”100%” border=”0″ align=”center” cellpadding=”4″ cellspacing=”0″>
<tr>
<b><td width=”137″ align=”right” class=”text”><b>UserName :</b></td>
<td width=”244″><input type=”text” name=”username” class = “textfield”></td>
</tr>
<tr>
<td align=”right” class=”text”><b>Password :</b></td>
<td><input type=”password” name=”password” class = “textfield”></td>
</tr>
<tr>
<td align=”center” colspan = “2”><input type=”submit” name=”login” value = “Login” class = “Button”/></td>
</tr> <br>
</table>
</td>
</tr>
</table>
</table>
</td>
</tr>
<tr class=”footer”>
<td height=”20″>Copyright © 2009 Cambridge Technology Enterprises. All rights reserved.</td>
</tr>
</table>
</form>
</body>
</html:html>
Upload File Module:
Upload form:
public class UploadForm extends ActionForm
{
/**Define a variable file of type file
Also define the getter and setter methods **/
}
Upload Action:
public class StrutsUploadAction extends Action
{
public ActionForward execute
(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception
{
/** If the token is valid then
Create an object for upload form to retrieve parameters like contentType, fileName, fileSize.
Create an object to interface to all the method parseExcel(file)
Return success
Else
Return failure **/
Upload.jsp
<%@ page contentType=”text/html;charset=UTF-8″ pageEncoding=”utf-8″ language=”java” %>
<%@ page import=”org.apache.struts.action.Action”%>
<%@ page import=”org.apache.struts.taglib.html.Constants”%>
<%@ taglib uri=”struts-html” prefix=”html” %>
<%@ taglib uri=”/WEB-INF/struts-bean.tld” prefix=”bean” %>
<%@ taglib uri=”/WEB-INF/struts-logic.tld” prefix=”logic” %>
<html:html locale=”true”>
<head>
<title>CTE Pay Slip Generation System – Employee Login</title>
<link href=”css/common.css” type=”text/css” rel=”stylesheet”>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
<link href=”css/styles.css” rel=”stylesheet” type=”text/css”>
<script>
function isFileName()
{
var fileName = document.forms[0].theFile.value; // uploadform is the form name
if (fileName ==””)
{
alert(“Please select a file”);
return false;
}
Else
{
if(fileName.substr((fileName.length)-3,fileName.length) == “xls”)
{
document.forms[0].action = “FileUpload.do”;
document.forms[0].method = “post”;
document.forms[0].submit();
return true;}
Else
{
alert(“Please Upload an Excel file”);
return false;
}}}
</script>
</head>
<body leftmargin=”0″ topmargin=”0″ marginwidth=”0″ marginheight=”0″ >
<html:form method=”POST” action=”/FileUpload” enctype=”multipart/form-data” onsubmit=”return isFileName();”>
<table border=”0″ cellpadding=”0″ cellspacing=”0″ class=”MainTable100Percent”>
<tr>
<td height=”120″ valign=”top” >
<table width=”175%” border=”0″ cellpadding=”0″ cellspacing=”0″>
<tr>
<td class=”headerbg”><img src=”images/logo_sales_report1.gif”></td>
</tr></table></td></tr>
<tr>
<td class=”loginbg”>
<table width=”35%” border=”0″ align=”center” cellpadding=”0″ cellspacing=”0″ class=”tableborder” >
<tr>
<td height=”162″ valign=”top”>
<table width=”100%” height=”100%” border=”1″ cellpadding=”2″ cellspacing=”0″>
<tr>
<td class=”tablehead”>File Upload</td>
<input type=”hidden” name=”<%= Constants.TOKEN_KEY %>” value=”<%= session.getAttribute(Action.TRANSACTION_TOKEN_KEY) %>” >
</tr>
<tr>
<td>
<table width=”100%” border=”0″ align=”center” cellpadding=”4″ cellspacing=”1″>
<tr>
<b><td width=”100″ align=”right” class=”text”><b>Select File</b></td>
<td width=”250″>
<html:file property=”theFile”/>
</td>
</tr>
<td align=”center” colspan = “2”><input type=”submit” name=”FileUpload” value = “Upload File” class = “Button”/></td>
</tr>
<br>
</table>
</td>
</tr>
</table>
</table>
</td>
</tr>
<tr class=”footer” width=”100″>
<td height=”20″>Copyright © 2009 Cambridge Technology Enterprises. All rights reserved.</td>
</tr>
</table>
</html:form>
</body>
</html:html>
Upload interface:
public interface PaySlipDAO {
declare a method parseExcel()
}
/**Upload interface implementation(Excel Working and PDF Generation Modules **/
)
public class PaySlipDAOImpl extends BaseDAO implements PaySlipDAO
{
Constructor()
{
}
public String parseExcel(String fileName) throws Exception
{
Define a String array str[]={“sno”,”month”,”NoofDays”,”empid”,”empname”,”desg”,”Basic”,”HRA”,……}
That defines the sequence in which Excel file should be in.
/**Define a string variable that holds the root tag <pay> declare an input stream and initialize it to null now define a new input stream and initialize it to file (Excel file)
initialize POIFSFileSystem to inputstream define a new HSSFworkbook
get the sheet count get the sheet with count zero
iterate the rows if the sheet has rows then
iterate the cells from that retrieve the 4th,2nd and 21st cell values.
4-mployeeid 2-month 21-Email id
For every cell value append the opening tag using the string array**/
/**According to the cell value get the value
Like
Numeric
Formula
String
After adding the value append the closing tag
Like wise iterate till all the cells are completed
At the end append the closing root tag
With this we are ready with our xml string.
Using this xml string as the argument make the call to the generatPDF()
Return empid’s of employees for whom the mail is sent and to whom the mail is not sent with a # appended in between.**/
}
PDF Generation Module:
public int genPDF( HSSFCell empid,
HSSFCell mailid,
HSSFCell monthyear,
String xmlStr )
/**Set the path of the base directory to the current directory
Define a file in which we save the xslt file that is used in designing the payslip
Also define a PDF file with parameters like where to save(current directory),with what name(employee-id) and with what extension(.pdf)
Create new instances for fop factory and fo user agent
Get the random generated password which is of six characters length
Now define two random numbers and retrieve th characters at that ndex in the employee id
Append these two characters to the random generated password
Encrypt the pdf using method PDFEncryptionParams() and set the Boolean parameters like allow print, allowCopyContent, allowEditContent, allowEditAnnotations and also the keys to encrypt
configure foUserAgent as desired.
Setup output.
Construct fop with desired output format
Setup XSLT
Setup input for XSLT transformation
Resulting SAX events (the generated FO) must be piped through to FOP
Start XSLT transformation and FOP processing**/
/**Call the sendmail method by creating its object
Save the returnvalue in a variable
If that is equal to one then save that email id as sentmailid and append all other of this kind in the Excel sheet to this**/
/**If that’s is equal to zero save that email id as failedmailid and append all others of this kind in the Excel sheet to this
After mail is sent save that in the log using the user defined method
insertIntoEmailLog (mailid, monthYear,status)**/ }
private void insertIntoEmailLog(HSSFCell mailid, String monthYear, int status)
{
/**Get the data base connection
Insert into table the values of status,month nd the mailed**/
}
public static String getPassword(int n)
{
/**Generate n random characters may it be alphabets(upper and lower),numbers and symbols
Return a string of length n characters**/
}
MailService Module:
public class MailService
{
MailService ();
{
}
/**Define the host, transport_protocol, authentication needed, debugging needed etc.**/
public int sendMail(String empId,String monthYear,String emailid,byte[] pdfBytes,String randompwd,int randomposition1,int randomposition2)
{
/**Set the parameters like frommail, tomail, subject, messagetext, content type etc
Define a new mail session
Declare a new MIMEmessage() for this mail session
set the source to PDF bytes
send that message as mail to the tomailid**/
}
}
Failure.jsp
<%@ page contentType=”text/html;charset=UTF-8″ pageEncoding=”utf-8″ language=”java” %>
<%@ taglib uri=”struts-html” prefix=”html” %>
<%@ taglib uri=”/WEB-INF/struts-bean.tld” prefix=”bean” %>
<%@ taglib uri=”/WEB-INF/struts-logic.tld” prefix=”logic” %>
<html:html locale=”true”>
<head>
<title>CTE Pay Slip Generation System – Employee Login</title>
<link href=”css/common.css” type=”text/css” rel=”stylesheet”>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
<link href=”css/styles.css” rel=”stylesheet” type=”text/css”>
</head>
<%
response.setHeader(“Cache-Control”,”no-cache”); //HTTP 1.1
response.setHeader(“Pragma”,”no-cache”); //HTTP 1.0
response.setDateHeader (“Expires”, 0); //prevents caching at the proxy server
response.setHeader(“Cache-Control”,”no-store”); //HTTP 1.1
%>
<body leftmargin=”0″ topmargin=”0″ marginwidth=”0″ marginheight=”0″>
<html:form method=”POST” action=”/FileUpload” >
<table border=”0″ cellpadding=”0″ cellspacing=”0″ class=”MainTable100Percent”>
<tr>
<td height=”110″ valign=”top” >
<table width=”175%” border=”0″ cellpadding=”0″ cellspacing=”0″>
<tr>
<td class=”headerbg”><img src=”images/logo_sales_report1.gif”></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<p align=”center”><font size=”6″ color=”#000080″>Invalid username or password Please</font> </p>
<p align=”center”><font size=”6″> <a href=’login.jsp’> Try Again </a></font></p>
</td>
</tr>
<tr class=”footer” width=”100″>
<td height=”20″>Copyright © 2009 Cambridge Technology Enterprises. All rights reserved.</td>
</tr>
</table>
<body>
</html:form>
</html:html>
Uploadsuccess.jsp
<%@ page contentType=”text/html;charset=UTF-8″ pageEncoding=”utf-8″ language=”java” %>
<%@ taglib uri=”struts-html” prefix=”html” %>
<%@ taglib uri=”/WEB-INF/struts-bean.tld” prefix=”bean” %>
<%@ taglib uri=”/WEB-INF/struts-logic.tld” prefix=”logic” %>
<html:html locale=”true”>
<head>
<title>CTE Pay Slip Generation System – Employee Login</title>
<link href=”css/common.css” type=”text/css” rel=”stylesheet”>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
<link href=”css/styles.css” rel=”stylesheet” type=”text/css”>
</head>
<%
response.setHeader(“Cache-Control”,”no-cache”); //HTTP 1.1
response.setHeader(“Pragma”,”no-cache”); //HTTP 1.0
response.setDateHeader (“Expires”, 0); //prevents caching at the proxy server
response.setHeader(“Cache-Control”,”no-store”); //HTTP 1.1
%>
<body leftmargin=”0″ topmargin=”0″ marginwidth=”0″ marginheight=”0″>
<html:form method=”POST” action=”/FileUpload” >
<table border=”0″ cellpadding=”0″ cellspacing=”0″ class=”MainTable100Percent”>
<tr>
<td height=”110″ valign=”top” >
<table width=”175%” border=”0″ cellpadding=”0″ cellspacing=”0″>
<tr>
<td class=”headerbg”><img src=”images/logo_sales_report1.gif”></td>
</tr>
</table>
</td>
</tr>
<tr height=”10%”>
<td>
<p align=”center”><font size=”6″ color=”#000080″>File Successfully Uploaded</font></p>
</td>
</tr>
<tr>
<td valign=”center”>
<table align=”center” width=”50%” height=”50%” border=”1″ cellpadding=”2″ cellspacing=”2″>
<tr>
<td class=”tablehead”>EMail sent to: </td></tr>
<%
String maildata = (String)request.getAttribute(“emailEmpId”);
int splitCount= maildata.indexOf(“#”);
String sentEmailIds=maildata.substring(0,splitCount);
String failedEmailIds=maildata.substring(splitCount+1,maildata.length());
%>
<tr>
<td valign=”top” > <%=sentEmailIds%> </td>
</tr>
<tr>
<td class=”tablehead”>EMail failed to: </td>
</tr>
<tr>
<td valign=”top”><%=failedEmailIds%></td>
</tr>
<tr><td></td>
</tr></table>
</td></tr>
<tr>
<td>
<p align=”center”><font size=”4″><a href=’login.jsp’>Login to upload another file</a></font></p>
</td>
</tr>
<tr class=”footer” width=”100″>
<td height=”20″>Copyright © 2009 Cambridge Technology Enterprises. All rights reserved.</td>
</tr>
</table>
</body>
</html:form>
</html:html
Already uploaded.jsp
<%@ page contentType=”text/html;charset=UTF-8″ pageEncoding=”utf-8″ language=”java” %>
<%@ taglib uri=”struts-html” prefix=”html” %>
<%@ taglib uri=”/WEB-INF/struts-bean.tld” prefix=”bean” %>
<%@ taglib uri=”/WEB-INF/struts-logic.tld” prefix=”logic” %>
<html:html locale=”true”>
<head>
<title>CTE Pay Slip Generation System – Employee Login</title>
<link href=”css/common.css” type=”text/css” rel=”stylesheet”>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
<link href=”css/styles.css” rel=”stylesheet” type=”text/css”>
</head>
<%
response.setHeader(“Cache-Control”,”no-cache”); //HTTP 1.1
response.setHeader(“Pragma”,”no-cache”); //HTTP 1.0
response.setDateHeader (“Expires”, 0); //prevents caching at the proxy server
response.setHeader(“Cache-Control”,”no-store”); //HTTP 1.1
%>
<body leftmargin=”0″ topmargin=”0″ marginwidth=”0″ marginheight=”0″>
<html:form method=”POST” action=”/FileUpload” >
<table border=”0″ cellpadding=”0″ cellspacing=”0″ class=”MainTable100Percent”>
<tr>
<td height=”110″ valign=”top” >
<table width=”175%” border=”0″ cellpadding=”0″ cellspacing=”0″>
<tr>
<td class=”headerbg”><img src=”images/logo_sales_report1.gif”></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<p align=”center”><font size=”6″ color=”#000080″>Fil already uploaded </font> </p>
<p align=”center”><font size=”6″> <a href=’login.jsp’> To Relogin click here</a></font></p>
</td>
</tr>
<tr class=”footer” width=”100″>
<td height=”20″>Copyright © 2009 Cambridge Technology Enterprises. All rights reserved.
</td>
</tr>
</table>
</body>
</html:form>
</html:html
Web.xml
<?xml>
<web-app>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<load-on-startup>0</load-on-startup>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<taglib>
<taglib-uri>struts-bean</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
And define some more tag libs that are used
After that specify the wlcome page
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
And also define any predefined errors and session time
</webapp>
Struts-config.xml
<?xml version=”1.0″ encoding=”ISO-8859-1″?>
<struts-config>
Define a formbean for login and upload file
<action-mappings>
Define the action path for login
<forward name=”success” path=”/FileUpload.jsp”/>
<forward name=”failure” path=”/failure.jsp”/>
</action>
Define the action path for upload file
<forward name=”success” path=”/uploadsuccess.jsp”/>
<forward name=”alreadyUploaded” path=”/alreadyupload.jsp”/>
</action>
</action-mappings>
</struts-config>
Payslipmap.xsl
Program for the formatting of the PDF that is generated
This program is written using xsl-fo
<?xml version=”1.0″ encoding=”UTF-8″?>
<xsl:stylesheet version=”1.0″ xmlns:xsl=”http://www.w3.org/1999/XSL/Transform” xmlns:fo=”http://www.w3.org/1999/XSL/Format”>
<xsl:decimal-format name=”amdformat” NaN=”” infinity=””/>
<xsl:output method=”xml” version=”1.0″ omit-xml-declaration=”no” indent=”yes”/>
<xsl:template match=”/”>
<fo:root xmlns:fo=’http://www.w3.org/1999/XSL/Format’ xmlns:xlink=’http://www.w3.org/1999/xlink’>
<fo:layout-master-set> //tag which defines the page layout
<fo:simple-page-master>
//It has the attributes that define page width,height and region body of the page.
<fo:region-body> //This tag has the attribute to define the watermark image.The attribute is background-image=”url(‘url is specified here’)”
background-repeat = “no-repeat” background-position-horizontal=”center” background-position-vertical=”center”
//These are the attributes defined to specify the watermark image.
…
</fo:simple-page-master>
</ layout-master-set>
<fo:page-sequence master-reference=’LTR’ initial-page-number=’1′>
<fo:static-content flow-name=’xsl-region-before’>
//static content is displayed before the xsl-region
<fo:block>
<fo:external-graphic src=……>
//This tag is used to display an image before the xsl region body.
</ fo:external-graphic>
</fo:block>
</fo:static-content>
<fo:flow flow-name=’xsl-region-body’> //The body should be defined in the flow taq.
//This tag is used to define the region body.
<fo:block>
<fo:table ……………………………………………………>
//This tag is used to define the table in xsl-fo.It has the attributes that define the table column width and the layout of the table.
<fo:table-body>
// table body is defined here.
<fo:table-row line-height=’20pt’ >
<fo:table-cell>
//This tag has the attributes like the padding and the border styles to specify how the content of the cell should be.
The static content of the cell should be given in <fo:block> tag.
</fo:table-cell>
Any number of rows can be defined and any number of cells can be fined by using the <fo:table-row> and <fo:table-cell> tags.
Static content in the cells can be given in the <fo:block> tag and the dynamic content of the pay details can be brought from the excel sheet by using the following tag
<xsl:value-of select =”value to be retrieved”>
</fo:block>
The <fo:block> tag has the attributes like text-align,font-family, font-size, space-after.
</fo:flow></fo:page-sequence></fo:root></xsl:template></xsl:stylesheet>
6.1 Purpose of Testing
The purpose of testing is to assess product quality. It helps to strengthen and stabilize the architecture early in the development cycle. We can verify through testing, the various interactions, integration of components and the requirements which were implemented. It provides timely feedback to resolve the quality issues, in a timely and cost effective manner. The test workflow involves the following:
Verifying the interactions of components.
Verifying the proper integration of components.
Verifying that all requirements have been implemented correctly.
Identifying and ensuring that all discovered defects are addressed before the software is deployed.
6.1.2 Quality
The common usage of the term quality refers to a number of things: principally it means the absence of defects, but more importantly, a fitness for a desired purpose. The ultimate goal of testing is to assess the quality of the end product. Quality assessments often consider process quality and organizational factors as well as direct product quality.
6.1.3 Product quality
The role of testing is not to assure quality, but to assess it, and to provide timely feedback so that quality issues can be resolved in a timely and cost-effective manner.
6.1.4 Testing in the iterative lifecycle
Testing is not a single activity, nor is it a phase in the project during which we assess quality. If developers are to obtain timely feedback on evolving product quality, testing must occur throughout the lifecycle: we can test the broad functionality of early prototypes: we can test the stability, coverage and performance of the architecture while there is still an opportunity to fix it; and we can test the final product to assess its readiness for delivery to customers.
6.1.5 Dimensions of testing
To assess product quality, different kinds of tests, each one with a different focus, are needed. These tests can be categorized by several dimensions:
Quality dimension: The major quality characteristic or attribute that is the focus of test.
Stage of testing: The point in the lifecycle at which the test, usually limited to a single quality dimension.
Type of testing: The specific test objective for an individual test, usually limited to a single quality dimension.
6.1.6 Stages of testing
Testing is not a single activity, executed all at once. Testing is executed against different types of targets in different stages of the software development. Test stages progress from testing small elements of the system, such as components (unit testing), to testing completed systems (system testing). The four stages have the following purposes:
Unit test: The smallest testable elements of the system are tested individually; typically at the same time those elements are implemented.
Integration test: The integrated units (or components or subsystems) are tested.
System test: the complete application and system (one or more applications) are tested.
Acceptance test: The complete application (or system) is tested by end users (or representatives) for the purpose of determining readiness for deployment.
These stages occur throughout the lifecycle, with varying emphasis. An early conceptual prototype user in the inception phase to assess the viability of the product vision will be subjected to acceptance tests. Architectural prototype developed during the elaboration phase be subjected to integration and system tests to validate architectural integrity and performance of key architectural elements.
6.2 Test cases:
Module: Authentication/Authorization
Test case
Input
Expected Output
Actual Output
Description
Status(Pass/Fail)
Verifying Login
Valid Username and Password
User is able to access and Login into the application
Valid User is able to Login into the application
Checking that user with proper privileges is able to access and log in into the application
Pass
Verifying invalid Login
Invalid Username and Password
User is not able to access and log in into the application.
User is not able to access and log in into the application.
Checking that user with improper privileges is not able to access and log in into the application
Pass
Redirect to Login page incase of invalid Login
Invalid username and password
Link to the Login page should be given in case of invalid Login
Link to the Login page incase of invalid Login
Checking that the user is redirected to the login page incase of invalid login
Pass
Login
A click on Login button without entering username and Password
Proper alerts should be displayed if no username and password is entered.
Proper alerts are displayed if no username and password is entered.
Checking that the user is alerted with proper messages if no username and password is entered.
Pass
After valid Login
Valid username and Password
User is directed to the File Upload screen after a valid Login
User is directed to the File Upload screen after a valid Login
Checking that user is directed to File upload screen after valid user logged in into the application
Pass
Module: File Upload
Test case
Input
Expected output
Actual Output
Description
Status(Pass/Fail)
Verify that user needs to enter a file to upload
No file is entered to upload
Proper alert messages should be displayed if a user doesn’t enter any file to upload
Proper alert messages should be displayed if a user doesn’t enter any file to upload
Checking that the user is alerted if he doesn’t enter any file to upload.
Pass
Verify that user cannot upload any non excel file into the application
Browse and select any non excel file to upload.
Proper alert messages should be displayed if user selects a non excel file to upload
Proper alert messages should be displayed if user selects a non excel file to upload
Checking that if user uploads any non excel file into the application an appropriate error message is displayed
Pass
Verify that the user is directed to the success screen after clicking on upload
Valid excel file should be entered to upload
User is directed to the success screen after clicking on upload
User is directed to the success screen after clicking on upload
Checking that the success screen is displayed after the file upload.
Pass
Module: Excel Parsing and PDF generation
Test case
Input
Expected output
Actual Output
Description
Status(Pass/Fail)
Verify that a random password is generated to lock the PDF.
Generate a password to encrypt the PDF
A Password
needs to be generated to encrypt and decrypt the PDF
A Password needs
to be generated to encrypt and decrypt the PDF
A password should be randomly generated to lock the PDF. This password should be mailed to the employee.
Pass
Verify that
the PDF
(payslip)
mailed to
the
employee is
Encrypted.
PDF mailed to the
Employee.
A password should be entered to open the PDF.
A password should be entered to open the PDF.
PDF is encrypted with the random generated password.
Pass
Module: E-mail
Test case
Input
Expected output
Actual output
Description
Status
Verify that the screen displays empid’s of employees.
Excel file that is uploaded
Empid’s of employees for whom mail is sent is displayed
Empid’s of
Employees for whom mail is sent is displayed
Screen displays empid’s who successfully received the mail.
Pass
Verify empid’s are displayed for whom sending mail has been failed.
Excel file that is uploaded
Empid’s of employees for whom mail has not been sent is displayed.
Empid’s of employees for whom mail has not been sent is displayed.
Screen displays empid’s who successfully received the mail.
Pass
Verify that the user is directed to the login page when he refreshes the success page
Refresh the success page
User directed to the login page when the page is refreshed
User directed to the login page when the page is refreshed
User is displayed with proper message and directed to login page when refreshed
Pass
7.1 Reports
Screen for building a war file:
Screen for Login:
An alert is displayed on the screen to the user if no username or password is entered.
The user gets into the following screen if a wrong username or password is entered. A reference to the Login page is provided to the user.
Screen for File Upload:
Refreshing the above page will direct the user to the below screen.
Screen to open the PDF:
Screen which provides the log information:
Having this application implemented in the company reduced their manual effort in generating and distributing the payslips to their employees.
The aim of the project is automating the generation of the payslips.The payslips are generated in a PDF format for all the employees and are successfully mailed to the respective employees by using their mailid.
The PDF’s are generated and mailed to all the employee’s whose pay details are specified in the excel sheet
The Future scope of the project is to automate the process of generating and distributing the payslips for the employees for whom the mail has been failed because of some network problems or others.
We upload an Excel file in to the application but the Excel file is not password protected. The data in the Excel file is very confidential; to avoid access and misuse to the Excel file the application should take a password protected Excel file and generate payslips.
The Excel file is restricted to a specified format if the Excel changes then the application may not process it properly. The future scope will be to provide the flexibility to the Excel file
Calvin Austin and Monica pawlan, Advanced Programming for the Java 2 Platform, Addison Wesley Longman publication,2000
Patrick Naughton and Herbert Schildt , The Complete Reference JAVA 2.0, Tata McGraw-Hill Publication,1999.
Bryan Pfaffenberger, Bill Karow, Chuck White, Steven M. Schafer, The Complete Reference Tata McGraw-Hill Publication,1998
Brown,Sam Dalton,Daniel Jepp,Dave, JSP, WROX Publications , 1999
Java Server Pages- O’Rielly Publications.
www.java.sun.com
www.w3schools.com
www.theserverside.com
www.javatutoorial.com
www.apache.org
www.javaworld.com
www.tutorial.deforum.com
www.javabeat.com
www.javaranch.com
www.laliluna.com
Order Now