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

Summer Training Report

This document summarizes a project submitted to fulfill requirements for a Bachelor's degree in Computer Applications. The project aims to develop a website to facilitate online bus ticket reservations through a simple graphical user interface. The document outlines the problem definition, objectives, goals, hardware and software requirements, and system analysis for the bus ticket booking system project.

Uploaded by

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

Summer Training Report

This document summarizes a project submitted to fulfill requirements for a Bachelor's degree in Computer Applications. The project aims to develop a website to facilitate online bus ticket reservations through a simple graphical user interface. The document outlines the problem definition, objectives, goals, hardware and software requirements, and system analysis for the bus ticket booking system project.

Uploaded by

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

Bus Ticket Booking System

Submitted in partial fulfillment of the requirements


for the award of the degree of

Bachelor of Computer Applications

To

GuruGobindSinghIndraprasthaUniversity, Delhi

Submitted by:
1. Vivek Bhardwaj (09824402020)
2. Krishna Mohan.B (35624402020)

Nurturing Excellence

Institute of Innovation In Technology & Management


New Delhi – 110058
Batch (2020-2023)
FORMAT FORTABLE OF CONTENTS
TABLE OF CONTENTS

S No Topic Page No

1 Certificate -

2 Acknowledgements -

3 List of Tables/Figures/Symbols -

4 Chapter-1: Introduction

5 Chapter-2: System Analysis

6 Chapter-3: System Design

8 Appendices

FORMAT FOR LIST OF TABLES/FIGURES/ SYMBOLS

LIST OF TABLES

Table No Title Page No

1 File Design for Employee Record

2 File Design for Personal Details

LIST OF FIGURES
Figure No Title Page No

1 Data Flow Diagram

2 Input Screen for Data Entry

LIST OF SYMBOLS

S No Symbol Nomenclature & Meaning

1  Sigma (Summation)

2 kbps Kilo bits per second

FORMAT FORTABLE OF CONTENTS


TABLE OF CONTENTS

S No Topic Page No

1 Certificate -

2 Acknowledgements -

3 List of Tables/Figures/Symbols -

4 Chapter-1: Introduction

5 Chapter-2: System Analysis

6 Chapter-3: System Design

8 Appendices

FORMAT FOR LIST OF TABLES/FIGURES/ SYMBOLS

LIST OF TABLES

Table No Title Page No

1 File Design for Employee Record

2 File Design for Personal Details

LIST OF FIGURES

Figure No Title Page No

1 Data Flow Diagram


2 Input Screen for Data Entry

LIST OF SYMBOLS

S No Symbol Nomenclature & Meaning

1  Sigma (Summation)

2 kbps Kilo bits per second

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:

“To Manage Online Bus Ticket Booking”.

Objective:

• To perform a thorough analysis of working of the whole System.

• To study the problems in the System through fact finding techniques.

• To follow SDLC to develop the system.

• To develop conceptual, logical and physical model for the system.

• To develop Graphical User Interface (GUI) as per convenience of the user.

• To implement the physical model, being tested as per the standards.

• To document our efforts and analysis in a proper comprehensible manner.

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.

To make a database that is consistent, reliable and secure.

To provide correct, complete, ongoing information.

To develop a well-organized information storage system.

To make good documentation so as to facilitate possible future enhancements.


Need of the System:

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.

Hardware and Software Requirements


Software Requirements:

• Technology: Python Django

• IDE : Pycharm/Atom

• Client Side Technologies: HTML, CSS, JavaScript , Bootstrap

• Server Side Technologies: Python

• Data Base Server: Sqlite

• Operating System: Microsoft Windows 11

Hardware Requirements:

• Processor: DELL

• Ram: 4GB

• Hard disk: 179 GB

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:

The key features required in the system are as follows:

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.

2) Cancellation: The passengers can cancel their bus tickets as usually.

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

Information of the system.

6) Report:This shows the reports in different fields of the system.

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.

Python is dynamically typed and garbage-collected. It supports multiple programming


paradigms, including procedural, object-oriented, and functional programming. Python is often
described as a "batteries included" language due to its comprehensive standard library.

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 SHEET (CSS)

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

Django is a web application framework written in Python programming language. It is based on


MVT (Model View Template) design pattern. The Django is very demanding due to its rapid
development feature. It takes less time to build application after collecting client requirement.

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 Application Database

Login
:Request

:Validate()
:executeQuery()

Response
Show Result

Failed:show()
Sequence Diagram For User

Login Application Database

Login
:Request

