You are on page 1of 76

CONTENTS

PAGE NO.

1. INTRODUCTION 2. OBJECTIVE & PURPOSE 3. SYSTEM STUDY 4. FEASIBILITY STUDY 5. DEVELOPMENT MODEL 6. HAEDWARE & SOFTWARE SPECIFICATIONS 7. TECHNICAL SPECIFICATIONS 8. DATA FLOW DIAGRAMS 9. CODING 10. TESTING & IMPLEMENTATION 11. FORMS IN THE PROJECT 12. CONCLUSION 13. BIBLIOGRAPHY

02 03 04 08 10 12 13 17 19 66 71 75 76

1|Page

INTRODUCTION
At present time, in the modern global world competitive environment organizations are developed rapidly. Many developed industries almost every organization prefers payroll software to maintain employee records up-to-date and is used frequently by Human Resource Management. The Payroll System has inbuilt features that saves time and money and of course gives an accurate result in a limited time period that helps to manage employee records in daily basis as well as annual records in a fraction of miniature. The Payroll Management System is deliberately planned to facilitate on cost-cutting with high qualitative results as per the needs of any successful organization and gives a hand to deal with complexities of management with an ease. It helps an organization to stay focused on business operations and refers to the administration of employees personal details. It consists of many important features such as employee name and their identity card, designation, birthday, date of joining, basic and gross salaries, net pay, wages, deductions such as provident fund, taxes, loan, advance taken if any, allowances like mobile and travelling allowance, commissions etc. that helps organization to keep an annual records as and when is needed, so as to reduce exhaustion of mankind, which results in cost-effectiveness and accumulate time saving. The Payroll Management System has many advantages that keeps organization up-to-date and accurate with a minimum time period and with a very little stumpy amount that consists features highly used by organizations and educational institutions and the features are as mentioned here -

Employee Profile. Customizable & Automatic Tax Calculations. Monthly Report & Pay Slip Generation. Dynamic Salary Calculation. Etc.

2|Page

OBJECTIVE & PURPOSE


The basic objective is to learn the concept behind the payroll system, and to learn new technologies like Swings programming by implementing this concept practically. The ultimate aim is achieved through: Understanding and analyzing the problem statement. Identify the input and output requirements of the system. Designing a user-friendly interface to interact with the system implementing and deploying the system. Preparing a well-organized documentation of the project to understand the system and its working.

Almost every organization or educational institute has its own Staff to support its work within the organization. The organizations need to work and every employee get perfect salary. So that no one can misuse the resources in the organization.

We need to develop such a payroll system that can perform following tasks Can enter the new employee entry. Can see the existing employee detail. Can maintain the existing employee salary record. Can make a new month salary.

That system should support organizations to maintain the salary record of its employees.

3|Page

SYSTEM STUDY
In the system study we study the existing system and new proposed system. In system study we study that what are trhe draw backs, and limitations exist. What are the the needs of existing system and also study what the new proposed system, how the new proposed system removes the draw backs & limitations of the existing system.in this section we study the advantages of the new proposed system.

EXISTING SYSTEM & ITS LIMITATIONS


The organization is maintaining most of their day-to-day transaction data in the registers.the employee of the organization are doing whole work manually. All the work is done manually,so different employees are appointed for the maintainace of registers ontaining all the information releted to the organization It is very time consuming and is also not error free in some situation .In existing manual system database calculations are difficult to perform so report generation as very much difficult. Generally whenever we implement a new system it is develop to eliminate the shortcoming of an existing system.The computerized system has more edge over the manual system.It is beacause of accuracy, highspeed, quickresult, diligenceetc.The existing system is totally based on manual system.Existing system has many draw backs in comparision of computerized system. 1. Time Consuming: High time consumption is the main weakness of the existing system. A lot of time is wasted in searching records from different files,which resulted in loss of time,and moreover workload is increases.Also a lot of time wasted in duplicating the same entries in different registers

4|Page

2. Service & Working condition: With the unusual dealy due to various reason,the costumer suffers a lot.without any firm reason he has to wait which disfigures the working condition. 3. Difficulties in retrieving Information : Sometimes, to get any type of instant information morethan one document needs to be searched .This requires the opening of both files and then combining the information.further this files may not be indexed according to the need,which causes difficulty in retrieving information. 4. Not Easy to Understandable by new users : To understand the manual system the user have to get more practice and have a grape all that help by other employee and have to be in contact with that person.If the person was in leave the user can get info from him. 5. Need more Speace to store : Here by using a paper work system the user need to maintain all the documents in proper way to avoid the difficulty in action and need more speace to store these document beacause they cant destroy the old documents. 6. Very Expensive : The existing manual method is very expensive method as lot of paperwork has to be done and a lot of wastage of manpower,which increase the expenses of existing system. 7. Data Sharing : The different user in different department can not share data simultaneously

5|Page

Need For a new system :


To enhance the working fine tech organization.which was complitly handled manually,the improvement was thought on the basis of computerizing the major activities.

Identify the opportunity to improve business function :


It has been identified that computerization process is necessity and what businee benefits can be derived by implementing this improvement.

Improve services and working condition :


To improve the working condition of existing system in every parts of tours & travels org. costumer services areneed to improve to a great extent.

PROPOSED SYSTEM
This consists of Payroll system.All these transactions need to be carefully understood and taken into consideration.The system also contains a lot of data redundancy at various stages. One of the objectives of the new system would be to store data in an efficient and non-redundant form and hense increase the overall efficiency of the system. The new system should ensure of simple and easy data entry procedures through suggestive looking form.There are quite number of lengthy calculations being done on the acquired data.These calculations should be thoroughly understood. The new system should be able to perform all these calculations automatically and efficiently. Numerous kinds of queries are done on large amounts of accumulated data,to find out the desired data. The new system should provide efficient,simple ,fast and smarter procedures for retreival of exhaustive type of data from the database. Finally, there are quite number of reports that are generated during the normal workimg ofthe system. Each of these required reports should be understood very carefully and the new system shall provide easy and efficient methods of generation of these reports.
6|Page

Advantages of the new system


To overcome those above stated limitations in the payroll Management System,we propose a new systemthat is the computerised system of 'Payroll Management System'. The proposed system would store all the informationcaptured in different registers that will be linked with each other and will provide direct and immediate access, Using a computerised system, we will do storing of data.All the addition,deletion,modification,printing will be done through computer for faster accessing.This proposed system would set free from all the burdens mentioned in the existing system.

Fast and Efficient Reliable and Accurate Centralized data Low Operation and Maintainance Cost Non-Redundant Information User Friendly Easy to Access No Documentation

7|Page

FEASIBILITY ANALYSIS
We have analyzed the feasibility of the system in terms of following spans:

Technical Feasibility Operational Feasibility Economical Feasibility Schedule Feasibility Behavioral Feasibility

Technical Feasibility:

The development process of Payroll Management System would be 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. Operational Feasibility: The Payroll Management System is intended to provide a very userfriendly 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.

8|Page

Economic Feasibility: The Payroll Management System has a very low development cost. 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.

Schedule feasibility: Projects are always given deadlines. Every project is completed in a 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. I had to complete the project in time and if it is not possible to complete the software in time then I would try our best to fulfill client requirements.

Behavioral Feasibility: Many times creates problem when someone tries to harm the system with malicious intensions. For this reason many people need some kind of network monitoring system.

9|Page

DEVELOPMENT MODEL
The Payroll Management System is a database software application which is developed using a waterfall software developing model. The waterfall model is a popular version of the systems development life cycle model (SDLC) for software engineering. Often considered the classic approach to the systems development life cycle, the waterfall model describes a development method that is linear and sequential. Waterfall development has distinct goals for each phase of development. Imagine a waterfall on the cliff of a steep mountain. Once the water has flowed over the edge of the cliff and has begun its journey down the side of the mountain, it cannot turn back. It is the same with waterfall development. Once a phase of development is completed, the development proceeds to the next phase and there is no turning back. The advantage of waterfall development is that it allows for departmentalization and managerial control. A schedule can be set with deadlines for each stage of development and a product can proceed through the development process like a car in a carwash, and theoretically, be delivered on time. Development moves from concept, through design, implementation, testing, installation, troubleshooting, and ends up at operation and maintenance. Each phase of development proceeds in strict order, without any overlapping or iterative steps. The disadvantage of waterfall development is that it does not allow for much reflection or revision. Once an application is in the testing stage, it is very difficult to go back and change something that was not well-thought out in the concept stage. Alternatives to the waterfall model include joint application development (JAD), rapid application development (RAD), synch and stabilize, build and fix, and the spiral model. To follow the waterfall model, one proceeds from one phase to the next in a purely sequential manner. For example, one first completes requirements specification,which are set in stone. When the requirements are fully completed, one proceeds to design. The software in question is designed and a blueprint is drawn for implementers (coders) to follow this design should be a plan for implementing the requirements given. When the design is fully completed, an implementation of that design is made by coders. Towards the later stages of this implementation phase, separate software components produced are combined to introduce new functionality and remove errors.
10 | P a g e

