Summer Training Report
Summer Training Report
To
GuruGobindSinghIndraprasthaUniversity, Delhi
Submitted by:
1. Vivek Bhardwaj (09824402020)
2. Krishna Mohan.B (35624402020)
Nurturing Excellence
S No Topic Page No
1 Certificate -
2 Acknowledgements -
3 List of Tables/Figures/Symbols -
4 Chapter-1: Introduction
8 Appendices
LIST OF TABLES
LIST OF FIGURES
Figure No Title Page No
LIST OF SYMBOLS
1 Sigma (Summation)
S No Topic Page No
1 Certificate -
2 Acknowledgements -
3 List of Tables/Figures/Symbols -
4 Chapter-1: Introduction
8 Appendices
LIST OF TABLES
LIST OF FIGURES
LIST OF SYMBOLS
1 Sigma (Summation)
Introduction
Introduction to the System:
The main aim of the project was to develop a website which would facilitate the reservation of
online bus tickets through an effective and yet simple GUI for a normal passenger intending to
travel in buses. Apart from reserving tickets, through our system a passenger can compare online
fares ‘from’ various cities ‘to’ various cities.
Problem Definition:
Managing your Online Bus Reservation System may seem tricky, but a BRS is part of Passenger
Service System (application support direct contact with passenger)
Aim:
Objective:
Goal:
The project is basically targeted at those people who would like to travel through bus and have
an Internet access.
Finally passengers curious in comparing the prices for various buses for their selected source and
destination cities.
There is always a need of a system that will perform to online bus ticket booking and bus
searching and also show the bus route.
Thus, there is a big need of a online bus ticket booking system, which provides all the Above-
mentioned facilities and many more.
• IDE : Pycharm/Atom
Hardware Requirements:
• Processor: DELL
• Ram: 4GB
System Analysis
Purpose:
To manage the online bus ticket booking. It helps to passenger to book seat from anywhere. Also
make payment online for it. It helps to people to reserve seats at their prefer time
Project Scope:
The project has a wide scope, as it is not intended to a particular organization. This project is
going to develop generic software, which can be applied by any businesses organization. More
over it provides facility to its passenger. Also the software is going to provide a huge amount of
summary data.
Proposed System:
The bus reservation system is available in the market that can serve customers to book online
ticket.
System Overview:
1) Booking
2) Cancellation
3) Passenger Details
4) Buses
5) Search
6) Report
1) Booking: The system can book online tickets of the passengers, where they want to go.
3) Passenger Details: The System stores all the necessary information of the passengers.
4) Buses:It shows the bus schedule such as bus time, arrival and departure time etc.
5) Search:This is provided the search options of the system that can search any related
Python
Python is a widely used general-purpose, high level programming language. It was initially
designed by Guido van Rossum in 1991 and developed by Python Software Foundation. It was
mainly developed for emphasis on code readability, and its syntax allows programmers to
express concepts in fewer lines of code.
Python is a programming language that lets you work quickly and integrate systems more
efficiently.
HTML
HTML (Hypertext Markup Language) is the set of markup symbols or codes inserted in a file
intended for display on a World Wide Web browser page. The markup tells the Web browser
how to display a Web page's words and images for the user. Each individual markup code is
referred to as an element (but many people also refer to it as a tag). Some elements come in pairs
that indicate when some display effect is to begin and when it is to end.
Cascading Style Sheets (CSS) are a collection of rules we use to define and modify web pages.
CSS are similar to styles in Word. CSS allow Web designers to have much more control over
their pages look and layout. For instance, you could create a style that defines the body text to
be Verdana, 10 point. Later on, you may easily change the body text to Times New Roman, 12
point by just changing the rule in the CSS. Instead of having to change the font on each page of
your website, all you need to do is redefine the style on the style sheet, and it will instantly
change on all of the pages that the style sheet has been applied to. With HTML styles, the font
change would be applied to each instance of that font and have to be changed in each spot.
CSS can control the placement of text and objects on your pages as well as the look of those
objects.
HTML information creates the objects (or gives objects meaning), but styles describe how the
objects should appear. The HTML gives your page structure, while the CSS creates the
“presentation”. An external CSS is really just a text file with a .css extension. These files can be
created with Dreamweaver, a CSS editor, or even Notepad. The best practice is to design your
web page on paper first so you know where you will want to use styles on your page. Then you
can create the styles and apply them to your page.
Javascript
JavaScript is a programming language commonly used in web development. It was originally
developed by Netscape as a means to add dynamic and interactive elements to websites. While
JavaScript is influenced by Java, the syntax is more similar to C and is based on ECMAScript, a
scripting language developed by Sun Microsystems.
JavaScript is a client-side scripting language, which means the source code is processed by the
client's web browser rather than on the web server. This means JavaScript functions can run after
a webpage has loaded without COMMUNICATING with the server. For example, a JavaScript
function may check a web form before it is submitted to make sure all the required fields have
been filled out. The JavaScript code can produce an error message before any information is
actually transmitted to the server.
Like server-side scripting languages, such as PHP and ASP, JavaScript code can be inserted
anywhere within the HTML of a webpage. However, only the output of server-side code is
displayed in the HTML, while JavaScript code remains fully visible in the source of the
webpage. It can also be referenced in a separate .JS file, which may also be viewed in a browser.
Django
This framework uses a famous tag line: The web framework for perfectionists with deadlines.
System Design
Use Case Diagram:
Use case diagram consists of use cases and actors and shows the interaction between
them. The key points are:
The main purpose is to show the interaction between the use cases and the actor.
To represent the system requirement from user’s perspective.
The use cases are the functions that are to be performed in the module.
DFD LEVEL0
DFD LEVEL 1
DFD LEVEL 2
ER DIAGRAM
Symbols Meanings
Data flow
Process
Data store
Entity
SequenceDiagram For Administrator
Login
:Request
:Validate()
:executeQuery()
Response
Show Result
Failed:show()
Sequence Diagram For User
Login
:Request
:Validate()
:executeQuery()
User
Response
Show Result
Login Table:-
S.NO. Field name Data type Description
username
BUSRESERVATION RECORDTABLE:-
1 Class Text
2 Name Text
3 Age Number
4 Gender Text
5 Date Number
Output Screens
HOME PAGE
REGISTRATION PAGE
LOGIN PAGE
WELCOME USER PAGE
SEARCH BUS PAGE
BOOKING PAGE
ADMIN PAGE
ADD NEW BUS DETAILS PAGE
ADD NEW BUS ROUTE
VIEW ALL BUS DETAILS
CODING
{% extends 'navigation.html' %}
{% load static %}
{% block a %}
<style>
input[type=text][type=password]{
border-radius:8px;
width:600px;
height:16px;
</style>
{% if error %}
<script>
alert('Logged in Sucessfully');
</script>
{% endif %}
{% if error2 %}
<script>
alert('Logged in Sucessfully');
</script>
{% endif %}
{% if error3 %}
<script>
</script>
{% endif %}
{% csrf_token %}
</form>
</div>
{% endblock %}
USER REGISTRATION PAGE CODING
{% extends 'navigation.html' %}
{% load static %}
{% block a %}
<style>
input[type=text][type=password]{
border-radius:8px;
width:600px;
height:16px;
</style>
{% if error %}
<script>
alert('Ragistration Sucessfull');
</script>
{% endif %}
</form>
</div>
{% endblock %}
SEARCH BUS PAGE CODING
{% extends 'navigation2.html' %}
{% load static %}
{% block b %}
<style>
input[type=text][type=password]{
border-radius:8px;
width:600px;
height:16px;
</style>
{% if error %}
<table width="800">
{% for i in route1 %}
<tr style="margin-top:10px">
</tr>
{% endfor %}
</table><br>
{% else %}
<h3><strong>Search Bus</strong></h3><hr>
{% csrf_token %}
{% for i in data2 %}
<option>{{i.route}}</option>
{% endfor %}
</select><br><br>
{% for i in data2 %}
<option>{{i.route}}</option>
{% endfor %}
</select><br><br>
</form>
{% endif %}
</div>
{% endblock %}
VIEW MY BOOKINGS PAGE
{% extends 'navigation2.html' %}
{% load static %}
{% block b %}
<style>
input[type=text][type=password]{
border-radius:8px;
width:600px;
height:16px;
</style>
{% if error %}
<script>
</script>
{% endif %}
<h3><strong>Booking Details</strong></h3><hr>
<div class="container">
<tr>
<th>Sr No</th>
<th>Passenger</th>
<th> Age</th>
<th>Gender</th>
<th>Date</th>
<th>Fare</th>
<th>Travelling</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
{% for i in pro %}
<tr>
<td>{{forloop.counter}}</td>
<td>{{i.name}}</td>
<td>{{i.bus.busname}}. {{i.bus.bus_no}}</td>
<td>{{i.age}}</td>
<td>{{i.gender}}</td>
<td>{{i.date1}}</td>
<td>{{i.fare}}</td>
<td>{{i.route}}</td>
{% if i.status == 'set' %}
{% else %}
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endblock %}
ADMIN HOME PAGE CODING
{% extends 'navigation3.html' %}
{% load static %}
{% block b %}
<style>
input[type=text][type=password]{
border-radius:8px;
width:600px;
height:16px;
</style>
<h3><strong>Dashboard</strong></h3><hr>
</div>
{% endblock %}
{% extends 'navigation3.html' %}
{% load static %}
{% block b %}
<style>
input[type=text][type=time][type=file]{
border-radius:8px;
width:600px;
height:16px;
</style>
{% if error %}
</script>
{% endif %}
{% csrf_token %}
</form>
</div>
{% endblock %}
{% load static %}
{% block b %}
{% if error %}
{% endif %}
<style>
input[type=text][type=time]{
border-radius:8px;
width:600px;
height:16px;
</style>
{% if error %}
<script>
</script>
{% endif %}
{% csrf_token %}
{% for i in data %}
<option value="{{i.id}}">{{i.busname}}.[{{i.bus_no}}]</option>
{% endfor %}
</select><br><br>
</form>
</div>
{% endblock %}
{% load static %}
{% block b %}
{% if error %}
{% endif %}
<style>
input[type=text][type=time]{
border-radius:8px;
width:600px;
height:16px;
</style>
{% if error %}
</script>
{% endif %}
{% csrf_token %}
{% for i in data2 %}
{% if i.id == data.bus.id %}
{% else %}
<option value="{{i.id}}">{{i.busname}}.[{{i.bus_no}}]</option>
{% endif %}
{% endfor %}
</select><br><br>
</form>
</div>
{% endblock %}
def nav(request):
return render(request,'carousel.html')
def About(request):
return render(request,'about.html')
def Contact(request):
return render(request,'contact.html')
def Login_customer(request):
error = False
error2 = False
error3 = False
if request.method == "POST":
n = request.POST['uname']
p = request.POST['pwd']
try:
user = authenticate(username=n,password=p)
except:
error3 = True
try:
if user.is_staff:
login(request,user)
error2 = True
elif user:
login(request, user)
error=True
except:
error3=True
d = {'error':error,'error2':error2,'error3':error3}
return render(request,'login_customer.html',d)
def Register_customer(request):
error = False
if request.method == "POST":
n = request.POST['uname']
f = request.POST['fname']
l = request.POST['lname']
e = request.POST['email']
a = request.POST['add']
m = request.POST['mobile']
g = request.POST['male']
d = request.POST['birth']
p = request.POST['pwd']
user =
User.objects.create_user(first_name=f,last_name=l,username=n,password=p,email=e)
Register.objects.create(user=user,add=a,mobile=m,gender=g,dob=d)
error = True
d = {'error':error}
return render(request,'register_customer.html',d)
def Search_Bus(request):
if not request.user.is_authenticated:
return redirect('login')
data = Add_route.objects.all()
ase = Asehi.objects.all()
coun = 7
error=False
fare3=0
count = 0
count1 = 0
data1=0
data2=0
route1=[]
route=0
b_no =[]
b_no1 =[]
bhu=0
if request.method=="POST":
f = request.POST["fcity"]
t = request.POST["tcity"]
da = request.POST["date"]
data1 = Add_route.objects.filter(route=f)
data2 = Add_route.objects.filter(route=t)
for i in data1:
for j in data2:
if i.bus.bus_no==j.bus.bus_no:
route1.append(Add_Bus.objects.filter(bus_no=i.bus.bus_no))
for i in data1:
fare1=i.fare
count+=1
b_no.append(i.bus.bus_no)
for i in data2:
fare2 = i.fare
count1+=1
b_no1.append(i.bus.bus_no)
fare3 = fare2-fare1
fare3 = 5
elif fare3<0:
fare3 = fare3*(-1)
elif fare3==0:
fare3 = fare3
Asehi.objects.create(fare=fare3,bus_name="bus2",date3=da)
for i in ase:
coun = coun + 1
error=True
d={"data2":data,'route1':route1,'fare3':fare3,"error":error,'coun':coun,'route':route}
return render(request,'search_bus.html',d)
def Dashboard(request):
if not request.user.is_authenticated:
return redirect('login')
return render(request,'dashboard.html')
def Logout(request):
logout(request)
return redirect('nav')
def Book_detail(request,coun,pid,route1):
if not request.user.is_authenticated:
return redirect('login')
error = False
data = Asehi.objects.get(id=coun)
data2 = Add_Bus.objects.get(id=pid)
user2 = User.objects.filter(username=request.user.username).get()
user1 = Register.objects.filter(user=user2).get()
pro = Passenger.objects.filter(user=user1)
book = Book_ticket.objects.filter(user=user1)
total = 0
for i in pro:
if i.status!="set":
passenger=0
if request.method=="POST":
f = request.POST["name"]
t = request.POST["age"]
da = request.POST["gender"]
passenger =
Passenger.objects.create(user=user1,bus=data2,route=route1,name=f,gender=da,age=t,fare=data.
fare,date1=data.date3)
if passenger:
error = True
d=
{'data':data,'data2':data2,'pro':pro,'total':total,'book':book,'error':error,'route1':route1,'coun':coun,'
pid':pid}
return render(request,'book_detail.html',d)
def Delete_passenger(request,pid,bid,route1):
if not request.user.is_authenticated:
return redirect('login')
data = Passenger.objects.get(id=pid)
data.delete()
ase = Asehi.objects.all()
coun = 7
for i in ase:
coun = coun + 1
if not request.user.is_authenticated:
return redirect('login')
error=False
data = Asehi.objects.get(id=coun)
data2 = Add_Bus.objects.get(id=pid)
user2 = User.objects.filter(username=request.user.username).get()
user1 = Register.objects.filter(user=user2).get()
pro = Passenger.objects.filter(user=user1)
book = Book_ticket.objects.filter(user=user1)
count=0
pro1 = 0
if request.method == "POST":
error=True
for i in pro:
count = i.name
if i.status != "set":
i.status="set"
i.save()
return redirect('my_booking')
total1=total
d=
{'user':user1,'data':data,'data2':data2,'pro':pro,'pro1':pro1,'total':total1,'book':book,'error':error,'rou
te1':route1,'count':count}
return render(request,'card_detail.html',d)
def my_booking(request):
if not request.user.is_authenticated:
return redirect('login')
user2 = User.objects.filter(username=request.user.username).get()
user1 = Register.objects.filter(user=user2).get()
pro = Passenger.objects.filter(user=user1)
book = Book_ticket.objects.filter(user=user1)
d = {'user':user1,'pro':pro,'book':book}
return render(request,'my_booking.html',d)
def delte_my_booking(request,pid):
if not request.user.is_authenticated:
return redirect('login')
error=False
pro = Passenger.objects.get(id=pid)
pro.delete()
error=True
d = {'error':error}
return render(request,'my_booking.html',d)
def Add_bus(request):
if not request.user.is_authenticated:
return redirect('login')
error=False
if request.method == "POST":
n = request.POST['busname']
no = request.POST['bus_no']
f = request.POST['fcity']
to= request.POST['tcity']
de= request.POST['dtime']
a = request.POST['atime']
t = request.POST['ttime']
d = request.POST['dis']
i = request.FILES['img']
Add_Bus.objects.create(busname=n,bus_no=no,from_city=f,to_city=to,departuretime=de,arrival
time=a,trevaltime=t,distance=d,img=i)
error=True
d={"error":error}
return render(request,'add_bus.html',d)
def view_bus(request):
if not request.user.is_authenticated:
return redirect('login')
data=Add_Bus.objects.all()
d={"data":data}
return render(request,"view_bus.html",d)
def add_route(request):
error=False
data=Add_Bus.objects.all()
if request.method == "POST":
b = request.POST['bus']
r = request.POST['route']
f= request.POST['fare']
d = request.POST['dis']
bus1 = Add_Bus.objects.filter(id=b).get()
Add_route.objects.create(bus=bus1,route=r,distance=d,fare=f)
error = True
d={"data":data,"error":error}
return render(request,'add_route.html',d)
def Edit_route(request,pid):
if not request.user.is_authenticated:
return redirect('login')
error=False
data=Add_route.objects.get(id=pid)
data2=Add_Bus.objects.all()
if request.method == "POST":
b = request.POST['bus']
r = request.POST['route']
f= request.POST['fare']
d = request.POST['dis']
a = Add_Bus.objects.filter(id=b).first()
data.bus = a
data.route = r
data.fare = f
data.distance = d
data.save()
error=True
d={"data":data,"data2":data2,"error":error}
return render(request,'editroute.html',d)
def edit(request,pid):
if not request.user.is_authenticated:
return redirect('login')
error = False
data1=Add_Bus.objects.get(id=pid)
if request.method == "POST":
n = request.POST['busname']
no = request.POST['bus_no']
de= request.POST['dtime']
a = request.POST['atime']
t = request.POST['ttime']
f = request.POST['fcity']
to= request.POST['tcity']
d = request.POST['dis']
data1.busname=n
data1.bus_no=no
data1.from_city=f
data1.to_city=to
data1.departuretime=de
data1.arrivaltime=a
data1.traveltime=t
data1.distance=d
data1.save()
error = True
d = {'data':data1,'error':error}
return render(request,'editbus.html',d)
def delete(request,pid):
if not request.user.is_authenticated:
return redirect('login')
error2=False
data=Add_Bus.objects.get(id=pid)
data.delete()
error2=True
d = {'error2':error2}
return render(request,"view_bus.html",d)
def delete_route(request,pid):
if not request.user.is_authenticated:
return redirect('login')
error=False
data=Add_route.objects.get(id=pid)
data.delete()
error = True
d = {'error2':error}
return render(request,"availableroute.html",d)
def displayroute(request):
if not request.user.is_authenticated:
return redirect('login')
data = Add_route.objects.all()
data2 = Add_Bus.objects.all()
d = {'data':data,'data2':data2}
return render(request,"availableroute.html",d)
def admindashboard(request):
if not request.user.is_authenticated:
return redirect('login')
return render(request,'admindashboard.html')
class Register(models.Model):
user = models.ForeignKey(User,on_delete=models.CASCADE,null=True)
mobile = models.CharField(max_length=10,null=True)
add = models.CharField(max_length=100,null=True)
dob = models.DateField(null=True)
gender = models.CharField(max_length=10,null=True)
def __str__(self):
return self.user.first_name
class Add_Bus(models.Model):
busname = models.CharField(max_length=30,null=True)
bus_no = models.IntegerField(null=True)
from_city = models.CharField(max_length=30,null=True)
to_city = models.CharField(max_length=30,null=True)
departuretime=models.CharField(max_length=30,null=True)
arrivaltime=models.CharField(max_length=30,null=True)
trevaltime=models.CharField(max_length=100,null=True)
distance=models.IntegerField(null=True)
img=models.FileField(null=True)
def __str__(self):
return self.busname+" "+str(self.bus_no)
class Add_route(models.Model):
bus = models.ForeignKey(Add_Bus,on_delete=models.CASCADE,null=True)
route = models.CharField(max_length=100,null=True)
distance=models.IntegerField(null=True)
fare=models.IntegerField(null=True)
def __str__(self):
class Passenger(models.Model):
user = models.ForeignKey(Register,on_delete=models.CASCADE,null=True)
bus = models.ForeignKey(Add_Bus,on_delete=models.CASCADE,null=True)
name = models.CharField(max_length=100,null=True)
age = models.IntegerField(null=True)
gender = models.CharField(max_length=30,null=True)
route=models.CharField(max_length=100,null=True)
status = models.CharField(max_length=30,null=True)
date1 = models.DateField(null=True)
fare = models.IntegerField(null=True)
def __str__(self):
class Book_ticket(models.Model):
passenger=models.ForeignKey(Passenger,on_delete=models.CASCADE,null=True)
user=models.ForeignKey(Register,on_delete=models.CASCADE,null=True)
route=models.CharField(max_length=100,null=True)
date2=models.DateField(null=True)
fare=models.IntegerField(null=True)
def __str__(self):
class Asehi(models.Model):
fare = models.IntegerField(null=True)
bus_name = models.CharField(max_length=30,null=True)
date3 = models.DateField(null=True)
“Online Bus Reservation System” provides various features, which complement the information
system and increase the productivity of the system. These features make the system easily usable
and convenient. Some of the important features included are listed as follows:
Intelligent User Forms Design
Data access and manipulation through same forms
Access to most required information
Data Security
Restrictive data access, as per login assigned only.
Organized and structured storage of facts.
Strategic Planning made easy.
No decay of old Records.
Exact financial position of the Business.
Besides the above achievements and the successful completion of the project, we still feel the
project has some limitations, listed as below:
FUTURE SCOPE
This web application involves almost all the features of the online bus ticket booking. The future
implementation will be online help for the customers and chatting with website administrator.
CONCLUSION
The project entitled “Online Bus Ticket Booking” is developed using HTML, CSS and Bootstrap
as front end and Python Django and Sqlite database in back end to computerize the process of
online bus ticket booking. This project covers only the basic features required.
BIBLIOGRAPHY
Wikipedia
https://www.geeksforgeeks.org/python-django/
https://www.javatpoint.com
https://www.python.org/
https://www.tutorialspoint/