:Validate()
:executeQuery()

User

Response
Show Result

Login Table:-
S.NO. Field name Data type Description

1 User Name Text Store user name for


checking correct

username

2 Password Text/Number Store password


corresponding to user
name

BUSRESERVATION RECORDTABLE:-

Sr.no. Field name Data type

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

CUSTOMER LOGIN 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('Logged in Sucessfully');

window.location='{% url 'dashboard' %}';

</script>

{% endif %}

{% if error2 %}

<script>

alert('Logged in Sucessfully');

window.location='{% url 'admindashboard' %}';

</script>

{% endif %}
{% if error3 %}

<script>

alert('Usename & Password are not Correct');

window.location='{% url 'login_customer' %}';

</script>

{% endif %}

<div style="color:Black;border:1px solid white;border-radius:8px;background-


color:white;padding:50px">

<h3><strong>Login to your account</strong></h3><hr>

<form method="post" action="">

{% csrf_token %}

User Name:<br><input type="text" placeholder="Enter user name" name="uname"


style="border-radius:8px;width:600px;height:35px;"><br><br>

Password:<br><input type="password" placeholder="Enter password" name="pwd"


style="border-radius:8px;width:600px;height:35px;"><br><br>

<input type="submit" value="Sign in" style="color:white;border-


radius:8px;width:100px;height:35px;background-color:#333;border:1px solid black">

</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');

window.location='{% url 'login_customer' %}';

</script>

{% endif %}

<div style="color:Black;border:1px solid white;border-radius:8px;background-


color:white;padding:50px">

<h3><strong>Register your account</strong></h3><hr>

<form method="post" action="">


{% csrf_token %}

First Name:<br><input type="text" placeholder="Enter first name" name="fname"


style="border-radius:8px;width:600px;height:35px;"><br><br>

Last Name:<br><input type="text" placeholder="Enter last name" name="lname"


style="border-radius:8px;width:600px;height:35px;"><br><br>

User Name:<br><input type="text" placeholder="Enter user name" name="uname"


style="border-radius:8px;width:600px;height:35px;"><br><br>

Password:<br><input type="password" placeholder="Enter password" name="pwd"


style="border-radius:8px;width:600px;height:35px;"><br><br>

Gender:<br><div style="border-radius:8px;width:600px;height:35px;"> Male <input


type="radio" value="Male" name="male"> Female <input type="radio" value="Female"
name="male"><br><br></div>

Email:<br><input type="email" placeholder="Enter email" name="email" style="border-


radius:8px;width:600px;height:35px;"><br><br>

Mobile:<br><input type="text" placeholder="Enter mobile number" name="mobile"


style="border-radius:8px;width:600px;height:35px;"><br><br>

Date of Birth:<br><input type="date" placeholder="Enter your Date of Birth" name="birth"


style="border-radius:8px;width:600px;height:35px;"><br><br>

Full Address:<br><input type="text" placeholder="Enter Address" name="add"


style="border-radius:8px;width:600px;height:35px;"><br><br>

<input type="submit" value="Sign in" style="color:white;border-


radius:8px;width:100px;height:35px;background-color:#333;border:1px solid black">

</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>

<div style="color:Black;border:1px solid white;border-radius:8px;background-


color:white;padding:50px">

{% if error %}

<h3><strong>All Available Bus</strong></h3><hr>

<table width="800">

{% for i in route1 %}

<tr style="margin-top:10px">

<td><hr><img src="{{i.0.img.url}}" style="width:150px;height:135"></td>

<td><b><br>Bus Name: {{i.0.busname}}</b><br>

Bus Number: {{i.0.bus_no}}<br>

From City: {{i.0.from_city}}<br>


Fare: {{fare3}}<br></td>

<td><br><br><button style="background-color:#333;border:1px solid black;border-


radius:8px;padding:10px"><a href="{% url 'book_detail' coun i.0.id route %}"
style="padding:30px;color:white;">Book Now</a></button><br><br></td>

</tr>

{% endfor %}

</table><br>

{% else %}

<h3><strong>Search Bus</strong></h3><hr>

<form method="post" action="">

{% csrf_token %}

From City:<br><select name="fcity" style="border-radius:8px;width:600px;height:35px;">

{% for i in data2 %}

<option>{{i.route}}</option>

{% endfor %}

</select><br><br>

To City:<br><select name="tcity" style="border-radius:8px;width:600px;height:35px;">

{% for i in data2 %}

<option>{{i.route}}</option>

{% endfor %}
</select><br><br>

