Employee Management

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

EMPLOYEE MANAGEMENT

SYSTEM

GROUP MEMBERS :

SANJAY.V
IRIN MARIAM SANU
INTRODUCTION

Employee Management system is an application that enables


users to create and store Employee Records. It also helps to
maintain the data of existing employees. It also helps to know
the number of employees in different departments by the
help of piechart and graph. This application is helpful to
department of the organization which maintains data of
employees related to an organization.

It is simple to understand and can be used by anyone who is


not even familiar with simple employees system. It is user
friendly and just asks the user to follow step by step
operations by giving him few options. It is fast and can
perform many operations of a company.

This software package has been developed using the powerful


coding tools of PYTHON. The software is very user friendly.
The package contains different modules like Employee details.
This version of the software has multi-user approach. For
further enhancement or development of the package, user
feedback will be considered.
The mission is to facilitate easy management and administration
of an employee record with capabilities to add, update, remove,
search, graphical representation of employee records, etc. using
the automated employee record management software.

One can keep detailed records or info on an unlimited amount of


employees. The system lets the user know which all employee
are available at any point of time. This makes the handling
considerably faster. And thus helps the employee record in
better management and reduce a lot of paper work as well as
manpower

ADVANTAGES OF THIS SYSTEM :

● Secure data
● Faster process
● Error Free
● Better management
● Save a lot of manpower
● Can easily make the daily reports
● Elimination of Paper work.
● High reliability and security.
● Fast and economical.
MODULE USED
MYSQLCONNECTOR
MySQL Connector/Python is a pure-Python MySQL driver that provides a
Pythonic interface to MySQL databases. It is the official MySQL driver for
Python, and it is compatible with all versions of MySQL from 5.0 and up.
It can be used with any Python application that uses the standard DB-API.
MySQL Connector/Python is a versatile tool that can be used for a wide
variety of applications, including:
Developing web applications: MySQL Connector/Python can be used
to connect to MySQL databases from web applications written in
Python.
Data analysis: MySQL Connector/Python can be used to connect to
MySQL databases making it easy to extract and analyze data from
MySQL databases.
MySQL Connector/Python is a powerful and easy-to-use tool that is
essential for any Python developer who needs to work with MySQL
databases.
Here are some of the benefits of using MySQL Connector/Python:
Pure Python: MySQL Connector/Python is written in pure Python,
which means that it does not require any C extensions. This makes it
easy to install and use, and it also makes it more portable than other
MySQL drivers.
Feature-rich: MySQL Connector/Python supports a wide range of
features, including prepared statements, stored procedures, and
binary data.
Well-maintained: MySQL Connector/Python is actively maintained by
a team of developers, and it is regularly updated with new features
and bug fixes
SOURCE CODE

GETTING STARTED

For creating the Employee Management System in Python that uses


MySQL database we need to connect Python with MySQL.
For making a connection we need to install mysqlconnector which
can be done by writing the following command in the command
prompt on Windows.
“pip install mysqlconnector”

Now after successful installation of mysqlconnector we can connect


MySQL with Python which can be done by writing the following
code

import mysql.connector

con=mysql.connector.connect(host="localhost",
user="root", password="password", database="emp")
CHECK EMPLOYEE FUNCTION
The check employee function takes employee id as a parameter and
checks whether any employee with given id exists in the employee
details record or not. For checking this it uses cursor.rowcount()
function which counts the number of rows that match with given
details. It is a utility function, and we will see its use in later
operations like Add employee function, etc.
Program:

# Function To Check if Employee with


# given Id Exist or Not

def check_employee(employee_id):
sql = 'select * from empd where id=%s'
c = con.cursor(buffered=True)
data = (employee_id,)

c.execute(sql, data)

r = c.rowcount
if r == 1:
return True
else:
return False
ADD EMPLOYEE FUNCTION
The Add Employee function will ask for the Employee Id and uses
the check employee function to check whether the employee to be
added already exist in our record or not if employee details do not
already exist then it asks for details of the employee to be added
like Employee Name, Post of Employee and Salary of the employee.
Now after getting all such details from the user of that system it
simply inserts the information in our Employee details table.
Program:

