Project - Employee Management System
Project - Employee Management System
This is to certify that PRIYA KUMARI, Roll No :26656434 has successfully completed
Computer Science (083) laid down in the regulations of CBSE for the purpose
Examiner:
Name:
Signature:
pg. 1
CONTENT
TABLE OF CONTENTS
1. Acknowledgement 4
2. Introduction 5
4. Output 17-24
pg. 2
ACKNOWLEDGEMENT
Apart from the efforts of me, the success of any project depends largely on the
encouragement and guidelines of many others. I take this opportunity to express my gratitude to the
people who have been instrumental in the successful completion of this project.
I express deep sense of gratitude to almighty God for giving me strength for the successful
completion of the project.
I express my heartfelt gratitude to my parents for constant encouragement while carrying out
this project.
I gratefully acknowledge the contribution of the individuals who contributed in bringing this
project up to this level, who continues to look after me despite my flaws,
I express my sincere thanks to the academician The Principal, RPVV RAJ NIWAS MARG,
for constant encouragement and the guidance provided during this project
My sincere thanks to SH. SUNNY JAIN sir , computer science teacher, A guide, Mentor all
the above a friend, who critically reviewed my project and helped in solving each and every problem,
occurred during implementation of the project
The guidance and support received from all the members who contributed and who are
contributing to this project, was vital for the success of the project. I am grateful for their constant
support and help.
pg. 3
EMPLOYEE MANAGEMENT SYSTEM
INTRODUCTION
The Employee Management System is basically a File based project done with help of
python language. this project is very use full for the companies/MNCs to keep a count on what
project they have and how their company has been progressing, salaries of employees and many
more. This project is multifield project, so that it can be modified for various purposes.
The objective of this project is to let the students apply the programming knowledge into a
real- world situation/problem and exposed the students how programming skills helps in developing
a good software.
sized projects.
• Students will demonstrate ability to conduct a research or applied Computer Science project,
requiring writing and presentation skills which exemplify scholarly style in computer science.
pg. 4
PROJECT ON EMPLOYEE MANAGEMENT SYSTEM
import pickle
import datetime
# Main menu
def Menu():
print('*'*160)
print('MAIN MENU'.center(90))
print(' '*40+'1. Insert Employee Record/Records')
print(' '*40+'2. Display Sorted Empolyee Records as per Emp No')
print(' '*40+'3. Display Sorted Empolyee Records as per Names')
print(' '*40+'4. Display Sorted Empolyee Records as per
Designation')
print(' '*40+'5. Display Employee Records as the Designation ')
print(' '*40+'6. Delete Record')
print(' '*40+'7. Update Record')
print(' '*40+'8. Search Employee Record Details as per the Employee
ID')
print(' '*40+'9. Search Record Detalis as per the Customer Name')
print(' '*40+'10. Apply for leave')
print(' '*40+'11. Display Gross Salary Breakup')
print(' '*40+'12. Display salary receipt')
print(' '*40+'13. Display total number of active employee')
print(' '*40+'14. List Employee to which Salary not given')
print(' '*40+'15. EXIT')
print('*'*160)
# Sort according to ID
def SortAcc(f):
try:
with open(f,'rb+') as fil:
rec=pickle.load(fil)
rec.sort(key=lambda rec:rec['ID'])
fil.seek(0)
pickle.dump(rec,fil)
except FileNotFoundError:
print(f,'File has no records')
# Insertion function
def Insert(f):
try:
fil=open(f,'ab+')
print(fil.tell())
Des=['MGR','CLK','VP','PRES']
Dep=['HR','IT','SALES','FINANCE']
if fil.tell()>0:
fil.seek(0)
Rec1=pickle.load(fil)
else:
Rec1=[]
while True:
while True:
Eid=input('Enter Emp Id: ')
Eid=Eid.upper()
if any(dict.get('ID')==Eid for dict in Rec1):
print('Employee already exists')
else:
break
Name=input('Enter Employee Name: ')
while True:
Mob=input('Enter Mobile Number: ')
if len(Mob)!=10 or Mob.isdigit()==False:
print('Please enter valid Mobile No: ')
else:
break
while True:
Email=input('Enter Email: ')
if'@' not in Email or '.'not in Email:
print('Enter valid mail address: ')
else:
pg. 6
break
while True:
DeptId=input('Enter Dept Name of the
Empolyee(HR/IT/SALES/FINANCE): ')
if DeptId.upper() in Dep:
break
while True:
Desig=input('Enter the Designation(MGR/CLK/PRES/VP): ')
if Desig.upper() in Des:
break
while True:
Leaves=int(input("Enter leave status, 0 for not taken,
1 for taken: "))
if Leaves==0 or Leaves==1:
break
while True:
Salary_status=int(input("Enter salary status, 0 for
pending 1 for given: "))
if Salary_status==0 or Salary_status==1:
break
# Record data
Rec={
'ID':Eid.upper(),
'NAME':Name.upper(),
'Mob':Mob,
'Email':Email.upper(),
'DeptId':DeptId.upper(),
'Desig':Desig.upper(),
'Sal':Sal,
'Date':Dat,
'Leaves': Leaves,
'Salary_status':Salary_status
}
Rec1.append(Rec)
pickle.dump(Rec,fil)
ch=input('Do you want to enter more records')
if ch=='N' or ch=='n':
break
fil.close()
with open(f,'wb')as fil:
pickle.dump(Rec1,fil)
pg. 7
except ValueError:
print('Invalid values entered')
# Display function
def Display(f):
try:
with open(f,'rb')as fil:
print('='*160)
f='%15s %15s %15s %15s %15s %15s %15s %15s %15s %16s'
print(f%('ID','NAME','MOBILE','EMAIL ADDRESS','Dept
ID','Designation','SALARY','DATE OF JOINING', 'Leave status', 'Salary
status'))
print('='*160)
Rec=pickle.load(fil)
c=len(Rec)
for i in Rec:
for j in i.values():
print('%15s' % j,end='')
print()
print()
print('*'*160)
print('Records Read :',c)
except EOFError:
print('='*160)
print('Records Read :',c)
except FileNotFoundError:
print(f,"File Doesn't exist")
except EOFError:
print('='*160)
print('Records Read :',c)
except FileNotFoundError:
print(f,"Files Doesn't exist")
except EOFError:
print('='*160)
print('Records Read :',c)
except FileNotFoundError:
print(f,"Files Doesn't exist")
# Update function
def Update(f):
try:
pg. 9
with open(f,'rb+')as fil:
found=0
Rec=pickle.load(fil)
A=input('Enter the Emp ID whose details to be changed: ')
for p in Rec:
if A==p['ID']:
found=1
for i,j in p.items():
if i!='Date':
if i!='Sal':
ch=input('Change '+i+'(Y/N): ')
if ch=='y'or ch=='Y':
p[i]=input('Enter new '+i)
p[i]=p[i].upper()
elif i=='Sal':
ch=input('Change '+i+'(Y/N): ')
if ch=='y'or ch=='Y':
p[i]=float(input('Enter new '+i))
break
if found==0:
print('Employee details not found ')
else:
fil.seek(0)
pickle.dump(Rec,fil)
except EOFError:
print('Records not found ')
except FileNotFoundError:
print(f,"Files Doesn't exist")
# Delete function
def Delete(f):
try:
with open(f,'rb+')as fil:
Rec=pickle.load(fil)
ch=input('Enter the Employee ID to be deleted: ')
for i in range(0,len(Rec)):
if Rec[i]['ID']==ch:
print('*'*160)
f='%15s %15s %15s %15s %15s %15s %15s %15s %15s
%15s'
print(f%('ID','NAME','MOBILE','EMAIL ADDRESS','Dept
ID','Designation','SALARY','DATE OF JOINING','Leave status', 'Salary
status'))
N=Rec.pop(i)
for j in N.values():
print('%15s'% j,end='')
pg. 10
print()
print('Record Deleted')
break
else:
print('Record Not found')
fil.seek(0)
pickle.dump(Rec,fil)
except FileNotFoundError:
print('Records not found ')
except KeyError:
print('Record not found')
except IndexError:
print('Record not found')
except FileNotFoundError:
print(f,"File Doesn't exist")
except FileNotFoundError:
print(f,"File Doesn't exist")
except EOFError:
print('Record not found')
print(f%(i['ID'],i['NAME'],i['Sal'],HRA,DA,TAX,GROSS))
else:
print('Going to Main menu.............')
pg. 12
except FileNotFoundError:
print(f,"File Doesn't exist")
# Printing slip
def Slip(f):
try:
with open(f,'rb')as fil:
Rec=pickle.load(fil)
id=input("Enter Employe ID for slip: ")
for i in Rec:
if id.upper()==i['ID']:
if i['Salary_status']==0:
print("Salary is not paid. Hence slip cannot be
given")
break
else:
print("Yes, the salary is paid, Generating
slip........")
ch=input('Continue(Y/N)')
if ch=='y'or ch=='Y':
print('*'*160)
print("\n")
print("******************* Employee Salary
Slip ************************** ")
f='%15s %15s %15s %15s '
print(f%('ID','NAME','Basic Salary','Salary
status'))
print()
print(f%(i['ID'],i['NAME'],i['Sal'],i['Salary_status']))
else:
print('Going to Main menu')
except FileNotFoundError:
print(f,"File Doesn't exist")
except FileNotFoundError:
print(f,"File Doesn't exist")
if found==0:
print('Employee details not found ')
else:
fil.seek(0)
pickle.dump(Rec,fil)
except EOFError:
print('Records not found ')
except FileNotFoundError:
print(f,"Files Doesn't exist")
# Infinite loop
while True:
Menu()
ch=input('Enter your choice: ')
if ch=='1':
Insert(File)
elif ch=='2':
pg. 14
SortAcc(File)
Display(File)
elif ch=='3':
SortName(File)
Display(File)
elif ch=='4':
SortDesig(File)
Display(File)
elif ch=='5':
DisplayonDesig(File)
elif ch=='6':
Delete(File)
elif ch=='7':
Update(File)
elif ch=='8':
SearchID(File)
elif ch=='9':
SearchName(File)
elif ch=='10':
Leave(File)
elif ch=='11':
Debit(File)
elif ch=='12':
Slip(File)
elif ch=='13':
Count(File)
elif ch=='14':
DisplayonSalary(File)
elif ch=='15':
print('Exiting....')
quit(1)
else:
print('Wrong Choice Entered, Try again: ')
pg. 15
OUTPUT OF PROGRAM
1.Inserting the record:
pg. 16
3.Display as per Names:
pg. 17
5.Display on the basis of Designation:
6.Delete record:
pg. 18
7.Update record:
pg. 19
9.Search on the basis of Name:
pg. 20
11.Display Gross Salary:
pg. 21
13.Display active employees:
pg. 22
15.Exit:
pg. 23