Travel Date:<br><input type="date" name="date" style="border-


radius:8px;width:600px;height:35px;"><br><br>

<input type="submit" value="Search" style="color:white;border-


radius:8px;width:115px;height:35px;background-color:#333;border:1px solid black">

</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>

alert('Booking Deleted Successfully')

window.location='{% url 'my_booking' %}'

</script>

{% endif %}

<div style="color:Black;border:1px solid white;border-radius:8px;background-


color:white;padding:50px">

<h3><strong>Booking Details</strong></h3><hr>

<div class="container">

<table class="table table-bordered" id="myTable">


<thead style="color:white;background-color:#333">

<tr>

<th>Sr No</th>

<th>Passenger</th>

<th>Bus Name & Bus No.</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' %}

<td style="color:green">Booking Confirmed</td>

{% else %}

<td style="color:red">No Transaction</td>

{% endif %}

<td><a href="{% url 'delte_my_booking' i.id %}" style="color:red"><u>Delete</u></a></td>

</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>

<div style="color:Black;border:1px solid white;border-radius:8px;background-


color:white;padding:50px">

<h3><strong>Dashboard</strong></h3><hr>

<h3><a href="{% url 'admindashboard' %}"><button style="width:600px;color:white;border-


radius:8px;height:45px;background-color:#333">Dashboard</button></a></h3>

<h3><a href="{% url 'add_bus' %}"><button style="width:600px;color:white;border-


radius:8px;height:45px;background-color:#333">Add Bus</button></a></h3>

<h3><a href="{% url 'add_route' %}"><button style="width:600px;color:white;border-


radius:8px;height:45px;background-color:#333">Add Route</button></a></h3>

<h3><a href="{% url 'availableroute' %}"><button style="width:600px;color:white;border-


radius:8px;height:45px;background-color:#333">View Route</button></a></h3>

<h3><a href="{% url 'view_bus' %}"><button style="width:600px;color:white;border-


radius:8px;height:45px;background-color:#333">Bus Report</button></a></h3>
<h3><a href="{% url 'log_out' %}"><button style="width:600px;color:white;border-
radius:8px;height:45px;background-color:#333">Logout</button></a></h3>

</div>

{% endblock %}

<li id="id1"><a href="{% url 'availableroute' %}">View Route</a></li>


ADD NEW BUS DETAIL FORM CODING