Thus the waterfall model maintains that one should move to a phase only when its preceding phase is completed and perfected. However, there are various modified waterfall models (including Royce's final model) that may include slight or major variations upon this process.

Changed Requirements Communicated Requirements

Requirements Engineering

Requirements Specification

Design

Design Specification

Programming

Executable Software Modules

Maintenance

Process

Integration

Integrated Software Product

Delivery Product Input Product Output

Delivered Software Product

FIG: WATERFALL MODEL

11 | P a g e

HARDWARE & SOFTWARE SPECIFICATIONS

Minimum Hardware Specifications:

System Type Processor Type RAM HDD

: : : :

Personal Computer. Celeron 1.79 GHz or higher. 256 MB or higher. At least 1000 Mb of free space for Good performance. 25 Mb space required to install.

SVGA Modes

256 color or higher and 1024*768 Resolution.

Software Requirements :

Operating System :

Windows 9x, NT, Me or XP Vista,7.

Other Software Developed on Data Base

: : :

JDK1.6 and Above, JCreator JAVA MS-Access

12 | P a g e

TECHNICAL SPECIFICATION
We have implemented our project in JAVA, one of the most powerful languages.

Java Development Kit When the java programming language was introduced in 1995, the only development tool available was the JDK from sun. This set of command line tools makes it possible to write, compile and debug JAVA programs. However, the JDK is the far cry from integrated development environment such as Visual Basic and Borland C++. An integrated development environment (IDE) is software that combines several development tools into a single, cohesive package. The assortment usually includes a source code editor, compiler debugger and other utilities. These tools work together the development process; most packages are highly visual and rely on windows, drag and drop, and other graphical elements. The goal is to make software design faster, more efficient, and easier to debug. Characteristics of Java JAVA is object oriented Object oriented programming is a power full way developing software. Object oriented programming uses a called objects. These objects exist independently of communicate with each other. Thats why object oriented adoptable and more bug proof. JAVA is small and simple The most complex parts of C++ were excluded from java, such as pointers and memory management. These elements are complicated to use and are thus easy to use incorrectly. of organizing and set of components each other and program are more

13 | P a g e

JAVA is safe Another thing essential to javas success is that it is safe. Java provides security and several different levels. Before a java program is run, a verifier check each by code to make sure nothing suspicious is going on.

JAVA is platform independent Platform independence is another way of saying that java is architectural neutral. The basically means that java programs dont care what system they are running on.

JAVA is architectural neutral The JAVA designers made several hard decisions in the java languages and JVM is an attempt to alter the situation programs not running on the same machine after few days. Their goal was Write once; run anywhere, anytime, forever.

JAVA is Distributed Java is designed for the distributed environment of Internet because it handles TCP/IP protocols. The feature of inter-address-space messaging is done with the help of package Remote Method Invocation (RMI). This feature brings an unparalleled level of instructions to the client/server programming. JAVA is dynamic Java programs carry with them substantial amounts of run time type information that is use to verify and resolve accesses to objects at run time. This is crucial to the robustness to the applet environment.

14 | P a g e

Swings
Swing is set of classes that provide more powerful and flexible functionality than is possible with the standard AWT components. In addition to the familiar components, such as buttons, check boxes, and labels, Swings supplies several exciting additions including tabbed panes, scroll panes, trees, and a button may have both image and text string associated with it. Also the image can be changed as the state of the button changes.

Swing is built upon the foundation of the AWT. Unlike AWT components, Swing component are not implemented by platform specific code. Instead they are written entirely in Java and therefore are platform independent. The term lightweight is used to describe such elements.

The class Swing Utilities, which provides methods that, facilitates the use of Swing. The Swing related classes are contained in javax.swing.tree and its sub packages, such as javax.swing.tree.

Swing is a large system, and it has many features. Swing provides toolbar, tool tips, and progress bars. Also swing component can provide a pluggable look and feel, which means that it is easy to substitute another appearance and behavior for an element. This can be also done dynamically. We may design our own look and feel. Because of the power of swing, it has become the approach of first choice by many programmers for creating GUIs.

15 | P a g e

Microsoft Access:
Microsoft Access, now known as Microsoft Office Access, is a database management system from Microsoft that combines the relational Microsoft Jet Database Engine with a graphical user interface and software-development tools. Software developers and data architects can use Microsoft Access to develop application software, and "power users" can use it to build software applications. Like other Office applications, Access is supported by Visual Basic for Applications, an object-oriented programming language that can reference a variety of objects including Data Access Objects, ActiveX Data Objects, and many other ActiveX components. Users can 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. Access also has report creation features that can work with any data source that Access can "access". In addition to using its own database storage file, Microsoft Access may also be used as the 'front-end' with other products as the 'back-end' tables, such as Microsoft SQL Server and non-Microsoft products such as Oracle and Sybase.

The developer is responsible for: Developing the system, which meets the SRS and solving all the requirements of the system. Demonstrating the system and installing the system at client's location after the acceptance testing is successful. Submitting the required user manual describing the system interfaces to work on it and also the documents of the system. Conducting any user training that might be needed for using the system. Maintaining the system for a period of one year after installation.

16 | P a g e

DATA FLOW DIAGRAM


PAYROLL MANAGEMENT SYSTEM

APPLY TO LOGIN

Denied Permission

APPROVE

Add,Modify,Delete

Access the Information

REGISTRATION
Report,View

DATABASE

EMPLOYEE MASTER (Add,Edit,Delete)

EMPLOYEE PAYSLIP

PAYROLL
SERVICES

ALLOWANCES/ DEDUCTIONS

REPORTS & SETTINGS

17 | P a g e

EMPLOYEE CODE

FIRST NAME

LAST NAME

DESIGNATION

ADDRESS

CONTACT NO.

EMPLOYEE

SALARY

BASIC

ALLOWANCES
(DA,HRA,WA)

DEDUCTIONS
(GPF,IT,GIS,PF,LIC)

18 | P a g e

CODING
List of Programs used in the Project:
LoginFrame.java MainMenu.java Addwindow.java Deletewindow.java Editwindow.java Emprptwindow.java Printwindow.java Settingswindow.java clsConnection.java clsSettings.java

19 | P a g e

LoginFrame.java
import import import import import import import import java.awt.*; java.awt.event.*; java.sql.*; java.io.*; java.util.*; java.net.*; javax.swing.*; 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 static Date td public LoginFrame() { panel1 = new JPanel(); panel1.setLayout(new FlowLayout()); nameLbl = new JLabel("WELCOME TO PAYROLL MANAGEMENT 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); = Toolkit.getDefaultToolkit().getScreenSize(); = new Date();

20 | P a g e

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!";

21 | P a g e

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(); } }

MainMenu.java
import import import import import import import import import import import import javax.swing.*; java.awt.*; java.awt.event.*; java.awt.Toolkit; java.io.*; java.sql.*; java.util.*; java.text.DateFormat; java.util.Date; java.text.*; java.lang.*; java.beans.PropertyVetoException;

public class MainMenu extends JFrame implements ActionListener{ JDesktopPane desktop = new JDesktopPane(); String sMSGBOX_TITLE = "Payroll Management 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 JMenuItem JMenuItem JMenuItem JMenuItem JMenuItem JMenuItem JMenuItem JMenuItem JMenuItem // JPanel JPanel panel_Bottom = new JPanel(); JPanel panel_Top = new JPanel(); itemExit = new JMenuItem(); itemAdd = new JMenuItem(); itemEdit = new JMenuItem(); itemDelete = new JMenuItem(); itemSettings = new JMenuItem(); itemCalculator = new JMenuItem(); itemNotePad = new JMenuItem(); itemEmprpt = new JMenuItem(); itemAuthor = new JMenuItem(); itemHelp = new JMenuItem();

22 | P a g e

// 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; Authorwindow FormAuthorwindow; Helpwindow FormHelpwindow; // Connection Variables Connection conn; // Date variables static Date td = new Date();

// String Variables static Statement stmtLogin; //Class Variables clsSettings settings

= new clsSettings(); = ""; = DateFormat.getDateTimeInstance().format(td);

//// User Details static String sUser static String sLogin

public MainMenu(String user, Date date) { super("PayRoll Accounting 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);

23 | P a g e

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() { menuFile.add(settings.setJMenuItem(itemExit,"Quit","images/exit.png")); itemExit.addActionListener(this); 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));

24 | P a g e

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")

25 | P a g e

{ 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;

26 | P a g e

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)

27 | P a g e

{ 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 method 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; } }

28 | P a g e

Addwindow.java
import import import import import import import java.awt.*; java.awt.event.*; java.io.*; java.sql.*; javax.swing.*; java.util.*; java.net.*; {

public class Addwindow extends JInternalFrame implements ActionListener //

Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); JFrame JFParentFrame; JDesktopPane desktop; private JPanel panel1; private JPanel panel2; private JButton AddBtn; private JButton ResetBtn; private JButton ExitBtn; private JLabel LblEmp_Code,LblEmp_Name1, LblEmp_Name2, LblEmp_Desi,LblEmp_Add,LblEmp_No; private JTextField TxtEmp_Code, TxtEmp_Name1, TxtEmp_Name2,TxtEmp_Add, TxtEmp_No; private JComboBox Emp_Type; String dialogmessage; String dialogs; int dialogtype = JOptionPane.PLAIN_MESSAGE; public static int record; String Emp_Code = ""; String Emp_Name1 = ""; String Emp_Name2 = ""; String Emp_Desi = ""; String Emp_Add = ""; String Emp_No = ""; // Class Variables clsSettings settings = new clsSettings(); clsConnection connect = new clsConnection(); Connection conn; public Addwindow(JFrame getParentFrame) { super("Add - Employee ",true,true,true,true); setSize(400,800); JFParentFrame = getParentFrame; panel1 = new JPanel(); panel1.setLayout(new GridLayout(7,7)); LblEmp_Code = new JLabel LblEmp_Name1 = new JLabel LblEmp_Name2 = new JLabel LblEmp_Desi = new JLabel LblEmp_Add = new JLabel LblEmp_No = new JLabel TxtEmp_Code = new JTextField(20); Emp_Type = new JComboBox(); Emp_Type.addActionListener(this); Emp_Type.setEditable(false); add_Cat_combo(Emp_Type); TxtEmp_Name1 = new JTextField(20); TxtEmp_Name2 = new JTextField(20); TxtEmp_Add = new JTextField(20); TxtEmp_No = new JTextField(20); panel1.add(LblEmp_Code); panel1.add(TxtEmp_Code); panel1.add(LblEmp_Desi); panel1.add(Emp_Type); panel1.add(LblEmp_Name1); panel1.add(TxtEmp_Name1); (" Employee Code :"); (" First Name (" Last Name (" Designation (" Address :"); (" Contact No :"); :"); :"); :");

29 | P a g e

panel1.add(LblEmp_Name2); panel1.add(TxtEmp_Name2); panel1.add(LblEmp_Add); panel1.add(TxtEmp_Add); panel1.add(LblEmp_No); panel1.add(TxtEmp_No); panel1.setOpaque(true); panel2 = new JPanel(); panel2.setLayout(new FlowLayout()); AddBtn = new JButton("Add"); ResetBtn = new JButton("Reset"); ExitBtn = new JButton("Exit"); panel2.add(AddBtn); AddBtn.addActionListener(this); panel2.add(ResetBtn); ResetBtn.addActionListener(this); panel2.add(ExitBtn); ExitBtn.addActionListener(this); panel2.setOpaque(true); getContentPane().setLayout(new GridLayout(2,1)); getContentPane().add(panel1,"CENTER"); getContentPane().add(panel2,"CENTER"); setFrameIcon(new ImageIcon( "images/backup.gif")); setDefaultCloseOperation(DISPOSE_ON_CLOSE); pack(); settings.Numvalidator(TxtEmp_No); } public void actionPerformed(ActionEvent event) { Object source = event.getSource(); if ( source.equals(Emp_Type)) { Emp_Desi = (String)Emp_Type.getSelectedItem(); } if(source.equals(AddBtn)) { Emp_Code = ""; Emp_Name1 = ""; Emp_Name2 = ""; Emp_Desi = ""; Emp_Add = ""; Emp_No = ""; Emp_Code = TxtEmp_Code.getText().trim(); Emp_Name1 = TxtEmp_Name1.getText().trim(); Emp_Name2 = TxtEmp_Name2.getText().trim(); Emp_Desi = (String)Emp_Type.getSelectedItem(); Emp_Add = TxtEmp_Add.getText().trim(); Emp_No = TxtEmp_No.getText().trim(); try { conn = connect.setConnection(conn,"",""); } catch(Exception e) { } try { Statement stmt = conn.createStatement(); if (!Emp_Code.equals("") && !Emp_Name1.equals("")&& !Emp_Name2.equals("")&& !Emp_Desi.equals("") && !Emp_Add.equals("") && !Emp_No.equals("") ) { String query = "SELECT * FROM EMPLOYEE WHERE Emp_Code='" + Emp_Code+"'"; ResultSet rs = stmt.executeQuery(query); int foundrec = 0;

30 | P a g e

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 EMPLOYEE VALUES ('"+Emp_Code +"','" +Emp_Name1 +"','" +Emp_Name2 +"','"+Emp_Desi +"','"+Emp_Add + "', '"+Emp_No + "')" ; int result = stmt.executeUpdate( temp ); if ( result == 1 ) { System.out.println("Recorded Added"); ResetRecord(); } else { dialogmessage = "Failed To Insert"; JOptionPane.showMessageDialog(null, "Failed To Insert in DataBase", "WARNING!!",JOptionPane.WARNING_MESSAGE); } }} else { dialogmessage = "Empty Record !!!"; 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); } } else if(source == ResetBtn) { ResetRecord(); } else if(source == ExitBtn) { setVisible (false); dispose(); }} private void ResetRecord() { TxtEmp_Code.setText(""); TxtEmp_Name1.setText(""); TxtEmp_Name2.setText(""); TxtEmp_Add.setText(""); TxtEmp_No.setText(""); } 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");

31 | P a g e

cmb.addItem(Txtcmb); } conn.close(); } catch(Exception ex) {} } }