# Function to mAdd_Employee

def Add_Employ():
Id = input("Enter Employee Id : ")
if(check_employee(Id) == True):
print("Employee already exists\nTry Again\n")
menu()
else:
Name = input("Enter Employee Name : ")
Post = input("Enter Employee Post : ")
Salary = input("Enter Employee Salary : ")
data = (Id, Name, Post, Salary)
sql = 'insert into empd values(%s,%s,%s,%s)'
c = con.cursor()
c.execute(sql, data)
con.commit()
print("Employee Added Successfully ")
menu()
REMOVE EMPLOYEE FUNCTION
The Remove Employee Function will simply ask for Id of the
employee to be removed because Id is Primary key in our Employee
Details Record as there can be two employees with the same name,
but they must have a unique id. The Remove Employee function
uses the check employee function to check whether the employee
to be removed exists in our record or not if employee details exist
then after getting a valid employee id it deletes the record
corresponding to that employee id.
Program:

# Function to Remove Employee with given Id

def Remove_Employ():
Id = input("Enter Employee Id : ")
if(check_employee(Id) == False):
print("Employee does not exists\nTry Again\n")
menu()
else:
sql = 'delete from empd where id=%s'
data = (Id,)
c = con.cursor()
c.execute(sql, data)
con.commit()
print("Employee Removed")
menu()
PROMOTE EMPLOYEE FUNCTION
The Promote Employee function will ask for the Employee Id and
uses the check employee function to check whether the employee
to be Promoted exist in our record or not if employee details exist
then it will ask for the amount by which his salary is to be
increased. After getting the valid details it increases the salary of
the employee with the given id by the given amount.
Program:

# Function to Promote Employee

def Promote_Employee():
Id = int(input("Enter Employ's Id"))
if(check_employee(Id) == False):
print("Employee does not exists\nTry Again\n")
menu()
else:
Amount = int(input("Enter increase in Salary"))
sql = 'select salary from empd where id=%s'
data = (Id,)
c = con.cursor()
c.execute(sql, data)
r = c.fetchone()
t = r[0]+Amount
sql = 'update empd set salary=%s where id=%s'
d = (t, Id)
c.execute(sql, d)
con.commit()
print("Employee Promoted")
menu()
DISPLAY EMPLOYEES FUNCTION
The Promote Employee function will ask for the Employee Id and
uses the check employee function to check whether the employee
to be Promoted exist in our record or not if employee details exist
then it will ask for the amount by which his salary is to be
increased. After getting the valid details it increases the salary of
the employee with the given id by the given amount.
Program:

# Function to Display All Employees

def Display_Employees():
sql = 'select * from empd'
c = con.cursor()
c.execute(sql)
r = c.fetchall()
for i in r:
print("Employee Id : ", i[0])
print("Employee Name : ", i[1])
print("Employee Post : ", i[2])
print("Employee Salary : ", i[3])
print("-----------------------------\
-------------------------------------\
-----------------------------------")
menu()
MENU FUNCTION
The Menu function displays the menu to the user and asks the user
to enter his choice for performing operations like Add employee,
Remove employee, etc.
Program :

# menu function to display the menu

def menu():
print("Welcome to Employee Management Record")
print("Press ")
print("1 to Add Employee")
print("2 to Remove Employee ")
print("3 to Promote Employee")
print("4 to Display Employees")
print("5 to Exit")
ch = int(input("Enter your Choice "))
if ch == 1:
Add_Employ()
elif ch == 2:
Remove_Employ()
elif ch == 3:
Promote_Employee()
elif ch == 4:
Display_Employees()
elif ch == 5:
exit(0)
else:
print("Invalid Choice")
menu()
BIBLIOGRAPHY
Computer science With Python - Class XI By: Sumita Arora

ChatGPT

GitHub.com

www.geeksforgeeks.org

You might also like