0% found this document useful (0 votes)
8 views22 pages

PAYROLL MANAGEMENT SYSTEM Corrected

nclajkc

Uploaded by

Lodhi Girjendra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views22 pages

PAYROLL MANAGEMENT SYSTEM Corrected

nclajkc

Uploaded by

Lodhi Girjendra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Name : Harsh Lodhi

Class : XII A
Roll no :
Sub : Computer Science
Topic : PYROLL
MANAGEMENT SYSTEM

Downloaded by Kumkum Rajpoot ([email protected])


Downloaded by Kumkum Rajpoot ([email protected])
CERTIFICATE

This to certify that the project “PAYROLL


MANAGEMENT SYSTEM” is made under my
supervision and guidance by:

Name: Harsh Lodhi


Class/Sec: XII-A
Roll:
Subject: Computer Science
Session: 2024-25

Downloaded by Kumkum Rajpoot ([email protected])


ACKNOWLEDGEMENT

I would like to express my gratitude to my


teacher, who has guided
me and gave me the opportunity to make this
project.

Downloaded by Kumkum Rajpoot ([email protected])


ABOUT

DESCRIPTION:
A payroll is the list of employees of that company that are entitled to receive pay
and the amounts that each should receive. Along with the amounts that each
employee should receive for time worked or tasks performed, payroll can also
refer to a company's records of payments that were previously made to employees,
including salaries and wages, bonuses, and withheld taxes, or the company's
department that calculates and pays out these amounts.

MODULE:
This program is made using the concept of PYTHON and MySQL
Connectivity and by using mysql.connector module

LANGUAGE USED:
Python and mysql

Downloaded by Kumkum Rajpoot ([email protected])


FLOWCHART

MENU IS DISPALYED
1. Adding employee records
2. For Displaying record of all the Employees
3. . For Displaying record of a particular Employee
4. For Deleting record of all employees
5. For Deleting record of a particular Employee
6. For Modification in a record
7. For displaying payroll
8. For displaying salary slip of all the Employees
9. For displaying salary slip of a particular Employee
10. For Exit

IF N= 2/3/7/8/9 IF N=10 IF N= 1/4/5/6

DATA IS FETCHED FROM DATA IS INDEPENDENT DATA IS INSERTED IN


THE DATABASE. FROM THE DATABASE.
THE DATABASE.

Downloaded by Kumkum Rajpoot ([email protected])


PROGARAM CODE:

import mysql.connecter

import datetime

from tabulate import tabulate

db=input("Enter NAMe of your database : ")

mybd=mysql.connecter.connect(host=’lo0calhost’,user=’root’,passwd=’1234 56’)

mycursor = mybd.cursor()

sql="CREATE DATABASE if not exists %s" % (db,)

mycursor.execute(sql)

print("Database created successfully..")