Deletewindow.java
import import import import import import import java.awt.*; java.awt.event.*; java.io.*; java.sql.*; javax.swing.*; java.util.*; java.net.*; {

public class Deletewindow extends JInternalFrame implements ActionListener //

Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); JFrame JFParentFrame; JDesktopPane desktop; private JPanel panel1; private JPanel panel2; private JButton FindBtn; private JButton DeleteBtn; private JButton ExitBtn; private JLabel LblEmp_Code,LblEmp_Name1, LblEmp_Name2, LblEmp_Desi,LblEmp_Add,LblEmp_No; private JTextField TxtEmp_Code, TxtEmp_Name1, TxtEmp_Name2, TxtEmp_Desi,TxtEmp_Add, TxtEmp_No; String dialogmessage; String dialogs; int dialogtype = JOptionPane.PLAIN_MESSAGE;

clsSettings settings = new clsSettings(); clsConnection connect = new clsConnection(); Connection conn; public Deletewindow(JFrame getParentFrame) { super("Delete - Employee ",true,true,true,true); setSize(400,800); JFParentFrame = getParentFrame; panel1 = new JPanel(); panel1.setLayout(new GridLayout(7,7)); LblEmp_Code = new JLabel(" Employee Code :"); LblEmp_Name1 = new JLabel (" First Name :"); LblEmp_Name2 = new JLabel(" Last Name :"); LblEmp_Desi = new JLabel (" Designation :"); LblEmp_Add = new JLabel (" Address :"); LblEmp_No = new JLabel (" Contact No :"); TxtEmp_Code = new JTextField(20); TxtEmp_Name1 = new JTextField(20); TxtEmp_Name2 = new JTextField(20); TxtEmp_Desi = new JTextField(20); TxtEmp_Add = new JTextField(20); TxtEmp_No = new JTextField(20); TxtEmp_Name1.setEditable(false); TxtEmp_Name2.setEditable(false); TxtEmp_Desi.setEditable(false); TxtEmp_Add.setEditable(false); TxtEmp_No.setEditable(false); panel1.add(LblEmp_Code); panel1.add(TxtEmp_Code);

32 | P a g e

panel1.add(LblEmp_Name1); panel1.add(TxtEmp_Name1); panel1.add(LblEmp_Name2); panel1.add(TxtEmp_Name2); panel1.add(LblEmp_Desi); panel1.add(TxtEmp_Desi); panel1.add(LblEmp_Add); panel1.add(TxtEmp_Add); panel1.add(LblEmp_No); panel1.add(TxtEmp_No); panel2 = new JPanel(); panel2.setLayout(new FlowLayout()); FindBtn = new JButton("Find"); DeleteBtn = new JButton("Delete"); ExitBtn = new JButton("Exit"); panel2.add(FindBtn); FindBtn.addActionListener(this); panel2.add(DeleteBtn); DeleteBtn.addActionListener(this); panel2.add(ExitBtn); ExitBtn.addActionListener(this); panel2.setOpaque(true); getContentPane().setLayout(new GridLayout(2,1)); getContentPane().add(panel1,"CENTER"); getContentPane().add(panel2,"CENTER"); setFrameIcon(new ImageIcon( "images/backup.gif")); setDefaultCloseOperation(DISPOSE_ON_CLOSE); pack(); settings.Numvalidator(TxtEmp_No);} public void actionPerformed(ActionEvent event) { Object source = event.getSource(); String sEmp_Code = ""; String sEmp_Name1 = ""; String sEmp_Name2 = ""; String sEmp_Desi = ""; String sEmp_Add = ""; String sEmp_No = ""; if(source.equals(FindBtn)) { sEmp_Code = TxtEmp_Code.getText().trim(); try { conn = connect.setConnection(conn,"",""); } catch(Exception e) { } try {Statement stmt = conn.createStatement(); if (!sEmp_Code.equals("")); String query = "SELECT * FROM EMPLOYEE WHERE Emp_Code='" + sEmp_Code +"'"; ResultSet rs = stmt.executeQuery(query); int foundrec = 0; while (rs.next()) { ResultSetMetaData rsmd = rs.getMetaData(); int columnCount = rsmd.getColumnCount(); sEmp_Name1 = rs.getString(2).trim(); sEmp_Name2 = rs.getString(3).trim(); sEmp_Desi = rs.getString(4).trim(); sEmp_Add = rs.getString(5).trim(); sEmp_No = rs.getString(6).trim(); TxtEmp_Name1.setText(sEmp_Name1); TxtEmp_Name2.setText(sEmp_Name2); TxtEmp_Desi.setText(sEmp_Desi);

33 | P a g e

TxtEmp_Add.setText(sEmp_Add); TxtEmp_No.setText(sEmp_No); foundrec = 1} if (foundrec == 0) { dialogmessage = "No Such Employuee"; dialogtype = JOptionPane.WARNING_MESSAGE; JOptionPane.showMessageDialog((Component)null, dialogmessage, dialogs, dialogtype); ResetRecord(); } conn.close();} catch(Exception e) { System.out.println("\nUnknown Error"); } } else if(source.equals(DeleteBtn)) { int DResult = JOptionPane.showConfirmDialog((Component) null,"Are you sure you want to delete Record?"); if (DResult == JOptionPane.NO_OPTION) { ResetRecord(); if (DResult == JOptionPane.YES_OPTION) { try { conn = connect.setConnection(conn,"",""); } catch(Exception e) { } try { Statement stmt = conn.createStatement(); sEmp_Code = TxtEmp_Code.getText().trim(); if ( !sEmp_Code.equals("")) { String temp = "DELETE from EMPLOYEE " +" WHERE Emp_Code= '" + sEmp_Code + "'"; int result = stmt.executeUpdate( temp ); if ( result == 1 ) { dialogmessage = "Employee Record Deleted!!!"; dialogtype = JOptionPane.WARNING_MESSAGE; JOptionPane.showMessageDialog((Component)null, dialogmessage, dialogs, dialogtype); ResetRecord(); } else { dialogmessage = "No Such Employuee"; dialogtype = JOptionPane.WARNING_MESSAGE; JOptionPane.showMessageDialog((Component)null, dialogmessage, dialogs, dialogtype); ResetRecord(); } } conn.close(); } catch(Exception e) { System.out.println("\nUnknown Error" + e); } } }

34 | P a g e

else if(source == ExitBtn) { setVisible (false); dispose();} } private void ResetRecord() { TxtEmp_Code.setText(""); TxtEmp_Name1.setText(""); TxtEmp_Name2.setText(""); TxtEmp_Desi.setText(""); TxtEmp_Add.setText(""); TxtEmp_No.setText(""); } }

Editwindow.java
import import import import import import import java.awt.*; java.awt.event.*; java.io.*; java.sql.*; javax.swing.*; java.util.*; java.net.*; {

public class Editwindow extends JInternalFrame implements ActionListener

JFrame JFParentFrame; JDesktopPane desktop; private JPanel panel1; private JPanel panel2; private JButton FindBtn; private JButton EditBtn; private JButton ExitBtn; private JLabel LblEmp_Code,LblEmp_Name1, LblEmp_Name2, LblEmp_Desi,LblEmp_Add,LblEmp_No; private JTextField TxtEmp_Code, TxtEmp_Name1, TxtEmp_Name2, TxtEmp_Desi,TxtEmp_Add, TxtEmp_No; int dialogtype = JOptionPane.PLAIN_MESSAGE; String dialogmessage; String dialogs; private JComboBox Emp_Type; clsSettings settings = new clsSettings(); clsConnection connect = new clsConnection(); Connection conn; public Editwindow(JFrame getParentFrame) { super("Edit - Employee ",true,true,true,true); setSize(400,800); JFParentFrame = getParentFrame; panel1 = new JPanel(); panel1.setLayout(new GridLayout(7,7)); LblEmp_Code = new JLabel(" Employee Code :"); LblEmp_Desi = new JLabel(" Designation :"); LblEmp_Name1 = new JLabel (" First Name :"); LblEmp_Name2 = new JLabel (" Last Name :"); LblEmp_Add = new JLabel(" Address :"); LblEmp_No = new JLabel (" Contact No :"); TxtEmp_Code = new JTextField(20); Emp_Type = new JComboBox(); Emp_Type.addActionListener(this); Emp_Type.setEditable(false); add_Cat_combo(Emp_Type); TxtEmp_Name1 = new JTextField(20); TxtEmp_Name2 = new JTextField(20); TxtEmp_Add = new JTextField(20);

35 | P a g e

TxtEmp_No = new JTextField(20); TxtEmp_Name1.setEditable(false); TxtEmp_Name2.setEditable(false); TxtEmp_Add.setEditable(false); TxtEmp_No.setEditable(false); panel1.add(LblEmp_Code); panel1.add(TxtEmp_Code); panel1.add(LblEmp_Desi); panel1.add(Emp_Type); panel1.add(LblEmp_Name1); panel1.add(TxtEmp_Name1); panel1.add(LblEmp_Name2); panel1.add(TxtEmp_Name2); panel1.add(LblEmp_Add); panel1.add(TxtEmp_Add); panel1.add(LblEmp_No); panel1.add(TxtEmp_No); panel2 = new JPanel(); panel2.setLayout(new FlowLayout()); FindBtn = new JButton("Find"); EditBtn = new JButton("Edit"); ExitBtn = new JButton("Exit"); panel2.add(FindBtn); FindBtn.addActionListener(this); panel2.add(EditBtn); EditBtn.addActionListener(this); panel2.add(ExitBtn); ExitBtn.addActionListener(this); panel2.setOpaque(true); getContentPane().setLayout(new GridLayout(2,1)); getContentPane().add(panel1,"CENTER"); getContentPane().add(panel2,"CENTER"); setFrameIcon(new ImageIcon( "images/backup.gif")); setDefaultCloseOperation(DISPOSE_ON_CLOSE); pack(); settings.Numvalidator(TxtEmp_No);} public void actionPerformed(ActionEvent event) { Object source = event.getSource(); String sEmp_Code = ""; String sEmp_Name1 = ""; String sEmp_Name2 = ""; String sEmp_Desi = ""; String sEmp_Add = ""; String sEmp_No = ""; if(source.equals(FindBtn)) { sEmp_Code = TxtEmp_Code.getText().trim(); try { conn = connect.setConnection(conn,"",""); } catch(Exception e) { } try { Statement stmt = conn.createStatement(); if (!sEmp_Code.equals("")) { String query = "SELECT * FROM EMPLOYEE WHERE Emp_Code='" + sEmp_Code +"'"; ResultSet rs = stmt.executeQuery(query); int foundrec = 0; while (rs.next()) { sEmp_Name1 = rs.getString(2).trim(); sEmp_Name2 = rs.getString(3).trim(); sEmp_Desi = rs.getString(4).trim();

36 | P a g e

sEmp_Add = rs.getString(5).trim(); sEmp_No = rs.getString(6).trim(); TxtEmp_Name1.setText(sEmp_Name1); TxtEmp_Name1.setEditable(true); TxtEmp_Name2.setText(sEmp_Name2); TxtEmp_Name2.setEditable(true); Emp_Type.setSelectedItem(sEmp_Desi); TxtEmp_Add.setText(sEmp_Add); TxtEmp_Add.setEditable(true); TxtEmp_No.setText(sEmp_No); TxtEmp_No.setEditable(true); foundrec = 1;} if (foundrec == 0) { dialogmessage = "No Such Employuee"; dialogtype = JOptionPane.WARNING_MESSAGE; JOptionPane.showMessageDialog((Component)null, dialogmessage, dialogs, dialogtype); ResetRecord();}} else { dialogmessage = "No Blank Field Allowed"; dialogtype = JOptionPane.WARNING_MESSAGE; JOptionPane.showMessageDialog((Component)null, dialogmessage, dialogs, dialogtype); ResetRecord(); } conn.close(); } catch(Exception e) { System.out.println("\nUnknown Error"); } } else if(source == EditBtn) { sEmp_Code = TxtEmp_Code.getText().trim(); sEmp_Name1 = TxtEmp_Name1.getText().trim(); sEmp_Name2 = TxtEmp_Name2.getText().trim(); sEmp_Desi = (String)Emp_Type.getSelectedItem(); sEmp_Add = TxtEmp_Add.getText().trim(); sEmp_No = TxtEmp_No.getText().trim(); try { conn = connect.setConnection(conn,"",""); } catch(Exception e) { } try { Statement stmt = conn.createStatement(); if (!sEmp_Code.equals("") && !sEmp_Name1.equals("")&& !sEmp_Name2.equals("")&& !sEmp_Desi.equals("") && !sEmp_Add.equals("") && !sEmp_No.equals("") ) { String temp ="UPDATE EMPLOYEE SET "+"Emp_Code = '"+sEmp_Code+ "',Emp_Name1 = '"+sEmp_Name1+"',Emp_Name2 = '"+sEmp_Name2+ "',Emp_Desi = '"+sEmp_Desi+"',Emp_Add = '"+sEmp_Add+ "',Emp_No = '"+sEmp_No+"'"+WHERE Emp_Code = '" +sEmp_Code+"'"; int result = stmt.executeUpdate( temp ); if (result == 1) { dialogmessage = "Record Updated!!!"; dialogtype = JOptionPane.INFORMATION_MESSAGE; JOptionPane.showMessageDialog((Component)null, dialogmessage, dialogs, dialogtype); ResetRecord();

37 | P a g e

} else { dialogmessage = "NO SUCH EMPLOYEE!!!"; dialogtype = JOptionPane.WARNING_MESSAGE; JOptionPane.showMessageDialog((Component)null, dialogmessage, dialogs, dialogtype); }} else { dialogmessage = "NULL VALUES OCCURED IN TEXTFIELD!!!"; dialogtype = JOptionPane.WARNING_MESSAGE; JOptionPane.showMessageDialog((Component)null, dialogmessage, dialogs, dialogtype); ResetRecord(); } conn.close(); } catch(Exception ex) { JOptionPane.showMessageDialog(null,"GENERAL EXCEPTION", "WARNING!!!",JOptionPane.INFORMATION_MESSAGE); System.out.println("Error in Edi Btn" + ex); } } else if(source == ExitBtn) { setVisible (false); dispose(); } } private void ResetRecord() { TxtEmp_Code.setText(""); TxtEmp_Name1.setText(""); TxtEmp_Name2.setText(""); TxtEmp_Add.setText(""); TxtEmp_No.setText(""); } 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(); cmb.addItem(Txtcmb); } conn.close(); } catch(Exception ex) { }}}

38 | P a g e

Emprptwindow.java
import import import import import import import import import import import java.awt.*; java.awt.event.*; javax.swing.*; java.sql.*; java.io.*; java.util.*; java.net.*; java.lang.String; java.awt.print.*; java.text.DateFormat; java.util.Date;

public class Emprptwindow extends JInternalFrame implements ActionListener { JFrame JFParentFrame; static Date td = new Date(); static String sDate = DateFormat.getDateTimeInstance().format(td); private private private private private private private private private private private private private private private private private private JPanel JPanel JPanel JPanel JPanel JPanel JPanel JPanel JPanel JPanel JPanel JPanel JPanel JPanel JPanel JPanel JPanel JPanel panel1; panel2; panel3; panel4; panel5; panel5_1; panel5_2; panel6; panel6_1; panel6_2; panel7; panel8_1; panel9; panel10; panel11; panel12; panel13; panel14;

private JButton GenerateBtn; private JButton PrintBtn; private JButton ExitBtn; private JTextField TxtCategory_Type,TxtCategory_Name; private JComboBox MonthCombo; private JTextField TxtYear; private JLabel LblMonth; private String[] Month_Name = {"January", "February","March","April","May", "June","July","August","September","October","November","December"}; String dialogmessage; String dialogs; int dialogtype = JOptionPane.PLAIN_MESSAGE; public static int record; clsSettings settings = new clsSettings(); clsConnection connect = new clsConnection(); Connection conn; private JLabel Lblcollege1, Lblcollege2, Lblcollege3, Lbldate, LblSalary_Slip; private JLabel LblEmp_Name, LblEmp_Code, LblEmp_Desi, LblBasic_Pay, LblAllowance, LblDeduction; private JLabel LblDA, LblHRA, LblWA, LblGPF, LblIT, LblGIS, LblPF, LblLIC; private JLabel LblTot_Allowance, LblTot_Deduction, LblNet_Salary; private JTextField TxtDate, TxtEmp_Name1, TxtEmp_Name2 , TxtEmp_Code,TxtSalary_Month, TxtEmp_Desi, TxtBasic_Pay; private JTextField TxtDA, TxtHRA, TxtWA, TxtGPF, TxtIT, TxtGIS, TxtPF, TxtLIC; private JTextField TxtTot_Allowance, TxtTot_Deduction, TxtNet_Salary; public public public public String String String String sEmp_Code = ""; sEmp_Name1 = ""; sEmp_Name2 = ""; sEmp_Desi = "";

39 | P a g e

public public public public public public public public public public public public public public public public public public public public public public

String String String String String String String String String String String String String String String String String String String String String String

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 = ""; sAllow = ""; sDedu = ""; sNet_Salary = "";

public String Emp_Month; public String Emp_Year; public static int vBasic_Pay, DA_Rs, HRA_Rs ,WA_Rs , GPF_Rs, IT_Rs, GIS_Rs, PF_Rs, LIC_Rs; public static int DA_Value,HRA_Value, WA_Value, GPF_Value, IT_Value, GIS_Value, PF_Value, LIC_Value; public static int Allow, Dedu, Net_Salary; public Emprptwindow(JFrame getParentFrame) { super("Employee PaySlip",true,true,true,true); setSize(600,700); JFParentFrame = getParentFrame; panel1 = new JPanel(); panel1.setLayout(new FlowLayout()); LblEmp_Code = new JLabel("Employee Code: "); TxtEmp_Code = new JTextField(10); LblMonth = new JLabel("For the Month :"); MonthCombo = new JComboBox(); MonthCombo.addActionListener(this); for ( int i = 0; i <= 11; i++ ) { MonthCombo.addItem(Month_Name[i]); } TxtYear = new JTextField(5); panel1.add(LblEmp_Code); panel1.add(TxtEmp_Code); panel1.add(LblMonth); panel1.add(MonthCombo); panel1.add(TxtYear); panel2 = new JPanel(); panel2.setLayout(new FlowLayout()); LblEmp_Name = new JLabel("Employee Name :"); TxtEmp_Name1 = new JTextField(10); TxtEmp_Name2 = new JTextField(10); TxtEmp_Name1.setEditable(false); TxtEmp_Name2.setEditable(false); panel2.add(LblEmp_Name); panel2.add(TxtEmp_Name1); panel2.add(TxtEmp_Name2); panel3 = new JPanel(); panel3.setLayout(new FlowLayout());

40 | P a g e

LblEmp_Desi = new JLabel("Designation :"); TxtEmp_Desi = new JTextField(20); TxtEmp_Desi.setEditable(false); panel3.add(LblEmp_Desi); panel3.add(TxtEmp_Desi); panel4 = new JPanel(); panel4.setLayout(new FlowLayout()); GenerateBtn = new JButton("Generate"); GenerateBtn.addActionListener(this); panel4.add(GenerateBtn); Lblcollege2 = new JLabel("NIIS INSTITUTE BHUBANESWAR"); Lbldate = new JLabel (" Date :"); LblSalary_Slip = new JLabel (" Salary Slip :"); LblBasic_Pay = new JLabel (" Basic Pay :"); LblAllowance = new JLabel ("********** A L L O W A LblDeduction = new JLabel ("********** D E D U C T LblDA = new JLabel (" DA :"); LblHRA = new JLabel (" HRA :"); LblWA = new JLabel (" WA :"); LblGPF = new JLabel (" GPF :"); LblIT = new JLabel (" IT :"); LblGIS = new JLabel (" GIS :"); LblPF = new JLabel (" PF :"); LblLIC = new JLabel (" LIC :"); LblTot_Allowance = new JLabel(" Total Allowances :"); LblTot_Deduction = new JLabel(" Total Deduction :"); LblNet_Salary = new JLabel (" Net Salary :"); TxtDate = new JTextField(10); TxtSalary_Month = new JTextField(20); TxtBasic_Pay = new JTextField(10); TxtDA = new JTextField(5); TxtHRA = new JTextField(5); TxtWA = new JTextField(5); TxtGPF = new JTextField(5); TxtIT = new JTextField(5); TxtGIS = new JTextField(5); TxtPF = new JTextField(5); TxtLIC = new JTextField(5); TxtTot_Allowance = new JTextField(6); TxtTot_Deduction = new JTextField(6); TxtNet_Salary = new JTextField(6); TxtDate.setEditable(false); TxtSalary_Month.setEditable(false); TxtBasic_Pay.setEditable(false); TxtDA.setEditable(false); TxtHRA.setEditable(false); TxtWA.setEditable(false); TxtGPF.setEditable(false); TxtIT.setEditable(false); TxtGIS.setEditable(false); TxtPF.setEditable(false); TxtLIC.setEditable(false); TxtTot_Allowance.setEditable(false); TxtTot_Deduction.setEditable(false); TxtNet_Salary.setEditable(false); panel5 = new JPanel(); panel5.setLayout(new FlowLayout()); panel5.add(Lblcollege2, BorderLayout.CENTER); panel5_1 = new JPanel(); panel5_1.setLayout(new GridLayout(3,3)); panel5_1.add(Lbldate); panel5_1.add(TxtDate); panel5_1.add(LblSalary_Slip, "CENTER"); panel5_1.add(TxtSalary_Month,"RIGHT");

N I

C O

E ********"); N ********");

41 | P a g e

panel5_1.add(LblBasic_Pay,"LEFT"); panel5_1.add(TxtBasic_Pay,"CENTER"); panel7 = new JPanel(); panel7.setLayout(new FlowLayout()); panel7.add(LblAllowance, "CENTER"); panel8_1 = new JPanel(); panel8_1.setLayout(new GridLayout(3,2)); panel8_1.add(LblDA); panel8_1.add(TxtDA); panel8_1.add(LblHRA); panel8_1.add(TxtHRA); panel8_1.add(LblWA); panel8_1.add(TxtWA); panel9 = new JPanel(); panel9.setLayout(new GridLayout(1,3)); panel9.add(LblTot_Allowance, "EAST"); panel9.add(TxtTot_Allowance, "EAST"); panel10 = new JPanel(); panel10.setLayout(new FlowLayout()); panel10.add(LblDeduction, "CENTER"); panel11 = new JPanel(); panel11.setLayout(new GridLayout(5,5)); panel11.add(LblGPF); panel11.add(TxtGPF); panel11.add(LblIT); panel11.add(TxtIT); panel11.add(LblGIS); panel11.add(TxtGIS); panel11.add(LblPF); panel11.add(TxtPF); panel11.add(LblLIC); panel11.add(TxtLIC); panel12 = new JPanel(); panel12.setLayout(new GridLayout(1,3)); panel12.add(LblTot_Deduction); panel12.add(TxtTot_Deduction); panel13 = new JPanel(); panel13.setLayout(new FlowLayout()); panel13.add(LblNet_Salary); panel13.add(TxtNet_Salary); panel14 = new JPanel(); panel14.setLayout(new FlowLayout()); PrintBtn = new JButton("Preview", new ImageIcon("images/prints.png")); PrintBtn.addActionListener(this); ExitBtn = new JButton("Exit", new ImageIcon("images/exit.png")); ExitBtn.addActionListener(this); panel14.add(PrintBtn); panel14.add(ExitBtn); Container pane = getContentPane(); pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS)); pane.add(panel1); pane.add(panel2); pane.add(panel3); pane.add(panel4); pane.add(panel5); pane.add(panel5_1); pane.add(panel7); pane.add(panel8_1); pane.add(panel9); pane.add(panel10); pane.add(panel11);

42 | P a g e

pane.add(panel12); pane.add(panel13); pane.add(panel14); setFrameIcon(new ImageIcon( "images/New.gif")); setDefaultCloseOperation(DISPOSE_ON_CLOSE); pack(); } public void actionPerformed(ActionEvent event) { Object source = event.getSource(); if ( source { String Emp_Month = (String)MonthCombo.getSelectedItem(); == MonthCombo)

} if (source == PrintBtn) { printwindow prn = new printwindow(); prn.fill_data(sEmp_Name1,sEmp_Name2,Emp_Month, Emp_Year,sEmp_Code,sDate, sEmp_Desi, sBasic_Pay, sDA_Allow, sHRA_Allow, sWA_Allow, sGPF_Dedu, sIT_Dedu, sGIS_Dedu, sPF_Dedu,sLIC_Dedu , sAllow, sDedu, sNet_Salary ); } if (source == GenerateBtn) { sEmp_Code = TxtEmp_Code.getText().trim(); Get_Data(sEmp_Code); Generate_Report(sEmp_Desi); } if (source == ExitBtn) { setVisible (false); dispose(); }} public void Get_Data(String code) { try { conn = connect.setConnection(conn,"",""); } catch(Exception e) { } try { Statement stmt = conn.createStatement(); if (!code.equals("")) { String query = "SELECT * FROM EMPLOYEE WHERE Emp_Code = '" + code +"'"; ResultSet rs = stmt.executeQuery(query); int foundrec = 0; while (rs.next()) { sEmp_Code = code; sEmp_Name1 = rs.getString(2).trim(); sEmp_Name2 = rs.getString(3).trim(); sEmp_Desi = rs.getString(4).trim(); Emp_Month = (String)MonthCombo.getSelectedItem(); Emp_Year = TxtYear.getText().trim(); foundrec = 1; } if (foundrec == 0) { dialogmessage = "No Such Employuee"; dialogtype = JOptionPane.WARNING_MESSAGE; JOptionPane.showMessageDialog((Component)null, dialogmessage, dialogs, dialogtype); } } else dialogmessage = "No Blank Field Allowed";

43 | P a g e

dialogtype = JOptionPane.WARNING_MESSAGE; JOptionPane.showMessageDialog((Component)null, dialogmessage, dialogs, dialogtype); { } catch(Exception e) { System.out.println("\nUnknown Error at Genrate_Data"); } } public void Generate_Report(String Desi) { try { conn = connect.setConnection(conn,"",""); } catch(Exception e) { } try { Statement stmt = conn.createStatement(); if (!Desi.equals("")) { String query = "SELECT * FROM Settings WHERE Category_Name = '" + Desi +"'"; ResultSet rs = stmt.executeQuery(query); int foundrec = 0; while (rs.next()) { sCategory_Type = rs.getString(1).trim(); sCategory_Name = rs.getString(2).trim(); vBasic_Pay = rs.getInt(3); 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(); DA_Value = rs.getInt(12); HRA_Value = rs.getInt(13); WA_Value = rs.getInt(14); GPF_Value = rs.getInt(15); IT_Value = rs.getInt(16); GIS_Value = rs.getInt(17); PF_Value = rs.getInt(18); LIC_Value = rs.getInt(19); if (sDA.equals("true") ) { DA_Rs = vBasic_Pay*DA_Value/100; } else { DA_Rs = DA_Value; } if (sHRA.equals("true")) { HRA_Rs = (vBasic_Pay * HRA_Value) / 100; } else { HRA_Rs = HRA_Value; } if (sWA.equals("true")) { WA_Rs = (vBasic_Pay * WA_Value) / 100; } else { WA_Rs = WA_Value; } if (sGPF.equals("true"))

44 | P a g e

{ GPF_Rs = (vBasic_Pay * GPF_Value) / 100; } else { GPF_Rs = GPF_Value; } if (sIT.equals("true")) { IT_Rs = (vBasic_Pay * IT_Value) / 100; } else { IT_Rs = IT_Value; } if (sGIS.equals("true")) { GIS_Rs = (vBasic_Pay * GIS_Value) / 100; } else { GIS_Rs = GIS_Value; } if (sPF.equals("true")) {PF_Rs = (vBasic_Pay * PF_Value) / 100; } else { PF_Rs = PF_Value; } if (sLIC.equals("true")) { LIC_Rs = (vBasic_Pay * LIC_Value) / 100; } else { LIC_Rs = LIC_Value; } Allow = DA_Rs + HRA_Rs + WA_Rs; Dedu = GPF_Rs + IT_Rs + GIS_Rs + PF_Rs + LIC_Rs; Net_Salary = (vBasic_Pay + Allow) - Dedu ; sBasic_Pay = Integer.toString(vBasic_Pay); sDA_Allow = Integer.toString(DA_Rs); sHRA_Allow = Integer.toString(HRA_Rs); sWA_Allow = Integer.toString(WA_Rs); sGPF_Dedu = Integer.toString(GPF_Rs); sIT_Dedu = Integer.toString(IT_Rs); sGIS_Dedu = Integer.toString(GIS_Rs); sPF_Dedu = Integer.toString(PF_Rs); sLIC_Dedu = Integer.toString(LIC_Rs); sAllow = Integer.toString(Allow); sDedu = Integer.toString(Dedu); sNet_Salary = Integer.toString(Net_Salary); ///// Feeding values to the form TxtDate.setText(sDate); TxtEmp_Name1.setText(sEmp_Name1); TxtEmp_Name2.setText(sEmp_Name2); TxtSalary_Month.setText("For the Month of " + Emp_Month + " , " + Emp_Year); TxtEmp_Code.setText(sEmp_Code); TxtEmp_Desi.setText(sEmp_Desi); TxtBasic_Pay.setText(sBasic_Pay); TxtDA.setText(sDA_Allow); TxtHRA.setText(sHRA_Allow); TxtWA.setText(sWA_Allow); TxtTot_Allowance.setText(sAllow); TxtGPF.setText(sGPF_Dedu); TxtIT.setText(sIT_Dedu); TxtGIS.setText(sGIS_Dedu); TxtPF.setText(sPF_Dedu);

45 | P a g e

TxtLIC.setText(sLIC_Dedu); TxtTot_Deduction.setText(sDedu); TxtNet_Salary.setText(sNet_Salary); foundrec = 1; } if (foundrec == 0) { dialogmessage = "No Such Employuee"; dialogtype = JOptionPane.WARNING_MESSAGE; JOptionPane.showMessageDialog((Component)null, dialogmessage, dialogs, dialogtype); } } else { dialogmessage = "No Blank Field Allowed"; dialogtype = JOptionPane.WARNING_MESSAGE; JOptionPane.showMessageDialog((Component)null, dialogmessage, dialogs, dialogtype); } conn.close(); } catch(Exception e) { System.out.println("\nUnknown Errorat Generate -report"); } }

Printwindow.java
import import import import import import import import import java.awt.*; java.awt.event.*; javax.swing.*; java.sql.*; java.io.*; java.util.*; java.net.*; java.lang.String; java.awt.print.*; {

public class printwindow extends JFrame implements ActionListener , Printable private private private private private private private private private private private private private private private private private private JPanel JPanel JPanel JPanel JPanel JPanel JPanel JPanel JPanel JPanel JPanel JPanel JPanel JPanel JPanel JPanel JPanel JPanel panel1; panel2; panel3; panel4; panel5; panel5_1; panel5_2; panel6; panel6_1; panel6_2; panel7; panel8_1; panel9; panel10; panel11; panel12; panel13; panel14;

private JTextField TxtYear; private JLabel LblMonth;

46 | P a g e

// Class Variables // clsSettings settings = new clsSettings(); //clsConnection connect = new clsConnection(); // Connection //Connection conn; private private private private JLabel JLabel JLabel JLabel Lblcollege2, Lbldate, LblSalary_Slip; LblEmp_Name, LblEmp_Code, LblEmp_Desi, LblBasic_Pay, LblAllowance, LblDeduction; LblDA, LblHRA, LblWA, LblGPF, LblIT, LblGIS, LblPF, LblLIC; LblTot_Allowance, LblTot_Deduction, LblNet_Salary;

private JTextField TxtDate, TxtEmp_Name1, TxtEmp_Name2 , TxtEmp_Code,TxtSalary_Month, TxtEmp_Desi, TxtBasic_Pay; private JTextField TxtDA, TxtHRA, TxtWA, TxtGPF, TxtIT, TxtGIS, TxtPF, TxtLIC; private JTextField TxtTot_Allowance, TxtTot_Deduction, TxtNet_Salary; private JButton PrintBtn, ExitBtn; public printwindow() { setSize(600,700); setVisible(true); panel1 = new JPanel(); panel1.setLayout(new FlowLayout()); LblEmp_Code = new JLabel("Employee Code: "); TxtEmp_Code = new JTextField(10); LblMonth = new JLabel("For the Month :"); TxtYear = new JTextField(5); panel1.add(LblEmp_Code); panel1.add(TxtEmp_Code); TxtEmp_Code.setEditable(false); panel2 = new JPanel(); panel2.setLayout(new FlowLayout()); LblEmp_Name = new JLabel("Employee Name :"); TxtEmp_Name1 = new JTextField(10); TxtEmp_Name2 = new JTextField(10); TxtEmp_Name1.setEditable(false); TxtEmp_Name2.setEditable(false); panel2.add(LblEmp_Name); panel2.add(TxtEmp_Name1); panel2.add(TxtEmp_Name2); panel3 = new JPanel(); panel3.setLayout(new FlowLayout()); LblEmp_Desi = new JLabel("Designation :"); TxtEmp_Desi = new JTextField(20); TxtEmp_Desi.setEditable(false); panel3.add(LblEmp_Desi); panel3.add(TxtEmp_Desi); panel4 = new JPanel(); panel4.setLayout(new FlowLayout()); Lblcollege2 = new JLabel("NIIS INSTITUTE BHUBANESWAR"); Lbldate = new JLabel (" Date :"); LblSalary_Slip = new JLabel (" Salary Slip :"); LblBasic_Pay = new JLabel (" Basic Pay :"); LblAllowance = new JLabel ("********** A L L O W LblDeduction = new JLabel ("********** D E D U C LblDA = new JLabel (" DA :"); LblHRA = new JLabel (" HRA :"); LblWA = new JLabel (" WA :");

A T

N I

C O

E ********"); N ********");

47 | P a g e

LblGPF = new JLabel (" LblIT = new JLabel (" LblGIS = new JLabel (" LblPF = new JLabel (" LblLIC = new JLabel (" LblTot_Allowance = new JLabel(" LblTot_Deduction = new JLabel(" LblNet_Salary = new JLabel (" TxtDate = new JTextField(10);

GPF :"); IT :"); GIS :"); PF :"); LIC :"); Total Allowances :"); Total Deduction :"); Net Salary :");

TxtSalary_Month = new JTextField(20); TxtBasic_Pay = new JTextField(10); TxtDA = new JTextField(5); TxtHRA = new JTextField(5); TxtWA = new JTextField(5); TxtGPF = new JTextField(5); TxtIT = new JTextField(5); TxtGIS = new JTextField(5); TxtPF = new JTextField(5); TxtLIC = new JTextField(5); TxtTot_Allowance = new JTextField(6); TxtTot_Deduction = new JTextField(6); TxtNet_Salary = new JTextField(6); TxtDate.setEditable(false); TxtSalary_Month.setEditable(false); TxtBasic_Pay.setEditable(false); TxtDA.setEditable(false); TxtHRA.setEditable(false); TxtWA.setEditable(false); TxtGPF.setEditable(false); TxtIT.setEditable(false); TxtGIS.setEditable(false); TxtPF.setEditable(false); TxtLIC.setEditable(false); TxtTot_Allowance.setEditable(false); TxtTot_Deduction.setEditable(false); TxtNet_Salary.setEditable(false); PrintBtn = new JButton("Print", new ImageIcon("images/printss.gif")); ExitBtn = new JButton ("Exit", new ImageIcon("images/exits.gif")); PrintBtn.addActionListener(this); ExitBtn.addActionListener(this); panel5 = new JPanel(); panel5.setLayout(new FlowLayout()); panel5.add(Lblcollege2, BorderLayout.CENTER); panel5_1 = new JPanel(); panel5_1.setLayout(new GridLayout(3,3)); panel5_1.add(Lbldate); panel5_1.add(TxtDate); panel5_1.add(LblSalary_Slip, "CENTER"); panel5_1.add(TxtSalary_Month,"RIGHT");

panel5_1.add(LblBasic_Pay,"LEFT"); panel5_1.add(TxtBasic_Pay,"CENTER"); panel7 = new JPanel(); panel7.setLayout(new FlowLayout()); panel7.add(LblAllowance, "CENTER"); panel8_1 = new JPanel();

48 | P a g e

panel8_1.setLayout(new GridLayout(3,2)); panel8_1.add(LblDA); panel8_1.add(TxtDA); panel8_1.add(LblHRA); panel8_1.add(TxtHRA); panel8_1.add(LblWA); panel8_1.add(TxtWA); panel9 = new JPanel(); panel9.setLayout(new GridLayout(1,3)); panel9.add(LblTot_Allowance, "EAST"); panel9.add(TxtTot_Allowance, "EAST"); panel10 = new JPanel(); panel10.setLayout(new FlowLayout()); panel10.add(LblDeduction, "CENTER"); panel11 = new JPanel(); panel11.setLayout(new GridLayout(5,5)); panel11.add(LblGPF); panel11.add(TxtGPF); panel11.add(LblIT); panel11.add(TxtIT); panel11.add(LblGIS); panel11.add(TxtGIS); panel11.add(LblPF); panel11.add(TxtPF); panel11.add(LblLIC); panel11.add(TxtLIC); panel12 = new JPanel(); panel12.setLayout(new GridLayout(1,3)); panel12.add(LblTot_Deduction); panel12.add(TxtTot_Deduction); panel13 = new JPanel(); panel13.setLayout(new FlowLayout()); panel13.add(LblNet_Salary); panel13.add(TxtNet_Salary); panel14 = new JPanel(); panel14.setLayout(new FlowLayout()); panel14.add(PrintBtn); panel14.add(ExitBtn); Container pane = getContentPane(); pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS)); pane.add(panel1); pane.add(panel2); pane.add(panel3); pane.add(panel4); pane.add(panel5); pane.add(panel5_1); pane.add(panel7); pane.add(panel8_1); pane.add(panel9); pane.add(panel10); pane.add(panel11); pane.add(panel12); pane.add(panel13); pane.add(panel14); pack(); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } });

49 | P a g e

} public void actionPerformed(ActionEvent event) { Object source = event.getSource();

if (source == PrintBtn) { PrintBtn.setVisible(false); ExitBtn.setVisible(false); PrinterJob printJob = PrinterJob.getPrinterJob(); // Get and change default page format settings if necessary. printJob.setPrintable(this); if (printJob.printDialog()) { try { printJob.print(); } catch (Exception PrintException) { PrintException.printStackTrace(); }

printJob.cancel(); } printJob.cancel(); PrintBtn.setVisible(true); ExitBtn.setVisible(true); } if (source == ExitBtn) { setVisible (false); dispose(); } } public void fill_data(String name1, String name2, String month, String year, String code, String date, String desi, String basic_pay, String da,String hra, String wa, String gpf, String it,String gis, String pf, String lic, String allow, String dedu, String net_salary ) { TxtEmp_Name1.setText(name1); TxtEmp_Name2.setText(name2); TxtSalary_Month.setText("For the Month of " + month + " , " + year); TxtEmp_Code.setText(code); TxtDate.setText(date); TxtEmp_Desi.setText(desi); TxtBasic_Pay.setText(basic_pay); TxtDA.setText(da); TxtHRA.setText(hra); TxtWA.setText(wa); TxtTot_Allowance.setText(allow); TxtGPF.setText(gpf); TxtIT.setText(it); TxtGIS.setText(gis); TxtPF.setText(pf);

50 | P a g e

TxtLIC.setText(lic); TxtTot_Deduction.setText(dedu); TxtNet_Salary.setText(net_salary); } public int print(Graphics g, PageFormat pf, int pi) throws PrinterException { Graphics2D g2 = (Graphics2D) g; g2.translate(pf.getImageableX()+5, pf.getImageableY()+5); Font f = new Font("Monospaced",Font.PLAIN,12); g2.setFont (f); paint (g2); return Printable.PAGE_EXISTS; }

Settingswindow
import import import import import import import import java.awt.*; java.awt.event.*; javax.swing.*; javax.swing.event.*; java.sql.*; java.io.*; java.util.*; 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 private private private private private private private JButton AddBtn; JButton ChangeBtn; JButton ExitBtn; JButton DeleteBtn; JLabel LblHeading, LblBasic_Salary, LblAllowance, LblPercent1, LblRs1; JLabel LblDeduction, LblPercent2, LblRs2; JLabel LblDA, LblHRA, LblWA, LblGPF, LblIT,LblGIS,LblPF, LblLIC; 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();

51 | P a g e

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 :");

52 | P a g e

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 LblIT = new JLabel LblGIS = new JLabel LblPF = new JLabel LblLIC = new JLabel ("GPF Deduction :"); ("I.T. Deduction:"); ("GIS Deduction :"); ("PF Deductoin :"); ("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);

53 | P a g e

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);

54 | P a g e

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 { 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) { == Cat_Name)

55 | P a g e

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) {

56 | P a g e

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);

57 | P a g e

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;

58 | P a g e

} 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 = "";

59 | P a g e

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( checkbox_state( checkbox_state( checkbox_state( checkbox_state( checkbox_state( checkbox_state( checkbox_state( chDA, sDA ); chHRA, sHRA ); chWA, sWA ); chGPF, sGPF ); chIT, sIT ); chGIS, sGIS ); chPF, sPF ); 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,"",""); }

60 | P a g e

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()

61 | P a g e

{ 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); } } } }

62 | P a g e

clsConnection.java
import import import import import import import import import import java.io.IOException; java.io.DataInputStream; java.io.FileInputStream; java.sql.Connection; java.sql.DriverManager; java.sql.SQLException; javax.swing.JDialog; java.io.*; java.util.*; java.net.*;

public class clsConnection { String url = ""; String username = ""; String password = ""; public Connection setConnection(Connection conn, String username, String password ) { try { Properties props = new Properties(); String fileName = "MakeDB.ini"; FileInputStream in = new FileInputStream(fileName); props.load(in); String drivers = props.getProperty("jdbc.drivers"); if(drivers != null) System.setProperty("jdbc.drivers", drivers); url = props.getProperty("jdbc.url"); username = props.getProperty("jdbc.username"); password = props.getProperty("jdbc.password"); conn = DriverManager.getConnection(url,username,password); }catch(SQLException e) { System.err.println("SQl Exception"); e.printStackTrace(); } catch(IOException e) { System.out.println("\nIO Exception"); } catch (Exception e) { System.out.println("\nAnother Error"); } return conn; } }

63 | P a g e

clsSettings.java
import import import import java.awt.*; java.awt.event.*; javax.swing.*; java.util.*;

