rohit project report 5.doc

83
PAYROLL MANAGEMENT SYSTEM Project / Training Report Submitted in partial fulfillment of the requirements for the award of the Degree of Bachelor of Technology in Electronics and Communication by (Vaibhav Sharma) (MRT11UGBEC065) Faculty of Electronics, Informatics and Computer Engineering III

Upload: gsrawat123

Post on 06-Nov-2015

250 views

Category:

Documents


0 download

TRANSCRIPT

Guide Certificate

PAYROLL MANAGEMENT SYSTEM

Project / Training Report

Submitted in partial fulfillment of the requirements for the award of the Degree

of

Bachelor of Technologyin

Electronics and Communication

by

(Vaibhav Sharma)

(MRT11UGBEC065)

Faculty of Electronics, Informatics and Computer EngineeringSHOBHIT UNIVERSITY, MEERUTMay/June 2015 PAYROLL MANAGEMENT SYSTEM

Project / Training Report

Submitted in partial fulfillment of the requirements for the award of the Degreeof

Bachelor of TechnologyinElectronics and Communicationby

(Rohit Kumar)(MRT11UGBEC072)

Faculty of Electronics, Informatics and Computer EngineeringSHOBHIT UNIVERSITY, MEERUTMay/June 2015Certificate

This is to certify that the work presented in this project report has been carried out at Payroll Management System under the supervision of Mr. Lalit Kumar Sharma by me during the period from 03/01/2015 to 6/05/2015.The above work has not been submitted by any one for the award of any Degree/Diploma in any other institution

Date:

SignatureName of the StudentThis is to certify that the above statement given by the students is true to the best of my knowledge.Date:

Signature

Name of the Mentor

ACKNOWLEDGEMENTSThe satisfaction that accompanies that the successful completion of any task would be incomplete without the mention of people whose ceaseless cooperation made it possible, whose constant guidance and encouragement crown all efforts with success. We are grateful to our project guide Mr. Gyan Sir for the guidance, inspiration and constructive suggestions that helpful us in the preparation of this project.

In Five Month Industrial Training in Hind Soft Technology Pvt. Ltd. Company Meerut Mall,Delhi Road, Meerut-250002. In Hind Soft Company, I am work as a trainee software developer and work on the project at payroll management system. The entire Project from the very Idea of it to the reality would not have been possible without the guidance and support of many People. I would like to thank of supervisor and committee who provide this Project and believe the I am able to complete this project. I would like to take this opportunity of experiencing my sincere and profound gratitude to all those people who helped me throughout the Project.

I am also thankful to Mr.Lalit Kumar Sharma Managing Director of Company and all the employees of Hind Soft Technology Pvt. Ltd.. Company . With whom I interacted during my training as a Trainee Software Developer and gained many valuable inputs and learning.I would like to express my Sincere gratitude to Gyan Sir for giving me an invaluable opportunity to start my Project without whose guidance this project would not have seen the light of the day. Gyan Sir support me on the project from beginning to end

Without the support of helpful fellow who support me a lot. I want to give special thanks to Hind Soft Technology Pvt. Ltd. who Provide me industry environment in the working environment as a trainee.TABLE OF CONTENTS

Contents

Page No.

1. INTRODUCTION

1

1.1 Defination of Problem

5 1.2 Terminology Defination 6 1.3 Defination of Project Objective 61.4 Project Deliverables

7

2. EXISTING SYSTEM

82.1 Introduction

82.2 Existing Software

92.3 DFD for present system

11

2.3.1 Whats new in the system to be developed

11

3. PROBLEM ANALYSIS

123.1 Product defination

12

3.2 Feasibility Analysis

12

3.3 Project Plan 134. SOFTWARE REQUIREMENT SYSTEM 14 4.1 Introduction 14 4.2 General Description 14 4.3 Specific Requirements 145.DESIGN 15 4.1 System Design 15 4.2 Design Notations 15 4.3 Details Design 16 4.4 Flowchart

16 4.5 Coding 23 4.6 Snapshot 565. CONCLUDING CHAPTER

60 5.1 Summary 60 5.2 Overview and Interpretation of Results Attained

60

5.3 Recommendations on Future Improvement 60BibliographyAnnexure

CHAPTER 1 INTRODUCTION1.1 DEFINATION OF PROBLEM Payroll is defined as a method of administrating employees salaries in the organizations.

The process consists of calculation of salaries and tax deductions of the employees, administrating the retirement benefits and disbursements of salaries to employees. It can also be called as an accounts activity which undertakes the salary administration of employees in the organization.

Administrating the employees salaries is not an easy task, the HR and accounts department work together to calculate and disburse the salary to the employees. Thus, payroll management can be further subdivided into two sub processes, i.e. Payroll accounting and payroll administration.

There are mainly 2 modules in this software

Administrator Module

Employee Module

In XP, the user story serves the purpose of the problem statement and the specifications. The user

story provided by the client was as follows:

You are to design and implement a payroll system that should accept employee hours

worked, compute net pay and record all the payroll data for subsequent processing. The

system should prepare pay cheques and a payroll ledger, and maintain data on a sequential

payroll file. Non-statutory deductions such as union dues and pension plans to be made.

The payroll data are employee number, employee name, pay rate, and union member flag.

The year-to-date total should contain earnings, federal tax, pension plan, and union dues

To accomplish these tasks, we had to meet with the client to find out exactly what the program is

meant to do. Here are the sub stories that we were able to get from the client:

The program accepts employee hours worked

The program computes net pay

The program record all the payroll data for subsequent processing

The program should prepare pay cheques

The program should prepare a payroll ledger

The program should maintain data on a sequential payroll file

Non-statutory deductions such as union dues and pension plans to be made

Year-to-date total should contain earnings, federal tax, pension plan, and union dues Payroll data are employee number, employee name, pay rate, and union member flag1.2 TERMINOLOGY DEFINATION This section gives a definition and explanation of some of the terms used in the project:

Employee Data: This is the employee's information in the company. It consists of the employee

identification number, employee name, pay rate, pension plan flag, and union member flag.

Payroll Records: The payroll records are used to store each months hours worked, and the rates for that month.

Rates: Rates consists of the percentage that would be deducted from the gross pay depending on

union membership status, pension plan, state and federal tax. Each employee can have a unique

hourly rate.

Payroll Ledger: This is a table that shows the calculated pay of employees and the month in which they earned the pay. The ledger can be filtered by name, identification number, year and month.

Hours Worked: This is the number of times that an employee work in a month. The hours worked is used to calculate the pay that an employee will receive for that month.

Net Pay: The net pay is the final salary amount that would be given to the employee after all the

deductions are subtracted from the gross pay. The deductions include among others taxes, union

member dues and pension plan.

Gross Pay: The gross pay is the amount that the employee earns before the deductions are

subtracted.

Deductions: Deductions are made up of taxes, union membership dues, pension plan. They are

subtracted from the gross pay to give the net pay which is the employee's final pay for the month.

Taxes: The taxes consists of the state dues and federal dues. A percentage of the employee's salary goes to state and country.

Union Membership Dues: This is meant for employee's that are union workers in the company.

They get to pay a percentage for union dues. An employee can be a union member and later change status to be a non-union member.

Pension Plan: Employees that opted to use the pension plan of the company get to pay a particular percentage of their pay in preparation for their retirement.

Payslip: These are similar to pay cheques. They allow the employee to have his or her pay printed out on paper so that they can cash it.

Year-To-Date Total: The year-to-date total is the summation of all the previous earnings till the

month before the current month.

1.3 DEFINATION OF PROJECT OBJECTIVES The purpose of this project is to put into practice what we have learnt so far in our software engineering class. We spent most of the semester studying extreme programming. With extreme programming, the client knows how far he or her software is coming and knows what to except at one particular time or the other. The software is built exactly the way the client wants it to be built. Employees are the backbone of any company; their management pays a major role in deciding the success of the organization. Employee information management helps in deciding the future management needs and any changes that has to be made for greater productivity. It keeps the records of the functions performed by the individual employee playing a vital role at the time of performance appraisal. Employee management software can carry out many functions like employee data analysis, employee monitoring, centralized employee database, management of the time sheet, etc.

