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

Class XII Computer Science Project 1

Class X11 CSC Project for reference

Uploaded by

chaitanyafam
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views

Class XII Computer Science Project 1

Class X11 CSC Project for reference

Uploaded by

chaitanyafam
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

EMPLOYEE

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 was created in the early 1980s by Guido van Rossum.

• Python is a high-level, interpreted, dynamic object-oriented


programming language that can be used to program applications or
web sites.

• It is also known as an object-oriented programming (OOP) language.


The main benefits of using Python instead of other languages are that
it is very easy to start programming with and because of its flexible
syntax, it can be used to program almost any kind of software
application.

• 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.

SALIENT FEATURES OF MYSQL


Quick and Reliable
MySQL stores data efficiently in the memory ensuring that data is
consistent, and not redundant. Hence, data access and manipulation using
MySQL is quick.
Free to download
MySQL is free to use so that we can download it from MySQL official
website without any cost.
Scalable
Scalability refers to the ability of systems to work easily with small amounts
of data, large amounts of data, clusters of machines, and so on. MySQL
server was developed to work with large databases.
Data Types
It contains multiple data types such as unsigned integers, signed integers,
float (FLOAT), double (DOUBLE), character (CHAR), variable character
(VARCHAR), text, blob, date, time, datetime, timestamp, year, and so on.
Secure
It provides a secure interface since it has a password system which is
flexible, and ensures that it is verified based on the host before accessing
the database. The password is encrypted while connecting to the server.
Support for large databases
MySQL has no limit on the number of databases. The underlying filesystem
may have a limit on the number of directories.MySQL has no limit on the
number of tables. The underlying file system may have a limit on the
number of files that represent tables. Individual storage engines may
impose engine-specific constraints. InnoDB permits up to 4 billion tables.
Client and Utility Programs
MySQL server also comes with many client and utility programs. This
includes Command line programs such as ‘mysqladmin’ and graphical
programs such as ‘MySQL Workbench’. MySQL client programs are written
in a variety of languages. Client library (code encapsulated in a module)
can be written in C or C++ and would be available for clients that have C
bindings.
Compatible on many operating systems
MySQL is compatible to run on many operating systems, like Novell
NetWare, Windows* Linux*, many varieties of UNIX* (such as Sun*Solaris*,
AIX, and DEC* UNIX), OS/2, FreeBSD*, and others. MySQL also provides
a facility that the clients can run on the same computer as the server or on
another computer (communication via a local network or the Internet).
GUI Support
MySQL provides a unified visual database graphical user interface tool
named "MySQL Workbench" to work with database architects, developers,
and Database Administrators.
HARDWARE AND
SOFTWARE
CONFIGURATION
HARDWARE
• Operating System : Windows 10 or above

• Processor : Pentium 2.6GHz

• RAM : 4GB

• HardDisk : SSD 128GB

SOFTWARE
• Windows OS

• Python 3.8 or above

• MySQL 8.0 Command Line Client


TABLES IN THE
DATABASE
SOURCE CODE
import mysql.connector as ms
mycon =
ms.connect(host='localhost',user="root",password="password",database="
Empdb")
mycursor = mycon.cursor()

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

print("*************** TOTAL RECORD :


",mycursor.rowcount,"**********")
except:
print("error")

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("*******************DELETE EMPLOYEE FORM


**************************")
en = int(input("Enter Employee number to delete :"))
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 delete ? (y/n)")


if ans=="y" or ans=="Y":
inpstrquery="delete from emp where empno={}".format(en)
mycursor.execute(inpstrquery)
mycon.commit()
print("\n RECORD DELETED")

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

• Computer Science with Python –


Sumitha Arora
Preethi Arora

You might also like