Attendence Management System

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 15

Attendence

Management System

Arka Kiran Banerjee 12 Sc C, 6

Computer Science
INDEX

Aim / Scope of the Project


Hardware Requirements / Software Requirements
Source Code
Outputs
Acknowledgement
Certificate
Aim :- To use Python and SQL and create a
Attendence Management System.

Scope of the project : - This is an application to keep


a track of student’s Attendance. It contains basic
Functions which include Insertion of student details
(Roll, Name and Phone no.), Deletion of records,
Editing records and mainly displaying of QR Code
to view record of a single student. In this
Application, there is no such login system. This
means he/she can use all those available features
easily without any restriction. While adding the
students, the user only has to enter his/her name ,roll
and phone no. then the system adds the record and
displays to the user and the user can view all these
students lists from the view section. In this Simple
Student Management, the user can edit the student’s
details. The record can also be removed if wished.
The special feature of this project is the QR Code
which can be generated to view the student’s details
individually on phone.
Hardware requirements-
1.Modern Operating System:
2.x86 64-bit CPU (Intel / AMD architecture)
3.4 GB RAM.
4.5 GB free disk space.

Software Requirments-
1.Python3 : To run this project pyton 3 is needed
2.MySQL : mysql database is needed for running
this program
3.MySQL Connector : For making the connection
between mysql and mysql connector
Source Code
MainApp.py
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'first.ui'


#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.

from PyQt5 import QtCore, QtGui, QtWidgets,uic


import mysql.connector as sql
import sqlite3
from InsertApp import InsertBox
from UpdateApp import UpdateBox
from RemoveApp import RemoveBox
from QRApp import QRBox

import pyqrcode
import png
from pyqrcode import QRCode

class App(object):
def __init__(self,app):
self.app=app
self.ui = uic.loadUi('first.ui')
self.initDBConnection()
# for loading all records
self.ui.reloadBtn.clicked.connect(self.loadData)
self.ui.insertBtn.clicked.connect(self.insertData)
self.ui.editButton.clicked.connect(self.updateData)
self.ui.deleteButton.clicked.connect(self.deleteData)
self.ui.qrButton.clicked.connect(self.qrData)
self.ui.show()
self.run()

def initDBConnection(self):
#self.connect = sql.connect(host="localhost",user="root",password="",database="office")
self.connect = sqlite3.connect("school.db")
self.loadData()
def run(self):
self.app.exec_()
def loadData(self):
cursor=self.connect.cursor()
sql="select id,name,phone from student where status=1 order by id desc"
cursor.execute(sql)
result = cursor.fetchall()
self.connect.commit()

self.ui.tableWidget.setRowCount(0)
for row_number,row_data in enumerate(result):
self.ui.tableWidget.insertRow(row_number)
for column_number,column_data in enumerate(row_data):

self.ui.tableWidget.setItem(row_number,column_number,QtWidgets.QTableWidgetItem(str(co
lumn_data)))

def insertData(self):
InsertBox()
self.loadData()

def updateData(self):
UpdateBox()
self.loadData()
def deleteData(self):
RemoveBox()
self.loadData()
def qrData(self):
qrmessage = "Welcome"
url = pyqrcode.create(qrmessage)
url.png('myqr.png', scale = 6)
QRBox()

if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
App(app)
InsertApp.py
from PyQt5 import uic
import mysql.connector as sql
import sqlite3
class InsertBox:
def __init__(self):
self.ui = uic.loadUi('insert_window.ui')
self.ui.show()
self.ui.saveBtn.clicked.connect(self.insertData)
self.run()
def run(self):
self.ui.exec_()

def insertData(self):
roll = self.ui.roll.text()
name = self.ui.name.text()
phone = self.ui.phone.text()
connect = sqlite3.connect("school.db")
cursor=connect.cursor()
qry="INSERT INTO `student` (`ID`,`name`, `phone`,`status`) VALUES ('{0}',
'{1}','{2}',1)".format(roll,name,phone)
cursor.execute(qry)
connect.commit()
self.ui.result_label.setText("Record Inserted Successfully")
UpdateApp.py
from PyQt5 import uic
import mysql.connector as sql
import sqlite3
class UpdateBox:
def __init__(self):
self.ui = uic.loadUi('update_window.ui')
self.ui.show()
self.ui.saveBtn.clicked.connect(self.updateData)
self.ui.fetchBtn.clicked.connect(self.fetchData)
self.run()
def run(self):
self.ui.exec_()

