You are on page 1of 36

Subodh Public

School

A
Project Report
on
Employee Management

Submitted By Under the Guidance of


1. Kratika Mittal Mr. Sunil Nehra
2. Manish Suryakant Jain PGT (Computer Science)
3. Mohit Chandel

CERTIFICATE

This is to certify that Kratika Mittal, Manish Suryakant Jain and Mohit Chandel of
Class XII A, has successfully completed the investigatory project on the topic Employee
Management under the guidance of Mr. Sunil Nehra (PGT, Computer Science) during
the academic year 2019-20 in the partial fulfillment of AISSCE Practical Examination
conducted by CBSE.

Signature of Signature of Signature of


Internal Examiner External Examiner Candidate
DECLARATION
I hereby declare that the project work entitled “Employee Management” submitted to
Department of Computer Science, Subodh Public School, Jaipur is prepared by us. All the
coding is result of my personal efforts.

1. Kratika Mittal – XII A


2. Manish Suryakant Jain – XII A
3. Mohit Chandel – XII A
ACKNOWLEDGEMENT
I would like to express a deep sense of thanks and gratitude to my project guide Mr. Sunil
Nehra Sir for guiding me immensely through the course of the project. He always evinced
keen interest in my work. His constructive advice and constant motivation have been
responsible for the successful completion of this project.

My sincere thanks goes to Dr Bela Joshi, our Principal Madam, for her coordination in
extending every possible support for completion of this project.

I also thanks to my parents for their motivation and support. I must thanks to my
classmates for their timely help and support for compilation of this project.

Last but not least, I would like to those who had helped directly or indirectly towards the
completion of this project.

1. Kratika Mittal – XII A


2. Manish Suryakant Jain – XII A
3. Mohit Chandel – XII A
CONTENTS

1. Introduction

2. Imported files and used functions in Python

3. Table Created in MySQL

4. Coding

5. Output Scenes

6. Limitations and Enhancement

7. Bibliography
INTRODUCTION

The project is designed to keep records of Employee in specific department and


specific post who are working in these companies. A table named cred in
MySQL5.0 to store information about user login ids and passwords.

One more table named department in MySQL5.0 to store information about


department code, name and their packages.

One more table named post in MySQL5.0 to store information about post code
and name.

One more table named staff in MySQL5.0 to store information about employee
(staff) name, address, phone number, salary and post.

Administrator of the project can enter new record, display all/specific


passenger record; he can modify and delete records in any table.
Files Imported in Project

1. Import MYSQL for database connectivity

Functions Used in Project

1. connect()- For Database and tables creation


2. cursor()- To execute MySQL queries.
3. fetchall ()- To fetch all the rows.
4. commit()- To execute (commit) current transaction.
5. fetchone ()- To fetch row according to query.
Tables Created in MySQL

Table: cred

Table: staff

Table: department

Table: post
CODING
import mysql.connector as my

yu="n"

while yu=="n":

print("---1-FOR LOGIN---")

print("---2-FOR SIGNUP---")

print("---0-EXIT---")

a6=input("ENTER:-")

if a6=="1":

uname=input(" ENTER USERNAME:-")

pswd=input(" ENTER PASSWORD:-")

con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")

cur=con.cursor()

cur.execute("select passwd,user_n from cred where user_n='"+uname+"'")

row=cur.fetchall()

for r in row:

if r[0]==pswd:

print("Sucessfully Login!")

cur.close()
# !!!department's employee management functions!!!

f0="n"

while f0=="n":

print("""

---1-Employee Details---

---2-Department Functions---

---3-Post Details---

---4-Update Or Delete LoginID And Password---

---0-LOGOUT---""")

a=input("ENTER:-")

if a=="1":

# !!!employee details functions!!!

f1="n"

while f1=="n":

print("")

print("---1-All Staff Details---")

print("---2-Search Employee By E_ID---")

print("---3-Change Employee Details---")

print("---4-Add New Employee---")

print("---5-Delete Employee Details---")

print("---0-Exit Staff Functions---")

a1=input("ENTER:-")
# !!!all details!!!

if a1=="1":

con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")

cur=con.cursor()

cur.execute("select * from staff")

for i in cur:

print(i)

con.close()

# !!!searcher!!!

if a1=="2":

y="y"

while y=="y":

eid=input("Enter Employee ID:-")

con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")

cur=con.cursor()

cur.execute("select * from staff where s_id='"+eid+"'")

x=cur.fetchone()

if x==None:

print("Invalid Id!")

else:
cur.execute("select * from staff where s_id='"+eid+"'")

for i in cur:

print(i)

con.close()

y=input("Search Another Id(y/n):-")

# !!!changer!!!

if a1=="3":

con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")

cur=con.cursor()

eid=input("Enter Employee ID:-")

cur.execute("select * from staff where s_id='"+eid+"'")

x=cur.fetchone()

if x==None:

print("Invalid Id!")

else:

print("""

---1-Change name---

---2-Change Contact---

---3-Change Address---

---4-Change Salary---""")
a10=input("ENTER:-")

if a10=="1":

aq=input("Enter New Name:-")

con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")

cur=con.cursor()

cur.execute("update staff set s_name='"+aq+"' where


s_id='"+eid+"'")

con.commit()

con.close()

print("Record Updated!")

if a10=="2":

aq=input("Enter New Contact:-")

con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")

cur=con.cursor()

cur.execute("update staff set s_phone='"+aq+"' where


s_id='"+eid+"'")

con.commit()

con.close()

print("Record Updated!")

if a10=="3":

aq=input("Enter New Address:-")


con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")

cur=con.cursor()

cur.execute("update staff set s_addr='"+aq+"' where s_id='"+eid+"'")

con.commit()

con.close()

print("Record Updated!")

if a10=="4":

aq=input("Enter New Salary:-")

con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")

cur=con.cursor()

cur.execute("update staff set s_salary='"+aq+"' where


s_id='"+eid+"'")

con.commit()

con.close()

print("Record Updated!")

# !!!adder!!!

if a1=="4":

nid=input("Enter ID:-")

nna=input("Enter name:-")

nad=input("Enter address:-")
nap=input("Enter Contact:-")

nsa=input("Enter Salary:-")

npo=input("Enter post:-")

con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")

cur=con.cursor()

cur.execute("select s_id from staff where s_id='"+nid+"'")

x=cur.fetchone()

if x==None and len(nap)<=11:

cur.execute("insert into staff


values('"+str(nid)+"','"+nna+"','"+nad+"','"+nap+"','"+nsa+"','"+npo+"')")

con.commit()

con.close()

print("Details Saved!")

else:

print("ID Already Exists Or Invalid Contact!")

# !!!remover!!!

if a1=="5":

aw=input("Enter Employee ID:-")

con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")

cur=con.cursor()

cur.execute("select * from staff where s_id='"+aw+"'")


x=cur.fetchone()

if x==None:

print("Invalid Id!")

else:

cur.execute("delete from staff where s_id='"+aw+"'")

con.commit()

con.close()

print("Record Removed!")

if a1=="0":

f1="y"

print("Staff Functions Closed!")

# !!!Department Functions!!!

if a=="2":

f1="n"

while f1=="n":

print("""

---1-See Department---

---2-Search Department---

---3-Add Department---

---4-Remove Department---

---5-Upadate Department---

---0-Exit Department Functions---""")


a2=input("ENTER:-")

# !!!see Department!!!

if a2=="1":

con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")

cur=con.cursor()

cur.execute("select * from department")

for i in cur:

print(i)

# !!!search item!!!

if a2=="2":

ad="y"

while ad=="y" or ad=="Y":

con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")

cur=con.cursor()

a=input("Enter Department Code:-")

cur.execute("select * from department where deptcode='"+a+"'")

x=cur.fetchone()

if x==None:

print("Invalid Id!")

else:
cur.execute("select * from department where deptcode='"+a+"'")

for i in cur:

print(i)

ad=input("Search Other Department(y/n):-")

# !!!Add Department!!!

if a2=="3":

ad="y"

while ad=="y" or ad=="Y":

ico=input("Enter Department code:-")

ina=input("Enter Department Name:-")

ipa=int(input("Enter Department package:-"))

con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")

cur=con.cursor()

cur.execute("select * from department where deptcode='"+ico+"'")

x=cur.fetchall()

if x==None:

print("Try Again!")

else:

cur.execute("insert into department


values('"+ico+"','"+ina+"','"+str(ipa)+"')")

print("Sucessfully Added!")
con.commit()

con.close()

ad=input("Add Other Department(y/n):-")

print("Department code Already Exists!")

# !!!remover!!!

if a2=="4":

ad="y"

while ad=="y" or ad=="Y":

con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")

cur=con.cursor()

a=input("Enter Department Code:-")

cur.execute("select * from department where deptcode='"+a+"'")

x=cur.fetchone()

if x==None:

print("Invalid Id!")

else:

cur.execute("delete from department where deptcode='"+a+"'")

con.commit()

con.close()

ad=input("Remove Other Department(y/n):-")

print("Deleted Sucessfully!")
# !!!updater!!!

if a2=="5":

ad="y"

while ad=="y" or ad=="Y":

print("""

---1-Change Department Name---

---2-Change Department Package---""")

i=input("ENTER:-")

if i=="1":

e="y"

while e=="y" or e=="Y":

a=input("Enter Department Code:-")

na=input("Enter New Name:-")

con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")

cur=con.cursor()

cur.execute("select * from department where deptcode='"+a+"'")

x=cur.fetchone()

if x==None:

print("Invalid Id!")

else:
cur.execute("update department set deptname='"+na+"' where
deptcode='"+a+"'")

con.commit()

con.close()

e=input("Change Any Other Name(y/n):-")

if i=="2":

e="y"

while e=="y" or e=="Y":

a=input("Enter Department Code:-")

na=int(input("Enter New package:-"))

con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")

cur=con.cursor()

cur.execute("select * from department where deptcode='"+a+"'")

x=cur.fetchone()

if x==None:

print("Invalid Id!")

else:

cur.execute("update department set deptname='"+na+"' where


deptcode='"+a+"'")

con.commit()

con.close()
e=input("Change Any Other Package(y/n):-")

print("Record Updated!")

ad=input("Change Any Other Record(y/n):-")

if a2=="0":

f1="y"

print("Department Closed!")

# !!!post functions!!!

if a=="3":

qp="n"

while qp=="n":

print("""

---1-See List Of Post---

---2-Update Post---

---3-Remove Or Add Post---

---0-Exit Post Functions---""")

a3=input("ENTER:-")

# !!!For list seeing!!!

if a3=="1":

con=my.connect(host='localhost',user="root",passwd="manager",database="empmanage"
)

cur=con.cursor()
cur.execute("select * from post")

for i in cur:

print(i)

con.close()

# !!!Updater!!!

if a3=="2":

er="y"

while er=="y" or er=="Y":

con=my.connect(host='localhost',user="root",passwd="manager",database="empmanage"
)

cur=con.cursor()

ic=input("Enter Post Code:-")

cur.execute("select * from post where post_code='"+ic+"'")

x=cur.fetchone()

if x==None:

print("Invalid Code!")

else:

upq=int(input("Enter New No_Of_Employees:-"))

cur.execute("update post set no_of_employees='"+str(upq)+"' where


post_code='"+ic+"'")

con.commit()
con.close()

print("Post Updated!")

er=input("Change Any Other Post(y/n):-")

# !!!remover and adder!!!

if a3=="3":

ui="y"

while ui=="y" or ui=="Y":

print("""---1-Add New Post---

---2-Remove Post---""")

rty=input("ENTER:-")

if rty=="1":

df="y"

while df=="y" or df=="Y":

con=my.connect(host='localhost',user="root",passwd="manager",database="empmanage"
)

cur=con.cursor()

itc=input("Enter Post Code:-")

itn=input("Enter Post Name:-")

itq=input("Enter No_Of_Employees:-")

cur.execute("select post_code from post where


post_code='"+itc+"'")

x=cur.fetchall()
if x==None:

cur.execute("insert into post values('"+itc+"','"+itn+"','"+itq+"')")

con.commit()

con.close()

print("Post Added!")

else:

print("Post Code Already Exists!")

df=input("Add Any Other Post(y/n):-")

if rty=="2":

op="y"

while op=="y" or op=="Y":

itc=input("Enter Post Code:-")

con=my.connect(host='localhost',user="root",passwd="manager",database="empmanage"
)

cur=con.cursor()

cur.execute("select post_code from post where


post_code='"+itc+"'")

x=cur.fetchone()

if x==None:

print("Invalid Post Code!")

else:

cur.execute("delete from post where post_code='"+itc+"'")


con.commit()

con.close()

print("Post Removed!")

op=input("Remove Any Other Post(y/n):-")

ui=input("Add Or Remove Any Other Post(y/n):-")

if a3=="0":

qp="y"

print("Posts Closed!")

# !!!loginId or Password update or delete programme!!!

if a=="4":

lk="n"

while lk=="n" or lk=="N":

print("""

---1-For Updating LoginId Or Password---

---2-For Remove An ID---

---0-For Exit---""")

jkl=input("ENTER:-")

if jkl=="1":

ty="y"

while ty=="y":

print("""
---1-Update LoginID---

---2-Update Password---""")

rt=input("ENTER:-")

if rt=="1":

nm="y"

while nm=="y" or nm=="Y":

con=my.connect(host='localhost',user="root",passwd="manager",database="empmanage"
)

cur=con.cursor()

oid=input("Enter Old LoginID:-")

nid=input("Enter New LoginID:-")

cur.execute("select * from cred where user_n='"+oid+"'")

x=cur.fetchone()

if x==None:

print("Id Does not Exists!")

else:

cur.execute("update cred set user_n='"+nid+"' where


user_n='"+oid+"'")

con.commit()

con.close()

print("LoginID Updated!")

nm=input("Change Any Other LoginID(y/n):-")


if rt=="2":

nm="y"

while nm=="y" or nm=="Y":

con=my.connect(host='localhost',user="root",passwd="manager",database="empmanage"
)

cur=con.cursor()

oid=input("Enter LoginID:-")

nid=input("Enter New Password:-")

cur.execute("select * from cred where user_n='"+oid+"'")

x=cur.fetchone()

if x==None:

print("Id Does not Exists!")

else:

cur.execute("update cred set passwd='"+nid+"' where


user_n='"+oid+"'")

con.commit()

con.close()

print("Password Updated!")

nm=input("Change Any Other Password(y/n):-")

ty=input("Change Any Other Login Or Password(y/n):-")

if jkl=="2":
nm="y"

while nm=="y" or nm=="Y":

con=my.connect(host='localhost',user="root",passwd="manager",database="empmanage"
)

cur=con.cursor()

oid=input("Enter LoginID:-")

cur.execute("select * from cred where user_n='"+oid+"'")

x=cur.fetchone()

if x==None:

print("Id Does not Exists!")

else:

cur.execute("delete from cred where user_n='"+oid+"'")

con.commit()

con.close()

print("LoginID Removed!")

nm=input("Change Any Other Credential(y/n):-")

if jkl=="0":

lk="y"

print("Sucessfully Exit!")

if a=="0":

f0="y"
print("Sucessfully LOGOUT!")

else:

print("Invalid Login Id or Password!")

print("Try Again!!")

# !!!Signup Function!!!

if a6=="2":

y="y"

while y=="y" or y=="Y":

us=input("Enter New Username:-")

ps=input("Enter New Password:-")

con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")

cur=con.cursor()

cur.execute("select * from cred where user_n='"+us+"'")

x=cur.fetchone()

if x==None:

cur.execute("insert into cred values('"+us+"','"+ps+"')")

print("Sucessfully Saved!")

con.commit()

con.close()

else:
print("UserID Already Exists!")

y=input("Create Other New id(y/n):-")

# !!!Programme Closer!!!

if a6=="0":

yu="y"

print("Programme Closed!")
OUTPUT
Main Record, Employee Details, Insert record, Show Particular
Record, Delete Record, Department record, Post Record, Delete
Record, Update Record.
Limitations and Enhancement

Limitations:

1. Printing facility is not available.

Enhancement:

1. Printing facility code can be generated.


BIBLIOGRAPHY

1. www.google.com

2. Computer Science with Python Book By Preeti Arora Arora

3. https://www.w3schools.com/python

You might also like