The usage of payroll management system would ultimately reduce the overallmanagement costs thus ensuring greater profits and reduced burdens. The system is veryeasy to use and can adjust into any business frame.1.4 PROJECT DELIVERABLES

We met with our client on a few occasions to show our progress so far. In the long run, showing the client part of the finished product in stages helped. There were a few things he brought to our

understanding and we were able to change those things. If we had waited till we finished the coding, we would have found it really difficult to correct the errors we found in such a short time. The graphical user interface was acceptable to the client at this stage even though he thought we could improve on it with a little more time. From our project deliverables, the client was able to bring to our understanding that the employees should have different pay rates and that it would be safe (for record purposes) to calculate the employee's year-to-data total salary earnings. These observations were later incorporated into the final deliverable. CHAPTER 2

EXISTING SYSTEM2.1 INTRODUCTION

Presently salary calculation is done manually, it take so much of time to compose salary of all employees. It also takes very long time to make salary slip ready. Due to manual process some time it takes very long time, in turn it delays the salary distribution. This is a big problem to manage when salary is not generated in time. The other main problem is errors, even with double cross check here or there some errors will happen, this again create large proble.Payroll Management system is to provide an option to generate the salary automatically

every month. This software also equipped with to enter the attendance of each employee in

the organization, it help them to track each employee attendance, based on this we can

generate the salary. The software built to generate individual pay slip and summary of the

payroll. It also has option to generate the report for Provident Fund and ESI. So they can

take the print out of Provident Fund and ESI to submit to the department.

In a company payroll is the sum of all financial records of salaries for an employee, wages, bonuses and deductions. In accounting, payroll refers to the amount paid to employees for services they provided during a certain period of time. Payroll plays a major role in a company for several reasons. From an accounting perspective, payroll is crucial because payroll and payroll taxes considerably affect the net income of most companies and they are subject to laws and regulations (e.g. in the US payroll is subject to federal, state and local regulations). From an ethics in business viewpoint payroll is a critical department as employees are responsive to payroll errors and irregularities: good employee morale requires payroll to be paid timely and accurately.

The primary mission of the payroll department is to ensure that all employees are paid accurately and timely with the correct withholdings and deductions, and to ensure the withholdings and deductions are remitted in a timely manner. This includes salary payments, tax withholdings, and deductions from a paycheck. Industry employs full-time and casual (contractual) academics. Employees in the Personnel Department will use the system to maintain employee information, manageleave, and make payments to the academics every fortnight. The Payroll system can add new employees and delete employees. It can manage annual and long-service leave as well as record any sick leave. The system must pay each academic the correct amount, on time, and by the payment method requested by an academic. Employees in the Personnel Department will access system via a Windows based desktop interface.

However, the system will also provide a web-based access (called Academic Kiosk)to full-time academics to view their payment details, leave balances, and personal information. Some of this information, such as personal details and payment method, can be updated by academics using the web-based interface.

The Payroll system verifies if the total hours worked so far do not exceed the number of hours agreed in the contract. The contract information is maintained by another system called Contracts Management, however the Payroll system stores basic information about contracts, in particular hourly rate for each contract. The industry deducts standard taxrates from payments made to full-time academics.Casual academics can request receiving payment notifications by mail or by email. Fulltime academics employees do not receive payment notifications but they can use.

Academic Kiosk to query the system about fortnightly payments, total salaries received year-to-date, tax and other deductions, leave balances, etc. As mentioned, Academic Kiosk can be used to modify personal details and payment method. The academics can choose the payment method. The payments can be mailed (as bank cheques) to academics to the postal address of their choice. Alternatively, the payments can be directly deposited into an academics bank account.

2.2 EXISTING SOFTWARE FRONT END: JAVA

BACK END: XAMPP

2.2.1 Java:Java is an object-oriented language similar to C++, but simplified to eliminate language features that cause common programming errors. Java source code files (files with a .java extension) are compiled into a format called byte code (files with a .class extension), which can then be executed by a Java interpreter. Compiled Java code can run on most computers because Java interpreters and runtime environments, known as Java Virtual Machines (VMs), exist for most operating systems, including UNIX, the Macintosh OS, and Windows. Byte code can also be converted directly into machine language instructions by a just-in-time compiler (JIT).

Java is a general purpose programming language with a number of features that make the language well suited for use on the World Wide Web. Small Java applications are called Java applets and can be downloaded from a Web server and run on your computer by a Java-compatible Web browser, such as Netscape Navigator or Microsoft Internet Explorer

2.2.1 Xampp Xampp is known for its ability to empower non-professional developers to create database applications on their own. Users can easily create tables, queries, forms and reports, and connect them together with macros. Advanced users can use VBA to write rich solutions with advanced data manipulation and user control.

Advantages of XamppEasy to use and easy to deployment.

Integration with Windows OS

Scalability

Import and Export of data in all major database system.

Centralized Management

Reliability

Automating Tasks

ADO compatibility especially with ASP scripting.

2.3 DFD FOR PRESENT SYSTEM :

Fig. 2.3.1 DFD for Present System.2.3.1 Whats new in the system to be developed ? It is efficient in working. It is fast in processing. Automated tedious task. Each user has unique account information. CHAPTER 3

PROBLEM ANALYSIS3.1 PRODUCT DEFINATION Industry employs full-time and casual (contractual) academics. Employees in the Personnel Department will use the system to maintain employee information, manage leave, and make payments to the academics every fortnight.

The Payroll system can add new employees and delete employees. It can manage annual and long-service leave as well as record any sick leave. The system must pay each academic the correct amount, on time, and by the payment method requested by an academic.

Employees in the Personnel Department will access system via a Windows-based desktop interface.However, the system will also provide a web-based access (called Academic Kiosk)to full-time academics to view their payment details, leave balances, and personal information. Some of this information, such as personal details and payment method, can be updated by academics using the web-based interface.

.3.2 FEASIBILITY ANALYSIS3.2.1 Technical Feasibility: The development process of Payroll Management System wouldbe advantageous to the organization because we would make use of only the currently available resources of the organization. All the tools needed for the development are already available with the organization and the organization does not have to acquire any new resources. The technical feasibility is also attributed to the fact that the system does not make use of any additional or external third party components which can lead to increased load on the system.

3.2.2 Operational Feasibility: The Payroll Management System is intended to provide avery user-friendly and easy to use interface which is beneficial for both the visitors as well as the operators who help in providing support for the system. This system would also be easily acceptable among the visitor and administrator, as there is no need of any special skill set for using the application. This system also benefits the users as they do not have to download anything on their terminals increasing their efficiency and ease of use.

3.2.3 Economic Feasibility: The Payroll Management System has a very low developmentcost. The low cost is attributed to the usage of the existing resources of the organization. As the website is very user friendly and easy to use, there is no need to provide special training to the users of the website, thus saving valuable time and money.

3.2.4 Scheduled feasibility: Projects are always given deadlines. Every project is completed ina specific duration. I was the only working on the project and I had the project duration of four months only. So i have tried our level best to fulfill each and every requirement.

3.3 PROJECT PLAN :The planning phase results in the architecture and design of the solution, the plans to accomplish the development and deployment of the solution, and the schedules associated with tasks and resources. There are three design processes in the planning phase: conceptual, logical, and physical design.

3.3.1 Developing and Designing the System

Design of any application is not complete without a way for users to interact with the system.User interaction takes place through the applications presentation layer. The presentation layer is the part of the application that provides a communication mechanism between the user and the business service layer of the system. The most simple presentation layers contain user interface components, such as Windows Forms or ASP Pages. For more complex user interactions, we can design user process components to orchestrate the user interface elements and control the user interaction. User interface components display data to users, acquire and validate data from user input, and interpret user gestures that indicate the user wants to perform an operation on the data. Additionally, the user interface should filter the available actions to let users perform only the operations that are appropriate at a certain point in time.

3.3.2 Stabilizing

