0% found this document useful (0 votes)
21 views

Employee Management

computer science

Uploaded by

Chahel Modi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Employee Management

computer science

Uploaded by

Chahel Modi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 24

EMPLOYEE MANAGEMENT

DONE BY: PREKSHA CHORDIA

CLASS: XII A
Under the guidance of
Mr. MANOJ BALANI
COMPUTER SCIENCE
DEPARTMENT OF COMPUTER
SCIENCE
SIR MUTHA SCHOOL, CHENNAI
ACKNOWLEDGEMENT

I would like to express a deep sense of


thanks
and gratitude to the principal and my
school for providing me with the facility that
was required. I would like to extend my
gratitude to my computer science teacher
Mr Manoj for guiding me immensely through
the course of my project.
THANKS AGAIN TO EVERYONE WHO
HELPED ME

INDEX
1. Acknowledgement………………………..

2. Introduction………………………………..

3. Hardware and software used……………

4. Why python………………………………..

5. Code………………………………………….

6. Output……………………………………..

7. Further Development…………………….

8. Bibliography……………………………….

INTRODUCTION
The purpose of the employee management
system is to provide a mechanism that
handles office operations using a computer
within a fraction of a second. As the name
suggests it is connected to the employees
of
the workplace. It records full employee
information like the Name, Date of joining,
calculating the salary with the number of
holidays taken, the post of the employee,
the
number of holidays taken in a month,
Deleting the employee, bonus, and
promotion. The employees can apply for
their
leave, there are only a small number of
leaves
in a month
HARDWARE AND
SOFTWARE USED

HARDWARE USED:
LAPTOP-O40VO6QV
SOFTWARE USED:
Python, MYSQL
WHY PYTHON?
Python is a very productive language.
We don’t need to spend too much time
understanding the syntax or behaviour of
the
programming language. Python is an
interpreted language which means that
Python directly executes the code line by
line.
In case of any error, it stops further
execution and reports back the error which
has occurred.
Python shows only one error even if the
program has multiple errors. This
makes debugging easier.

Python doesn’t know the type of variable


until we run the code. It automatically
assigns the data type during execution.

The programmer doesn’t need to worry


about declaring variables and their data
types.
CODE
import mysql.connector

con = mysql.connector.connect(
host="localhost", user="root", password="",
database="emp")

def Add_Employee():
Id = input("Enter Employee Id : ")
if(check_employee(Id) == True):
print("Employee aready 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()
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:
Post = input("Enter change in post")

sql = 'select post from empd where id=%s'


data = (Id,)
c = con.cursor()

c.execute(sql, data)

r = c.fetchone()
t = Post

sql = 'update empd set Post=%s where id=


%s'
d = (t, Id)

c.execute(sql, d)

con.commit()
print("Employee Promoted")
menu()

def Bonus_Employee():
Id = int(input("Enter Employ's Id"))

if(check_employee(Id) == False):
print("Employee does not exists\nTry Again\
n")
menu()
else:
bn = int(input("Enter Bonus:"))

sql = 'select salary from empd where id=


%s'
data = (Id,)
c = con.cursor()

c.execute(sql, data)

r = c.fetchone()
t = r[0]+bn

sql = 'update empd set salary=%s where


id=%s'
d = (t, Id)

c.execute(sql, d)

con.commit()
print("Bonus Added")
menu()

def leave_Employee():
Id=input("Enter employee Id")
day=int(input("Enter the number of leave
days"))
if (day<=3):
print("LEAVE GRANTED")
print("EMPLOYEE ID:",Id,",",day,"DAYS
LEAVE GRANTED")
else:
print("PLEASE SEEK PERMISSION FROM THE
HR MANAGER")
menu()

def Remove_Employee():
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()

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

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

def menu():
print(" Employee Management System")
print("Press: ")
print("1 to Add Employee")
print("2 to Remove Employee ")
print("3 to Display Employee")
print("4 to Bonus Employees")
print("5 to promote Employee")
print("6 to Grant leave")
print("7 tO Exit")

ch = int(input("Enter your Choice "))


if ch == 1:
Add_Employee()
elif ch == 2:
Remove_Employee()
elif ch == 4:
Bonus_Employee()
elif ch == 3:
Display_Employees()
elif ch == 7:
Exit(0)
elif ch== 5:
Promote_Employee()
elif ch==6:
leave_Employee()
else:
print("Invalid Choice")
menu()

menu()

OUTPUT
FURTHER
DEVELOPMENT

I would further develop this code where it

would calculate the salary with the number


of

leaves are taken after a certain number of


days.
After an employee is removed the names of

the employee are not displayed so would do

the code in such a way that would display

the employee after the one is removed


BIBLIOGRAPHY

Sumita Arora computer science


textbook class 12

Sumita Arora computer science class


textbook class 11

https://
www.anjeevsinghacademy.com/
python1

Anjeev Singh academy


https://www.geeksforgeeks.org/
python-programming-language/
Geeks for Geeks

You might also like