mycursor=mybd.cursor() mycursor.execute("use

"vdb)

Tablename=input("Name of Table to be created:")

query="createtable if not exists"vTableNamev"\

(empno int primary key,\

name varchar(15) not null,\ job

varchar(15),\

basic salary int,\

DA float,\ GRA

Downloaded by Kumkum Rajpoot ([email protected])


float,\

GrossSalary float,\

Downloaded by Kumkum Rajpoot ([email protected])


Tax float,\

Net salary float)"

print("Table"vTableNamev" created successfully. .......... ")

mycursor.execute(query)

While True:

print(’\n\n\n’)

print("*"*95)

print(’\t\t\t\t\tMAINMENU’)

print("*"*95)

print(’\t\t\t\t1. Adding employee records’)

print(’\t\t\t\t2. For Displaying record of all the Employees’)

print(’\t\t\t\t3. For Displaying record of a particular Employee’)

print(’\t\t\t\t4. For Deleting record of all employees’) print(’\t\t\t\t5.

For Deleting record of a particular Employee’) print(’\t\t\t\t6. For

Modification in a record’)

print(’\t\t\t\t7. For displaying payroll’)

print(’\t\t\t\t8. For displaying salary slip of all the Employees’) print(’\t\t\t\t9.

For displaying salary slip of a particular Employee’) print(’\t\t\t\t10.For Exit’)

print(’Enter Choice ...... ’,end=’’)

choice=int(input()) if

choice==1:

try:

print(’Enter employee information ............. ’)

Downloaded by Kumkum Rajpoot ([email protected])


mempno=int(input(’Enter employee no:’))

mname=input(’Enter employee name:’) mjob=input(’Enter

employee job:’) mbasic=float(input(’Enter basic salary:’))

if mjob.upper()==’OFFICER’:

mda=mbasic*0.5

mhra=mbasic*0.35

mtax=mbasic*0.2

elif mjob.upper()==’MANAGER’

mda=mbasic*0.45

mhra=mbasic*0.30

mtax=mbasic*0.15

else:

mda=mbasic*0.40

mhra=mbasic*0.25

mtax=mbasic*0.1

mgross=mbasicvmdavmhra

mnet=mgross-mtax

rec=(mempno,mname,mjob,mbasic,mda,mhra,mgross,mtax,mnet) query="insert

into"vTableNamev values (’%s,%s%,%s,%s,%s,%s,%s,%s,%s’)

mycursor.execute(query,rec)

mybd.commit()

print(’Record added successfully’)

except Exception as e:
Downloaded by Kumkum Rajpoot ([email protected])
print(’Something went wrong’,e)

elif choce==2: try:

query=’select * from ’vTableName

mycursor.execute(query)

print(tabulate(mycursor, headers=[’EmpNo’,’Job’,’Basic Salary’,’DA’,’GRA’,’Gross


Salary’,’Tax’,’Net salary’], tablefmt=’psql’))

’’’myrecords=mycursor.fetchall() for

rec in myrecords:

print(rec)’’’

except:

print(’Something went wrong’)

elif choice==3: try:

en=input(’Enter employee no. of the record to displayed...’) query="selct v

from "vTableNamev’ where empno=’ven mycursor.execute(query)

myrecord=mycursor.fetchone()

print(’\n\n\nRecord of Employee No.:’ven)

print(myrecord)

c=mycursor.rowcount

Downloaded by Kumkum Rajpoot ([email protected])


if c==-1:

print(’Nothing to display’) except:

print(’Something went wrong’)

elif choice==4: try:

ch=input(’Do you want to delete all the records (y\n)’) if

ch.upper()==’Y’:

mycursor.execute(’delete from ’vTableName)

mybd.commit()

print(’All the records are deleted...’) except:

print(’something went wrong’)

elif choice==5: try:

en=input(’Enter employee no. of the record to deleted...’) query="delete v

from "vTableNamev’ where empno=’ven mycursor.execute(query)

mybd.commit()

c=mycursor.rowcount if

c›0:

Downloaded by Kumkum Rajpoot ([email protected])


print(’Deletion Done’)

else:

print(’Employee no.’,en,’not found’) except:

print(’something went wrong’)

elif choice==6: try:

en=input(’Enter employee no. of the record to modified...’)

query="select v from "vTableNamev’ where empno=’ven

mycursor.execute(query)

myrecord=mycursor.fetchone()

c=mycursor.rowcount

if c==-1:

print(’Empno ’venv’ does not exist’) else:

mname=myrecord[1]

mjob=myrecord[2]

mbasic=[3]

print(’EmpNo :’,myrecord[0])

print(’Job :’,myrecord[1])

print(’Basic :’,myrecord[3])

print(’DA :’,myrecord[4])

Downloaded by Kumkum Rajpoot ([email protected])


print(’GRA :’,myrecord[5])

print(’Gross :’,myrecord[6])

print(’Tax :’,myrecord[7])

print(’Net :’,myrecord[8])

print(’ ’)

print(’type value to modify below or just press enter for no change’)

x=input(’Enter name’)

if len(x)›0:

mname=x

x=input(’Enter job’) if

len(x)›0:

mjob = x

x=input(’Enter basic salary ’) if

len(x)›0:

mbasic=float(x)

query=’update ’vTablenamev’ set name’v"’"v’,’v’job=’v"’"v’Basic

salary’\
vstr(mbasic)v’ where empno=’ven

print(query) mycursor.execute(query)

mybd.commit()

print(’Record modified’)

except:

Downloaded by Kumkum Rajpoot ([email protected])


print(’something went wrong’) elif

choice==7:

try:

query="selct v from "vTableName

mycursor.execute(query)

myrecord=mycursor.fetchall()

print("\n\n\n")

print(95*’*’)

print(’Employee Payroll’.center(90))

print(95*’*’) now=datetime.datetime.now()

print("Current Date and Time:",end=’ ’)

print(now.strftime("%Y-%m-%d %G:%M:%S"))

print()

print(’95’*’-’)

print(’%-5s %-15s %-10s %-8s %-8s %-8s %-9s %-8s %-9s’\

%(’Empno’,’Job’,’Basic’,’DA’,’GRA’,’Gross’,’Tax’,’Net’))

print(’95’*’-’)

for r in my records:

print(’%4d %-15s %-10s %8.2f %8.2f %8.2f %9.2f %8.2f %9.2f’%rec)

print(’95’*’-’)

except:

print(’something went wrong’)

Downloaded by Kumkum Rajpoot ([email protected])


elif choice==8: try:

query="selct v from "vTableName

mycursor.execute(query)

myrecord=datetime.datetime.now()

print("\n\n\n")

print("-"*95)

print("\t\t\t\tSalary Slip")

print("-"*95)

print("Current Date and Time:",end=’ ’)

print(now.strftime("%Y-%m-%d %G:%M:%S"))

myrecord=mycursor.fetchall()

for r in my records:

print(’%4d %-15s %-10s %8.2f %8.2f %8.2f %9.2f %8.2f %9.2f’%rec)

except:

print(’something went wrong’)

elif choice==9: try:

en=input(’Enter employee number whose payslip you want to


retrieve:’)

query="select * from "vTableNamev’ where empno=’ven

mycursor.execute(query) now=datetime.datetime.now()

print("\n\n\n\t\t\t\tSALARY SLIP ")

Downloaded by Kumkum Rajpoot ([email protected])


print("Current Date and Time:",end=’ ’)

print(now.strftime("%Y-%m-%d %G:%M:%S"))

print(tabulate(mycursor, headers=[’EmpNo’,’Job’,’Basic Salary’,’DA’,’GRA’,’Gross


Salary’,’Tax’,’Net salary’], tablefmt=’psql’))

except Exception as e:

print(’Something went wrong’,e)

elif choice==10:

break

else:

print(’Wrong Choice...’)

Downloaded by Kumkum Rajpoot ([email protected])


OUTPUT:

Downloaded by Kumkum Rajpoot ([email protected])


Downloaded by Kumkum Rajpoot ([email protected])
Downloaded by Kumkum Rajpoot ([email protected])
Downloaded by Kumkum Rajpoot ([email protected])
Downloaded by Kumkum Rajpoot ([email protected])

You might also like