The purpose of the stabilizing phase is to reduce the risks of releasing the solution to production. A successful stabilizing phase requires that the team make the transition from a mindset focused on building features to one focused on getting the solution to a known state of quality.

Deliverables of the deploying phase are operations and support information systems, repository of all versions of documentation and code, and project closeout reports.

CHAPTER 4

SOFTWARE REQUIREMENT SYSTEM4.1 INTRODUCTION:Nowadays, the world is moving at a lightening swiftness and so is computer field. It is advancing

each and every day.

Initially the work of project management was done manually and the data was kept in

filesbut now the technology is such that each employee who is part of project management team has all the projects, their phases, reports all at hand.

Due to which user can quickly know regarding the status of any project and its progress.

Such is the technology which is increasing at a very fast pace. This system has been made

so, that user can work faster and in a much better environment.

4.2 GENERAL DESCRIPTION:

This project has many future applications like it can be used in any of the Retail Outlet of Any Type companies.

Project was build keeping in mind all the requirements of these outlets and they can be implemented in any such type of organization with very few modification.

With modifications it can be possible for Employee Attendance to control all retail outlets by connecting them through a network. Because of this software all they need is a Server application and any type of connectivity to that server.4.3 SPECIFIC REQUIREMENT:4.3.1 Hardware Requirements:

233 MHz Pentium processor or other compatible Intel Chipset Motherboard

512 MB SD-RAM

4 GB hard disk4.3.2 Software Requirements:

Operating System -Windows 98 onwards

Application Software -java

Database Tool xampp

CHAPTER 5

DESIGN4.1 SYSTEM DESIGN : Systems design is the process of defining the architecture, components, modules, interfaces, and data for a system to satisfy specified requirements

Fig. 4.1.1. USE-CASE DIAGRAM 4.2 DESIGN NOTATION:4.2 DESIGN NOTATION :SymbolsElementary references Process that transforms data flowData Flow

Source or Destination of data

Data Store4.3 DETAILED DESIGN :4.3.1 Data Flow Diagram DFDA data-flow diagram (DFD) is a graphical representation of the "flow" of data through an information system. DFDs can also be used for the visualization of data processing (structured design). On a DFD, data items flow from an external data source or an internal data store to an internal data store or an external data sink, via an internal process.

4.4 FLOWCHART:

Fig. 4.4.1. 0th Level DFD.

Fig. 4.4.2. Level 1(High Level Diagram).

Fig. 4.4.3. 2nd Level DFD.

Fig. 4.4.4. 2nd Level DFD

Fig. 4.4.5. 2nd Level DFD

Fig. 4.4.6. ER -Diagram.Tables used for this project:-

1.Add Employee 2.Edit- Employee 3. Delete-Employee 4.Employee-Settings 5.Employee-Payslip Table 4.4.1. Add- Employee.

Field NameData TypeSize

Employee codeNumber10

DesignationChar10

First NameChar10

Last Name

Char10

AddressChar50

Contact no.Number10

Table 4.4.2. Edit- Employee.Field NameData TypeSize

Employee codeNumber10

DesignationChar10

First NameChar10

Last Name

Char10

AddressChar50

Contact no.Number10

Table 4.4.3 Delete- Employee.Field NameData TypeSize

Employee codeNumber10

DesignationChar10

First NameChar10

Last Name

Char10

AddressChar50

Contact no.Number10

Table 4.4.3. Employee-SettingsField NameData TypeData Type

Employee-TypeChar10

Basic SalaryNumber10

DA AllowanceNumber10

HRA AllowanceNumber10

WA AllowanceNumber10

GPF DeductionNumber10

IT DeductionNumber10

GIS DeductionNumber10

PF DeductionNumber10

LIC DeductionNumber10

Table 4.4.4 Employee-Pay slip.Field NameData TypeNumber

Employee-codeNumber10

MonthChar

Employee-NameChar50

DesignationChar

DateNumber

Salary SlipChar20

Basic payNumber10

DANumber10

HRANumber10

WANumber10

Total AllowancesNumber10

GPFNumber10

ITNumber10

GISNumber10

PFNumber10

LICNumber10

Total DeductionNumber10

Net salaryNumber10

4.5 CODING4.5.1. Login frame:-

import java.awt.*;

import java.awt.event.*;

import java.sql.*;

import java.io.*;

import java.util.*;

import java.net.*;

import javax.swing.*;

import java.util.Date;

public class LoginFrame extends JFrame implements ActionListener {

static JFrame frame;

private String username;

private String password;

private static JFrame loginFrame;

private static JPanel panel1;

private static JPanel panel2;

private static JPanel panel3;

private JButton loginBtn;

private JButton exitBtn;

int dialogtype = JOptionPane.PLAIN_MESSAGE;

String dialogmessage;

String dialogs;

private JLabel nameLbl;

private JLabel userLbl;

private JLabel passwordLbl;

private static JTextField userTxt;

private static JPasswordField passwordTxt;

public String loginname;

public String loginpass;

// class Veriables

clsConnection connect = new clsConnection();

//Connection variable

Connection conn;

Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();

static Date td

= new Date();

public LoginFrame()

{

panel1 = new JPanel();

panel1.setLayout(new FlowLayout());

nameLbl = new JLabel("WELCOME TO GEC'S PAYROLL SYSTEM");

panel2 = new JPanel();

panel2.setLayout(new GridLayout(2,2));

userLbl = new JLabel("Username :");

userTxt = new JTextField(20);

passwordLbl = new JLabel("Password :");

passwordTxt = new JPasswordField(20);

panel3 = new JPanel();

panel3.setLayout(new FlowLayout());

loginBtn = new JButton("Login", new ImageIcon("images/key.gif"));

loginBtn.addActionListener(this);

exitBtn = new JButton("Exit", new ImageIcon("images/Keys.gif"));

exitBtn.addActionListener(this);

panel1.add(nameLbl);

panel1.setOpaque(true);

panel2.add(userLbl);

panel2.add(userTxt);

panel2.add(passwordLbl);

panel2.add(passwordTxt);

panel2.setOpaque(true);

panel3.add(loginBtn);

panel3.add(exitBtn);

panel3.setOpaque(true);

frame = new JFrame("PayRoll User Login...");

frame.setSize(300,200);

Container pane = frame.getContentPane();

pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS));

//pane.setLayout(new GridLayout(3,1));

pane.add(panel1);

pane.add(panel2);

pane.add(panel3);

frame.setLocation((screen.width - 500)/2,((screen.height-350)/2));

frame.setVisible(true);

frame.addWindowListener(new WindowAdapter()

{

public void windowClosing(WindowEvent e)

{

System.exit(0);

}

});

}

public void actionPerformed(ActionEvent event)

{

Object source = event.getSource();

if(source.equals(loginBtn))

{

login();

}

else if(source.equals(exitBtn))

{

System.exit(0);

}

}

public void login()

{

loginname = userTxt.getText().trim();

loginpass = passwordTxt.getText().trim();

try {

conn = connect.setConnection(conn,"","");

}

catch(Exception e)

{

}

try{

Statement stmt = conn.createStatement();

String query = "SELECT * FROM Login WHERE USERNAME='" + loginname +

"'AND PASSWORD='"+loginpass+"'";

ResultSet rs = stmt.executeQuery(query);

boolean recordfound = rs.next();

if (recordfound)

{

dialogmessage = "Welcome - " +loginname;

dialogtype = JOptionPane.INFORMATION_MESSAGE;

JOptionPane.showMessageDialog((Component)null, dialogmessage, dialogs, dialogtype);

userTxt.setText("");

passwordTxt.setText("");

frame.setVisible(false);

frame.dispose();

MainMenu menu = new MainMenu(loginname,td);

}

else

{

dialogmessage = "Login Failed!";

JOptionPane.showMessageDialog(null, "INVALID ID OR PASSWORD!",

"WARNING!!",JOptionPane.WARNING_MESSAGE);

userTxt.setText("");

passwordTxt.setText("");

}

conn.close();

}

catch(Exception ex)

{

JOptionPane.showMessageDialog(null,"GENERAL EXCEPTION", "WARNING!!!",JOptionPane.INFORMATION_MESSAGE);

}

}

