payroll managements medium project

15
BERESA ABEBE 2015 PAYROLL SYSTEM PROJECTS I’M VERY HAPPY TO DISPLAY THE FIRST SEMISTER OF FUNDAMENTAL DATABASE PROJECT USING MY SQL SOFTWARE COMPUTER SCIENCE STUDENT AT WOLLEGA UNIVERSITY NEKEMTE, OROMIA, ETHIOPIA +251917361283 [email protected] [email protected]

Upload: wuni

Post on 27-Mar-2023

0 views

Category:

Documents


0 download

TRANSCRIPT

BE

RE

SA

AB

EB

E

20

15

PA

YR

OL

L S

YS

TE

M P

RO

JEC

TS

I’M VERY HAPPY TO

DISPLAY THE FIRST

SEMISTER OF

FUNDAMENTAL DATABASE

PROJECT USING MY SQL

SOFTWARE

COMPUTER SCIENCE STUDENT

AT WOLLEGA UNIVERSITY

NEKEMTE, OROMIA,

ETHIOPIA

+251917361283

[email protected] [email protected]

PAYROLL SYSTEM PROJECTS

Payroll projects Page 2

Chapter-1 Introduction

1. PROJECT BACKGROUND This chapter provides an introduction to the project, existing problems, and ways to solve the existing problems. This payroll management system project is some of its entity and attributes are very similar to that of company database, but this project selects only few of company database entities and attributes. As a general to indicate payroll management system this project contains three chapters those are:

1. Chapter one about the background of the projects 2. Chapter two about the system design of projects 3. Chapter three about the physical implementation of projects

At the end of the project theirs is conclusion about the payroll management system project.

1.1 Project Outline Current salary system is manual therefore this wants to switch to an automated computerized salary management system. After building this system we have to integrate it with the existing computerized system that uses MYSQL server 2005. The existing system dealing with the client registrations, keeping records of clients, client billing Hence we can say, employee payroll system will be a subpart of the existing computerized system. The managers or team leaders of this organization are able to fill out all necessary information of an employee, i.e., residential address, social security number, type of salary fixed, monthly or hourly and other relevant information. Moreover, the system should be able to calculate tax deductions of every employee on monthly basis, throughout offices nationwide, annually. Finally, the tax files should be sent to tax office.

1.2 Problem Identification They also have to calculate and keep record of tax of whole organization and maintain tax files manually. The management of organization also has to deal with bank files manually. All this work requires a lot of paper work, is extremely time consuming job, and accordingly costly as well as they have to hire more man power. Since there is always a risk of human errors present in a manual system so the chances of errors are very high and to figure out such errors is also a very lengthy procedure. Therefore, this project is decided to switch from a manual system to My SQL computerized payroll management system. The requirement of this project is to develop a My SQL based project that is able to deal with salary and tax calculation of employees within the organization and maintain its data base.

1.3 Existing problem Presently salary calculation is done manually, it take so much of time to compose salary of all employees. It also takes very long time to make salary slip ready. Due to manual process some time it takes very long time, in turn it delays the salary distribution. This is a big problem to manage when salary is not generated in time. The other main problem is errors, even with double

PAYROLL SYSTEM PROJECTS

Payroll projects Page 3

cross check here or there some errors will happen, this again create large problem. To solve all this organization requires very good software to take care of all these

1.4 Proposed system The proposed software will solve all the problems they are facing now. This software is designed such way that it will generate the salary automatically every month in time. So there not much worries. This software also equipped with to enter the attendance of each employee in the organization, it help them to track each employee attendance, based on this we can generate the salary. The software built to generate individual pay slip and summary of the payroll.

Terminology Definition This section gives a definition and explanation of some of the terms used in the project: Employee Data: This is the employee's information in the company. It consists of the employee identification number, employee name, address, sex, pay rate, pension plan flag, and union member flag. Payroll Records: The payroll records are used to store each month’s hours worked, and the rates for that month. Rates: Rates consists of the percentage that would be deducted from the gross pay depending on pension plan, state and federal tax. Each employee can have a unique hourly rate. Payroll Ledger: This is a table that shows the calculated pay of employees and the month in which they earned the pay. The ledger can be filtered by name, identification number, year and month. Hours Worked: This is the number of times that an employee works in a month. The hours worked is used to calculate the pay that an employee will receive for that month. Net Pay: The net pay is the final salary amount that would be given to the employee after all the deductions are subtracted from the gross pay. The deductions include among others taxes, union member dues and pension plan. Gross Pay: The gross pay is the amount that the employee earns before the deductions are subtracted. Deductions: Deductions are made up of taxes, union membership dues, pension plan. They are subtracted from the gross pay to give the net pay which is the employee's final pay for the month. Taxes: The tax consists of the state dues and federal dues. A percentage of the employee's salary goes to state and country. Pension Plan: Employees that opted to use the pension plan of the company get to pay a particular percentage of their pay in preparation for their retirement.

PAYROLL SYSTEM PROJECTS

Payroll projects Page 4

Chapter-2 System Design

2. SYSTEM DESIGN 2.1 CONCEPTUAL DESIGN

A) PAYROLL ENTITIES 1. EMPLOYEE

(Name, SSN, address, sex, salary, dnumber, 2. PAYROLL RECORDS

Hourly worked, rateofmonth, SSN 3. PAYROLL LEDGER

Name, SSN, date 4. DEPARTMENT

Dname, dnumber, multivalued location, 5. PAYMENT

Salary, Payrate, pension , netpay, Grosspay, deduction, tax, 6. PROJECT

Unique Pname, Pnumber, dnumber B) ATTRIBUTIES AND THEIR DATA TYPES FOR THE ENTITIES, CONSTRAINTS

IF ANY 1. EMPLOYEE

Attribute-----------------Data Type------------------Constraints Name-----------------------------string ---------------------------NOT NULL, SSN-------------------------------string ------------------primary key NOT NULL, Address---------------------------string --------------------------NOT NULL, Sex---------------------------------char---------------------, Hourlyworked--------------------integer-------------------, Salary------------------------------real------------------------ foreign key NOT NULL, Dnumber-------------------------string----------------------foreign key NOT NULL,

2. PAYROLL RECORDS Attribute-----------------Data Type-------------------Constraints

Hourlyworked-------------------integer-------------------primary key NOT NULL Rateofmonth---------------------real------------------------------ SSN--------------------------------string-----------------foreign key NOT NULL

3. PAYROLL LEDGER Attribute-----------------Data Type-------------------Constraints

SSN-------------------------------string----------------primary key NOT NULL, Date------------------------------string--------------------------NOT NU

PAYROLL SYSTEM PROJECTS

Payroll projects Page 5

4. DEPARTMENT Attribute-------------------Data type-------------------Constraints

Dname---------------------------string--------------------------------Unique, Dnumber------------------------string----------------primary key NOT NULL, Location--------------------------string-----------------------------,

5. PAYMENT Attribute------------------Data type-----------------------------Constraints

Salary-----------------------------real------------------primary key NOT NULL, Payrate----------------------------real----------------------------------NOT NULL, Pension---------------------------real---------------------------------NOT NULL, Tax--------------------------------real---------------------------------NOT NULL, Deduction------------------------real----------------------------------NOT NULL,

6. PROJECTS Attributes----------------Data type-----------------------Constraints Pnumber-------------------------integer-------------------primary key NO NULL, Pname----------------------------String---------------------------------Unique,

C) KEYS ATTRIBUTES AND FOREIGN KEYS

i. EMPLOYEE Attributes----------------------------------------Key types SSN------------------------------------------------primary key, dnumber-------------------------------foreign key references Department, Salary------------------------------------foreign key references Payment,

ii. PAYROLL Attributes----------------------------------------Key types Hourlyworked---------------------------------------------primary key SSN-----------------------------------------------------foreign key

iii. LEDGER Attributes------------------------------------Key types SSN-----------------------------------------Primary key and foreign key

iv. DEPARTMENT Attributes-----------------------------------Key types Dnumber------------------------------------primary key,

v. PAYMENT Attributes------------------------------------Key types Salary-----------------------------------------primary key

vi. PROJECTS Attributes------------------------------------Key type Pnumber--------------------------------------primary key Dnumber--------------------------------------foreign key

D) RELATIONSHIP BETWEEN ENTITIES a. Between Employee and Department

� The relationship is many-to-many Because Many employers can work in many departments. Diagrammatically,

PAYROLL SYSTEM PROJECTS

Payroll projects Page 6

∞ ∞

� Also from many Employees the manager of Departments is one because of this the relationship between Employee and Department here is one-to-many. Diagrammatically,

b. Between Employee and Payroll

� The relationship between Employee and Payroll is one-to-many because one employee can have the same hours of work rates.

Diagrammatically, ∞ 1

c. Between Employee and Ledger � The relationship between employee and ledger is many-to-one because ledger

table shows the month in which employees earned their pay. Diagrammatically,

d. Between Employee and payment � The relationship between Employee and payment is many-to-many because for

many Employees different salary is paid. Diagrammatically, ∞ ∞

e. Between Employee and Projects � The relationship between Employee and Project is many-to-many because many

employees participate in many projects and works on that project. Diagrammatically,

f. Between Department and projects � The relationship between Departments and project is one-to-many because one

department only can controls so much projects.

Employee Department Works-in

Employee Payroll Have

Employee Earn Ledger

Employee Paid Payment

Employee Works on Projects

Employee Manages Department

PAYROLL SYSTEM PROJECTS

Payroll projects Page 7

Diagrammatically,

E) CARDINALITY RATIO The possible cardinality ratios for binary relationship types are 1:1, 1: N, N: 1, and M: N.

1. The cardinality ratio between Employee and Department there is M: N ratio. 2. The cardinality ratio between Employee and payroll there is M: 1 ratio. 3. The cardinality ratio between Employee and Ledger there is 1:1 ratio. 4. The cardinality ratio between Employee and Payment there is M:N ratio.

F) PARTIAL AND TOTAL PARTICIPATION The relation of partiality and totality of entities exist in payroll system are:

1. The relationship of Department and Employee is Total every employee participates in the departments and works in those departme Diagrammatically these relationships is shown below respectively

2. The relation between Employee and Payroll many-to-one since many employer can have the same hours of works rate. Diagrammatically it is shown as bellows

3. The relation between Employee and ledger is Partial because Every employee participate to earn their pay in the same or one month. Diagrammatically this can be shown as:

4. The relationship between Employee and Payment entity is total participation because every employee participates in the earning of theirs payments in every month. Diagrammatically this can be shown as follows:

Department Project Controls

Employee Works-

for Department

Employee Have Payroll

Employee Earn Ledger

Employee Paid Payment

PAYROLL SYSTEM PROJECTS

Payroll projects Page 8

5. The relationship between Employee and project can be total participation because in many projects many employees participate to achieve their goals. Diagrammatically this participation is shown as:

6. The participation of Department to project is partial because every department does not participate in the every project and control every projects. Diagrammatically this participation is shown as:

G) THE ROLE (ROLE NAME ) OF EACH RELATION Since, the definition for role name signifies the role that a participating entity from the entity type plays in each relationship instance, and helps to explain what the relationship means. Those role names are:

i. Between Employee and Department works-for ii. Between Employee and payroll have iii. Between Employee and ledger is earn iv. Between Employee and Payment is paid v. Between Employee and Project works on vi. Between Department and Projects Controls

Employee Works on Projects

Department Controls Projects

PAYROLL SYSTEM PROJECTS

Payroll projects Page 9

H) SKETCH THE ER DIAGRAM USING ER MODELING

M 1 1 M

Employee

Sex SSN

Name

Works-in Department

Controls

Projects

Works-

on

Manages

Ea

rn

Ledger

Have

Payroll

Paid

Payment

Lname

Fname

Mname

Dnumber

Hourlyworked

Sa

lary

Dnumber Dname

Loca

tio

n

Pname

Pnumber

Ta

x

Salary

SSN

Deduction

Pa

yra

te

Pe

nsi

on

Name

Ho

url

y w

ork

ed

Rate of month

Date

SSN

dnumbe

PAYROLL SYSTEM PROJECTS

Payroll projects Page 10

I) MAP THE ER DIAGRAM TO THE RELATIONAL TABLE

1. Employee table: Name SSN Salary dnumber Sex Pnumber

2. Department table: dname dnumber Location

3. Payroll table: Hourly worked SSN Rate of month

4. Ledger table: SSN Date

5. Payment table: Salary Tax Pension Payrate Deduction

6. Project table: Pnumber Pname dnumber 2.2 LOGICAL DESIGN

• NORMALIZE YOUR RELATION Since the entire relational table already normalized we can leave as it is, but we will take as an example un normalized table of Employee-payment-department from the ER diagram of payroll management system. Unnormalized table of Employee-payment-department Ename SSN dname salary dnumber pname pnumber 1. First normalization form (1NF)

Identify functional dependency Employee SSN, Ename, sex Employee-Project SSN, pnumber, salary, payrate, deduction, dnumber, dname

2. Second normalization form (2NF) Deleting partial dependency Employee SSN, Ename, sex Project pnumber, SSN, salary Project-department pnumber, dnumber, pname, dname,

3. Third normalization form (3NF) Deleting partial dependency Employee SSN, Ename, sex Project pnumber, SSN, salary

PAYROLL SYSTEM PROJECTS

Payroll projects Page 11

Prod dnumber, pnumber,

CHAPTER -3 PHSICAL DESIGN (IMPLEMENTATION)

3 Implementation Implement the projects in the lab using SQL 2005 DATABASE SERVER 3.1 Creating entire table for the projects with the appropriate data type

create database Payroll ; use payroll ; create table department ( dname varchar ( 30) not null, dnumber int not null, location varchar ( 30) not null, primary key ( dnumber )); create table project ( pnumber int not null, dnumber int not null, pname varchar ( 20) not null, primary key ( pnumber ), foreign key ( dnumber ) references department ( dnumber )); create table payment ( salary real not null, tax real , pension real , deduction real , primary key ( salary )); create table emplyee ( ename varchar ( 30) not null, SSN varchar ( 30) not null, salary real not null, dnumber int not null, sex varcha not null, pnumber int not null, primary key ( SSN), foreign key ( dnumber ) references department ( dnumber ), foreign key ( salary ) references payment ( salary ), foreign key ( pnumber ) references project ( pnumber )); create table payroll (

PAYROLL SYSTEM PROJECTS

Payroll projects Page 12

H_worked real not null, SSN varchar ( 30) not null, R_month real not null, primary key ( H_worked , SSN), foreign key ( SSN) references employee ( SSN)); create table ledger ( SSN varchar ( 30) not null, Ldate varchar ( 10) not null, primary key ( SSN), foreign key ( SSN) references employee ( SSN));

3.2 Create the appropriate relationship for your design

in SQL 2005

PAYROLL SYSTEM PROJECTS

Payroll projects Page 13

3.3 Populate the relation with sample data

insert into department ( dname, dnumber , location ) values ( 'CS' , 1, 'Nekemte' ); insert into department ( dname, dnumber , location ) values ( 'Business' , 2, 'Jimma' ); insert into department ( dname, dnumber , location ) values ( 'IT' , 3, 'Ambo' ); insert into department ( dname, dnumber , location ) values ( 'Agri' , 4, 'Shambu' ); insert into project ( pname, pnumber , dnumber ) values ( 'sisco' , 001 , 3); insert into project ( pname, pnumber , dnumber ) values ( 'plantscience' , 002 , 4); insert into project ( pname, pnumber , dnumber ) values ( 'prolong' , 003 , 1); insert into project ( pname, pnumber , dnumber ) values ( 'Marketing' , 004 , 2); insert into payment values ( 500 , 3, 5, 6); insert into payment values ( 1500 , 5, 5, 10); insert into payment values ( 5000 , 45, 78, 23); insert into payment values ( 2000 , 123 , 23, 90); insert into payment values ( 3500 , 3, 55, 60); update payment set tax =salary * 0.0 - 0 where salary <=150 ; update payment set tax =salary * 0.1 - 15 where salary <=650 ; update payment set tax =salary * 0.15 - 47.5 where salary <=1400 ; update payment set tax =salary * 0.2 - 117.5 where salary <=2350 ; update payment set tax =salary * 0.25 - 262 where salary <=3500 ; update payment set tax =salary * 0.3 - 412.5 where salary <=5000 ; update payment set tax =salary * 0.35 - 662.5 where salary >5000 ;

insert into employee values ( 'Beresa' , '0987' , 500 , 001 , 'M' , 1); insert into employee values ( 'hawii' , '0967' , 1500 , 003 , 'F' , 3); insert into employee values ( 'Bontu' , '0900' , 3500 , 002 , 'F' , 4); insert into employee values ( 'Megersa' , '0345' , 5000 , 004 , 'M' , 2); insert into employee values ( 'Bula' , '0768' , 2000 , 002 , 'M' , 3); insert into employee values ( 'Abdena' , '0842' , 500 , 001 , 'M' , 1); insert into employee values ( 'Gemada' , '0917' , 5000 , 002 , 'M' , 4);

PAYROLL SYSTEM PROJECTS

Payroll projects Page 14

insert into payroll values ( 1, '0987' , 54); insert into payroll values ( 4, '0917' , 34); insert into payroll values ( 2, '0768' , 23); insert into payroll values ( 3, '0987' , 54); select * from payroll ; insert into ledger values ( '0987' , '12/05/2007' ); insert into ledger values ( '0768' , '16/06/2007' ); insert into ledger values ( '0917' , '13/03/2007' ); insert into ledger values ( '0345' , '12/08/2007' ); insert into ledger values ( '0842' , '12/05/2007' ); select * from ledger ;

3.4 Generate at least 10 important SQL queries

1. Inserting the entire data to the each tables

2. Update the entire data- this update is more

applicable in the payment table to calculate tax,

pension, deduction and all the calculation parts

held in the payroll management system.

3. Select to select and retrieve all the table entries

with their attributes.

4. Delete to remove a single attributes from the

payrolls table in the payroll management system.

5. Nested query

� SELECT * FROM employee WHERE SSN IS NULL;

� SELECT DISTINCT SSN FROM employee WHERE (Pno, Hours) IN (SELECT Pno, Hours FROM employee WHERE SSN=‘0987’);

PAYROLL SYSTEM PROJECTS

Payroll projects Page 15

6. Remove table payments, employee and ledger

� Drop table payment; � Drop table ledger; � Drop table employee;

7. Count all employee their salary is less than 500

� Select count(*) as count_ from employee e, payment p where e.SSN=p.SSN and salary<500;

8. Sum all the payments attribute � SELECT SUM (Salary) as sum_salary from

payment; � Select sum(pension) as sum_pension from

payment; � Select sum(deduction) as sum_deduction

from payment; 9. MAX and MIN of all the salary, pension, tax,

deduction � Select max(salary) as Max_salary,

min(salary) as min_salary, max(pension) as max_pension, min(pension) as min_pension, max(tax) as max_pension,max(deduction) as max_deduction, min(deduction) as min_deduction from payment;

10.Average of salary � Select avg(salary) as Avg_salary from

payment;