def fetchData(self):
roll = self.ui.roll.text()
#connect =
sql.connect(host="localhost",user="root",password="",database="office")
connect = sqlite3.connect("school.db")
cursor=connect.cursor()
qry="select * from student where id = {0} and status=1".format(roll)
cursor.execute(qry)
result = cursor.fetchone()
connect.commit()
if result != None:
self.ui.name.setText(result[1])
self.ui.phone.setText(result[2])

def updateData(self):
roll = self.ui.roll.text()
name = self.ui.name.text()
phone = self.ui.phone.text()
#connect =
sql.connect(host="localhost",user="root",password="",database="office")
connect = sqlite3.connect("school.db")
cursor=connect.cursor()
qry="update student set name ='{0}', phone='{1}' where id={2} and
status=1".format(name,phone,roll)
cursor.execute(qry)
connect.commit()
self.ui.result_label.setText("Record Updated Successfully")
RemoveApp.py
from PyQt5 import uic
import mysql.connector as sql
import sqlite3

class RemoveBox:
def __init__(self):
self.ui = uic.loadUi('remove_window.ui')
self.ui.show()
self.ui.removeBtn.clicked.connect(self.updateData)
self.ui.fetchBtn.clicked.connect(self.fetchData)
self.run()
def run(self):
self.ui.exec_()

def fetchData(self):
roll = self.ui.roll.text()
#connect = sql.connect(host="localhost",user="root",password="",database="office")
connect = sqlite3.connect("school.db")
cursor=connect.cursor()
qry="select * from student where id = {0} and status=1".format(roll)
cursor.execute(qry)
result = cursor.fetchone()
connect.commit()
if result!=None:
self.ui.name.setText(result[1])
self.ui.phone.setText(result[2])

def updateData(self):
roll = self.ui.roll.text()
#connect = sql.connect(host="localhost",user="root",password="",database="office")
connect = sqlite3.connect("school.db")
cursor=connect.cursor()
qry="delete from student where id={0}".format(roll)
cursor.execute(qry)
connect.commit()
self.ui.result_label.setText("Record Deleted Successfully")
self.ui.roll.setText("")
self.ui.phone.setText("")
self.ui.name.setText("")
QRApp.py
from PyQt5 import uic
import mysql.connector as sql
import sqlite3
import pyqrcode
import png
from pyqrcode import QRCode

from PyQt5 import QtGui as qtg

class QRBox:
def __init__(self):
self.ui = uic.loadUi('qr_window.ui')
self.ui.show()
self.ui.fetchBtn.clicked.connect(self.fetchData)
self.run()
def run(self):
self.ui.exec_()

def fetchData(self):
roll = self.ui.roll.text()
#connect =
sql.connect(host="localhost",user="root",password="",database="office")
connect = sqlite3.connect("school.db")
cursor=connect.cursor()
qry="select * from student where id = {0} and status=1".format(roll)
cursor.execute(qry)
result = cursor.fetchone()

if result:
qrmessage = "Roll: {}\nName : {}\n Phone:{}\
n".format(result[0],result[1],result[2])
url = pyqrcode.create(qrmessage)
#url.svg("myqr.svg", scale = 8)
url.png('myqr.png', scale = 6)
self.ui.qrbox.setPixmap(qtg.QPixmap('./myqr.png'))

connect.commit()
create_DBs.py
import sqlite3

connect = sqlite3.connect("school.db")
cursor=connect.cursor()
cursor.execute("DROP TABLE IF EXISTS GEEK")

qry='''
CREATE TABLE student (
ID INTEGER PRIMARY KEY AUTOINCREMENT,
name varchar(255) NOT NULL,
phone varchar(255),
status boolean
);
'''

cursor.execute(qry)
connect.close()
print("Table is created")
Acknowledgement

I would like to express my special thanks and gratitude to

my teacher MRS. Anuja Dutta who gave me the golden

opportunity to do this wonderful project in

COMPUTERSCIENCE PRACTICAL on the topic STUDENT ATTENDENCE


MANAGEMENT SYSTEM , which also helped me in doing a lot of

research and I came to know about so many new things

that I am really thankful to her.

Secondly, I would also like to thank my friends who helped me a lot in


finalizing this project

within the stipulated time.

--------------------------

ARKA KIRAN BANERJEE

You might also like