{% 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>alert('Added New Bus Sucessfully');

window.location='{% url 'view_bus' %}';

</script>

{% endif %}

<div style="color:Black;border:1px solid white;border-radius:8px;background-


color:white;padding:50px">

<h3><strong>Add New Bus</strong></h3><hr>

<form method="post" action="" enctype="multipart/form-data">

{% csrf_token %}

Bus Name:<br><input type="text" placeholder="Enter Bus Name" name="busname"


style="border-radius:8px;width:600px;height:35px;"><br><br>
Bus No:<br><input type="text" placeholder="Enter Bus no" name="bus_no" style="border-
radius:8px;width:600px;height:35px;"><br><br>

From City:<br><input type="text" placeholder="Enter pick location" name="fcity"


style="border-radius:8px;width:600px;height:35px;"><br><br>

To City:<br><input type="text" placeholder="Enter Drop location" name="tcity"


style="border-radius:8px;width:600px;height:35px;"><br><br>

Departure Time:<br><input type="text" placeholder="Enter Departure time HH:MM


am/pm" name="dtime" style="border-radius:8px;width:600px;height:35px;"><br><br>

Arrival Time:<br><input type="text" placeholder="Enter arrival time HH:MM am/pm"


name="atime" style="border-radius:8px;width:600px;height:35px;"><br><br>

Travel Time:<br><input type="text" placeholder="Enter Travel time HH:MM"


name="ttime" style="border-radius:8px;width:600px;height:35px;"><br><br>

Distance:<br><input type="number" placeholder="Enter Distance (in Km)" name="dis"


style="border-radius:8px;width:600px;height:35px;"><br><br>

<br><input type="file" name="img" style="border-


radius:8px;width:600px;height:35px;"><br><br>

<input type="submit" value="Add Bus" style="color:white;border-


radius:8px;width:100px;height:35px;background-color:#333;border:1px solid black">

</form>

</div>

{% endblock %}

ADD BUS ROUTE FORM CODING


{% extends 'navigation3.html' %}

{% load static %}

{% block b %}

{% if error %}

alert('Route is added successfully')

{% endif %}

<style>

input[type=text][type=time]{

border-radius:8px;

width:600px;

height:16px;

</style>

{% if error %}

<script>

alert('Added New Route Sucessfully');

window.location='{% url 'availableroute' %}';

</script>

{% endif %}

<div style="color:Black;border:1px solid white;border-radius:8px;background-


color:white;padding:50px">
<h3><strong>Add New Route</strong></h3><hr>

<form method="post" action="">

{% csrf_token %}

<select name="bus" style="border-radius:8px;width:600px;height:35px;">

{% for i in data %}

<option value="{{i.id}}">{{i.busname}}.[{{i.bus_no}}]</option>

{% endfor %}

</select><br><br>

Route:<br><input type="text" placeholder="Enter Route" name="route" style="border-


radius:8px;width:600px;height:35px;"><br><br>

Distance:<br><input type="number" placeholder="Enter Distance" name="dis"


style="border-radius:8px;width:600px;height:35px;"><br><br>

Fare:<br><input type="number" placeholder="Enter fare" name="fare" style="border-


radius:8px;width:600px;height:35px;"><br><br>

<input type="submit" value="Add Route" style="color:white;border-


radius:8px;width:100px;height:35px;background-color:#333;border:1px solid black">

</form>

</div>

{% endblock %}

EDIT BUS ROUTE DETAIL PAGE CODING


{% extends 'navigation3.html' %}

{% load static %}

{% block b %}

{% if error %}

alert('Route is added successfully')

{% endif %}

<style>

input[type=text][type=time]{

border-radius:8px;

width:600px;

height:16px;

</style>

{% if error %}

<script>alert('Update Route Sucessfully');

window.location='{% url 'availableroute' %}';

</script>

{% endif %}

<div style="color:Black;border:1px solid white;border-radius:8px;background-


color:white;padding:50px">
<h3><strong>Edit Route</strong></h3><hr>

<form method="post" action="">

{% csrf_token %}

<select name="bus" style="border-radius:8px;width:600px;height:35px;">

{% for i in data2 %}

{% if i.id == data.bus.id %}

<option value="{{i.id}}" selected>{{i.busname}}.[{{i.bus_no}}]</option>

{% else %}

<option value="{{i.id}}">{{i.busname}}.[{{i.bus_no}}]</option>

{% endif %}

{% endfor %}

</select><br><br>

Route:<br><input type="text" placeholder="Enter Route" name="route"


value="{{data.route}}" style="border-radius:8px;width:600px;height:35px;"><br><br>

Distance:<br><input type="number" placeholder="Enter Distance" name="dis"


value="{{data.distance}}" style="border-radius:8px;width:600px;height:35px;"><br><br>

Fare:<br><input type="number" placeholder="Enter fare" name="fare"


value="{{data.fare}}" style="border-radius:8px;width:600px;height:35px;"><br><br>

<input type="submit" value="Update" style="color:white;border-


radius:8px;width:100px;height:35px;background-color:#333;border:1px solid black">

</form>

</div>
{% endblock %}

“VIEWS.PY” FILE CODING


from django.shortcuts import render,redirect

from django.contrib.auth import authenticate,logout,login

from django.contrib.auth.models import User

from .models import *

from django.contrib import messages

# Create your views here.

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

if fare3<5 and fare3>0:

fare3 = 5

elif fare3<0:

fare3 = fare3*(-1)

elif fare3==0:

fare3 = fare3

route = f+" to "+t

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":

total = total + i.fare

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)

Book_ticket.objects.create(user=user1, route=route1, fare=total, passenger=passenger,


date2=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

messages.info(request,'Passenger Deleted Successfully')

return redirect('book_detail', coun,bid,route1)


def Card_Detail(request,total,coun,route1,pid):

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

“MODELS.PY” FILE CODING

from django.db import models


from django.contrib.auth.models import User

# Create your models here.

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

return self.route+" "+str(self.bus.bus_no)

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

return self.user.user.username+" "+self.name

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

return self.user.user.username+" "+self.route

class Asehi(models.Model):

fare = models.IntegerField(null=True)

bus_name = models.CharField(max_length=30,null=True)

date3 = models.DateField(null=True)

Advantages of “Online Bus Reservation System:

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

Limitations of “Online Bus Reservation System:

Besides the above achievements and the successful completion of the project, we still feel the
project has some limitations, listed as below:

 It is not a large scale system.


 Only limited information provided by this system.
 Since it is an online project, customers need internet connection to buy products.
 People who are not familiar with computers can’t use this software.

FUTURE SCOPE AND CONCLUSION

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/

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy