You are on page 1of 50

A PROJECT REPORT

ON

HOSTEL MANAGEMENT SYSTEM


Submitted in partial fulfilment of the requirements to
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY-Kakinada
For the Award of the degree

BACHELOR OF TECHNOLOGY
IN

DATA SCIENCE
Submitted by
GANAGAVARAPU CHANDU (20JK1A4406)
PITTALA PRASANNA KUMAR (20JK1A4410)

ANIVIREDDY GNANASATYAVENI (20JK1A4401)

UNDER THE ESTEEMED GUIDANCE OF


Mr.KIRAN KUMAR

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

GUNTUR ENGINEERING COLLEGE

(Approved by A.I.C.T.E & Affiliated to J.N.T.U Kakinada)

(An ISO Certified Institution& Accredited by NBA)

YANAMADALA-522019 2020-2024

GUNTUR ENGINEERING COLLEGE 1 HOSTEL MANAGEMENT SYSTEM


GUNTUR ENGINEERING COLLEGE
(Approved by AICTE,Affilated to JNTU-Kakinada)
NH-5-Yanamadala,Guntur, Ap-52201
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

CERTIFICATE

This is to certify that this project work titled “Hostel Management System Using Python”
is the Bonafide work Gangavarapu Chandu (20jk1a4406) ,Pittala Prasanna Kumar
(20jk1a4410) ,Anivireddy Gnana Satyaveni (20jk1a4401) who carried out the work under
supervision and submitted in the partial fulfilment of the requirements for the award of the
degree of Bachelor of Technology in Computer Science & Engineering from JNTU-
Kakinada during the academic year 2022-2023.

Internal Guide HOD

External Examiner

GUNTUR ENGINEERING COLLEGE 2 HOSTEL MANAGEMENT SYSTEM


GUNTUR ENGINEERING COLLEGE 3 HOSTEL MANAGEMENT SYSTEM
GUNTUR ENGINEERING COLLEGE 4 HOSTEL MANAGEMENT SYSTEM
GUNTUR ENGINEERING COLLEGE 5 HOSTEL MANAGEMENT SYSTEM
DECLARATION

WE, GANGAVARAPU CHANDU, PITTALA PRASANNA KUMAR,


ANIVIREDDY GNANA SATYA VENI the students of the GUNTUR
ENGINEERING COLLEGE of the Department of Computer Science
and Engineering, GUNTUR ENGINEERING COLLEGE, do hereby
declare that I have completed the mandatory Internship on PYTHON
FULLSTACK in CODEGNAN IT SOLUTION Pvt.Ltd, from 15th
may2023 TO (2 Months) under the PROJECT Guideship of Mr.KIRAN
KUMAR

GANGAVARAPU CHANDU (20JK1A4406)

PITTALA PRASANNA KUMAR (20JK1A4410)

ANIVIREDDY GNANA SATYAVENI (20JK1A4401)

GUNTUR ENGINEERING COLLEGE 6 HOSTEL MANAGEMENT SYSTEM


ACKNOWLEDGEMENT

We take this occasion to thank God, almighty for blessing us with his grace and
taking our endeavor to a successful culmination. We extend our sincere and heartfelt
thanks to our esteemed guide, ESWAR, for providing us with the right guidance and
advice at crucial junctures and for showing me the right way.
We extend our sincere thanks to our respected Head of the division, Mr
BULLIBABU, for allowing us to use the facilities available. We would like to thank
the other faculty members also, at this occasion. Last but not least, we would like to
thank our friends and family for the support and encouragement they have given us
during the course of our work.

GANGAVARAPU CHANDU -20JK1A4406

PITTALA PRASANNA KUMAR -20JK1A4410

ANIVIREDDY GNANA SATYA VENI -20JK1A4401

GUNTUR ENGINEERING COLLEGE 7 HOSTEL MANAGEMENT SYSTEM


TABLE OF CONTENTS

ABSTRACT 10

1. INTRODUCTION 11
1.1 PROJECT AIMS AND OBJECTIVES 11

1.2 BACKGROUND OF PROJECT 12

1.3 PROBLEM STATEMENT 12


1.4 OPERATION ENVIRONMENT 13

2. SYSTEM ANALYSIS 14
2.1 FEASIBITY ANALYSIS 14

2.2 ALGORITHMS 16
3. SYSTEM DESIGN 20
3.1 TABLE DESIGN 20
3.2 DATA FLOW DIAGRAM’S 22

4. SYSTEM IMPLEMENTATION 28
4.1 MODULE DESCRIPTION 28
4.2 SCREEN SHOTS 40
5. SYSTEM TESTING 44
5.1 UNIT TESTING 44
5.2 INTEGRATION TESTING 46
6. CONCLUSION & FUTURE SCOPE 48
7. REFERENCES 50

GUNTUR ENGINEERING COLLEGE 8 HOSTEL MANAGEMENT SYSTEM


LIST OF DATA FLOW DIAGRAMS.

1 DATA FLOW DIAGRAM FOR LOGIN 22

2 DATA FLOW CHART FOR SAVE INFORMATION 23

3 DATA FLOW CHART FOR ADD USER 24

4 DATA FLOW CHART FOR EDIT USER 25

5 DATA FLOW CHART FOR DELETE USER 26

6 DATA FLOW CHAR ROOM VACANCY 27

ABSTRACT

GUNTUR ENGINEERING COLLEGE 9 HOSTEL MANAGEMENT SYSTEM


“Hostel Management System (HMS)” is an individual project developed in Notepad .
This project can be used in hostel to facilitate to store new records of students in database,
to display the saved records with printing facilities.

During the development of this project I have visited the hostel administration for
collection of data and analyze their problem. We have tried to fulfill most of the desire of
the hostel requirements but due to the lack of time some of the requirements were solved.
The problem analyzed for the hostel were
• Check in/ checkout system for students to keep records of room that have been
reserved.
• Room Reservation system to keep records of the Students and find their room
number.
• To generate report of each room reserved.

Among these problems we have choose the Mark sheet problem and try to make the
project to display Mark sheet of the students with printing facility. The user can also save
record of total number of students in the hostel, information about their faculty and course
the study. We have also attached the form to keep simple record of the teachers.

This software is totally secure with password protected facility. The administrator can
create new user, update them when required and delete them if necessary. The
administrator staff can utilize all the facility provided by the software and all the guest
staff can get some of the facility.
This software also provides the facility to create backup of the database which will help to
retrieve data when the accidental loss in the original database happen.

CHAPTER 1

GUNTUR ENGINEERING COLLEGE 10 HOSTEL MANAGEMENT SYSTEM


INTRODUCTION

This chapter gives an overview of the aim , objectives ,background and


operation environment of the system.

1.1 PROJECT AIMS AND OBJECTIVES

With the advancement of technology, application areas of computer are rising day by day.
Every sector desires its procurement for fast accurate and automated operations. Therefore
different program are developed to meet the requirement of various types of users i.e.
related to any field.

This program entitled “Hostel Management System” is an individual work of DIT 6 th


semester student. It is a small software package which is helpful in the areas of Hostel.
This program package includes all the activities in which the hostel is managed. The
activities like the user management, the inventory processing, the data summary, etc are
included.

In terms of security this software is totally secure as it doesn't give access to unauthorized
user as the username and password facility is provided.

I chose Hostel management software as the system seemed simple and easy to use. During
its development we realized that we needed software that may help to manage hostel
activities and various other adjustments.

GUNTUR ENGINEERING COLLEGE 11 HOSTEL MANAGEMENT SYSTEM


1.2 BACKGROUND OF PROJECT

During this project development, I visited different hostels such as hostel Skyplane ,hostel
top in Jomo Kenyatta University etc and analysis the difficulties of administrative group in
their hostel transaction and provide such solution which may solve their desire problem. I
also ask them about how their activities are operated day to day. I also discuss what is the
best solution of this problem.

1.3 Problem statement

Even though I have tried my best effort in making the system error free but some
errors may have crept into it. As this is my first project or system development in
visual basic we have tried my best to make it free from limitations, and maybe I’m
successful. The limitation on the project is the lesson for me to improve it. During
my system development on this project I have faced many problems in testing,
coding, debugging and implementing some rules and regulation.

GUNTUR ENGINEERING COLLEGE 12 HOSTEL MANAGEMENT SYSTEM


1.4 OPERATION ENVIRONMENT

PROCESSOR INTEL CORE PROCESSOR OR BETTER


PERFORMANCE (I5 BETTER)
OPERATING ,WINDOWS10, UBUNTU
SYSTEM
MEMORY 4GB RAM OR MORE

HARD DISK SPACE MINIMUM 4 GB FOR DATABASE USAGE FOR


FUTURE
DATABASE MY SQL

GUNTUR ENGINEERING COLLEGE 13 HOSTEL MANAGEMENT SYSTEM


CHAPTER 2
SYSTEM ANALYSIS

2.1 Feasibility Analysis

It is necessary to determine whether the development of new program will be beneficial to


us or not. This study examines the aspect the hardware and software requirement that are
needed to develop a program. It also provides:

a) The definition of the problem.


b) The alternative solution and their benefits.
c) Required resources cost and delivery date.

Feasibility Analysis includes:

Technical Feasibility Analysis


i. Hardware: - Hardware requirements includes following points:

1. Any Computer (Pentium PC, Laptop etc)


2. RAM
3. Hard-disk
4. Printer
5. VDU(CRT or LCD)
6. Peripherals (Like. Mouse and Keyboard)

ii. Software: - It includes following programs:


1. Operating System(62 bits or higher)
2. Notepad
Economical Feasibility Analysis (Requirement Document)

GUNTUR ENGINEERING COLLEGE 14 HOSTEL MANAGEMENT SYSTEM


Cost

S.N Details Rs
.
1 Computer (Laptop) N/a

2 Required Software 2,000

3 Portable devices (Pen drives,CD etc) 1,500

4 Paper work cost 500

5 Miscellaneous 2,500

Total 6,500
Cost

Profit: Rs. 20000

Selling Price: Rs. 26,500

Operating Feasibility

Feasibility analysis which is necessary to check the manpower viability. It helps to find
whether the existing manpower can handle the new system effectively or not.

Some tips to handle this system:

3. Password is case-sensitive.

2.2 Algorithm

GUNTUR ENGINEERING COLLEGE 15 HOSTEL MANAGEMENT SYSTEM


Algorithm for form Load

Step1: Start the application

Step2: Wait until the program loads

Step3: This form automatically closes.

Algorithm for Login

Step1: Start
Step2: Select User Name
Step3: Enter password
Step4: Click on Login button
If (User ID) and (Password) is Valid then
Unload the user form from memory
and Load and show MDI Main
form.
Else
Display the message “Username and Password
doesn't match” Go to Step2
Step5: Stop
Algorithm for Adding New User
Step1: Start
Step2: Go to system > manage user
Step3: Enter the administrative password to carry out the operation.
Step4: Click on Add New User and a field appears,
Step5: Enter new User name, Password, Confirm Password.
Step6: Click on save button for adding user and cancel button for cancelling operation.
Step7: If all condition remains true then print message “Username Added”,End.

GUNTUR ENGINEERING COLLEGE 16 HOSTEL MANAGEMENT SYSTEM


Algorithm for Editing User’s record
Step1: Start
Step2: Go to system > manage user
Step3: Enter the administrative password to carry out the operation
Step4: Click on update user and a field appears,
Step5: Choose the user name you want to edit and Click on save button for adding user and
cancel button for cancelling operation
Step6: if the User ID after editing is found on the database then print the message “User
already exists”
Else save the record on the database with message
Step7: End

Algorithm for Deleting User’s record

Step1: Start
Step2: Click on the user’s record from the list whom you want to Delete
Step3: Click on the Delete button then print the message “Do you really want to delete this
user”
Step4: If click on yes the user will be deleted
If click on no the operation will be cancelled
Step6: End

Algorithm for Adding New Room Reservation

Step2: Go to New Room Reservation


Step3: Click on New Button of the form
Step4: Fill all the given fields,
Step5: Click on Save button to save record or Cancel button to cancel the operation
Step6: If clicked Save

GUNTUR ENGINEERING COLLEGE 17 HOSTEL MANAGEMENT SYSTEM


Print the message “Record Saved successfully”. And it saves the record
to the database Else program terminates to main form.
Step8: Stop.

Algorithm for Delete Record

Step1: Start
Step2: Go to Customer > New Room Reservation
Step3: Click on Delete Button of the form
Step4: Enter the Reservation Number which you want to delete.
Step5: click on Ok button to delete record or Cancel button to cancel the operation
Step6: If clicked Ok
Print the message “Record Deleted successfully”. And it deletes the record
from the database Else program terminates to main form.
Step7: Stop.

Algorithm for Print Record


Step1: Start
Step2: Click on Report >Print or Open the Room Reservation form and click Print.
Step3: The system calls the print function and starts printing if the printer is installed.
Step4: Stop
Algorithm for Backup

Step1: Start.
Step2: Open Main form >Tools >Database Backup.
Step3: The form opens and asks the user to give the path.
Step4: Click on Ok to create backup or Cancel to cancel operation.
If Ok button is the program creates a backup in the specified path.
Else the program terminates to the previous form.

GUNTUR ENGINEERING COLLEGE 18 HOSTEL MANAGEMENT SYSTEM


Step5: Stop.

Algorithm for Search


Step1: Start
Step2: Open Main form >Customer
>Search Step3: Click on the search
type.
Step4: Enter the part of data you want to search.
Step5: Click on Ok to search record or Cancel to change search type
If record exists then record is shown
Else print message "No Record was found"
Step6: Stop

Algorithm for Exit menu


Step1: Start
Step2: Click on File > Exit to exit from the program.
Step2: Print the message “Do you really want to exit from
program” Step3: If yes then close the program and all
running forms.
If no then return to the MDI main form
Step4: End

CHAPTER 3

GUNTUR ENGINEERING COLLEGE 19 HOSTEL MANAGEMENT SYSTEM


SYSTEM DESIGN
3.1 TABLE DESIGN

VARIOUS TABELS TO MAINTAIN INFORMATION

Admin table

Records table

Student table:

GUNTUR ENGINEERING COLLEGE 20 HOSTEL MANAGEMENT SYSTEM


Visitor table

Visitorrecords table

GUNTUR ENGINEERING COLLEGE 21 HOSTEL MANAGEMENT SYSTEM


3.2 DATA FLOW DIAGRAMS

Flowchart for Login


Start

Select User Name

Enter Password

Click on Log in button

Is Username and NO
password Valid?

Yes

Load MDI main form in the


memory and display all facility.

Unload Login form from the memory.

Stop

GUNTUR ENGINEERING COLLEGE 22 HOSTEL MANAGEMENT SYSTEM


Flow chart for save information
Start

Click on New button

Enter all fields

Click on Save button

Yes
Is Record exists?

Print message
NO “Record exists”

Is all criteria valid NO


?

Yes

Save the new record

Print message “Record


Saved Successfully”

Stop

Flow chart for Add User

GUNTUR ENGINEERING COLLEGE 23 HOSTEL MANAGEMENT SYSTEM


Start

Click on Manage user

Select Add user

Fill the Form

Yes
Is username exists?

Print message “User


NO exists”

Is Password = NO
confirm password

Yes

Save the new user

Print message “User name


Saved Successfully”

Stop

GUNTUR ENGINEERING COLLEGE 24 HOSTEL MANAGEMENT SYSTEM


Flowchart for Edit User

Start

Click on Manage user

Select Edit user

Fill the Form

Is username NO
exists?

Print message “User


exists”
Yes

Save the Record

Print message “Record Updated


successfully”

Stop

GUNTUR ENGINEERING COLLEGE 25 HOSTEL MANAGEMENT SYSTEM


Flowchart For Delete User

Start

Click on the required record from list and


click on Delete button.

Print message “Do you really want


to delete this user?”

Yes / No NO
?

Yes

Delete the Record

Print message “Record Deleted


successfully”

Stop

GUNTUR ENGINEERING COLLEGE 26 HOSTEL MANAGEMENT SYSTEM


Flowchart for Room Vacancy

Start

Click on New Room Vacancy

Enter all fields

Click on Save button

Yes
Is Room Vacancy
exists?

Print message “Room


NO vacancy exists”

Save the New Entry

Print message “New Entry


Saved Successfully”

Stop

GUNTUR ENGINEERING COLLEGE 27 HOSTEL MANAGEMENT SYSTEM


CHAPTER 4

4.1 SYSTEM IMPLEMENTATION


SOURCE CODE ;

from flask import


