Class XII Computer Science Project 1
Class XII Computer Science Project 1
MANAGEMENT SYSTEM
TABLE OF CONTENTS
1. Project Description
2. Glimpses of Python
3. Glimpses of MySQL
4. Hardware and
Software Configuration
5. Tables in the Database
6. Source code
7. Output
8. Bibliography
PROJECT DESCRIPTION
The project Employee Management System uses Python as front end
and MySql as backend. It aims to maintain the details of Employee details
in a systematic way.
Employee details are stored in Mysql table for easy retrieval and access.
The following functionalities are included in the project:
• Adding Employee Details
• Display Employee Details
• Search Employee Details
• Update Employee Details
• Delete Employee Details
• Generation of Pay Slip
GLIMPSES OF PYTHON
• Python is a high-level, general-purpose, self- contained programming
language designed to meet the needs of computer scientists,
software developers and college students interested in coding.
• Python is an open source language that’s free to use and has a wide
range of features that make it easy to customize.
Python Features and Advantages
• Easy to Code. Python is a very high-level programming language, yet
it is effortless to learn.
• Easy to Read. Python code looks like simple English words.
• Free and Open-Source.
• Robust Standard Library.
• Interpreted.
• Portable.
• Object-Oriented and Procedure-Oriented.
• Extensible.
GLIMPSES OF MYSQL
MySQL is a system that helps to store and manage data efficiently.
Database generally stores data in a structured fashion.
• RAM : 4GB
SOFTWARE
• Windows OS
def Display():
global mycon,mycursor
try:
inpstrquery="select * from emp"
mycursor.execute(inpstrquery)
results = mycursor.fetchall()
print("**************************************************")
print('%5s'%"EMPNO",'%15s'%'EMP
NAME','%12s'%'DEPARTMENT','%10s'%'SALARY')
print("**************************************************")
count=0
for row in results:
print('%5s' % row[0],'%15s'%row[1],'%12s'%row[2],'%10s'%row[3])
def insertEmp():
global mycon,mycursor
print("*******************ADD NEW
EMPLOYEE**************************")
eno = int(input("Enter employee number :"))
en = input("Enter employee name :")
dp = input("Enter department ")
sl = int(input("Enter Salary :"))
inpstrQuery="insert into emp values({},'{}','{}',{})".format(eno,en,dp,sl)
mycursor.execute(inpstrQuery)
mycon.commit()
print("\nRECORD ADDED SUCCESSFULLY!")
def searchEmp():
global mycon,mycursor
print("*******************SEARCH EMPLOYEE FORM
**************************")
en = int(input("Enter Employee number to search :"))
inpstrQuery="select * from emp where empno={}".format(en)
mycursor.execute(inpstrQuery)
results = mycursor.fetchall()
if mycursor.rowcount<=0:
print("\n SORRY! NO MATCHING DETAILS AVAILABLE!")
else:
print("**************************************************")
print('%5s'%"EMPNO",'%15s'%'EMP
NAME','%12s'%'DEPARTMENT','%10s'%'SALARY')
print("**************************************************")
for row in results:
print('%5s' % row[0],'%15s'%row[1],'%12s'%row[2],'%10s'%row[3])
print("-"*50)
def updateEmp():
global mycon,mycursor
print("*******************UPDATE EMPLOYEE FORM
**************************")
en = int(input("Enter Employee number to update :"))
inpstrquery="select * from emp where empno={}".format(en)
mycursor.execute(inpstrquery)
results = mycursor.fetchall()
if mycursor.rowcount<=0:
print("SORRY! NO MATCHING DETAILS AVAILABLE")
else:
print("**************************************************")
print('%5s'%"EMPNO",'%15s'%'EMP
NAME','%12s'%'DEPARTMENT','%10s'%'SALARY')
print("**************************************************")
for row in results:
print('%5s' % row[0],'%15s'%row[1],'%12s'%row[2],'%10s'%row[3])
print("-"*50)
ans = input("Are you sure to update ? (y/n)")
if ans=="y" or ans=="Y":
d = input("Enter new department to update (enter old value if not to
update) :")
s = int(input("Enter new salary to update (enter old value if not to
update) :"))
inpstrquery="update emp set dept='{}',salary={} where
empno={}".format(d,s,en)
mycursor.execute(inpstrquery)
mycon.commit()
print("\nRECORD UPDATED")
def deleteEmp():
global mycon,mycursor
print("**************************************************")
print('%5s'%"EMPNO",'%15s'%'EMP
NAME','%12s'%'DEPARTMENT','%10s'%'SALARY')
print("**************************************************")
for row in results:
print('%5s' % row[0],'%15s'%row[1],'%12s'%row[2],'%10s'%row[3])
print("-"*50)
def generateSlip():
global mycon,mycursor
print("*******************SALARY SLIP
**************************")
en = int(input("Enter Employee number to print salary slip :"))
query="select * from emp where empno="+str(en)
mycursor.execute(query)
results = mycursor.fetchone()
if mycursor.rowcount<=0:
print("\n SORRY! NO MATCHING DETAILS AVAILABLE ")
else:
print("EMPNO :",results[0]," "*20,"NAME :",results[1])
print("DEPARTMENT :",results[2])
print("*"*50)
s = int(results[3])
hra = s * 12/100
da = s * 15/100
it = 1000
gross = s +hra+da
ded = it
net = gross - ded
print("%19s"%"EARNING","%27s"%"DEDUCTION")
print("-------------------------------------------------")
print("%20s"%"Basic :"+str(s),"%22s"%"INC. TAX :"+str(it))
print("%20s"%"HRA :"+str(hra))
print("%20s"%"DA :"+str(da))
print("-"*50)
print(" GROSS :",gross," NET SALARY :",net," TOTAL DED :",ded)
print("-"*50)
while True:
print("*******************EMPLOYEE MANAGEMENT SYSTEM
**************************")
print("1. SHOW EMPLOYEE LIST ")
print("2. ADD NEW EMPLOYEE")
print("3. SEARCH EMPLOYEE ")
print("4. UPDATE EMPLOYEE ")
print("5. DELETE EMPLOYEE ")
print("6. GENERATE PAY SLIP ")
print("7. EXIT")
print("*********************************************
**************************")
ans = int(input("Enter your choice :"))
if ans==1:
Display()
elif ans==2:
insertEmp()
elif ans==3:
searchEmp()
elif ans==4:
updateEmp()
elif ans==5:
deleteEmp()
elif ans==6:
generateSlip()
elif ans==7:
mycon.close()
break
else:
print("\nInvalidChoice!!")
OUTPUT
BIBLIOGRAPHY