Professional Documents
Culture Documents
0 INTRODUCTION
permanently connected. Because of the minute by minute change in finances, accurate record keeping is critical. Computerizing a businesss general ledger, payroll, and other accounting tasks increases office efficiency. With the advent of computerization in accounting, Electronic spreadsheets were used to compute payroll and perform other accounting routines in organizations. Electronic spreadsheets allow you to do anything that you would normally do with a calculator, pencil and columnar scratch pad. Spreadsheets were primarily designed for managers who in the process of planning must do what if calculations and due to their flexibility; electronic spreadsheets have found their way into businesses. It takes its name from the accountants spreadsheeta sheet of paper with rules for rows and columnson which such work was usually done. Spreadsheet programs are much faster, more accurate, and easier to use than traditional accounting techniques. An example of electronic spreadsheet is Microsoft Excel. Early programs such as VisiCalc provided 254 rows and 63 columns for entering data and formulas for calculations. VisiCalc was introduced by Robert Frankston, a young computer programmer, and Dan Bricklin, a Harvard Business School student who was looking for a way to use the power of a computer to simplify complex time-consuming financial analyses. VisiCalc proved so useful in such applications that it provided an entry for personal computers into the business world. In 1980, the Sorcim Corporation introduced SuperCalc, a similar spreadsheet program for personal computers using the CPM operating system. Some modern programs for computers with large memories provide thousands of rows and hundreds of columns.
A new generation of computer software for business began with integrated spreadsheet programs, which can be used to prepare spreadsheets, create graphs, and manage data. In such programs, for example, it is easy to display spreadsheet data in the form of a graph or to transfer data from a data base to a spreadsheet. One of the first such programs was Lotus 1-2-3, an immediate success following its introduction in 1983.
A public sector (Kosofe Local Government) has been chosen as the litmus test for this project work because it is one of the largest employers of labor and it has been discovered that calculating the payroll of large organizations by manual process can be more prone to errors, inaccurate and burdensome. Also, it has been discovered that the development and use of an application is more cost effective than the manual system. Therefore a secured application that will improve on the way employees are being paid shall be developed for the Local Government.
(Payroll,Wikipedia the free encyclopedia.htm,2006). Payroll involves the calculation of amounts due the employee, such as hourly wages, a salary consisting of a certain amount per calendar period, or pay to salespersons on commission. In addition to these payments, there are often computed amounts of paid vacation time and accrued sick leave which have been used or are available for use. All of these monies credited to the employee are usually referred to as gross pay. From these amounts that are credited to the employee, various debits are taken as withholding, the most significant being income tax, then other taxes such as security. There may also be additional deductions for health insurance, union dues, pension plan contributions, repayment of prior salary, vacation or sick leave overpayments made in error and other deductions. The amount left after deductions from gross pay is generally the amount given in the employee's pay envelope, either as cash or a cheque. This amount is known as net pay. If the employee has their net pay deposited to their bank account (through a process known as direct deposit) then the employee may simply receive a pay stub indicating this. 6
The purpose of payroll is to calculate pay due employees, to print paychecks and to maintain cumulative earnings records of all employees. Generally, there are three main computations in the payroll namely: Gross Earnings Deductions Net Pay.
Gross Wages Less: Deductions Taxes Union Dues Loan Total Deductions Net Pay **** **** ****
****
- **** ****
After the data for each employee is entered in the payroll journal, the payroll is then proved by adding and subtracting the columns.
10
provides reports to better manage employee pay records, and generates complete weekly, monthly, quarterly, and annual payroll tax-related forms and reports. Computerized payroll can assure business accurately withholds taxes from employees and pays mandatory fees such as Workers Compensation, once the initial information is input into the system. It is also used in automating and providing timely and accurate payroll processing for all types of employees. The computerized payroll is designed to process all types of payroll transactions for the purpose of computing and paying employees hence, computerization makes generating payroll a much simpler and quicker process than if trying to perform these duties manually.
It also holds many benefits for organization apart from time saving and accuracy already mentioned, other advantages include: Reduced administration time by automating payroll calculation and printing of paychecks Eliminated tax penalties for inaccurate returns or late payments of amounts withheld Improved payroll accuracy with automatic tax and deduction calculations Easily compensate employees for work performed Improved organization with consolidation of all payroll related records and reports Increased speed in adjusting to regulations by receiving periodic updates and effortlessly produce the required governmental reporting Eliminated paper check security issues with direct-deposit capability Increased accuracy of tracking payroll expenses to the proper general ledger account or customer job Reduction of administrative overhead Automation of many manual processes Provides timely payroll processing
12
Program controls: certain controls can be built into the program itself. For example
some programs require that a password is entered into the system before access can be made to the program. This is usually a code that prevents others from having access to the work that is being done. Password is a special word or combination of letters or numbers. Passwords are used to protect confidential files or information. An example of a
13
password is the personal identification number (PIN), user login identification and authentication. An error report is a control in which computer is instructed not to process something. For example, the computer can be instructed not to write a check for more than one hundred thousand naira. If a check request for one hundred and twenty thousand naira is possessed, the computer will not issue the check. However, it will issue an error report and refer the request to management. This report alerts management to possible unauthorized attempts to use the program. An item count is a control in which the software is programmed to allow a specified number of items to be processed. For example, in processing payroll checks, the computer can be instructed to print out only a certain number of checks. As each is printed, a count is made. If the number of checks requested is different than the number of employees, the program issues an alert.
14
Program also verifies that the total amounts of paychecks is equal to total debits and credits on general ledger accounts.
Payroll register: Payroll systems produce a payroll register prior to printing payroll
checks. The register lists all employees for whom paychecks are due. For each employee, it shows the gross pay, list all deductions, and show net pay. Producing the payroll register is an important control practice because a payroll supervisor will have to review the payroll register for errors before printing the paychecks. Then a clerk corrects error prior to printing the checks. This avoids printing erroneous checks that could be stolen and cashed.
Print checks control report: Because paychecks can easily be stolen or falsified,
the system must control their preparation. The print checks control report aids in detecting missing or unauthorized checks. The computer program that prints checks also produces this control report showing the number of checks printed and the total amount of these checks. The data control group compares these control totals with the checks.
15
Other Units are under the chairmans office in the Local Government and these include: Audit Information and the Legal
16
All processes to compute the payroll to pay employees salaries in all these departments are done manually in Kosofe Local Government. The personnel department completes a series of activities prior to and at the beginning of employment and forwards the information to the payroll department. Before the new employee begins work, certain personnel records must be completed. Generally these records form the basis for deductions that will be made from the employees gross pay. For a newly employed staff, a letter of appointment stating the grade level and step is given to the new employee and a copy will be submitted in the personnel department, after which the personnel department will send a copy of the appointment letter to the finance department in care of the council treasurer. The council treasurer will minute on the appointment letter to the officer in charge of salaries to open a personal emolument record for the new employee. The personal emolument record shows the name, address, the grade level and step of the employee, the incremental date and the salary details (Gross pay, deductions and net pay) every month for each employee for the year. It is from the personal emolument record that salary details will be entered into the payment salary voucher. The payment salary voucher contains total of salaries paid to all employees in all departments in the Local Government, it is also from the payment salary voucher that payment slips and checks are written out. The payment slip and checks are dispatched to every staffs after they are written out. It is after they have gotten their payment slip and checks that they can go to the bank to collect their salaries.
17
For an existing staff, the process still remains the same as for a newly employed staff except that while the old staff is leaving the former Local Government, he/she will go to the new Local Government with the following documents: Last Pay Certificate Release letter Record of service
All the mentioned documents will be submitted to the Head of Department/Director of the personnel department and the process continues the same way as for the newly employed staff. For a retiree, a letter is sent from the permanent secretary of local government service commission to the chairman of the local government who minutes on it and sends it to the head of personnel department. The head of personnel department then sends it to the council treasurer, who sends it to the officer in charge of salary with the order to stop payment of salary to the retiree after three months from that date. All this processing involved in paying salaries are done manually and all records are stored in files which are eventually stored in a file cabinet. All these manual processes have resulted in problems such as: Missing records Theft and fraudulent practices Errors Wastage of materials and Lack of adequate information.
18
3.1 INTRODUCTION
According to Simon Bennett et al (2002), system analysis is defined as a process of seeking to understand the organization, investigating its requirements and modeling them. System analysis can also be referred to as the study of a business problem domain to recommend improvements and specify the business requirements for the solution. (Jeffrey.L.Whitten et al, 2001) It is the result of this analysis activity that gives the specification of what the proposed system will do based on the requirements. System analysis is the study of a system and its component as a prerequisite to system design. It is a problem solving technique that decomposes a system into its component pieces for the purpose of studying how well those components work and interact to accomplish their purpose. Contemporarily, System analysis is a term that collectively describes the early phases of system development. There are many approaches to system analysis and these include structured analysis, information engineering, discovery prototyping, and object oriented analysis. For the purpose of this project, the object oriented analysis will be used for the system analysis and design. System analysis is a very important aspect of system development because during this phase several fundamental decisions are made. During the analysis the system owner and user are specified because the system analysis is driven by the business concerns of the system owners and users, system analysis also reveals what the system would do and it 19
helps the stakeholders know whether the proposed system is technically, economically and operationally feasible.
20
and specify percentages that will be used to compute payments. Staffs, Salary officers and Payroll Administrator at the login interface will have to enter their username and password in the text fields as contained in the database. If username and password are valid for respective users as contained in the database, the system welcomes them and takes them to the menu interface as related to individual users. For the staffs, the system takes them to the menu where they will be able to view reports and paycheque while for the salary officer, the system opens the menu interface where all payroll processes are contained. In the payroll module, the salary officer after entering key details about the employee, the program will automatically call other payments from the database and display the net pay for the pay period. The payroll administrator will be granted access to the database where records can be modified, edited and updated. The output that will be generated from the proposed system will be the paycheque, staffs report and management report needed at different levels. The computerization of the existing system will help to address problems such as missing records, theft and fraudulent practice, arithmetic errors, wastage of materials, lack of adequate information, e.t.c in the system.
21
22
The following UML diagrams will be used to model the system: Use-Case diagram Activity diagram Sequence diagram
23
Compute Pay
View Report/Paycheque
Salary Officer
Print Report/Paycheque
Staff
Edit Record
PayrollAdministrator
Update Record
24
Compute Netpay
Go to Bank
Receive Salary
25
Welcome
Menu
Payroll
Report/Paycheque
Update
Database
Exit
Valid
Staff Welcome Staff View Report
Yes
Exit system
Valid
SalaryOfficer Enter key details Read Other Paydetails From Database Welcome Salary Officer
Yes
Compute Netpay
Valid
PayrollAdministrator Welcome PayrollAdministrator
Yes
26
27
The structured query language can be used in two ways: interactively or embedded inside another program. It is used interactively to directly operate a database and produce the desired results. The second way to execute a SQL command is by embedding it in another language such as COBOL, BASIC, Visual Basic, C or Java. The result of the embedded SQL command is then passed to the variables in the host program, which in turn will deal with them. This application is implemented by combining structured query language (SQL) together with a high level language (JAVA) which allows the creation of user interfaces and database access in one application. To design the illustration above, it would commence with the database design which would reveal all the necessary component, entities and attribute that would be needed through out the course of our implementation. The database design includes three major tables which would serve as the basis of discussion for the requirement of the system. The tables (records) used are listed below as applied within the program listing. The following shows the payroll database and its schema: 1. Personnel (StaffId, StaffName, StaffAddress, GradeLevel, Step, Sex, Department, BasicSalary, Overtime, TransportAllowance, MonthlyTax, UnionDues, Netpay) 2 3 MonthlyBasicSalary (GradeLevel,Step1,Step2,Step3,Step4,Step5,Step6Step15) Users (UserName ,Password, Status)
28
4.1 INTRODUCTION
Implementation is the process by which a system developed is utilized and made functional or the process of converting a new system design into operation. It is the delivery of the system into production. This is the phase where all the requirement analysis and system design is put to test to ensure effective delivery of the system.
29
U.P.S
Welcome Module: This module allows users to login and have access options in
order to be able to access other modules as related to individual user. The payroll administrator login his/her username as contained in the database in order to be able to edit records in the database, In this same module the salary officers and the staffs also login their username and password in order to be able to view and print reports/ paycheques and compute net pay respectively. To login, click on the username and password text field and type in the username and password respectively, then click on the ok button to login. See interface in appendix 2.
30
Menu Module: This is the module for users who login as salary officers and this is
where the actual payroll computation is done. When users login in this module, they will be able to perform different tasks such as viewing and printing of reports and paycheques and computing of the salaries. This module contains sub modules such as the file and payroll sub modules. See interface in appendix 2.
File Sub Module: From the file sub module, the salary officer is able view and print
report/pay cheques. To view and print reports/paycheque, click on file, open, and then click on the report/paycheque that is to be viewed or printed and click print. See interface in appendix 3.
Payroll Sub Module: This is contained in the menu module. This is where the actual
payroll process takes place. To compute salaries, click on paydetail, payroll and then the payroll page comes up. In the payroll page, enter key details such as the satffId, grade level and employee step, then click on compute button to generate net pay for the pay period. See interface in appendix 2.
Payroll Administrator Module: Only the payroll administrator has access into
this module and this is where records can be edited and updated. When the payroll administrator login his/her username and password in the login menu, the program automatically brings the administrator to this admin module and it is from this module that other sub modules such as Personnel Adjustment, Percentage Allocation, and Update Basic Salaries can be viewed and worked on. See interface in appendix 2.
Personnel Adjustment Sub Module: It is from this module that the payroll
administrator will be able to add the records of new employees search and delete existing record of employees. To add the record of a new employee, enter data into the text fields
31
and click on new button, to delete an existing record, enter the staffId and click on search button to bring out details of the particular employee to be deleted and then click on delete button to delete the record. See interface in appendix 2.
Update Basic Salaries Sub Module: This interface is made available in order to
make the system flexible in that when changes are made to the basic salaries, it will be reflected from this interface and then saved into the database as the new basic salary value for all grade levels and steps. To update basic salary table, click on activate button to activate the fields and then enter into the fields the new values for the basic salaries, then click on the update button to update the basic salary table in the basic salary table in the database. See interface in appendix 2.
Staffs Module: This is the module that allows staffs to be able to view their report
/paycheque. To view report/paycheque, enter staffid, staff name, grade level and step and then click on search button to view records as pertaining to the indicated staff. See interface in appendix 3.
ConnectDB Modules: This is the database class that connects all the programs with
the database.
32
33
Developing a system requires the system developer to meet the user requirements of the proposed system and as a result of this, the developer must fully understand what the problems are, understand the people for whom he/she is designing the system for in order for the system to communicate effectively.
5.2 RECOMMENDATION
Considering the rate of technological development in our society today, any organization that want to remain in the forefront of todays competitive market is left with no choice than to computerize the manual system that are operational in their organization. Other recommendations include: Putting in place computers and other peripherals that would allow the usage of the system. Installation of Java 2 Software Development Kit (J2SDK1.4.1) and
PAYMASTER software with Microsoft SQL server engine. A good training background for the users of the system in order to familiarize with the software. A recovery/back up must be in place. 34
Lastly, adequate environmental security must be provided for the confidentiality of information.
5.3 CONCLUSION
The development of this application software is to help solve problems associated with the existing system and this has been achievable to an extent. The merits of the new system outweigh the advantages (if any) of the existing system. It does not only provide automation, it has also replaced the traditional cabinet file storage method that deals with a lot of paper work thereby, allowing ease in the storing, handling and retrieval of data in a dynamic way. In concluding this project, I would like to highlight areas for future development and these include: Reviewing of this project work to see what has been done and then look out for what the project should have accomplished that has not been implemented in it for those who desire to continue on this project. Furthermore, certain features must be included in the system in order to justify improvements on the current version and this include putting in place a multi-user system that allows for use in a network environment so that information can be made available in all other Local Governments as well other parts of the organization under study.
35
REFERENCES
1. Jeffrey L.Whitten, Lonnie D.Bentley and Kevin D.Dittman (2001). System Analysis and DesignMethods. New York, Irwin/McGraw-Hill, Fifth Edition, pp13, 479. 2. Simon Bennet, Steve McRobb and RayFarmer (2002). Object Oriented Systems Analysis and Design Using UML, Maiden: McGraw-Hill, Second Edition, pp301, 321. 3. J.L.Boockhdt (1999) Accounting Information Systems-Transaction Processing and Controls. United States of America, Irwin/McGraw-Hill, pp 673-674. 4. David H.Weaver, Edward B. Bruner, James.M.Smiley and Virginia A. Rose (1988). Accounting Systems and Procedures. United States of America, McGraw-Hill, Fifth Edition, pp 443-449. 5. Gregory E.Anders, Emmajo Spiegel berg and Sally Nelson (2002).
Microcomputer Accounting-Tutorial and Applications. United States of America, Glencoe/McGraw-Hill, pp196-197. 6. Mark Priestley (2003) Practical Object-Oriented Design With UML. New York. McGraw-Hill. Second Edition, pp330-333. 7. Myrvin F. Chester, Avtar.K. Athwall (2002). Introduction to Basic Information Systems Analysis and Design .New York. McGraw-Hill, pp 212. 8. Payroll, Wikipedia the free encyclopedia.htm, 2006. www.alltheweb.com.
36
37
SYSTEM FLOWCHART
LOGIN SCREEN
OPTION MENU
DATABASE
MODULES/PROCESSINGS
REPORTS
38
GENERAL MENU
Start
Welcome Screen
NO
NO
Staffs Option
YES
Exit System
39
PAYROLL PROCESSING
Start
Compute Netpay
Exit
40
41
42
43
44
45
46
47
48
49
50
51
FI G 13
52
53
package salarys;
54
import java.sql.*; import javax.swing.*; public class ConnectDB { private Connection connection; private Statement statement; private ResultSet resultset; private String jdbcDriver="sun.jdbc.odbc.JdbcOdbcDriver"; private String databaseUrl="jdbc:odbc:NIYI"; public ConnectDB() { } public ConnectDB(String driver,String database) { jdbcDriver = driver; databaseUrl = database; } public void setDriver(String driver) { jdbcDriver = driver; } public void setDatabase(String database) { databaseUrl = database; } public Statement connect() { try { Class.forName(jdbcDriver); connection = DriverManager.getConnection(databaseUrl); statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONC UR_READ_ONLY); } catch(Exception e) { statement = null;
55
} finally { return statement; } } public int disconnect() { int result=1; try { if(statement!=null) statement.close(); if(connection!=null) connection.close(); } catch(Exception e) { result = 0; } finally { return result; } } public String getDriver() { return jdbcDriver; } public String getDatabase() { return databaseUrl; } public ResultSet setQuery(String query) { try { resultset=statement.executeQuery(query); } catch(SQLException sqle) {
56
JOptionPane.showMessageDialog(null,query+"\n"+sqle.toString()); resultset=null; } return resultset; } public int setUpdate(String query) { int result; try { result=statement.executeUpdate(query); } catch(SQLException sqle) { JOptionPane.showMessageDialog(null,sqle+" Funny Error"); result=0; disconnect(); } return result; } }
package salarys;
57
import java.sql.*; import javax.swing.*; import java.awt.*; import com.borland.jbcl.layout.*; import java.awt.event.*; import javax.swing.event.*; import com.borland.dx.sql.dataset.*; import com.borland.dbswing.*; import com.borland.dx.dataset.*; import javax.swing.border.*; /** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2006</p> * <p>Company: </p> * @author not attributable * @version 1.0 */ public class Payroll extends JDialog { String stepNo,gradeNo,STAFFID; ConnectDB condb=new ConnectDB(); String query,query1,query2; ResultSet rs, rs1,rs2; int overtime, rentallow, shift, transport, vehicleallow, courseutility, hazard, monthlytax, rentdeduct, uniondues, thrift, vehiclededuct, housing, typist, namm,BASIC,totalgross,totaldeduction,totalnetpay; JPanel panel1 = new JPanel(); XYLayout xYLayout1 = new XYLayout(); JLabel GRADELEVELLabel1 = new JLabel(); JTextField gRADELEVELTextField1 = new JTextField(); JLabel STEPLabel1 = new JLabel(); JTextField sTEPTextField1 = new JTextField(); JLabel STAFFIDLabel1 = new JLabel(); JTextField sTAFFIDTextField1 = new JTextField(); JLabel STAFFNAMELabel1 = new JLabel(); JTextField sTAFFNAMETextField1 = new JTextField(); JPanel jPanel1 = new JPanel(); XYLayout xYLayout2 = new XYLayout(); JButton jButton1 = new JButton(); JLabel VEHICLELOANLabel2 = new JLabel(); JLabel BASICSALARYLabel2 = new JLabel(); JTextField hOUSINGLOANTextField1 = new JTextField(); JLabel RENTDEDUCTLabel2 = new JLabel();
58
JLabel TGPLabel2 = new JLabel(); JLabel OVERTIMELabel2 = new JLabel(); JLabel NANNMSLabel2 = new JLabel(); JLabel TRANSPORTLabel2 = new JLabel(); JLabel RENTLabel2 = new JLabel(); JTextField tOTALNETPAYTextField1 = new JTextField(); JTextField tOTALDEDUCTIONTextField1 = new JTextField(); JTextField mONTHLYTAXTextField1 = new JTextField(); JTextField tYPISTLOANTextField1 = new JTextField(); JLabel MONTLYTAXLabel2 = new JLabel(); JLabel HAZARDLabel2 = new JLabel(); JTextField rENTTextField1 = new JTextField(); JLabel TDLabel2 = new JLabel(); JLabel TYPISTLabel2 = new JLabel(); JLabel NPLabel2 = new JLabel(); JLabel HOUSINGLabel2 = new JLabel(); JLabel SHIFTLabel2 = new JLabel(); JLabel VEHICLELabel2 = new JLabel(); JTextField uTILITYTextField1 = new JTextField(); JTextField hAZARDTextField1 = new JTextField(); JTextField sHIFTTextField1 = new JTextField(); JTextField bASICTextField1 = new JTextField(); JTextField tRANSTextField2 = new JTextField(); JLabel UTILITYLabel2 = new JLabel(); JLabel DEDUCTLabel2 = new JLabel(); JTextField nAMMSASSOCIATIONTextField1 = new JTextField(); JTextField oVERTIMETextField1 = new JTextField(); JTextField tHRIFTTextField1 = new JTextField(); JTextField tOTALGROSSTextField1 = new JTextField(); JLabel EARNINGSLabel2 = new JLabel(); JLabel THRIFTLabel2 = new JLabel(); JTextField rENTTextField2 = new JTextField(); JTextField uNIONDUESTextField1 = new JTextField(); JTextField vEHICLEALLOWTextField1 = new JTextField(); JLabel jLabel2 = new JLabel(); private JButton COMPUTEButton2 = new JButton(); Statement stmt; int result; //ConnectDB condb; String sql; JTextField vEHICLELOANTextField1 = new JTextField();
59
public Payroll(Frame frame, String title, boolean modal) { super(frame, title, modal); try { jbInit(); pack(); this.setSize(1000,1200); this.setVisible(true); } catch(Exception ex) { ex.printStackTrace(); } } public Payroll() { this(null, "", false); } public void actionPerformed(ActionEvent e) { COMPUTEButton2_actionPerformed(e); } }); vEHICLEALLOWTextField1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { vEHICLEALLOWTextField1_actionPerformed(e); } });
60
int gradNo= Integer.parseInt(gRADELEVELTextField1.getText()); float OVERTIME,RENTALLOW,VEHICLEALLOW,HAZARD,SHIFT,COURSEUTILITY, TRANSPORTALLOW; float MONTHLYTAX,RENTDEDUCT,THRIFT,VEHICLEDEDUCT,HOUSINGLOAN,TYP ISTLOAN,UNIONDUES,NAMMASSOCIATION; float TOTALGROSS,TOTALDEDUCTION,TOTALNETPAY; String qry="select STEP" +stepNo+ " from MONTHLYBASICSALARY where GRADELEVEL = "+gradNo; JOptionPane.showMessageDialog(null,qry); rs=condb.setQuery(qry); try { if(rs.next()) { BASIC=Integer.parseInt(rs.getString("STEP"+stepNo)); } } catch(SQLException sqle) { JOptionPane.showMessageDialog(null,"Error! "+sqle); } OVERTIME =overtime/100*BASIC; RENTALLOW =rentallow/100*BASIC; VEHICLEALLOW =vehicleallow/100*BASIC; HAZARD =hazard/100*BASIC; SHIFT =shift/100*BASIC; TRANSPORTALLOW =transport/100*BASIC; COURSEUTILITY =courseutility/100*BASIC; MONTHLYTAX =monthlytax/100*BASIC; RENTDEDUCT =rentdeduct/100*BASIC; THRIFT =thrift/100*BASIC; VEHICLEDEDUCT =vehiclededuct/100*BASIC; HOUSINGLOAN =housing/100*BASIC; TYPISTLOAN =typist/100*BASIC; NAMMASSOCIATION = namm/100*BASIC; UNIONDUES =uniondues/100*BASIC; TOTALGROSS=BASIC+OVERTIME+RENTALLOW+SHIFT+TRANSPORTALLO W+VEHICLEALLOW+COURSEUTILITY+HAZARD; TOTALDEDUCTION=MONTHLYTAX+RENTDEDUCT+UNIONDUES+THRIFT+ VEHICLEDEDUCT+HOUSINGLOAN+TYPISTLOAN+NAMMASSOCIATION; TOTALNETPAY = TOTALGROSS - TOTALDEDUCTION;
61
//CONVERTING VARIABLES TO TEXT SO AS TO SET THEM AS TEXT IN STRING CLASS String STROVERTIME = Float.toString(OVERTIME); String STRBASIC = Float.toString(BASIC); String STRRENTALLOW = Float.toString(RENTALLOW); String STRVEHICLEALLOW = Float.toString(VEHICLEALLOW); String STRCOURSEUTILITY = Float.toString(COURSEUTILITY); String STRHAZARD = Float.toString(HAZARD); String STRSHIFT = Float.toString(SHIFT); String STRMONTHLYTAX = Float.toString(MONTHLYTAX); String STRRENTDEDUCT = Float.toString(RENTDEDUCT); String STRTHRIFT = Float.toString(THRIFT); String STRVEHICLEDEDUCT = Float.toString(VEHICLEDEDUCT); String STRHOUSINGLOAN = Float.toString(HOUSINGLOAN); String STRTYPISTLOAN = Float.toString(TYPISTLOAN); String STRNAMMASSOCIATION = Float.toString(NAMMASSOCIATION); String STRUNIONDUES = Float.toString(UNIONDUES); String STRTOTALDEDUCTION = Float.toString(TOTALDEDUCTION); String STRTOTALGROSS = Float.toString(TOTALGROSS); String STRTOTALNETPAY = Float.toString(TOTALNETPAY); bASICTextField1.setText(STRBASIC); oVERTIMETextField1.setText(STROVERTIME); rENTTextField1.setText( STRRENTALLOW); vEHICLELOANTextField1.setText(STRVEHICLEALLOW); uTILITYTextField1.setText(STRCOURSEUTILITY); hAZARDTextField1.setText(STRHAZARD); sHIFTTextField1.setText(STRSHIFT); mONTHLYTAXTextField1.setText(STRMONTHLYTAX); rENTTextField1.setText(STRRENTDEDUCT); tHRIFTTextField1.setText(STRTHRIFT); vEHICLELOANTextField1.setText(STRVEHICLEDEDUCT); vEHICLELOANTextField1.setText(STRVEHICLEALLOW) ; hOUSINGLOANTextField1.setText(STRHOUSINGLOAN); tYPISTLOANTextField1.setText(STRTYPISTLOAN); nAMMSASSOCIATIONTextField1.setText(STRNAMMASSOCIATION); uNIONDUESTextField1.setText(STRUNIONDUES); tOTALDEDUCTIONTextField1.setText(STRTOTALDEDUCTION); tOTALGROSSTextField1.setText(STRTOTALGROSS); tOTALNETPAYTextField1.setText(STRTOTALNETPAY); STAFFID=sTAFFIDTextField1.getText(); query2="INSERT INTO PERSONNEL(BasicSalary,Overtime,HazardAllowance,RentAllowance,VehicleAllowan ce,ShiftAllowance,TransportAllowance,CourseUtilityAllowance,MonthlyTax,RentDeduc t,Thrift,VehicleLoan,HousingLoan,TypistLoan,NammAssociation,UnionDues,TotalGros
62
spay,TotalDeduction,TotalNetpay) VALUES ('"+BASIC+"','"+overtime+"','"+ hazard+"','"+rentallow+"','"+vehicleallow+"','"+shift+"','"+transport+"','"+courseutility+"' , '"+monthlytax+"','"+rentdeduct+"','"+thrift+"','"+vehiclededuct+"','"+housing+"','"+typist +"','"+namm+"','"+uniondues+"','"+totalgross+"','"+totaldeduction+"','"+totalnetpay+"') WHERE StaffId='"+STAFFID+"'"; result=condb.setUpdate(query2); } void vEHICLEALLOWTextField1_actionPerformed(ActionEvent e) { } } class Payroll_jButton1_actionAdapter implements java.awt.event.ActionListener { Payroll adaptee; Payroll_jButton1_actionAdapter(Payroll adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { } } class Payroll_STAFFIDTextField1_actionAdapter implements java.awt.event.ActionListener { Payroll adaptee; Payroll_STAFFIDTextField1_actionAdapter(Payroll adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { } }
package salarys;
63
import java.sql.*; import javax.swing.*; import java.awt.*; import com.borland.jbcl.layout.*; import java.awt.event.*; import javax.swing.event.*; import com.borland.dx.sql.dataset.*; import com.borland.dbswing.*; import com.borland.dx.dataset.*; import javax.swing.border.*; /** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2006</p> * <p>Company: </p> * @author not attributable * @version 1.0 */ public class PayAdmin extends JFrame { //private String name="Update.jpg"; private Icon icon = new ImageIcon(salarys.PayAdmin.class.getResource( "pix1.jpg")); String stepNo,gradeNo; ConnectDB condb1=new ConnectDB(); String query1,query2,query3,query4; ResultSet rs1,rs2; String USERNAME,PASSWORD,CATEGORY,STAFFID,STAFFNAME,STAFFADD,SEX,G RADELEVEL,STEP,DATEEMP,INCREAMENTALDATE; public PayAdmin() { try { jbInit(); this.setSize(500,700); this.setVisible(true); } catch(Exception ex) { ex.printStackTrace(); } } void jbInit() throws Exception { DELETEButton1.setFont(new java.awt.Font("Dialog", 1, 11)); DELETEButton1.setText("DELETE");
64
DELETEButton1.addActionListener(new PayAdmin_DELETEButton1_actionAdapter(this)); this.getContentPane().setBackground(Color.pink); this.setTitle("PERSONNEL ADJUSTMENT"); USERNAMELabel1.setText("USERNAME"); uSERNAMETextField1.setText(""); PASSWORDLabel1.setText("PASSWORD"); passwordTextField1.setText(""); ADDButton1.setFont(new java.awt.Font("Dialog", 1, 11)); ADDButton1.setText("ADD"); ADDButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { ADDButton1_actionPerformed(e); } }); SEARCHButton1.setFont(new java.awt.Font("Dialog", 1, 11)); SEARCHButton1.setText("SEARCH"); SEARCHButton1.addActionListener(new PayAdmin_SEARCHButton1_actionAdapter(this)); void uSERNAMETextField1_actionPerformed(ActionEvent e) { } void passwordTextField1_actionPerformed(ActionEvent e) { } void DELETEButton1_actionPerformed(ActionEvent e) { //STAFFID=sTAFFIDTextField1.getText(); STAFFNAME=sTAFFNAMETextField1.getText(); STAFFADD=sTAFFADDTextField1.getText(); GRADELEVEL=gRADELEVELTextField1.getText(); STEP=sTEPTextField1.getText(); DATEEMP=dATEEMPTextField1.getText(); INCREAMENTALDATE=iNCREAMENTTextField1.getText(); SEX=sEXTextField1.getText(); query4="DELETE FROM PERSONNEL (StaffName,StaffAddress,Sex,GradeLevel,Step,DateEmployed,IncreamentDate) WHERE StaffId='"+ STAFFID +"'"; result = condb.setUpdate(query4); }
65
void ADDButton1_actionPerformed(ActionEvent e) { STAFFID=sTAFFIDTextField1.getText(); STAFFNAME=sTAFFNAMETextField1.getText(); STAFFADD=sTAFFADDTextField1.getText(); GRADELEVEL=gRADELEVELTextField1.getText(); STEP=sTEPTextField1.getText(); DATEEMP=dATEEMPTextField1.getText(); INCREAMENTALDATE=iNCREAMENTTextField1.getText(); SEX=sEXTextField1.getText(); query1="INSERT INTO PERSONNEL(StaffId,StaffName,StaffAddress,Sex,GradeLevel,Step,DateEmployed,Incr eamentDate) VALUES ('"+STAFFID+"','"+STAFFNAME+"','"+STAFFADD+"','"+SEX+"','"+GRADELEVEL+ "','"+STEP+"','"+DATEEMP+"','"+INCREAMENTALDATE+"')"; result = condb.setUpdate(query1); USERNAME= uSERNAMETextField1.getText(); PASSWORD= passwordTextField1.getText(); CATEGORY= cATEGORYTextField1.getText(); query2="INSERT INTO USERS(USERNAME,PASSWORD,CATEGORY)VALUES('"+USERNAME+"','"+PAS SWORD+"','"+CATEGORY+"')"; result = condb.setUpdate(query2); } void jButton1_actionPerformed(ActionEvent e) { Open open = new Open(); jLabel1.setIcon(icon); } void SEARCHButton1_actionPerformed(ActionEvent e) { //STAFFID=sTAFFIDTextField1.getText(); STAFFNAME=sTAFFNAMETextField1.getText(); STAFFADD=sTAFFADDTextField1.getText(); GRADELEVEL=gRADELEVELTextField1.getText(); STEP=sTEPTextField1.getText(); DATEEMP=dATEEMPTextField1.getText(); INCREAMENTALDATE=iNCREAMENTTextField1.getText(); SEX=sEXTextField1.getText(); query3="select StaffName,StaffAddress,Sex,GradeLevel,Step,DateEmployed,IncreamentDate from PERSONNEL where StaffId='"+ STAFFID +"'"; try
66
{ rs=condb.setQuery(query3); if(rs.next()) { STAFFID=rs.getString("StaffId"); STAFFNAME=rs.getString("StaffName"); STAFFADD = rs.getString("StaffAddress"); SEX=rs.getString("Sex"); GRADELEVEL = rs.getString("GradeLevel"); STEP = rs.getString("Step"); DATEEMP=rs.getString("DateEmployed"); INCREAMENTALDATE=rs.getString("IncreamentDate"); } } catch(SQLException sqle) { JOptionPane.showMessageDialog(null,"Error! "+sqle); } } } class PayAdmin_DELETEButton1_actionAdapter implements java.awt.event.ActionListener { PayAdmin adaptee; PayAdmin_DELETEButton1_actionAdapter(PayAdmin adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.DELETEButton1_actionPerformed(e); } } class PayAdmin_SEARCHButton2_actionAdapter implements java.awt.event.ActionListener { PayAdmin adaptee; PayAdmin_SEARCHButton2_actionAdapter(PayAdmin adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) {
67
} } class PayAdmin_ADDButton1_actionAdapter implements java.awt.event.ActionListener { PayAdmin adaptee; PayAdmin_ADDButton1_actionAdapter(PayAdmin adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.ADDButton1_actionPerformed(e); } } class PayAdmin_jButton1_actionAdapter implements java.awt.event.ActionListener { PayAdmin adaptee; PayAdmin_jButton1_actionAdapter(PayAdmin adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jButton1_actionPerformed(e); } } class PayAdmin_SEARCHButton1_actionAdapter implements java.awt.event.ActionListener { PayAdmin adaptee; PayAdmin_SEARCHButton1_actionAdapter(PayAdmin adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.SEARCHButton1_actionPerformed(e); } )
68