Project Report On Employee Management System
Project Report On Employee Management System
PROJECT REPORT ON
ROLL NO :
NAME :
CLASS : XII
PGT (CS)
1
VSS INTERNATIONAL PUBLIC SCHOOL
CERTIFICATE
on______________.
Name: _______________________
Examiner Number:_______________
2
TABLE OF CONTENTS [ T O C ]
01 ACKNOWLEDGEMENT 04
02 INTRODUCTION 05
04 PROPOSED SYSTEM 06
07 FLOW CHART 15
08 SOURCE CODE 16
09
OUTPUT 51
10 INSTALLATION FILE 53
10 TESTING 55
12 BIBLIOGRAPHY 58
3
ACKNOWLEDGEMENT
4
PROJECT ON EMPLOYEE MANAGEMENT SYSTEM
INTRODUCTION
This project is all about software for Employee management system. It helps
to have a full-fledged control over his/her employees. The project is divided into 2
It receives user name and password to log in and register .It keeps the record
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
5
PROPOSED SYSTEM
Today one cannot afford to rely on the fallible human beings of be really
wants to stand against today’s merciless competition where not to wise saying “to
err is human” no longer valid, it’s outdated to rationalize your mistake. So, to keep
pace with time, to bring about the best result without malfunctioning and greater
efficiency so to replace the unending heaps of flies with a much sophisticated hard
One has to use the data management software. Software has been an ascent
markets, which have helped in making the organizations work easier and efficiently.
Data management initially had to maintain a lot of ledgers and a lot of paper work
has to be done but now software product on this organization has made their work
faster and easier. Now only this software has to be loaded on the computer and work
can be done.
This prevents a lot of time and money. The work becomes fully automated
and any information regarding the organization can be obtained by clicking the
6
SYSTEM DEVELOPMENT LIFE CYCLE (SDLC)
7
PHASES OF SYSTEM DEVELOPMENT LIFE CYCLE
INITIATION PHASE
8
SYSTEM CONCEPT DEVELOPMENT PHASE
9
PICTORIAL REPRESENTATION OF SDLC:
PLANNING PHASE
10
REQUIREMENTS ANALYSIS PHASE
This phase formally defines the detailed functional user requirements using
high-level requirements identified in the Initiation, System Concept, and Planning
phases. It also delineates the requirements in terms of data, system performance,
security, and maintainability requirements for the system. The requirements are
defined in this phase to a level of detail sufficient for systems design to proceed.
They need to be measurable, testable, and relate to the business need or
opportunity identified in the Initiation Phase. The requirements that will be used to
determine acceptance of the system are captured in the Test and Evaluation
MasterPlan.
Further define and refine the functional and data requirements and document
them in the Requirements Document.
Develop detailed data and process models (system inputs, outputs, and the
process.
Develop the test and evaluation requirements that will be used to determine
acceptable system performance.
DESIGN PHASE
11
database managers, and network administrators should review and refine the
prototyped designs in an iterative process until they agree on an acceptable design.
Audit, security, and quality assurance personnel should be involved in the review
and approval process. During this phase, the system is designed to satisfy the
functional requirements identified in the previous phase. Since problems in the
design phase could be very expensive to solve in the later stage of the software
development, a variety of elements are considered in the design to mitigate risk.
These include:
DEVELOPMENT PHASE
12
Translating the detailed requirements and design into system components.
Testing individual elements (units) for usability.
Preparing for integration and testing of the IT system.
Testing as a deployed system with end users working together with contract
personnel
IMPLEMENTATION PHASE
This phase is initiated after the system has been tested and accepted by the
user. In this phase, the system is installed to support the intended business
functions. System performance is compared to performance objectives established
during the planning phase. Implementation includes user notification, user training,
installation of hardware, installation of software onto production computers, and
13
integration of the system into daily work processes. This phase continues until the
system is operating in production in accordance with the defined user requirement
14
FLOW CHART
START
LOGIN
ADMIN EMPLOYEE
1.ADD EMPLOYEE 1. PAYSLIP(monthly)
2.UPDATE EMPLOYEE 2. UPDATE EMPLOYEE
3.REMOVE EMPLOYEE
3. PAYSLIP(yearly)
4.SEARCH AND DISPLAY
EMPLOYE DETAILS 4. SEARCH AND DISPLAY
STOP 15
SOURCE CODE
================================================================
import mysql.connector as sql
conn=sql.connect(host='localhost',user='root',password='Vssips2022!'
,database='employee')
if conn.is_connected():
print("{:>70}".format("--->>WELCOME TO VSSIPS EMPLOYEE
MANAGEMENT SYSTEM<<---"))
conn.close()
#-----------------------------
emp_login-------------------------------------------
def emp_login():
import mysql.connector as sql
conn=sql.connect(host='localhost',user='root',password='Vssips2022!'
,database='employee')
if conn.is_connected():
print("{:>60}".format("--->>EMPLOYEE LOGIN<<---"))
d=conn.cursor()
u=input("\nENTER YOUR USERNAME\n")
q=(u,)
b=str(u)
sql_tm="select * from employee_details where user_name=%s;"
d.execute(sql_tm,q)
e=d.fetchall()
if e==[]:
print("\nUSERNAME NOT FOUND\nTRY AGAIN\n")
log_in()
else:
p=input("\nENTER YOUR PASSWORD\n")
if p==u+'@2023':
print("{:>60}".format("--->>WELCOME<<---"))
emp_main_menu()
else:
print("\nINCORRECT PASSWORD\nTRY AGAIN\n")
log_in()
#-----------------------------
ad_login-------------------------------------------
def ad_login():
import mysql.connector as sql
conn=sql.connect(host='localhost',user='root',password='Vssips2022!'
,database='employee')
if conn.is_connected():
print("{:>60}".format("--->>ADMIN LOGIN<<---"))
d=conn.cursor()
16
u=input("\nENTER YOUR USERNAME\n")
q=(u,)
sql_tm="select * from employee_details where user_name=%s;"
d.execute(sql_tm,q)
e=d.fetchall()
if e==[]:
print("\nUSERNAME NOT FOUND\nTRY AGAIN\n")
log_in()
else:
p=input("\nENTER YOUR PASSWORD\n")
if p=='admin2023':
print("{:>60}".format("--->>WELCOME<<---"))
ad_main_menu()
else:
print("INCORRECT PASSWORD\nTRY AGAIN\n")
log_in()
#-----------------------------
add_emp-------------------------------------------
def add_emp():
import mysql.connector as sql
con=sql.connect(host='localhost',user='root',password='Vssips2022!',
database='employee')
if con.is_connected():
print("{:>60}".format("--->>EMPLOYEE REGISTRATION<<---"))
c=con.cursor()
17
while emp_fname1.isalpha()==False:
print("\nINVALID FIRST NAME\nNAME SHOULD CONTAIN ONLY
LETTERS\nPLEASE TRY AGAIN\n")
emp_fname1=input("\nENTER YOUR FIRST NAME\n")
continue
emp_fname=emp_fname1.capitalize()
emp_lastname1=input("\nENTER YOUR LAST NAME\n")
while emp_lastname1.isalpha()==False:
print("\nINVALID LAST NAME\nNAME SHOULD CONTAIN ONLY
LETTERS\nPLEASE TRY AGAIN\n")
emp_lastname1=input("\nENTER YOUR LAST NAME\n")
continue
emp_lastname=emp_lastname1.capitalize()
a=str(emp_fname)
b=str(emp_lastname)
emp_name=a+" " + b
#emp-name
18
if gender!='1' or gender!='2' or gender!='3':
while gender!='1' and gender!='2' and gender!='3':
print("\nINVALID CHOICE\nPLEASE TRY AGAIN\n")
gender = input("ENTER YOUR GENDER: \n1 for MALE\n2
for FEMALE \n3 for OTHERS\n")
continue
if gender== '1':
gender='MALE'
elif gender=='2':
gender='FEMALE'
else:
gender='OTHERS'
19
print("\nENTER WITHIN 70 CHARCTERS ONLY\nPLEASE TRY
AGAIN\n")
permanent_address = input("\nPLEASE ENTER YOUR PERMANENT
ADDRESS IN NOT MORE THAN 70 CHARACTERS\n")
continue
20
y=int(year)
if y<1963 or y>1998:
print("\nNOT ELIGIBLE\nAGE IS BEYOND THE
REQUIRED RANGE\n")
ad_main_menu()
else:
month = input('ENTER MONTH:\n')
while month.isdigit()==False:
print("\nINVALID FORMAT\nPLEASE TRY AGAIN\n ")
month = int(input('ENTER MONTH:\n'))
continue
if month!='1'or month!='2'or month!='3'or month!
='4'or month!='5'or month!='6'or month!='7'or month!='8'or month!
='9'or month!='10'or month!='11'or month!='12':
while month!='1' and month!='2' and month!
='3' and month!='4' and month!='5' and month!='6' and month!='7' and
month!='8'and month!='9'and month!='10'and month!='11'and month!
='12':
print("\nINVALID CHOICE\nPLEASE TRY
AGAIN\n")
month = input("\nENTER YOUR CHOICE\n")
continue
m=int(month)
day = input('ENTER DAY:\n')
while day.isdigit()==False:
print("\nINVALID FORMAT\nPLEASE TRY AGAIN\n ")
day = input('ENTER DAY:\n')
continue
d=int(day)
if month=='1' or month=='3' or month=='5' or
month=='7' or month=='8' or month=='10' or month=='12':
while d>31:
print("\nINVALID FORMAT\nPLEASE TRY AGAIN\n
")
day = input('ENTER DAY:\n')
d=int(day)
continue
elif m==2:
while d>28:
print("\nINVALID FORMAT\nPLEASE TRY AGAIN\n
")
day = input('ENTER DAY:\n')
d=int(day)
continue
elif m==4 or m==6 or m==8 or m==9 or m==11:
while d>30:
print("\nINVALID FORMAT\nPLEASE TRY AGAIN\n
")
day = input('ENTER DAY:\n')
21
d=int(day)
continue
DOB= date(y,m,d)
else:
print("\nPAN NUMBER ALREADY EXISTS\nPLEASE TRY AGAIN")
ad_main_menu()
user_name=emp_id
pwd=emp_id+'@2023'
var=(emp_id,emp_name,designation,ph_no,emergency_ph_no,gender,qualif
ication,blood_group,permanent_address,mail_id,pan_no,dept_id,DOB,use
r_name,pwd,salary)
sql_stm= 'insert into employee_details values(%s,%s,%s,%s,
%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s);'
c.execute(sql_stm,var)
con.commit()
print("\nEMPLOYEE WITH THE ID",emp_id,'ADDED SUCCESSFULLY\
nUSER NAME=',user_name,'\nPASSWORD=',pwd,'\nDEPARTMENT ID=',dept_id)
ad_main_menu()
else:
print("EMPLOYEE ALREADY EXISTS\nPLEASE TRY AGAIN\n")
ad_main_menu()
con.close()
#-----------------------------remove
employee------------------------------------------------------------
--------------------------------------------------------
def remove_emp():
import mysql.connector as sql
con=sql.connect(host='localhost',user='root',password='Vssips2022!',
database='employee')
k=con.cursor()
if con.is_connected():
print("{:>60}".format("--->>REMOVE EMPLOYEE<<---"))
22
emp_id2=str(emp_id1)
emp_id = "vss_" + emp_id2
emp_id3=(emp_id,)
23
continue
while (len(str(emp_id1))!=3):
print("ENTER 3 DIGITS ONLY\nPLEASE TRY AGAIN\n")
emp_id1 = input("\nENTER THE LAST THREE DIGITS OF THE
EMPLOYEE ID AGAIN\n")
continue
emp_id2=str(emp_id1)
emp_id = "vss_" + emp_id2
emp_id3=(emp_id,)
sql_tm="select * from employee_details where emp_id=%s;"
c.execute(sql_tm,emp_id3)
e=c.fetchall()
if e==[]:
print("EMPLOYEE NOT FOUND\nTRY AGAIN")
update_emp()
else:
if choice=='1':
designation = input("\nENTER EMPLOYEE DESIGNATION\
n")
var1=(designation,emp_id)
sql1 = "update employee_details set designation=%s
where emp_id=%s;"
c.execute(sql1,var1)
print("\n'EMPLOYEE DETAILS UPDATED SUCCESSFULLY'\n")
elif choice=='2':
ph_no = input("\nENTER MOBILE NUMBER\n")
while ph_no.isdigit()==False:
print("\nINVALID MOBILE NUMBER\nPLEASE TRY
AGAIN\n")
ph_no = input("\nENTER MOBILE NUMBER AGAIN\n")
continue
while (len(str(ph_no))!=10):
print("\nENTER 10 DIGITS ONLY\nPLEASE TRY AGAIN\
n")
ph_no = input("\nENTER MOBILE NUMBER AGAIN\n")
continue
var2=(ph_no,emp_id)
sql2 = "update employee_details set ph_no=%s where
emp_id=%s;"
c.execute(sql2,var2)
print("\n'EMPLOYEE DETAILS UPDATED SUCCESSFULLY'\n")
elif choice=='3':
emergency_ph_no = input("\nENTER EMERGENCY CONTACT
NUMBER\n")
while emergency_ph_no.isdigit()==False:
print("\nINVALID MOBILE NUMBER\nPLEASE TRY
AGAIN\n")
24
emergency_ph_no = input("\nENTER EMERGENCY
CONTACT NUMBER AGAIN\n")
continue
while (len(str(emergency_ph_no))!=10):
print("\nENTER 10 DIGITS ONLY\PLEASE TRY AGAIN\
n")
emergency_ph_no = input("\nENTER EMERGENCY
CONTACT NUMBER AGAIN\n")
continue
var3=(emergency_ph_no,emp_id)
sql3 = "update employee_details set emergency_ph_no=
%s where emp_id=%s;"
c.execute(sql3,var3)
print("\n'EMPLOYEE DETAILS UPDATED SUCCESSFULLY'\n")
elif choice=='4':
qualification=input("\nENTER YOUR QUALIFICATION\n")
var4=(qualification,emp_id)
sql4 = "update employee_details set qualification=%s
where emp_id=%s;"
c.execute(sql4,var4)
print("\n'EMPLOYEE DETAILS UPDATED SUCCESSFULLY'\n")
elif choice=='5':
permanent_address=input("\nPLEASE ENTER YOUR
PERMANENT ADDRESS IN NOT MORE THAN 70 CHARACTERS\n")
while (len(str(permanent_address))>70 ):
print("\nENTER WITHIN 70 CHARCTERS ONLY\nPLEASE
TRY AGAIN\n")
permanent_address = input("\nPLEASE ENTER YOUR
PERMANENT ADDRESS AGAIN\n")
continue
var5=(permanent_address,emp_id)
sql5 = "update employee_details set
permanent_address=%s where emp_id=%s;"
c.execute(sql5,var5)
print("\n'EMPLOYEE DETAILS UPDATED SUCCESSFULLY'\n")
elif choice=='6':
mail_id=input("\nENTER YOUR MAIL ID IN THE FORMAT
GIVEN BELOW \n<username>@gmail.com\n")
cm= '@gmail.com'
while cm not in mail_id:
print('\nINVALID \nPLEASE TRY AGAIN IN THE GIVEN
FORMAT\n')
mail_id=input("\nENTER YOUR MAIL ID AGAIN\n")
continue
var6=(mail_id,emp_id)
sql6 = "update employee_details set mail_id=%s where
emp_id=%s;"
25
c.execute(sql6,var6)
print("\n'EMPLOYEE DETAILS UPDATED SUCCESSFULLY'\n")
elif choice=='7':
print("\n1-->A1\n2.-->B2\n3.-->C3\n4.-->D4\n")
ch=input("\nCHOOSE EMPLOYEE'S RESPECTIVE DEPARTMENT\
n")
if ch!='1' or ch!='2' or ch!='3' or ch!='4' :
while ch!='1' and ch!='2' and ch!='3' and ch!
='4':
print("\nINVALID CHOICE\nPLEASE TRY AGAIN\
n")
ch = input("\nENTER YOUR CHOICE AGAIN\n")
continue
if ch=='1':
dept_id='dpt_A1'
elif ch=='2':
dept_id='dpt_B2'
elif ch=='3':
dept_id='dpt_C3'
elif ch=='4':
dept_id='dpt_D4'
else:
print("\nINVALID CHOICE\nPLEASE TRY AGAIN\
n")
var7=(dept_id,emp_id)
sql7 = "update employee_details set dept_id=%s where
emp_id=%s;"
c.execute(sql7,var7)
print("\n'EMPLOYEE DETAILS UPDATED SUCCESSFULLY'\n")
elif choice=='8':
salary = input("\nENTER THE SALARY\n")
while salary.isdigit()==False:
print("\nINVALID FORMAT\nPLEASE TRY AGAIN\n ")
salary = input("\nENTER THE SALARY AGAIN\n")
continue
var74=(salary,emp_id)
sql74 = "update employee_details set salary=%s where
emp_id=%s;"
c.execute(sql74,var74)
print("\n'EMPLOYEE DETAILS UPDATED SUCCESSFULLY'\n")
26
a2=i[1]
a3=i[2]
a4=i[3]
a5=i[4]
a6=i[5]
a7=i[6]
a8=i[7]
a9=i[8]
a10=i[9]
a11=i[10]
a12=i[11]
a13=i[12]
a14=i[13]
a16=i[15]
from prettytable import PrettyTable
a=PrettyTable()
a.field_names =
(['emp_name','DOB','ph_no','emergency_ph_no','gender','qualification
','blood_group','permanent_address','pan_no'])
a.add_row([a2,a13,a4,a5,a6,a7,a8,a9,a11])
print("{:>60}".format("--->>PERSONAL DETAILS<<---"))
print(a)
from prettytable import PrettyTable
b=PrettyTable()
b.field_names =
(["emp_id",'dept_id','designation','mail_id','salary'])
b.add_row([a1,a12,a3,a10,a16])
print("{:>60}".format("--->>EMPLOYEE DETAILS<<---"))
print(b)
conn.commit()
conn.close()
ad_main_menu()
#-----------------------------search
_emp----------------------------------------------------------------
----------------------------------------------------------
def search_emp():
import mysql.connector as sql
conn=sql.connect(host='localhost',user='root',password='Vssips2022!'
,database='employee')
c=conn.cursor()
if conn.is_connected():
print("{:>60}".format("--->>SEARCH EMPLOYEE<<---"))
27
emp_id1 = input("\nENTER THE LAST THREE DIGITS OF THE
EMPLOYEE ID AGAIN\n")
continue
while (len(str(emp_id1))!=3):
print("ENTER 3 DIGITS ONLY\nPLEASE TRY AGAIN\nY")
emp_id1 = input("\nENTER THE LAST THREE DIGITS OF THE
EMPLOYEE ID AGAIN\n")
continue
emp_id2=str(emp_id1)
emp_id = "vss_" + emp_id2
emp_id3=(emp_id,)
sql_tm="select * from employee_details where emp_id=%s;"
c.execute(sql_tm,emp_id3)
e=c.fetchall()
if e==[]:
print("EMPLOYEE NOT FOUND\nTRY AGAIN")
search_emp()
else:
a=input("\nEMPLOYEE FOUND\nWOULD YOU LIKE TO DISPLAY THE
EMPLOYEE DETAILS??? \nENTER 1-->YES\nANY OTHER KEY-->NO\n")
if a=='1':
sql = 'select*from employee_details where emp_id=%s;'
c=conn.cursor()
c.execute(sql,emp_id3)
d=c.fetchall()
for i in d:
a1=i[0]
a2=i[1]
a3=i[2]
a4=i[3]
a5=i[4]
a6=i[5]
a7=i[6]
a8=i[7]
a9=i[8]
a10=i[9]
a11=i[10]
a12=i[11]
a13=i[12]
a14=i[13]
from prettytable import PrettyTable
a=PrettyTable()
a.field_names =
(['emp_name','DOB','ph_no','emergency_ph_no','gender','qualification
','blood_group','permanent_address','pan_no'])
a.add_row([a2,a13,a4,a5,a6,a7,a8,a9,a11])
print("{:>60}".format("--->>PERSONAL DETAILS<<---"))
print(a)
from prettytable import PrettyTable
b=PrettyTable()
28
b.field_names =
(["emp_id",'dept_id','designation','mail_id'])
b.add_row([a1,a12,a3,a10])
print("{:>60}".format("--->>EMPLOYEE DETAILS<<---"))
print(b)
conn.commit()
conn.close()
ad_main_menu()
#-----------------------------search
_emp_1-------------------------------------------
def search_emp_1():
import mysql.connector as sql
conn=sql.connect(host='localhost',user='root',password='Vssips2022!'
,database='employee')
c=conn.cursor()
if conn.is_connected():
print("{:>60}".format("--->>SEARCH EMPLOYEE<<---"))
29
d=c.fetchall()
for i in d:
a1=i[0]
a2=i[1]
a3=i[2]
a4=i[3]
a5=i[4]
a6=i[5]
a7=i[6]
a8=i[7]
a9=i[8]
a10=i[9]
a11=i[10]
a12=i[11]
a13=i[12]
a14=i[13]
a16=i[15]
from prettytable import PrettyTable
a=PrettyTable()
a.field_names =
(['emp_name','DOB','ph_no','emergency_ph_no','gender','qualification
','blood_group','permanent_address','pan_no'])
a.add_row([a2,a13,a4,a5,a6,a7,a8,a9,a11])
print("{:>60}".format("--->>PERSONAL DETAILS<<---"))
print(a)
from prettytable import PrettyTable
b=PrettyTable()
b.field_names =
(["emp_id",'dept_id','designation','mail_id'])
b.add_row([a1,a12,a3,a10])
print("{:>60}".format("--->>OFFICE DETAILS<<---"))
print(b)
conn.close()
emp_main_menu()
#-----------------------------
display_all-------------------------------------------
def display_all():
import mysql.connector
conn=mysql.connector.connect(host='localhost',password='Vssips2022!'
,user='root',database='employee')
c=conn.cursor()
if conn.is_connected():
print("{:>80}".format("--->>DISPLAY DETAILS OF ALL
EMPLOYEES<<---"))
sql=("select * from employee_details")
c.execute(sql)
q=c.fetchall()
30
for i in q:
print("-"*160)
print('EMPLOYEE ID=',i[0],'\nEMPLOYEE NAME=',i[1])
a1=i[0]
a2=i[1]
a3=i[2]
a4=i[3]
a5=i[4]
a6=i[5]
a7=i[6]
a8=i[7]
a9=i[8]
a10=i[9]
a11=i[10]
a12=i[11]
a13=i[12]
a14=i[13]
a16=i[15]
from prettytable import PrettyTable
a=PrettyTable()
a.field_names =
(['emp_name','DOB','ph_no','emergency_ph_no','gender','qualification
','blood_group','permanent_address','pan_no'])
a.add_row([a2,a13,a4,a5,a6,a7,a8,a9,a11])
print("{:>60}".format("--->>PERSONAL DETAILS<<---"))
print(a)
from prettytable import PrettyTable
b=PrettyTable()
b.field_names =
(["emp_id",'dept_id','designation','mail_id','salary'])
b.add_row([a1,a12,a3,a10,a16])
print("\n{:>60}".format("--->>OFFICE DETAILS<<---"))
print(b)
print('\n \n \n ')
conn.commit()
conn.close()
ad_main_menu()
#-----------------------------
update_emp_1-------------------------------------------
def update_emp_1():
import mysql.connector as sql
conn = sql.connect(host = 'localhost', user =
'root',password='Vssips2022!',database='employee')
c=conn.cursor()
if conn.is_connected():
print("{:>60}".format("--->>UPDATE EMPLOYEE<<---"))
31
print('\n1. NAME')
print('\n2. MOBILE NUMBER')
print('\n3. PERMANENT ADDRESS')
print('\n4. MAIL ID')
if p==[]:
print("EMPLOYEE NOT FOUND\nTRY AGAIN")
update_emp_1()
else:
if choice=='1':
emp_fname1=input("\nENTER YOUR FIRST NAME\n")
while emp_fname1.isalpha()==False:
print("\nINVALID FIRST NAME\nNAME SHOULD CONTAIN
ONLY LETTERS\nPLEASE TRY AGAIN\n")
emp_fname1=input("\nENTER YOUR FIRST NAME\n")
continue
emp_fname=emp_fname1.capitalize()
emp_lastname1=input("\nENTER YOUR LAST NAME\n")
while emp_lastname1.isalpha()==False:
print("\nINVALID LAST NAME\nNAME SHOULD CONTAIN ONLY
LETTERS\nPLEASE TRY AGAIN\n")
emp_lastname1=input("\nENTER YOUR LAST NAME\n")
32
continue
emp_lastname=emp_lastname1.capitalize()
a=str(emp_fname)
b=str(emp_lastname)
emp_name=a+" " + b
var0=(emp_name,emp_id)
sql0 = "update employee_details set emp_name=%s where
emp_id=%s;"
c.execute(sql0,var0)
elif choice=='2':
ph_no = input("\nENTER MOBILE NUMBER\n")
while ph_no.isdigit()==False:
print("\nINVALID MOBILE NUMBER\nPLEASE TRY AGAIN\n")
ph_no = input("\nENTER MOBILE NUMBER\n")
continue
while (len(str(ph_no))!=10):
print("\nENTER 10 DIGITS ONLY\nPLEASE TRY AGAIN\n")
ph_no = input("\nENTER MOBILE NUMBER\n")
continue
var2=(ph_no,emp_id)
sql2 = "update employee_details set ph_no=%s where
emp_id=%s;"
c.execute(sql2,var2)
elif choice=='3':
address=input("\nPLEASE ENTER YOUR PERMANENT ADDRESS IN
NOT MORE THAN 70 CHARACTERS\n")
while (len(str(address))>70 ):
print("\nENTER WITHIN 70 CHARCTERS ONLY\nPLEASE TRY
AGAIN\n")
address = input("\nPLEASE ENTER YOUR PERMANENT
ADDRESS IN NOT MORE THAN 70 CHARACTERS\n")
continue
var5=(address,emp_id)
sql5 = "update employee_details set permanent_address=%s
where emp_id=%s;"
c.execute(sql5,var5)
elif choice=='4':
mail_id=input("\nENTER YOUR MAIL ID IN THE FORMAT GIVEN
BELOW \n<username>@gmail.com\n")
cm= '@gmail.com'
while cm not in mail_id:
print('\nINVALID \nPLEASE TRY AGAIN IN THE GIVEN
FORMAT\n')
mail_id=input("\nENTER YOUR MAIL ID IN THE FORMAT
GIVEN BELOW \n<username>@gmail.com\n")
continue
var6=(mail_id,emp_id)
33
sql6 = "update employee_details set mail_id=%s where
emp_id=%s;"
c.execute(sql6,var6)
conn=sql.connect(host='localhost',user='root',password='Vssips2022!'
,database='employee')
d=conn.cursor()
if conn.is_connected():
34
print("{:>60}".format("--->>DISPLAY MONTHLY SALARY
SLIP<<---\n"))
pan_no1=input("\nENTER PAN NUMBER\n")
while (len(str(pan_no1))!=10):
print("INVALID LENGTH OF PAN NUMBER!!TRY AGAIN")
pan_no1=input("\nENTER PAN NUMBER\n")
pan_no2=(pan_no1,)
sql_sql="select * from employee_details where pan_no=%s;"
d.execute(sql_sql,pan_no2)
e=d.fetchall()
if e==[]:
print("EMPLOYEE NOT FOUND")
print("WOULD YOU LIKE TO GO BACK TO THE PREVIUOS
FUNCTION??")
axy=input("PRESS 1 FOR GOING BACK AND ANY OTHER KEY TO
CONTINUE")
if axy=="1":
ad_main_menu()
else:
salary_slip_monthly_ad()
else:
x=tuple(e)
"""print(x)"""
for i in x:
"""print(i,end="")"""
for j in i:
"""print(j):"""
y=j
35
"""print(y)"""
q=tuple(g)
"""print(q)"""
for s in q:
"""print(s,end="")"""
for h in s:
"""print(h)"""
v=h
"""print(v)"""
for ai in te:
"""print(ai,end="")"""
for aq in ai:
"""print(aq)"""
aw=aq
"""print("salary=",aw)"""
for ao in yw:
"""print(ao,end="")"""
for ay in ao:
"""print(ay)"""
aew=ay
"""print("name of the employee=",aew)"""
for ok in wool:
"print"
for uikl in ok:
"print"
36
def leaves():
abso=input("\nENTER NUMBER OF LEAVES TAKEN AFTER TEN
DAYS OF ALLOWED LEAVES\n ")
if abso!="0" and abso!="1" and abso!="2" and abso!="3"
and abso!="4" and abso!="5" and abso!="6" and abso!="7" and abso!
="8" and abso!="9" and abso!="10" and abso!="11" and abso!="12" and
abso!="13" and abso!="14" and abso!="15" and abso!="16" and abso!
="17" and abso!="18" and abso!="19" and abso!="20":
print("INVALID NO. OF LEAVES")
leaves()
else:
dnum=int(abso)
ubch=2*dnum
oji=(ubch/100)*aw
"""print(oji)"""
t=y+v+oji
"""r=print("total deduction=",t)"""
aa=aw-t
"""print("net=",aa)"""
leaves()
ad_main_menu()
#----------------------------yearly salary
slip-------------------------
def salary_slip_year_ad():
import mysql.connector as sql
conn=sql.connect(host='localhost',user='root',password='Vssips2022!'
,database='employee')
d=conn.cursor()
if conn.is_connected():
print("{:>60}".format("--->>DISPLAY YEARLY SALARY SLIP<<---\
n"))
37
d.execute(sql_sql,pan_no2)
e=d.fetchall()
if e==[]:
print("EMPLOYEE NOT FOUND TRY AGAIN")
print("WOULD YOU LIKE TO GO BACK TO THE PREVIUOS
FUNCTION??")
axy=input("PRESS 1 FOR GOING BACK AND ANY OTHER KEY TO
CONTINUE")
if axy=="1":
ad_main_menu()
else:
salary_slip_year_ad()
else:
x=tuple(e)
"""print(x)"""
for i in x:
"""print(i,end="")"""
for j in i:
"""print(j):"""
y=j
"""print(y)"""
ydeduction1=y*12
q=tuple(g)
"""print(q)"""
for s in q:
"""print(s,end="")"""
38
for h in s:
"""print(h)"""
v=h
"""print(v)"""
ydeduction2=v*12
for ai in te:
"""print(ai,end="")"""
for aq in ai:
"""print(aq)"""
aw=aq
"""print("salary=",aw)"""
ysalary=aw*12
for ao in yw:
"""print(ao,end="")"""
for ay in ao:
"""print(ay)"""
aew=ay
"""print("name of the employee=",aew)"""
t=ydeduction1+ydeduction2
"""r=print("total deduction=",t)"""
aa=ysalary-t
"""print("net=",aa)"""
for ok in wool:
"print"
for uikl in ok:
"print"
39
from prettytable import PrettyTable
ayt=PrettyTable()
ayt.field_names=["EMP_ID","EMP_NAME","DEPT_ID","PAN
NO.","SALARY","DEDUCTION_1","DEDUCTION_2","TOTAL_DEDUCTION","NET"]
ayt.add_row([uikl,aew,yop,pan_no1,ysalary,ydeduction1,ydeduction2,t,
aa])
print(ayt)
employee_report()
ad_main_menu()
#---------------employee count-------------------------
def emp_count():
import mysql.connector as sql
conn=sql.connect(host='localhost',user='root',password='Vssips2022!'
,database='employee')
d=conn.cursor()
print("SELECT YOUR DEPARTMENT\n")
print("\nSELECT 1 TO PRINT EMPLOYEE DETAILS FROM
DEPARTMENT(dpt_A1)\n\nSELECT 2 TO PRINT EMPLOYEE DETAILS FROM
DEPARTMENT(dpt_B2)\n\nSELECT 3 TO PRINT EMPLOYEE DETAILS FROM
DEPARTMENT(dpt_C3)\n\nSELECT 4 TO PRINT EMPLOYEE DETAILS FROM
DEPARTMENT(dpt_D4)")
a=input("\nENTER YOUR CHOICE\n")
dpt=None
if a=="1" or a==" 1" or a=="1 " or a==" 1 ":
dpt="dpt_A1"
elif a=="2" or a==" 2" or a=="2 " or a==" 2 ":
dpt="dpt_B2"
elif a=="3" or a==" 3" or a=="3 " or a==" 3 ":
dpt="dpt_C3"
elif a=="4" or a==" 4" or a=="4 " or a==" 4 ":
dpt="dpt_D4"
else:
print("INVALID CHOICE")
emp_count()
40
#-----------------displaying employees of a
department------------------
def dpt_display():
import mysql.connector as sql
conn=sql.connect(host='localhost',user='root',password='Vssips2022!'
,database='employee')
d=conn.cursor()
"""print("WOULD YOU LIKE TO CONTINUE OR GO BACK TO THE REPORT
FUNCTON??")
A=input("\nENTER '6' FOR GOING BACK TO REPORT FUNCTION AND ANY
OTHER KEY TO CONTINUE\n")
if A=="6":
employee_report()
else:"""
print("SELECT YOUR DEPARTMENT")
print("SELECT 1 TO PRINT EMPLOYEE DETAILS FROM
DEPARTMENT(dpt_A1)\n\nSELECT 2 TO PRINT EMPLOYEE DETAILS FROM
DEPARTMENT(dpt_B2)\n\nSELECT 3 TO PRINT EMPLOYEE DETAILS FROM
DEPARTMENT(dpt_C3)\n\nSELECT 4 TO PRINT EMPLOYEE DETAILS FROM
DEPARTMENT(dpt_D4)")
a=input("\nENTER YOUR CHOICE\n")
dpt=None
if a=="1" or a==" 1" or a=="1 " or a==" 1 ":
dpt="dpt_A1"
elif a=="2" or a==" 2" or a=="2 " or a==" 2 ":
dpt="dpt_B2"
elif a=="3" or a==" 3" or a=="3 " or a==" 3 ":
dpt="dpt_C3"
elif a=="4" or a==" 4" or a=="4 " or a==" 4 ":
dpt="dpt_D4"
else:
print("INVALID CHOICE")
dpt_display()
sql="select * from employee_details where dept_id=%s"
dpt3=(dpt,)
d.execute(sql,dpt3)
e=d.fetchall()
from prettytable import PrettyTable
print("-----> DETAILS OF EMPLOYEES IN DEPARTMENT",dpt,"<-----")
for i in e:
a=i[0]
b=i[1]
c=i[2]
e=i[3]
f=i[4]
g=i[5]
h=i[6]
j=i[7]
k=i[8]
41
l=i[9]
m=i[10]
n=i[11]
o=i[12]
p=i[13]
q=i[14]
x=PrettyTable()
x.field_names=["EMP ID","EMP NAME","PHONE NO.","PERMANENT
ADDRESS","MAIL ID"]
x.add_row([a,b,e,k,l])
print(x)
employee_report()
#----------------------------emp salary
monthly-------------------------------------------
def salary_slip_monthly_emp():
import mysql.connector as sql
conn=sql.connect(host='localhost',user='root',password='Vssips2022!'
,database='employee')
d=conn.cursor()
if conn.is_connected():
print("{:>60}".format("--->>DISPLAY MONTHLY SALARY
SLIP<<---\n"))
if e==[]:
print("\nEMPLOYEE NOT FOUND\n")
print("\nWOULD YOU LIKE TO GO BACK TO THE PREVIUOS
FUNCTION??\n")
axy=input("\nPRESS 1 FOR GOING BACK AND ANY OTHER KEY TO
CONTINUE\n")
if axy=="1":
emp_main_menu()
else:
salary_slip_monthly_emp()
else:
sql_sql="select * from employee_details where pan_no=%s;"
d.execute(sql_sql,pan_no2)
e=d.fetchall()
if e==[]:
salary_slip_monthly()
42
else:
sqlo="select dept_id from employee_details where pan_no=
%s"
d.execute(sqlo,pan_no2)
tr=d.fetchall()
for un in tr:
"""print(un)"""
for yop in un:
"""print(yop)"""
txp=yop
typ=(txp,)
sql_tm="select deduction_1 from salary_info where
dept_id=%s;"
d.execute(sql_tm,typ)
e=d.fetchall()
"""print(e)"""
x=tuple(e)
"""print(x)"""
for i in x:
"""print(i,end="")"""
for j in i:
"""print(j):"""
y=j
"""print(y)"""
q=tuple(g)
"""print(q)"""
for s in q:
"""print(s,end="")"""
for h in s:
"""print(h)"""
v=h
"""print(v)"""
43
for ai in te:
"""print(ai,end="")"""
for aq in ai:
"""print(aq)"""
aw=aq
"""print("salary=",aw)"""
for ao in yw:
"""print(ao,end="")"""
for ay in ao:
"""print(ay)"""
aew=ay
"""print("name of the employee=",aew)"""
for ok in wool:
"print"
for uikl in ok:
"print"
def leaves():
abso=input("\nENTER NUMBER OF LEAVES TAKEN AFTER TEN
DAYS OF ALLOWED LEAVES\n ")
if abso!="0" and abso!="1" and abso!="2" and abso!
="3" and abso!="4" and abso!="5" and abso!="6" and abso!="7" and
abso!="8" and abso!="9" and abso!="10" and abso!="11" and abso!="12"
and abso!="13" and abso!="14" and abso!="15" and abso!="16" and
abso!="17" and abso!="18" and abso!="19" and abso!="20":
print("INVALID NO. OF LEAVES")
leaves()
else:
dnum=int(abso)
ubch=2*dnum
oji=(ubch/100)*aw
"""print(oji)"""
t=y+v+oji
"""r=print("total deduction=",t)"""
44
aa=aw-t
"""print("net=",aa)"""
ayt.field_names=["EMP_ID","EMP_NAME","DEPT_ID","PAN
NO.","SALARY","DEDUCTION_1","DEDUCTION_2","DEDUCTION_LEAVES","TOTAL_
DEDUCTION","NET"]
ayt.add_row([uikl,aew,yop,pan_no1,aw,y,v,oji,t,aa])
print(ayt)
leaves()
emp_main_menu()
#----------------------------emp salary
yearly-------------------------------------------
def salary_slip_year_emp():
import mysql.connector as sql
conn=sql.connect(host='localhost',user='root',password='Vssips2022!'
,database='employee')
d=conn.cursor()
if conn.is_connected():
print("{:>60}".format("--->>DISPLAY MONTHLY SALARY
SLIP<<---\n"))
45
tr=d.fetchall()
for un in tr:
"""print(un)"""
for yop in un:
"""print(yop)"""
txp=yop
typ=(txp,)
sql_tm="select deduction_1 from salary_info where dept_id=
%s;"
d.execute(sql_tm,typ)
e=d.fetchall()
"""print(e)"""
x=tuple(e)
"""print(x)"""
for i in x:
"""print(i,end="")"""
for j in i:
"""print(j):"""
y=j
"""print(y)"""
ydeduction1=y*12
q=tuple(g)
"""print(q)"""
for s in q:
"""print(s,end="")"""
for h in s:
"""print(h)"""
v=h
"""print(v)"""
ydeduction2=v*12
for ai in te:
"""print(ai,end="")"""
for aq in ai:
"""print(aq)"""
46
aw=aq
"""print("salary=",aw)"""
ysalary=aw*12
for ao in yw:
"""print(ao,end="")"""
for ay in ao:
"""print(ay)"""
aew=ay
"""print("name of the employee=",aew)"""
t=ydeduction1+ydeduction2
"""r=print("total deduction=",t)"""
aa=ysalary-t
"""print("net=",aa)"""
for ok in wool:
"print"
for uikl in ok:
"print"
ayt.add_row([uikl,aew,yop,pan_no1,ysalary,ydeduction1,ydeduction2,t,
aa])
print(ayt)
emp_main_menu()
#----------------------------
report-------------------------------------------
def employee_report():
print("\nENTER 1 TO DISPLAY MONTHLY SALARY SLIP OF AN EMPLOYEE\
n")
print("\nENTER 2 TO DISPLAY YEARLY SALARY SLIP OF AN EMPLOYEE\
n")
47
print("\nENTER 3 TO SEE THE NUMBER OF EMPLOYEES IN A DEPARTMENT\
n")
print("\nENTER 4 TO DISPLAY THE DETAILS OF EMPLOYEES IN A
DEPARTMENT\n")
print("\nENTER 5 TO RETURN TO MAIN PROGRAM\n")
a=input("\nENTER YOUR CHOICE\n")
if a=="1" or a==" 1" or a=="1 " or a==" 1 ":
salary_slip_monthly_ad()
elif a=="2" or a==" 2" or a=="2 " or a==" 2 ":
salary_slip_year_ad()
elif a=="3" or a==" 3" or a=="3 " or a==" 3 ":
emp_count()
elif a=="4" or a==" 4" or a=="4 " or a==" 4 ":
dpt_display()
elif a=="5" or a==" 5" or a=="5 " or a==" 5 ":
print("{:>50}".format("--->>^_^THANK YOU^_^<<---\n"))
print("\nMAIN FUNCTION\n")
ad_main_menu()
else:
print("INVALID CHOICE")
employee_report()
#-----------------------------
ad_main_menu-------------------------------------------
def ad_main_menu():
print("\n\n1. ADD EMPLOYEE")
print('\n2. UPDATE EMPLOYEE')
print('\n3. SEARCH AND DISPLAY EMPLOYEE')
print('\n4. DISPLAY ALL EMPLOYEE DETAILS')
print('\n5. REMOVE EMPLOYEE')
print("\n6. EMPLOYEE REPORT")
print('\n7. CLOSE APPLICATION')
print('\n\n')
choice = input('ENTER YOUR CHOICE...:\n')
while choice.isdigit()==False:
print("\nINVALID FORMAT\nPLEASE TRY AGAIN\n ")
choice = input('ENTER YOUR CHOICE...:\n')
continue
if choice =="1":
add_emp()
elif choice == "2":
update_emp()
elif choice == "3":
search_emp()
elif choice == "4":
display_all()
elif choice == "5":
remove_emp()
elif choice == "6":
employee_report()
elif choice == "7":
48
print("{:>50}".format("--->>^_^THANK YOU^_^<<---"))
else:
print("INVALID CHOICE\nENTER ONLY 1-6\n")
ad_main_menu()
#ad_main_menu()
#-----------------------------
emp_main_menu-------------------------------------------
def emp_main_menu():
print('\n1. PAYSLIP(monthly)\n')
print('\n2. PAYSLIP(yearly)\n')
print('\n3. UPDATE EMPLOYEE\n')
print('\n4. SEARCH AND DISPLAY EMPLOYEE\n')
print('\n5. CLOSE APPLICATION\n')
print('\n\n')
#----------------------------
login_type-------------------------------------------
def log_in():
log_in=input("\nPLEASE CHOOSE A LOG IN TYPE\n1-->ADMIN\n2--
>EMPLOYEE\n")
if log_in!='1' or log_in!='2':
while log_in!='1' and log_in!='2':
print("\nINVALID CHOICE\nPLEASE TRY AGAIN\n")
log_in=input("\nPLEASE CHOOSE A LOG IN TYPE\n1-->ADMIN\
n2-->EMPLOYEE\n")
continue
if log_in=='1':
ad_login()
else:
emp_login()
49
log_in()
SAMPLE OUTPUT
50
51
52
INSTALLATION PROCEDURE
-------------------------------------
Pre-Requisites :-
------------------------
Installation :-
-------------------
A.) mysql.connector
B.)IMPORT time
53
3. Open the files in any python editors and run it to start
and work on the software.
54
TESTING
TESTING METHODS
Software testing methods are traditionally divided into black box testing and
white box testing. These two approaches are used to describe the point of view that
a test engineer takes when designing test cases.
55
SPECIFICATION-BASED TESTING
The black box tester has no "bonds" with the code, and a tester's perception
is very simple: a code must have bugs. Using the principle, "Ask and you shall
receive," black box testers find bugs where programmers don't. But, on the other
hand, black box testing has been said to be "like a walk in a dark labyrinth without a
flashlight," because the tester doesn't know how the software being tested was
actually constructed.
That's why there are situations when (1) a black box tester writes many test
cases to check something that can be tested by only one test case, and/or (2) some
parts of the back end are not tested at all. Therefore, black box testing has the
advantage of "an unaffiliated opinion," on the one hand, and the disadvantage of
"blind exploring," on the other.
56
WHITE BOX TESTING
White box testing, by contrast to black box testing, is when the tester has
access to the internal data structures and algorithms (and the code that implement
these)
White box testing methods can also be used to evaluate the completeness of
a test suite that was created with black box testing methods. This allows the software
team to examine parts of a system that are rarely tested and ensures that the most
important function points have been tested.
57
HARDWARE AND SOFTWARE REQUIREMENTS
X. Printer : required
SOFTWARE REQUIREMENTS:
I. Windows OS
II. Python
BIBLIOGRAPHY
58