public static void main(String[] args)

{

LoginFrame frame1 = new LoginFrame();

frame1.addNotify();

frame1.pack();

}

}4.5.2. Setting window:-

package roll;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import javax.swing.event.*;

import java.sql.*;

import java.io.*;

import java.util.*;

import java.net.*;

public class Settingswindow extends JInternalFrame implements ActionListener, ItemListener {

JFrame JFParentFrame;

JDesktopPane desktop;

private JPanel panel2;

private JPanel panel3;

private JPanel panel4;

private JPanel panel5;

private JPanel panel6;

private JPanel panel7;

private JPanel panel8;

private JButton AddBtn;

private JButton ChangeBtn;

private JButton ExitBtn;

private JButton DeleteBtn;

private JLabel LblHeading, LblBasic_Salary, LblAllowance, LblPercent1, LblRs1;

private JLabel LblDeduction, LblPercent2, LblRs2;

private JLabel LblDA, LblHRA, LblWA, LblGPF, LblIT,LblGIS,LblPF, LblLIC;

private JLabel Emp_Type, SELECT1, SELECT2;

private JTextField TxtBasic, TxtDA1, TxtHRA1, TxtWA1, TxtGPF1, TxtIT1, TxtGIS1, TxtPF1, TxtLIC1;

private JTextField TxtCategory_Name,TxtDA2, TxtHRA2, TxtWA2;

private JTextField TxtGPF2,TxtIT2, TxtGIS2, TxtPF2, TxtLIC2;

private JComboBox Cat_Name;

private JCheckBox chDA,chHRA,chWA, chGPF, chIT, chGIS, chPF, chLIC;

String dialogmessage;

String dialogs;

int dialogtype = JOptionPane.PLAIN_MESSAGE;

public static int record;

// Class Variables

clsSettings settings = new clsSettings();

clsConnection connect = new clsConnection();

// Connection

Connection conn;

private String sCategory_Type = "";

private String sCategory_Name = "";

private String sBasic_Pay = "";

private String sDA = "false";

private String sHRA = "false";

private String sWA = "false";

private String sGPF = "false";

private String sIT = "false";

private String sGIS = "false";

private String sPF = "false";

private String sLIC = "false";

private String sDA_Allow = "";

private String sHRA_Allow = "";

private String sWA_Allow = "";

private String sGPF_Dedu = "";

private String sIT_Dedu = "";

private String sGIS_Dedu = "";

private String sPF_Dedu = "";

private String sLIC_Dedu = "";

public static boolean s;

public Settingswindow(JFrame getParentFrame)

{

super("Employee - Settings",true,true,true,true);

setSize(800,850);

JFParentFrame = getParentFrame;

panel2 = new JPanel();

panel2.setLayout(new FlowLayout());

Emp_Type = new JLabel("Employee Type :");

Cat_Name = new JComboBox();

Cat_Name.addActionListener(this);

Cat_Name.setEditable(false);

add_Cat_combo(Cat_Name);

TxtCategory_Name = new JTextField(10);

TxtCategory_Name.setText(null);

String cat_Name = (String)Cat_Name.getSelectedItem();

panel2.add(Emp_Type,"LEFT");

panel2.add(Cat_Name,"CENTER");

panel2.add(TxtCategory_Name,"RIGHT");

panel3 = new JPanel();

panel3.setLayout(new FlowLayout());

LblBasic_Salary = new JLabel("Basic Salary : ");

TxtBasic = new JTextField(10);

panel3.add(LblBasic_Salary,"LEFT");

panel3.add(TxtBasic,"RIGHT");

panel4 = new JPanel();

panel4.setLayout(new GridLayout(1,4,5,5));

SELECT1 = new JLabel("Check for %");

LblAllowance = new JLabel("Allowance");

LblPercent1 = new JLabel(" Allowance Value");

LblRs1 = new JLabel("Information");

panel4.add(SELECT1,"CENTER");

panel4.add(LblAllowance, "CENTER");

panel4.add(LblPercent1, "CENTER");

panel4.add(LblRs1, "CENTER");

panel5 = new JPanel();

panel5.setLayout(new GridLayout(3,4,5,5));

LblDA = new JLabel("DA Allowance :");

LblHRA = new JLabel("HRA Allowance :");

LblWA = new JLabel("WA Allowane :");

TxtDA1 = new JTextField();

TxtDA2 = new JTextField("Enter in Rupees");

TxtHRA1 = new JTextField();

TxtHRA2 = new JTextField("Enter in Rupees");

TxtWA1 = new JTextField();

TxtWA2 = new JTextField("Enter in Rupees");

chDA = new JCheckBox("DA",false);

chDA.addItemListener(this);

chHRA = new JCheckBox("HRA",false);

chHRA.addItemListener(this);

chWA = new JCheckBox("WA",false);

chWA.addItemListener(this);

panel5.add(LblDA);

panel5.add(chDA);

panel5.add(TxtDA1);

panel5.add(TxtDA2);

panel5.add(LblHRA);

panel5.add(chHRA);

panel5.add(TxtHRA1);

panel5.add(TxtHRA2);

panel5.add(LblWA);

panel5.add(chWA);

panel5.add(TxtWA1);

panel5.add(TxtWA2);

panel6 = new JPanel();

panel6.setLayout(new GridLayout(1,4,5,5));

SELECT2 = new JLabel("Check for %");

LblDeduction = new JLabel("Deduction :");

LblPercent2 = new JLabel("Deduction Value");

LblRs2= new JLabel("Information");

panel6.add(SELECT2,"CENTER");

panel6.add(LblDeduction, "CENTER");

panel6.add(LblPercent2, "CENTER");

panel6.add(LblRs2, "CENTER");

panel7 = new JPanel();

panel7.setLayout(new GridLayout(6,4,2,2));

LblGPF = new JLabel ("GPF Deduction :");

LblIT = new JLabel ("I.T. Deduction:");

LblGIS = new JLabel ("GIS Deduction :");

LblPF = new JLabel ("PF Deductoin :");

LblLIC = new JLabel ("LIC Deduction :");

TxtGPF1 = new JTextField();

TxtGPF2 = new JTextField("Enter in Rupees");

TxtIT1 = new JTextField();

TxtIT2 = new JTextField("Enter in Rupees");

TxtGIS1 = new JTextField();

TxtGIS2 = new JTextField("Enter in Rupees");

TxtPF1 = new JTextField();

TxtPF2 = new JTextField("Enter in Rupees");

TxtLIC1 = new JTextField();

TxtLIC2 = new JTextField("Enter in Rupees");

chGPF = new JCheckBox("GPF",false);

chGPF.addItemListener(this);

chIT = new JCheckBox("IT",false);

chIT.addItemListener(this);

chGIS = new JCheckBox("GIS",false);

chGIS.addItemListener(this);

chPF = new JCheckBox("PF",false);

chPF.addItemListener(this);

chLIC = new JCheckBox("LIC",false);

chLIC.addItemListener(this);

panel7.add(LblGPF);

panel7.add(chGPF);

panel7.add(TxtGPF1);

panel7.add(TxtGPF2);

panel7.add(LblIT);

panel7.add(chIT);

panel7.add(TxtIT1);

panel7.add(TxtIT2);

panel7.add(LblGIS);

panel7.add(chGIS);

panel7.add(TxtGIS1);

panel7.add(TxtGIS2);

panel7.add(LblPF);

panel7.add(chPF);

panel7.add(TxtPF1);

panel7.add(TxtPF2);

panel7.add(LblLIC);

panel7.add(chLIC);

panel7.add(TxtLIC1);

panel7.add(TxtLIC2);

panel7.setOpaque(true);

panel8 = new JPanel();

panel8.setLayout(new FlowLayout(FlowLayout.CENTER));

AddBtn = new JButton("Add New");

AddBtn.addActionListener(this);

ChangeBtn = new JButton("Edit");

ChangeBtn.addActionListener(this);

DeleteBtn = new JButton("Delete");

DeleteBtn.addActionListener(this);

ExitBtn = new JButton("Exit");

ExitBtn.addActionListener(this);

panel8.add(AddBtn);

panel8.add(ChangeBtn);

panel8.add(DeleteBtn);

panel8.add(ExitBtn);

panel8.setOpaque(true);

check_false();

uncheck_true();

Container pane = getContentPane();

pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS));

pane.add(panel2);

pane.add(panel3);

pane.add(panel4);

pane.add(panel5);

pane.add(panel6);

pane.add(panel7);

pane.add(panel8);

setFrameIcon(new ImageIcon( "images/settings.gif"));

setDefaultCloseOperation(DISPOSE_ON_CLOSE);

pack();

settings.Numvalidator(TxtBasic);

settings.Numvalidator(TxtDA1);

settings.Numvalidator(TxtDA2);

settings.Numvalidator(TxtHRA1);

settings.Numvalidator(TxtHRA2);

settings.Numvalidator(TxtWA1);

settings.Numvalidator(TxtWA2);

settings.Numvalidator(TxtGPF1);

settings.Numvalidator(TxtGPF2);

settings.Numvalidator(TxtIT1);

settings.Numvalidator(TxtIT2);

settings.Numvalidator(TxtGIS1);

settings.Numvalidator(TxtGIS2);

settings.Numvalidator(TxtPF1);

settings.Numvalidator(TxtPF2);

settings.Numvalidator(TxtLIC1);

settings.Numvalidator(TxtLIC2);

fill_form(cat_Name);

}

public void actionPerformed(ActionEvent event)

{

Object source = event.getSource();

if ( source == Cat_Name)

{

String cat_Name = (String)Cat_Name.getSelectedItem();

fill_form(cat_Name);

}

if (source == AddBtn)

{

add_record();

}

if (source == ChangeBtn)

{

edit_record();

}

if (source == DeleteBtn)

{

delete_record();

}

if (source == ExitBtn)

{

setVisible (false);

dispose();

}

}

public void itemStateChanged(ItemEvent event)

{

Object item = event.getItemSelectable();

if (item == chDA)

{

if (event.getStateChange() == ItemEvent.SELECTED) {

sDA = "true";

TxtDA2.setText("Enter in % of Basic");

}

else if (event.getStateChange() == ItemEvent.DESELECTED)

{

sDA = "false";

TxtDA2.setText("Enter in Rupees");

}

}

else if (item == chHRA)

{

if (event.getStateChange() == ItemEvent.SELECTED) {

sHRA = "true";

TxtHRA2.setText("Enter in % of Basic");

}

else if (event.getStateChange() == ItemEvent.DESELECTED)

{

sHRA = "false";

TxtHRA2.setText("Enter in Rupees");

}

}

else if (item == chWA)

{

if (event.getStateChange() == ItemEvent.SELECTED) {

sWA = "true";

TxtWA2.setText("Enter in % of Basic");

}

else if (event.getStateChange() == ItemEvent.DESELECTED)

{

sWA = "false";

TxtWA2.setText("Enter in Rupees");

}

}

else if (item == chGPF)

{

if (event.getStateChange() == ItemEvent.SELECTED) {

sGPF = "true";

TxtGPF2.setText("Enter in % of Basic");

}

else if (event.getStateChange() == ItemEvent.DESELECTED)

{

sGPF = "false";

TxtGPF2.setText("Enter in Rupees");

}

}

else if (item == chIT)

{

if (event.getStateChange() == ItemEvent.SELECTED) {

sIT = "true";

TxtIT2.setText("Enter in % of Basic");

}

else if (event.getStateChange() == ItemEvent.DESELECTED)

{

sIT = "false";

TxtIT2.setText("Enter in Rupees");

}

}

else if (item == chGIS)

{

if (event.getStateChange() == ItemEvent.SELECTED) {

sGIS = "true";

TxtGIS2.setText("Enter in % of Basic");

}

else if (event.getStateChange() == ItemEvent.DESELECTED)

{

sGIS = "false";

TxtGIS2.setText("Enter in Rupees");

}

}

else if (item == chPF)

{

if (event.getStateChange() == ItemEvent.SELECTED) {

sPF = "true";

TxtPF2.setText("Enter in % of Basic");

}

else if (event.getStateChange() == ItemEvent.DESELECTED)

{

sPF = "false";

TxtPF2.setText("Enter in Rupees");

}

}

else if (item == chLIC)

{

if (event.getStateChange() == ItemEvent.SELECTED) {

sLIC = "true";

TxtLIC2.setText("Enter in % of Basic");

}

else if (event.getStateChange() == ItemEvent.DESELECTED)

{

sLIC = "false";

TxtLIC2.setText("Enter in Rupees");

}

}

}

public void check_false()

{

TxtDA1.setEditable(true);

TxtHRA1.setEditable(true);

TxtWA1.setEditable(true);

TxtGPF1.setEditable(true);

TxtIT1.setEditable(true);

TxtGIS1.setEditable(true);

TxtPF1.setEditable(true);

TxtLIC1.setEditable(true);

}

public void uncheck_true()

{

TxtDA2.setEditable(false);

TxtHRA2.setEditable(false);

TxtWA2.setEditable(false);

TxtGPF2.setEditable(false);

TxtIT2.setEditable(false);

TxtGIS2.setEditable(false);

TxtPF2.setEditable(false);

TxtLIC2.setEditable(false);

}

public void seteditable_true(JTextField chtxt )

{

chtxt.setEditable(true);

}

public void seteditable_false(JTextField chtxt)

{

chtxt.setEditable(false);

}

public void checkbox_state( JCheckBox chbox, String opt)

{

s = Boolean.valueOf(opt);

chbox.setSelected(s);

}

public void txtbox_fill(JTextField txt1, String value)

{

//s = Boolean.valueOf(option);

txt1.setText(value);

}

public void add_Cat_combo(JComboBox cmb)

{

try {

conn = connect.setConnection(conn,"","");

}

catch(Exception e)

{

}

try{

Statement stmt = conn.createStatement();

String query = "SELECT * FROM Settings";

ResultSet rs = stmt.executeQuery(query);

while (rs.next())

{

String Txtcmb = rs.getString(2).trim();

record = rs.getInt("Category_Type");

cmb.addItem(Txtcmb);

}

conn.close();

}

catch(Exception ex)

{

}

}

/////////////////////////////////

public void add_record()

{

try {

conn = connect.setConnection(conn,"","");

}

catch(Exception e)

{

}

try{

record = record +1;

sCategory_Type = ""+record;

sCategory_Name = TxtCategory_Name.getText().trim();

sBasic_Pay = TxtBasic.getText().trim();

sDA_Allow = TxtDA1.getText().trim();

sHRA_Allow =TxtHRA1.getText().trim();

sWA_Allow = TxtWA1.getText().trim();

sGPF_Dedu = TxtGPF1.getText().trim();

sIT_Dedu = TxtIT1.getText().trim();

sGIS_Dedu = TxtGIS1.getText().trim();

sPF_Dedu = TxtPF1.getText().trim();

sLIC_Dedu = TxtLIC1.getText().trim();

if (!sCategory_Type.equals("") &&

!sCategory_Name.equals("")&&

!sBasic_Pay.equals("")&&

!sDA_Allow.equals("") &&

!sHRA_Allow.equals("")&&

!sWA_Allow.equals("") &&

!sGPF_Dedu.equals("") &&

!sIT_Dedu.equals("")&&

!sGIS_Dedu.equals("")&&

!sPF_Dedu.equals("") &&

!sLIC_Dedu.equals(""))

{

System.out.println("Category Name :" +sCategory_Name);

Statement stmt = conn.createStatement();

String query = "SELECT * FROM Settings WHERE Category_Name='" +sCategory_Name+ "'";

ResultSet rs = stmt.executeQuery(query);

int foundrec=0;

while (rs.next())

{

dialogmessage = "Record Already Exists in DataBase!!!";

dialogtype = JOptionPane.WARNING_MESSAGE;

JOptionPane.showMessageDialog((Component)null, dialogmessage, dialogs, dialogtype);

foundrec = 1;

}

if (foundrec == 0)

{

String temp = "INSERT INTO Settings VALUES (" + sCategory_Type +",'" +

sCategory_Name +"'," +

sBasic_Pay +",'" +

sDA +"','" +

sHRA

+"','" +

sWA

+ "','" +

sGPF

+"','"+

sIT

+"','"+

sGIS

+"','"+

sPF

+"','"+

sLIC

+"',"+

sDA_Allow

+","+

sHRA_Allow

+","+

sWA_Allow

+","+

sGPF_Dedu

+","+

sIT_Dedu

+","+

sGIS_Dedu

+","+

sPF_Dedu

+","+

sLIC_Dedu

+")";

int result = stmt.executeUpdate( temp );

if ( result == 1 )

{

dialogmessage = "New Position Added";

dialogtype = JOptionPane.INFORMATION_MESSAGE;

JOptionPane.showMessageDialog((Component)null, dialogmessage, dialogs, dialogtype);

Cat_Name.addItem(sCategory_Name);

}

else {

dialogmessage = "Failed To Insert";

JOptionPane.showMessageDialog(null, dialogmessage,

"WARNING!!",JOptionPane.WARNING_MESSAGE);

}

}

}

else

{

dialogmessage = "EMPTY VALUE FOUND";

JOptionPane.showMessageDialog(null, dialogmessage,

"WARNING!!",JOptionPane.WARNING_MESSAGE);

}

conn.close();

}

catch(Exception ex)

{

System.out.println("Unknown Error" +ex);

}

}

public void fill_form(String name)

{

try {

conn = connect.setConnection(conn,"","");

}

catch(Exception e)

{

}

try{

Statement stmt = conn.createStatement();

String query = "SELECT * FROM Settings WHERE Category_Name='" +name+ "'";

ResultSet rs = stmt.executeQuery(query);

while (rs.next())

{

sCategory_Type = "";

sCategory_Name = "";

sBasic_Pay = "";

sDA = "";

sHRA = "";

sWA = "";

sGPF = "";

sIT = "";

sGIS = "";

sPF = "";

sLIC = "";

sDA_Allow = "";

sHRA_Allow = "";

sWA_Allow = "";

sGPF_Dedu = "";

sIT_Dedu = "";

sGIS_Dedu = "";

sPF_Dedu = "";

sLIC_Dedu = "";

sCategory_Type += rs.getString(1).trim();

sCategory_Name = rs.getString(2).trim();

sBasic_Pay = rs.getString(3).trim();

sDA = rs.getString(4).trim();

sHRA = rs.getString(5).trim();

sWA = rs.getString(6).trim();

sGPF = rs.getString(7).trim();

sIT = rs.getString(8).trim();

sGIS = rs.getString(9).trim();

sPF = rs.getString(10).trim();

sLIC = rs.getString(11).trim();

sDA_Allow = rs.getString(12).trim();

sHRA_Allow = rs.getString(13).trim();

sWA_Allow = rs.getString(14).trim();

sGPF_Dedu = rs.getString(15).trim();

sIT_Dedu = rs.getString(16).trim();

sGIS_Dedu = rs.getString(17).trim();

sPF_Dedu = rs.getString(18).trim();

sLIC_Dedu = rs.getString(19).trim();

TxtBasic.setText(sBasic_Pay);

checkbox_state( chDA, sDA );

checkbox_state( chHRA, sHRA );

checkbox_state( chWA, sWA );

checkbox_state( chGPF, sGPF );

checkbox_state( chIT, sIT );

checkbox_state( chGIS, sGIS );

checkbox_state( chPF, sPF );

checkbox_state( chLIC, sLIC );

txtbox_fill(TxtDA1,sDA_Allow);

txtbox_fill(TxtHRA1,sHRA_Allow);

txtbox_fill(TxtWA1,sWA_Allow);

txtbox_fill(TxtGPF1,sGPF_Dedu);

txtbox_fill(TxtIT1,sIT_Dedu);

txtbox_fill(TxtGIS1,sGIS_Dedu);

txtbox_fill(TxtPF1, sPF_Dedu);

txtbox_fill(TxtLIC1, sLIC_Dedu);

rs = null;

}

conn.close();

}

catch(Exception ex)

{

}

}

public void edit_record()

{

try {

conn = connect.setConnection(conn,"","");

}

catch(Exception e)

{

}

try{

sCategory_Name = (String)Cat_Name.getSelectedItem();

sBasic_Pay = TxtBasic.getText().trim();

sDA_Allow = TxtDA1.getText().trim();

sHRA_Allow =TxtHRA1.getText().trim();

sWA_Allow = TxtWA1.getText().trim();

sGPF_Dedu = TxtGPF1.getText().trim();

sIT_Dedu = TxtIT1.getText().trim();

sGIS_Dedu = TxtGIS1.getText().trim();

sPF_Dedu = TxtPF1.getText().trim();

sLIC_Dedu = TxtLIC1.getText().trim();

if (!sCategory_Name.equals("")&&

!sBasic_Pay.equals("")&&

!sDA_Allow.equals("") &&

!sHRA_Allow.equals("")&&

!sWA_Allow.equals("") &&

!sGPF_Dedu.equals("") &&

!sIT_Dedu.equals("")&&

!sGIS_Dedu.equals("")&&

!sPF_Dedu.equals("") &&

!sLIC_Dedu.equals(""))

{

Statement stmt = conn.createStatement();

String temp = "UPDATE Settings SET " +

"Category_Type= " +sCategory_Type+

", Category_Name= '" + sCategory_Name +

"',Basic_Pay= " + sBasic_Pay +

", DA='" + sDA +

"',HRA= '" + sHRA +

"',WA= '" + sWA +

"',GPF = '" + sGPF +

"',IT = '" + sIT +

"',GIS = '" + sGIS +

"',PF = '" + sPF +

"',LIC = '" + sLIC +

"',DA_Allow = " + sDA_Allow +

",HRA_Allow = " + sHRA_Allow +

",WA_Allow = " + sWA_Allow +

",GPF_Dedu = " + sGPF_Dedu +

",IT_Dedu = " + sIT_Dedu +

",GIS_Dedu = " + sGIS_Dedu +

",PF_Dedu = " + sPF_Dedu +

",LIC_Dedu = " + sLIC_Dedu +

" WHERE Category_Type= " + sCategory_Type;

int result = stmt.executeUpdate( temp );

if ( result == 1 )

{

dialogmessage = "Record Altered into DataBase!!!";

dialogtype = JOptionPane.INFORMATION_MESSAGE;

JOptionPane.showMessageDialog((Component)null, dialogmessage, dialogs, dialogtype);

}

else

{

dialogmessage = "NO SUCH POSITION FOUND!!!";

dialogtype = JOptionPane.WARNING_MESSAGE;

JOptionPane.showMessageDialog((Component)null, dialogmessage, dialogs, dialogtype);

}

}

else

{

dialogmessage = "NULL VALUES IN TEXTFIELD OCCURED!!!";

dialogtype = JOptionPane.WARNING_MESSAGE;

JOptionPane.showMessageDialog((Component)null, dialogmessage, dialogs, dialogtype);

}

conn.close();

}

catch(Exception ex)

{

JOptionPane.showMessageDialog(null,"GENERAL EXCEPTION", "WARNING!!!",JOptionPane.INFORMATION_MESSAGE);

}

}

//////////////////////////////////

public void delete_record()

{

sCategory_Name = (String)Cat_Name.getSelectedItem();

int DResult = JOptionPane.showConfirmDialog(null,"Are you sure you want to delete Record?");

if (DResult == JOptionPane.NO_OPTION || DResult == JOptionPane.CANCEL_OPTION) {

dialogmessage = "Operation Calceld By User!!!";

dialogtype = JOptionPane.INFORMATION_MESSAGE;

JOptionPane.showMessageDialog((Component)null, dialogmessage, dialogs, dialogtype);

}

if (DResult == JOptionPane.YES_OPTION)

{

try {

conn = connect.setConnection(conn,"","");

}

catch(Exception e)

{

}

try{

if (!sCategory_Name.equals(""))

{

Statement stmt = conn.createStatement();

String temp = "DELETE from Settings " +

" WHERE Category_Name = '" + sCategory_Name + "'";

int result = stmt.executeUpdate( temp );

if ( result == 1 )

{

dialogmessage = "Record Deleted From DataBase!!!";

dialogtype = JOptionPane.INFORMATION_MESSAGE;

JOptionPane.showMessageDialog((Component)null, dialogmessage, dialogs, dialogtype);

}

else

{

dialogmessage = "No Such Record Found!!!";

dialogtype = JOptionPane.WARNING_MESSAGE;

JOptionPane.showMessageDialog((Component)null, dialogmessage, dialogs, dialogtype);

}

}

else

{

dialogmessage = "Empty Record Found!!!";

dialogtype = JOptionPane.WARNING_MESSAGE;

JOptionPane.showMessageDialog((Component)null, dialogmessage, dialogs, dialogtype);

}

conn.close();

}

catch(Exception ex)

{

JOptionPane.showMessageDialog(null,"GENERAL EXCEPTION", "WARNING!!!",JOptionPane.INFORMATION_MESSAGE);

}

}

}

///////////////////////////////

}4.5.3. Main Menu:-

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

import java.awt.Toolkit;

import java.io.*;

import java.sql.*;

import java.util.*;

import java.text.DateFormat;

import java.util.Date;

import java.text.*;

import java.lang.*;

import java.beans.PropertyVetoException;

import roll.Addwindow;

import roll.Deletewindow;

import roll.Editwindow;

import roll.Emprptwindow;

import roll.Settingswindow;

import roll.clsSettings;

public class MainMenu extends JFrame implements ActionListener{

JDesktopPane desktop = new JDesktopPane();

String sMSGBOX_TITLE= "Payroll Managment System";

// Menu Bar Variables

JMenuBar menubar = new JMenuBar();

JMenu menuFile = new JMenu("File");

JMenu menuEmployee = new JMenu("Employee");

JMenu menuTools = new JMenu("Tools");

JMenu menuReports = new JMenu("Reports");

JMenu menuHelp = new JMenu("Help");

// Menu Item

JMenuItem itemExit = new JMenuItem();

JMenuItem itemAdd = new JMenuItem();

JMenuItem itemEdit = new JMenuItem();

JMenuItem itemDelete = new JMenuItem();

JMenuItem itemSettings = new JMenuItem();

JMenuItem itemCalculator = new JMenuItem();

JMenuItem itemNotePad = new JMenuItem();

JMenuItem itemEmprpt = new JMenuItem();

JMenuItem itemAuthor = new JMenuItem();

JMenuItem itemHelp = new JMenuItem();

// JPanel

JPanel panel_Bottom = new JPanel();

JPanel panel_Top = new JPanel();

// Label

JLabel lblUsername = new JLabel("User Name:");

JLabel lblLogDetails = new JLabel("Time Login :");

JLabel lblTimeNow = new JLabel();

// TextField

JTextField username = new JTextField();

JTextField logtime = new JTextField();

// JInternalFrame variables

Addwindow FormAddwindow;

Editwindow FormEditwindow;

Deletewindow FormDeletewindow;

//Settingswindow FormSettingswindow;

Emprptwindow FormEmprptwindow;

Settingswindow FormSettingswindow;

// Connection Variables

Connection conn;

// Date variables

static Date td = new Date();

// String Variables

static Statement stmtLogin;

//Class Variables

clsSettings settings = new clsSettings();

//// User Details

static String sUser

= "";

static String sLogin = DateFormat.getDateTimeInstance().format(td);

public MainMenu(String user, Date date) {

super("Payroll Managment System");

sUser = user;

td = date;

JTextField username = new JTextField();

username.setEditable(false);

JTextField logtime = new JTextField();

logtime.setEditable(false);

username.setText(sUser);

logtime.setText(sLogin);

panel_Bottom.setLayout(new FlowLayout());

panel_Bottom.setPreferredSize(new Dimension(10,25));

// panel_Bottom.add(lblUserIcon);

panel_Bottom.add(lblUsername);

panel_Bottom.add(username);

panel_Bottom.add(lblLogDetails);

panel_Bottom.add(logtime);

panel_Top.setLayout(new BorderLayout());

panel_Top.setPreferredSize(new Dimension(10,65));

panel_Top.add(createJToolBar(),BorderLayout.PAGE_START);

desktop.setBackground(Color.WHITE);

desktop.setAutoscrolls(true);

desktop.setBorder(BorderFactory.createLoweredBevelBorder());

desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);

getContentPane().add(panel_Top,BorderLayout.PAGE_START);

getContentPane().add(desktop,BorderLayout.CENTER);

getContentPane().add(panel_Bottom,BorderLayout.PAGE_END);

addWindowListener(new WindowAdapter(){

public void windowClosing(WindowEvent e)

{

UnloadWindow();

}

});

setJMenuBar(CreateJMenuBar());

setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

setIconImage(new ImageIcon("images/Business.png").getImage());

setSize(700,700);

setLocation(2,2);

show();

}

protected JMenuBar CreateJMenuBar()

{

// creating Submenu

// Menu File

menuFile.add(settings.setJMenuItem(itemExit,"Quit","images/exit.png"));

itemExit.addActionListener(this);

// MEnu Employee

menuEmployee.add(settings.setJMenuItem(itemAdd,"Add Employee","images/employee.png"));

menuEmployee.add(settings.setJMenuItem(itemEdit,"Edit Employee","images/edit.png"));

menuEmployee.addSeparator();

menuEmployee.add(settings.setJMenuItem(itemDelete,"Delete Employee","images/delete.png"));

itemAdd.addActionListener(this);

itemEdit.addActionListener(this);

itemDelete.addActionListener(this);

// setting tool bar

menuTools.add(settings.setJMenuItem(itemSettings,"Settings","images/setting.png"));

menuTools.add(settings.setJMenuItem(itemCalculator,"Calculator","images/calc.png"));

menuTools.addSeparator();

menuTools.add(settings.setJMenuItem(itemNotePad,"NotePad","images/notepad.png"));

itemSettings.addActionListener(this);

itemCalculator.addActionListener(this);

itemNotePad.addActionListener(this);

// setting Reports bar

menuReports.add(settings.setJMenuItem(itemEmprpt,"Employee Report","images/emp_rpt.png"));

menuTools.addSeparator();

menuTools.addSeparator();

itemEmprpt.addActionListener(this);

// setting Help

menuHelp.add(settings.setJMenuItem(itemAuthor,"About Author","images/xp.png"));

menuHelp.add(settings.setJMenuItem(itemHelp,"Help","images/help.png"));

itemAuthor.addActionListener(this);

itemHelp.addActionListener(this);

// adding menuitem to menubar

menubar.add(settings.setJMenu(menuFile));

menubar.add(settings.setJMenu(menuEmployee));

menubar.add(settings.setJMenu(menuTools));

menubar.add(settings.setJMenu(menuReports));

menubar.add(settings.setJMenu(menuHelp));

return menubar;

}

protected JToolBar createJToolBar()