public class clsSettings { public JLabel setJLabel(JLabel lbl, int sLeft, int sTop, int sWidth, int sHeight, boolean setBool) { lbl.setBounds(sLeft,sTop,sWidth, sHeight); lbl.setFont(new Font("Dialog",Font.PLAIN,12)); if(setBool == true){lbl.setForeground(new Color(166,0,0));} else{lbl.setForeground(java.awt.Color.BLACK);} return lbl; } //Set-up in JLabel public JTextField setJTextField(JTextField txtfield, int sLeft, int sTop, int sWidth, int sHeight) { txtfield.setBounds(sLeft,sTop,sWidth, sHeight); txtfield.setFont(new Font("Dialog",Font.PLAIN,12)); txtfield.setSelectionColor(new Color(200,150,150)); txtfield.setSelectedTextColor(new Color(0,0,0)); return txtfield; } //Set-up in JTextField public JMenu setJMenu(JMenu menu) { menu.setFont(new Font("Dialog", Font.BOLD, 12)); menu.setCursor(new Cursor(Cursor.HAND_CURSOR)); menu.setForeground(new Color(0,0,0)); return menu; } //Create a Menu public JMenuItem setJMenuItem(JMenuItem mnuitem, String sCaption, String imgLocation) { mnuitem.setText(sCaption); mnuitem.setIcon(new ImageIcon(imgLocation)); mnuitem.setCursor(new Cursor(Cursor.HAND_CURSOR)); mnuitem.setFont(new Font("Dialog", Font.PLAIN, 12)); mnuitem.setForeground(new Color(0,0,0)); return mnuitem; } //Create a MenuItem public JTabbedPane setJTabbedPane( JTabbedPane setTabbed, String setTitle, String setIcon, JPanel setPanel, int sLeft, int sTop, int sWidth, int sHeight) { setTabbed.setBounds(sLeft,sTop,sWidth, sHeight); setTabbed.setCursor(new Cursor(Cursor.HAND_CURSOR)); setTabbed.setFont(new Font("Dialog", Font.CENTER_BASELINE, 12)); setTabbed.setForeground(new Color(166,0,0)); setTabbed.addTab(setTitle, new ImageIcon(setIcon), setPanel); return setTabbed; } //Create a JTabbedPane public JButton CreateJToolbarButton(String srcToolTipText,String srcImageLocation,String srcActionCommand, ActionListener JToolBarActionListener) { JButton bttnToolbar = new JButton(new ImageIcon(srcImageLocation)); bttnToolbar.setActionCommand(srcActionCommand); bttnToolbar.setToolTipText(srcToolTipText); bttnToolbar.setCursor(new Cursor(Cursor.HAND_CURSOR)); bttnToolbar.setFont(new Font("Dialog", Font.PLAIN, 12)); bttnToolbar.addActionListener(JToolBarActionListener); return bttnToolbar; }

64 | P a g e

//Create JToolbarButton public void Numvalidator(JTextField txtField) { txtField.addKeyListener(new KeyAdapter() { public void keyTyped(KeyEvent e) { char c = e.getKeyChar(); if (!(Character.isDigit(c) || (c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE))) { // getToolkit().beep(); e.consume(); } } }); } }

65 | P a g e

TESTING AND IMPLEMENTATION


VALIDATION CHECKS: In the text boxes like name, first name,last name etc., only alphabets and number could be entered thus if the operator by mistake enters other special characters, it would not be entered.In the text boxes like a contact number only numbers could be entered.If the users do not fill any of the fields, which could not be empty, a message would be displayed asking to enter the required parameters. When a user starts the applications, a login form will be displayed prompting to enter the username and password, if even any one of them is not matched with the details stored in the database, the user will be warned to re-enter the correct details.While entering the details of new customer, the customer number which cannot be null value will be automatically generated. This is one greater than the highest number existing previously. When the details of one customer are modified even if one parameter is missed a message will be displayed asking to enter complete details.

SOFTWARE TESTING TECHNIQUES: Software testing is a critical element of software quality assurance and represents the ultimate review of specification, designing and coding. TESTING OBJECTIVES: 1. Testing is process of executing a program with the intent of finding an error. 2. A good test case design is one that has a probability of finding an as yet undiscovered error. 3. A successful test is one that uncovers an as yet undiscovered error.These above objectives imply a dramatic change in view port. 4. Testing cannot show the absence of defects, it can only show that software errors are present
TEST CASE DESIGN:

Any engineering product can be tested in one of two ways:


White Box Testing: This testing is also called as glass box testing. In this testing, by

knowing the specified function that a product has been designed to perform test can be conducted that demonstrates each function is fully operation at the same time searching for errors in each function. It is a test case design method that uses the control structure of the procedural design to derive test cases. Basis path testing is a white box testing.
66 | P a g e

Basis Path Testing: i. ii. iii. iv. Flow graph notation Cyclomatic Complexity Deriving test cases Graph matrices

Control Structure Testing: i. ii. iii. Condition testing Data flow testing Loop testing

Black Box Testing: In this testing by knowing the internal operation of a product, tests can be conducted to ensure that all gears mesh, that is the internal operation performs according to specification and all internal components have been adequately exercised. It fundamentally focuses on the functional requirements of the software. The steps involved in black box test case design are: i. ii. iii. iv. Graph based testing methods Equivalence partitioning Boundary value analysis Comparison testing

VARIOUS TESTING METHODS ARE: Unit Testing Integration Testing System Testing Acceptance Testing In Unit Testing, we tested individual components like each controls for their validations to ensure that they operate correctly. The next level is called Integration Testing. In this many unit tested modules are combined into subsystems, which are then tested. The goal here is to see if the modules can be integrated properly. This testing activity can be considered testing the design.

67 | P a g e

In System Testing, we tested whether system elements have been properly integrated and perform allocated functions to detect the errors that may result from unanticipated interactions between sub-system and system components. Finally, in Acceptance Testing, we tested whether the system is accepted for operational use or not.

UNIT TESTING

INTEGARTION TESTING

SYSTEM TESTING

ACCEPTANCE TESTING

68 | P a g e

IMPLEMENTATION:
Implementation is the process of having systems personnel check out and put new equipment into use, train users, install the new application depending on the size of the organization that will be involved in using the application and the risk associated with its use, systems developers may choose to test the operation in only one area of the firm, say in one department or with only one or two persons. Sometimes they will run the old and new systems together to compare the results. In still other situation, developers will stop using the old system one-day and begin using the new one the next. As we will see, each implementation strategy has its merits, depending on the business situation in which it is considered. Regardless of the implementation strategy used, developers strive to ensure that the systems initial use in trouble-free. Once installed, applications are often used for many years. However, both the organization and the users will change, and the environment will be different over weeks and months. Therefore, the application will undoubtedly have to be maintained; modifications and changes will be made to the software, files, or procedures to meet emerging user requirements. Since organization systems and the business environment undergo continual change, the information systems should keep pace. In this sense, implementation is ongoing process. Evaluation of the system is performed to identify its strengths and weakness. The actual evaluation can occur along any of the following dimensions. Operational Evaluation: assessment of the manner in which the system functions, including ease of use, response time, suitability of information formats, overall reliability, and level of utilization. Organization Impact: Identification and measurement of benefits to the organization in such areas as financial concerns operational efficiency, and competitive impact. Includes impact on internal and external information flows. User Manager Assessment: Evaluation of the attitudes of senior and user mangers within the organization, as well as end-users. Development Performance: Evaluation of the development process in accordance with such yardsticks as overall development time and effort, conformance to budgets and standards, and other project management criteria. Includes assessment of development methods and tools. Unfortunately system evaluation does not always receive the attention it merits. Where properly managed however, it provides a great deal of information that can improve the effectiveness of subsequent application efforts.

69 | P a g e

When a new system needs to be implemented in an organization, there are three different ways to adopt this new system: The big bang adoption, phased adoption and parallel adoption. Parallel adoption: The old and the new system are running parallel, so all the users can get used to the new system, and meanwhile do their work using the old system. Phased adoption :The adoption will happen in several phases, so after each phase the system is a little nearer to be fully adopted. Big bang adoption: The switch between using the old system and using the new system happens at one single date, the so called instant changeover of the system. Everybody starts to use the new system at the same date and the old system will not be used anymore from that moment on. Since our system is completely independent from the existing system and makes no use of the existing system, the implementation method used is the Big Bang Adoption. User documentation does not need to be updated during the implementation process, because it happens in such a short period. There are no special interfaces needed to be able to get used to the new system, because the new system is all there is.

70 | P a g e

FORMS IN THE PROJECT

71 | P a g e

72 | P a g e

73 | P a g e

74 | P a g e

CONCLUSION

It is easy to use, since it uses the GUI provided in the user dialog. User friendly screens are provided. The usage of software increases the efficiency, decreases the effort. It also provides the user with variable options in administering. It has been thoroughly tested and implemented.

This application can be further enhanced to cover each aspect of the institutes. Payroll management system will be extended towards a complete management package for the institute. It will really help to manage and organize the employees detail very efficiently and effectively. The application will prove itself as a powerful tool which enhance the working power of the administration department and can help in improving overall management of the institute. The following are some of the important enhancement that can take place into the current working software application :

This includes management of employees salary and each kind of financial features which helps the institute as a financial tool. In this System an Administor easily Modify and Update the any Employees information. Easily add new user in database.

75 | P a g e

BIBLIOGRAPHY

We have referred to lot of books as well as many websites that give us much information. Except this we have in contact of many seniors as well as our faculty for getting some support related to our project. This is the list of books which we have referred JAVA The complete reference
By: Herbert shield

Software Engineering A Practical Approach


By: Roger S. Pressman

An Integrated Approach to Software Engineering


By: Pankaj Jalote

We referred following websites: www.google.co.in www.wikipedia.com www.java.com

76 | P a g e

You might also like