1Flask,flash,redirect,render_template,url_for,request,session
from flask_session import Session from flask_mysqldb
import MySQL from datetime import date from datetime
import datetime import smtplib from otp import genotp from
cmail import sendmail
from itsdangerous import
URLSafeTimedSerializer as Serializer from
tokenreset import token app=Flask(__name__)
app.secret_key='*67@hjyjhk'
app.config['SESSION_TYPE']='filesystem'
app.config['MYSQL_HOST']='localhost'
app.config['MYSQL_USER']='root'
app.config['MYSQL_PASSWORD']='admin'
app.config['MYSQL_DB']='hostel' Session(app)
mysql=MySQL(app)
@app.route('/') def index(): return
render_template('index.html')
@app.route('/register',methods=['GE
T','POST']) def register():
if request.method=='POST':
userid=request.form['userid']
username=request.form['userna
me']
password=request.form['passw
ord']
email=request.form['email']
code=request.form['passcode']
#define college code
ccode='gecg@123'
if ccode==code:

GUNTUR ENGINEERING COLLEGE 28 HOSTEL MANAGEMENT SYSTEM


cursor=mysql.connection.cursor()
cursor.execute('select userid from admin')
data=cursor.fetchall()
cursor.execute('SELECT email from admin')
edata=cursor.fetchall()
#print(data) if (userid,) in
data: flash('User already
already exists')
return
render_template('Registration.html')
if (email,) in edata:
flash('Email id already already
exists') return
render_template('Registration.html')

cursor.close()
otp=genotp()
subject='thanks for register'
body=f'use this otp
register{otp}'

sendmail(email,subject,body)
return
render_template('otp.html',otp=otp,userid=userid,username=username,password=pass
word,email=email) else:
flash('Invalid college code')
return
render_template('registration.html')
return
render_template('Registration.html')
@app.route('/otp/<otp>/<userid>/<username>/<password>/
<email>',methods=['GET','POST']) def
otp(otp,userid,username,password,email):
if request.method=='POST':
uotp=request.form['otp']
if otp==uotp:
cursor=mysql.connection.cursor()
cursor.execute('insert into admin values(%s,%s,%s,%s)',
(userid,username,password,email)) mysql.connection.commit()
cursor.close()

GUNTUR ENGINEERING COLLEGE 29 HOSTEL MANAGEMENT SYSTEM


flash('Details registered')

return
redirect(url_for('login'))
else:
flash('Wrong
otp') return
render_template('otp.html',otp=otp,userid=userid,username=username,password=password,
email=email)

@app.route('/
login') def
login():
if
session.get('user')
:
cursor=mysql.connection.cursor()
cursor.execute('SELECT userid,password from admin')
books=cursor.fetchall()
cursor.close()
return render_template('Admin-login.html')
@app.route('/
logout')
def logout():
if session.get('user'):
session.pop('user')
return
redirect(url_for('index'))
else:
flash('already logged out!')
return redirect(url_for('index'))
@app.route('/
validate',methods=['POST'])
def validate():
userid=request.form['userid']
password=request.form['password']
cursor=mysql.connection.cursor()
cursor.execute('SELECT userid,password from admin')
data=cursor.fetchall()[0]
userid=data[0]

GUNTUR ENGINEERING COLLEGE 30 HOSTEL MANAGEMENT SYSTEM


password=data[1]
cursor.close()
if userid==userid and
password==password: return
redirect(url_for('Adminpage'))
else:
return
redirect(url_for('Adminpage'))
@app.route('/adminpage',methods=['GE
T','POST']) def Adminpage():
return
render_template('adminhomepage.html'
)
@app.route('/addstudent',methods=['GE
T','POST']) def addstudent():
if request.method=='POST':
id1=request.form['id1']
name=request.form['name']
section=request.form['section']
room=request.form['roomno']
mobile=request.form['mobile']
cursor=mysql.connection.cursor()
cursor.execute('insert into students(Id,Name,Section,Roomno,moblie) values(%s,%s,
%s,%s,%s)',[id1,name,section,room,mobile])
mysql.connection.commit()
cursor.close() return
redirect(url_for('studentrecord'))
return render_template('Add-
students.html')
@app.route('/studentrecord',methods=['G
ET','POST']) def studentrecord():
cursor=mysql.connection.cursor()
cursor.execute('SELECT * from students')
data=cursor.fetchall()
cursor.close()

return render_template('Student records.html',data=data)

@app.route('/delete/<id>')
def delete(id):

GUNTUR ENGINEERING COLLEGE 31 HOSTEL MANAGEMENT SYSTEM


cursor=mysql.connection.cu
rsor()
cursor.execute('delete from students where
id=%s',[id]) mysql.connection.commit()
cursor.close()
flash('student delete successfully')
return redirect(url_for('studentrecord'))
@app.route('/update/<id>',methods=['GE
T','POST']) def update(id):
cursor=mysql.connection.cursor()
cursor.execute('select * from students where
id=%s',[id]) data=cursor.fetchone()
if request.method=='POST':
id1=request.form['id']
name=request.form['name']
section=request.form['section']
room =request.form['Room']
mobile=request.form['mobile']
cursor.execute('update students set Name=%s,Section=%s,Roomno=
%s,moblie=%s where id=%s',[name,section,room,mobile,id1])
mysql.connection.commit()
return redirect(url_for('studentrecord'))
return render_template('update.html',data=data)
@app.route('/checkin',methods=['GET','POST']) def checkin():
details=None
cursor=mysql.connection.cursor()
cursor.execute('SELECT * from students')
data=cursor.fetchall()
data1=request.args.get('name')
if request.args.get('name')
else 'empty'
print(data1)
cursor.execute('SELECT * from students where id=%s',[data1])
details=cursor.fetchone()
cursor.execute('SELECT * from records')

std_records=cursor.fetchall()
print(std_records)
cursor.close()

GUNTUR ENGINEERING COLLEGE 32 HOSTEL MANAGEMENT SYSTEM


if request.method=='POST':
cursor=mysql.connection.curs
or()
Id=request.form['empCode']
today=date.today()
day=today.day
month=today.month
year=today.year
date_today=f'{year}-{month}-{day}'
Name=request.form['name']
section=request.form['Section']
roomno=request.form['Roomno']
mobileno=request.form['Mobileno']
cursor.execute('select count(*) from records where Id=%s and date=
%s',[Id,date_today]) count=int(cursor.fetchone()[0])
if Id=="" or Name=="" or section=="" or roomno=="" or mobileno=="":
flash('Select The student Id first') elif count>=1:
flash('The student already gone
outside') else:
cursor=mysql.connection.cursor()
cursor.execute('insert into
records(Id,Name,Section,Roomno,moblieNumber,date) values(%s,%s,%s,%s,%s,
%s)',[Id,Name,section,roomno,mobileno,date_today])
mysql.connection.commit()
cursor.execute('SELECT * from records')
std_records=cursor.fetchall()
cursor.close()
return render_template('Check in-
page.html',data1=data1,data=data,details=details,std_records=std_records)
@app.route('/
checkout',methods=['GET','POST'])
def checkout():
details=None
cursor=mysql.connection.cursor()
cursor.execute('SELECT * from students')
data=cursor.fetchall()
data1=request.args.get('name') if request.args.get('name') else
'empty' print(data1)

GUNTUR ENGINEERING COLLEGE 33 HOSTEL MANAGEMENT SYSTEM


cursor.execute('SELECT * from students where id=%s',[data1])
details=cursor.fetchone()
cursor.execute('SELECT * from records')

std_records=cursor.fetchall()
print(std_records)
cursor.close() if
request.method=='POST':
cursor=mysql.connection.curs
or()
Id=request.form['empCode']
today=date.today()
day=today.day
month=today.month
year=today.year
date_today=f'{year}-{month}-{day}'
Name=request.form['name']
section=request.form['section']
roomno=request.form['roomno']
mobileno=request.form['mobileno']
cursor.execute('select count(*) from records where Id=%s and date=
%s',[Id,date_today]) count=int(cursor.fetchone()[0])
if Id=="" or Name=="" or section=="" or roomno=="" or
mobileno=="": flash('Select The student Id first')
elif count<=1:
flash('The student already gone outside')
else:
cursor=mysql.connection.cursor()
cursor.execute('insert into
records(Id,Name,Section,Roomno,moblieNumber,date) values(%s,%s,%s,%s,%s,
%s)',[Id,Name,section,roomno,mobileno,date_today])
mysql.connection.commit()
cursor.execute('SELECT * from records')
std_records=cursor.fetchall()
cursor.close()
return render_template('Check out
page.html',data1=data1,data=data,details=details,std_records=std_records)
@app.route('/checkoutupdate/
<date>/<id1>')

GUNTUR ENGINEERING COLLEGE 34 HOSTEL MANAGEMENT SYSTEM


def checkoutupdate(date,id1):
cursor=mysql.connection.cursor()
cursor.execute('update records set checkout=current_timestamp() where date=%s
and Id=%s',[date,id1]) mysql.connection.commit()
return redirect(url_for('checkin'))
@app.route('/checkinupdate/<date>/<id1>')
def checkinupdate(date,id1):
cursor=mysql.connection.cursor()
cursor.execute('update records set checkin=current_timestamp() where date=%s and Id=
%s',[date,id1]) mysql.connection.commit()
return redirect(url_for('checkin'))

@app.route('/Delete/<s')
def Delete(sid):
cursor=mysql.connection.cursor()
cursor.execute('Delete from visitor where sid=%s',[sid])
mysql.connection.commit()
cursor.close()
flash('student delete
successfully')
return redirect(url_for('Visitorrecord'))
@app.route('/Update/
<sid>',methods=['GET','POST'])
def Update(sid):
cursor=mysql.connection.cursor()
cursor.execute('select * from visitor where
sid=%s',[sid]) data=cursor.fetchone()
if request.method=='POST':
sid=request.form['sid']

visitorname=request.form['visitorname']
visitormobile=request.form['visitormobile']
roomno =request.form['roomno']
cursor.execute('Update visitor set visitorname=%s,visitormobile=
%s,roomno=%s where sid=%s',[visitorname,visitormobile,roomno,sid])
mysql.connection.commit()
return redirect(url_for('Visitorrecord'))
return render_template('visitorupdate.html',data=data)
@app.route('/Checkoutupdate/
<date>/<id1>')

GUNTUR ENGINEERING COLLEGE 35 HOSTEL MANAGEMENT SYSTEM


def Checkoutupdate(date,id1):
cursor=mysql.connection.cursor()
cursor.execute('update visitorrecords set checkout=current_timestamp() where date=%s
and Id=%s',[date,id1]) mysql.connection.commit()
return
redirect(url_for('visitorcheckin'))
@app.route('/Checkinupdate/<date>/
<id1>') def Checkinupdate(date,id1):
cursor=mysql.connection.cursor()
cursor.execute('update visitorrecords set checkin=current_timestamp() where date=%s
and Id=%s',[date,id1]) mysql.connection.commit()
return redirect(url_for('visitorcheckin'))

@app.route('/
forgetpassword',methods=['GET','POST'])
def forget():#after clicking the forget
password
if request.method=='POST':
userid=request.form['userid']# store the id in the rollno
cursor=mysql.connection.cursor()#connection to mysql
cursor.execute('select userid from admin')# fetch the rollno data in the table
students data=cursor.fetchall()#fetching all the rollno data and store it in the
"data" variable
if(int(userid),) in data:# if the given rollno of the user is present in tha database-
>data
cursor.execute('select email from admin where userid=%s',[userid])#it fetches
email related to the rollno data=cursor.fetchone()[0]#fetch the only one email
related to the rollno
print(data)
cursor.close()
subject=f'Reset Password for {data}'
body=f'Reset the password using-
{request.host+url_for("createpassword",token=token(userid,120))}'
sendmail(data,subject,body)
flash('Reset link sent to your mail')
return
redirect(url_for('login'))
else:
return 'Invalid user id'

GUNTUR ENGINEERING COLLEGE 36 HOSTEL MANAGEMENT SYSTEM


return
render_template('forgot.html')
@app.route('/checkoutvisitor/
<id1>') def
checkoutvisitor(id1):
cursor=mysql.connection.cursor()
cursor.execute('update visitor set checkout=current_timestamp() where
Studentid=%s',[id1]) mysql.connection.commit()
return redirect(url_for('visitor'))
@app.route('/checkinvisitor/<id1>')
def checkinvisitor(id1):
cursor=mysql.connection.cursor()
cursor.execute('update visitor set checkin=current_timestamp() where Studentid=%s',
[id1]) mysql.connection.commit()
return redirect(url_for('visitor'))
@app.route('/
visitor',methods=['GET','POST'])
def visitor():
cursor=mysql.connection.cursor()
cursor.execute('SELECT * from students')
data=cursor.fetchall()
cursor.execute('Select *
from visitor')
details=cursor.fetchall()
cursor.close()
if request.method=="POST":
Studentid=request.form['Studentid']
name=request.form['Name']
mobilenumber=request.form['MobileNumber']
cursor=mysql.connection.cursor()
cursor.execute('INSERT INTO
visitor(Studentid,Name,mobilenumber) values(%s,%s,%s)',
[Studentid,name,mobilenumber])
cursor.execute('Select * from visitor')
details=cursor.fetchall()
mysql.connection.commit()
return render_template('visitorcheckin.html',data=data,details=details)
@app.route('/
allroomsinfo',methods=['GET','POST'])

GUNTUR ENGINEERING COLLEGE 37 HOSTEL MANAGEMENT SYSTEM


def allrooms():
cursor=mysql.connection.cursor()
cursor.execute('select s.roomno,count(*) as count from students as s inner
join students as se on s.roomno=se.roomno group by s.roomno')
data=cursor.fetchall()
cursor.execute('select s.roomno from students as s inner join students as se on
s.roomno=se.roomno group by s.roomno')
odata=cursor.fetchall()
ogdata=set([int(i[0]) for i in odata])
room_lst={101, 102, 103, 104, 105, 106, 107, 108, 109,
110, 111} vac_rooms=room_lst.difference(ogdata)
print(vac_rooms)
return
render_template('room.html',data=data,vac_rooms=vac_roo
ms)
@app.route('/createpassword/<token>',methods=['GET','POS
T'])
def createpassword(token):#to create noe password and
conform the password
try:

s=Serializer(app.config['SECRET_KE
Y']) userid=s.loads(token)
['username']
if request.method=='POST':

npass=request.form['npassword']
cpass=request.form['cpassword']
if npass==cpass:
cursor=mysql.connection.cursor()
cursor.execute('update admin set password=%s where
userid=%s',[npass,userid]) mysql.connection.commit()
return 'Password reset Successfull'
else:
return 'Password mismatch'
return
render_template('newpassword.html')
except Exception as e:
print(e)

GUNTUR ENGINEERING COLLEGE 38 HOSTEL MANAGEMENT SYSTEM


return 'Link expired try again'
app.run(debug=True)

OUTPUT SCREENS
First of all, welcome to our portal. Here is our portal to solve the grievances of
students.

Here students have to register their details after registration (he/she) to the
portal.

GUNTUR ENGINEERING COLLEGE 39 HOSTEL MANAGEMENT SYSTEM


4.2 SCREEN SHOTS

ADMIN REGISTRATION:

ADMIN LOGIN:

GUNTUR ENGINEERING COLLEGE 40 HOSTEL MANAGEMENT SYSTEM


ADMIN PAGE:

GUNTUR ENGINEERING COLLEGE 41 HOSTEL MANAGEMENT SYSTEM


STUDENT ADD:

GUNTUR ENGINEERING COLLEGE 42 HOSTEL MANAGEMENT SYSTEM


CHECK IN :

CHAPTER 5
GUNTUR ENGINEERING COLLEGE 43 HOSTEL MANAGEMENT SYSTEM
SYSTEM TESTING
The aim of the system testing process was to determine all defects in our
project .The program was subjected to a set of test inputs and various
observations were made and based on these observations it will be decided
whether the program behaves as expected or not. Our Project went through two
levels of testing
1.Unit testing
1. integration testing

5.1 UNIT TESTING


Unit testing is undertaken when a module has been created and succesfully
reviewed .In order to test a single module we need to provide a complete
environment ie besides the module we would require
a. The procedures belonging to other modules that the module under test
calls

b. Non local data structures that module accesses

c. A procedure to call the functions of the module under test with


appropriate parameters
Unit testing was done on each and every module that is described under module
description of chapter 4

Test For the admin moduleTesting admin login form-This form is used for log in of
administrator of the system.In this we enter the username and password if both are
correct administration page will open other wise if any of data is wrong it will get
redirected back to the login page and again ask for username and password

GUNTUR ENGINEERING COLLEGE 44 HOSTEL MANAGEMENT SYSTEM


Student account addition- In this section the admin can verify student details from
student academinc info and then only add student details to main library database it
contains add and delete buttons if user click add button data will be added to student
database and if he clicks delete button the student data will be deleted
Book Addition- Admin can enter details of book and can add the details to the main
book table also he can view the books requests .

2.Test for Student login module

Test for Student login Form-This form is used for log in of Student .In this we enter
thelibraryid, username and password if all these are correct student login page will
open other wise if any of data is wrong it will get redirected back to the login page
and again ask for libraryid, username and password.
Test for account creation- This form is used for new account creation when student
does not fill the form completely it asks again to fill the whole form when he fill the
form fully it gets redirected to page which show waiting for conformation message
as his data will be only added by administrator after verification.
3Test for teacher login module-

Test for teacher login form- This form is used for logg in of teacher .In this we enter
the username and password if all these are correct teacher login page will open other
wise if any of data is wrong it will get redirected back to the login page and again
ask for username and password

5.2 INTEGRATION TESTING

GUNTUR ENGINEERING COLLEGE 45 HOSTEL MANAGEMENT SYSTEM


In this type of testing we test various integration of the project module by
providing the input

.The primary objective is to test the module interfaces in order to ensure that
no errors occur when one module invokes the other module.

12.1 Test Cases


Login form:

The test cases involved are whether valid password and name are entered
or invalid name and password entered.

S.NO TEST CASE EXPECTED RESULT TEST RESULTS

Enter valid Admin _id Software should display Successful


1. and Password and admin main window
click on login button

Enter invalid details of Software should not display Successful


2. Admin_ id and Password admin main window

Enter valid Student _id Software should display Successful


3. and Password and click student main window
on login button

Enter invalid details of Software should not display Successful


4. student_ id and Password student main window

Registration form:
The test cases are checking whether all details are relevant and are not or check
whether improper data/empty data if any entered.

GUNTUR ENGINEERING COLLEGE 46 HOSTEL MANAGEMENT SYSTEM


S.NO TES EXPECTED RESULT TEST
T CASE RESUL
T
student At first user have to fill all fields with
1. Registratio proper data. If any error like entering text
n in place of integer data or text in place of successful
integer is found then it gives proper
message otherwise, add student details to
database.

Edit Credentials Form:

Test cases are if the required credential are only be retrieved/edited if the
desired input for a forgotten field are correct or not

S.NO Test case EXPECTED TEST RESULT


RESULT
on click of If details i.e.,
forgot security code or
password by username/passwor successful
1.Forgot admin/student d if the particular
password
details are right, it
should update the
details in data
base or show the
error
CHAPTER 6
CONCLUSION & FUTURE SCOPE

GUNTUR ENGINEERING COLLEGE 47 HOSTEL MANAGEMENT SYSTEM


Hostel management system (HMS). This hostel management software is designed for
people who want to manage various activities in the hostel. This project is designed to
fulfill the need of the future generations.

This project is small package which includes different categories as well as having all
possible features. We have expected that it will be helpful to the, customers as well as
Administrative member.

We will improve this project in future with online room reservation system and also
improve in security by providing a magnetic coated card to permanent students for
automatic check in and check out.

We are waiting for your best suggestion and encouragement which could make us improve
the future programming much better than the one we have carried out.

Conclusion

GUNTUR ENGINEERING COLLEGE 48 HOSTEL MANAGEMENT SYSTEM


This project made by the handwork of me and is a small effort in the development of larger
programs, and it involves limited aspects which are needed in day to day hostel operation.

The software development although is a very difficult task but it can be carried out
successfully with the effort of my work. After the completion of this project we learnt
different things about software and its development. I also learnt to work in a group and
realize its importance.

Thus this project can be a guideline for the beginners and can be example for the
development of a small program.

CHAPTER 7
REFERENCES

GUNTUR ENGINEERING COLLEGE 49 HOSTEL MANAGEMENT SYSTEM


• Dan Rommel, “Database programming with-Visual Basic 6”, BPB
Publication
• Evangel’s Petroutsos, “Mastering Visual Basic 6”, Asia Publication.

GUNTUR ENGINEERING COLLEGE 50 HOSTEL MANAGEMENT SYSTEM

You might also like