{

JToolBar toolbar = new JToolBar("Toolbar");

toolbar.add(settings.CreateJToolbarButton("Exit", "images/exit.png", "File_Exit",

JToolBarActionListener));

toolbar.addSeparator();

toolbar.addSeparator();

toolbar.add(settings.CreateJToolbarButton("Add - Employee", "images/employee.png", "Emp_Add",

JToolBarActionListener));

toolbar.add(settings.CreateJToolbarButton("Edit - Employee", "images/edit.png", "Emp_Edit",

JToolBarActionListener));

toolbar.addSeparator();

toolbar.add(settings.CreateJToolbarButton("Delete - Employee", "images/delete.png","Emp_Delete",

JToolBarActionListener));

toolbar.addSeparator();

toolbar.addSeparator();

toolbar.add(settings.CreateJToolbarButton("Employee Position Settings", "images/setting.png","Settings",

JToolBarActionListener));

toolbar.add(settings.CreateJToolbarButton("Calculator", "images/calc.png","Tools_Calculator",

JToolBarActionListener));

toolbar.add(settings.CreateJToolbarButton("NotePad", "images/notepad.png","Tools_NotePad",

JToolBarActionListener));

toolbar.addSeparator();

toolbar.addSeparator();

toolbar.add(settings.CreateJToolbarButton("Employee - Report", "images/emp_rpt.png","Reports_Employee",

JToolBarActionListener));

toolbar.add(settings.CreateJToolbarButton("Help - Author", "images/xp.png","Help_Author",

JToolBarActionListener));

toolbar.add(settings.CreateJToolbarButton("Help - Help", "images/help.png","Help_Help",

JToolBarActionListener));

return toolbar;

}

ActionListener JToolBarActionListener = new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

String source = e.getActionCommand();

if (source == "File_Exit")

{

loadJInternalFrame(2);

}

else if (source == "Emp_Add")

{

loadJInternalFrame(3);

}

else if (source == "Emp_Edit")

{

loadJInternalFrame(4);

}

else if (source == "Emp_Delete")

{

loadJInternalFrame(5);

}

else if (source == "Settings")

{

loadJInternalFrame(6);

}

else if (source == "Tools_Calculator")

{

loadJInternalFrame(7);

}

else if (source == "Tools_NotePad")

{

loadJInternalFrame(8);

}

else if (source == "Reports_Employee")

{

loadJInternalFrame(9);

}

else if (source == "Help_Author")

{

loadJInternalFrame(11);

}

else if (source == "Help_Help")

{

loadJInternalFrame(12);

}

}

};

public void actionPerformed(ActionEvent event)

{

Object object = event.getSource();

if (object == itemExit)

{

loadJInternalFrame(2);

}

else if (object == itemAdd)

{

loadJInternalFrame(3);

}

else if ( object == itemEdit)

{

loadJInternalFrame(4);

}

else if (object == itemDelete)

{

loadJInternalFrame(5);

}

else if (object == itemSettings)

{

loadJInternalFrame(6);

}

else if (object == itemCalculator)

{

loadJInternalFrame(7);

}

else if (object == itemNotePad)

{

loadJInternalFrame(8);

}

else if (object == itemEmprpt)

{

loadJInternalFrame(9);

}

else if (object == itemAuthor)

{

loadJInternalFrame(12);

}

else if (object == itemHelp)

{

loadJInternalFrame(13);

}

}

private void loadJInternalFrame(int intWhich)

{

switch(intWhich)

{

case 2:

System.exit(0);

break;

case 3:

try {

FormAddwindow = new Addwindow(this);

loadForm("Add Employee", FormAddwindow);

}

catch(Exception e)

{

System.out.println("\nError");

}

break;

case 4:

try {

FormEditwindow = new Editwindow(this);

loadForm("Edit Employee", FormEditwindow);

}

catch(Exception e)

{

System.out.println("\nError");

}

break;

case 5:

try {

FormDeletewindow = new Deletewindow(this);

loadForm("Delete Employee", FormDeletewindow);

}

catch(Exception e)

{

System.out.println("\nError");

}

break;

case 6:

try {

FormSettingswindow = new Settingswindow(this);

loadForm("Settings of Employee", FormSettingswindow);

}

catch(Exception e)

{

System.out.println("\nError");

}

break;

case 7:

runComponents("Calc.exe");

break;

case 8:

runComponents("Notepad.exe");

break;

case 9:

try{

FormEmprptwindow = new Emprptwindow(this);

loadForm("Employee PaySlip", FormEmprptwindow);

}

catch(Exception e)

{

System.out.println("\nError" + e );

}

break;

case 12:

//FormAuthorwindow = new Authorwindow(this);

break;

case 13:

//FormHelpwindow = new Helpwindow(this);

break;

}

}

protected void runComponents(String sComponents)

{

Runtime rt = Runtime.getRuntime();

try{rt.exec(sComponents);}

catch(IOException evt){JOptionPane.showMessageDialog(null,evt.getMessage(),"Error Found",JOptionPane.ERROR_MESSAGE);}

}

protected void loadForm(String Title, JInternalFrame clsForm)

{

boolean xForm = isLoaded(Title);

if (xForm == false)

{

desktop.add(clsForm);

clsForm.setVisible(true);

clsForm.show();

}

else

{

try {

clsForm.setIcon(false);

clsForm.setSelected(true);

}

catch(PropertyVetoException e)

{}

}

} // Complete Load Form methode

protected boolean isLoaded(String FormTitle)

{

JInternalFrame Form[] = desktop.getAllFrames();

for ( int i = 0; i < Form.length; i++)

{

if (Form[i].getTitle().equalsIgnoreCase(FormTitle))

{

Form[i].show();

try

{

Form[i].setIcon(false);

Form[i].setSelected(true);

}

catch(PropertyVetoException e)

{

}

return true;

}

}

return false;

} // Complete to Verify Form loaded or not

protected void UnloadWindow()

{

try

{

int reply = JOptionPane.showConfirmDialog(this,"Are you sure to exit?",sMSGBOX_TITLE,JOptionPane.YES_NO_OPTION,

JOptionPane.WARNING_MESSAGE);

if (reply == JOptionPane.YES_OPTION)

{

setVisible(false);

System.exit(0);

}

}

catch(Exception e)

{}

}// Close the Windows

public static void setlogin(String sUsername, Date sDate)

{

sUser = sUsername;

td = sDate;

}//Set Login

4.6 SNAP SHOT

Fig.4.6.1 Login page.

Fig. 4.6.2 Add Employee

Fig. 4.6.3 Edit- Employee.

Fig. 4.6.4 Delete- Employee.

Fig. 4.6.5 Employee- Settings.

Fig. 4.6.5 Employee pay slip.

CHAPTER 5CONCLUSIONS AND FURTHERWORK

5.1 SUMMARY The main aim of this project was to put what we learnt in our Software engineering class into practice. The payroll system designated to our team allowed us to fully exercise the techniques of XP. The final deliverable was a simple payroll calculator and we were able to learn a new programming language, VB. In addition, we were able to apply the knowledge of OOP learnt in our Java classes to another language thereby giving us a better understanding of OOP.

5.2 OVERVIEW AND INTERPRETATION OF RESULTS ATTAINED We were able to attain our set objectives, and this helped us gain confidence in writing our own code and our own applications.

In addition, the use of serialization was an experimentation to cut down the time taken in designing the front-ends and back-ends of applications separately. With our OOP approach and serialization, we only concentrated on designing the objects/ classes, and then just serialized them on disk. So we did not spend any time on designing how to store data. We also worked as a team, and gained some experience on how professional programmers work in the industry.

5.3 RECOMMENDATIONS ON FUTURE IMPROVEMENT There is always room for imporvement, and the software we created can also be imporved. This is especially because we had to create it within a limited time. With more time, the software can be improved to include security and different types of users. This would be the first step in making the software network-enabled, and eventually web-enabled. This was our original after-thought to programming the software, and we had chosen XML. In addition, the software can also be improved

in terms of the calculations it can do, and more flexiblility in the rates used in calculations per employee.

Bibliography REFERENCES

Horton, Ivor Java 8 SDK 1.8 Edition Wiley Publishing Inc., Indianapolis 2003

Millspaugh, Anita C. and Julia Case Bradley Programming in Visual Basic6.0 Update Edition McGraw-Hill Irwin, Boston 2002.

Odinma, Augustine Software Engineering I SEN 261 Lecture Notes April/Spring 2007 ABTIAmerican University of Nigeria Palmer, Daniel W. and Daniel H. Steinberg Extreme Software Engineering A hands-on approach

Complete Reference 8th Edition.

Bibliography:- www.bulwarks.com/PDFS/Payroll%20Management%20System.pdf www.employeesalarysoftware.com www.xiphiastec.com/payroll.html www.navayugainfotech.com/payroll_management.html www.payrollsoftware.co.in/III