Final-Report
Final-Report
Final-Report
B.W.G.N Ranathunge
E111041050
B.W.G.N Ranathunge
E111041050
I declare that this thesis is my own work and has not been submitted in any
form for another degree or diploma at any university or other institution of tertiary
education. Information derived from the published or unpublished work of others has
been acknowledged in the text and a list of references is given.
Date:
Supervised by
Date:
i
Acknowledgement
I would like to present my heartfelt thanks and deep regards to Mr. Aruna
Dissanayake who is my project supervisor for the constant support rendered to me at
all stages of the project, right from the very beginning, till the submission of the final
document. And also I wish to acknowledge the support and help given to my dear
lecturer Ms. Shashini Pathiraja. I would like to pass my special thanks to my dear
friend Mr. Dinesh Priyashantha for the support and assistance given to my project.
Very special thanks should be made to my dearest parents who have made my life
successful in every way, for guiding me, for providing me with all the comfort and for
providing me with the best education.
ii
Abstract
iii
Contents
vi
List of Figures
viii
List of Table
Table 2.1: Comparison between Manual vs. Web based online bus booking system ... 9
Table 6.1: Resource Requirements .............................................................................. 26
Table 7.2.1 Test case for Login Interface .................................................................... 56
Table 7.2.2 Test case for Add New Bus Interface ....................................................... 57
Table 7.2.3 Test case for Update Bus Data Interface .................................................. 57
Table 7.2.4 Test case for Change Password Interface ................................................. 58
Table 7.2.5 Test case for View Report Interface ......................................................... 59
Table 7.2.6 Test case for Select Bus Seat Interface ..................................................... 60
Table 7.2.7 Test case for Tracking Interface ............................................................... 60
ix
Chapter 1 – Introduction
1.1 Introduction
In Sri Lanka there are few bus booking centers. . Up to date almost the whole
process of the centre is carried out manually. Therefore it takes much time to fill
information and produce the ticket. Hence there are queues. And also it is not possible
to do a bus booking at any time of the day (24 hours). Because it is open only at
working hours. SLTB bus booking center is situated in Colombo. Therefore it is
difficult to book your tickets without going for the center. It is a waste of both time
and money for coming to the center for reserve your tickets. But without reserving the
tickets it may also cause waste of time and lack of comfort. In such cases people
require a possible solution. Having a complete manual system and less information
technology they couldn’t settle an appropriate method for above problems.
Web based online bus booking system is the solution for above problems. To
the people who suffer to go to places to reserve their tickets, this system may be a
great solution. And after reserving their ticket they do not need to wait at the bus
stand until the bus comes, they could track the location of the bus and be at time. So it
would be a quiet nice journey for all the passengers. Therefore this system is going to
develop not only for online bus booking service and also to track the location. PHP
[1], HTML [2], CSS [3], jQuery [4], Ajax [5], MySQL [6], android [7] and Google
Cloud Platform [11] (for web service) would be used to develop this system.
There are many aspects which forced me to select this problem. In Sri Lanka,
nowadays travelling in a bus has been a difficult task for the passengers. Personally, I
have faced to all the problems which I have mentioned above. And there are many
changes in modern world. In this generation, IT has been using its power through all
the areas. So when we look into travelling, in Sri Lanka we have to improve our
technology resources. Technology and system design makes work easy and effective;
therefore web based online bus booking and tracking system saves time. Time is the
1
most precious thing for the people nowadays. So the enthusiasm motivated me to do
this project.
Aim
The aim of this project is to achieve a standard web based online bus booking and
tracking system which will be a great solution with many benefits to bus booking
centers and passengers. This system will be implemented with the use of technologies
like HTML, CSS, Ajax, jQuery, MySQL and android.
Objectives
2
• Reinforce a variety of skills including concentration, problem solving
effort, creativity to fulfill the vision.
• Evaluation of the web based system.
• Preparation of final documentation.
1.4 Web based Online Bus Booking and Tracking System for bus booking
centers
In my project, the proposed solution would be the Web based online bus
booking and tracking system for bus booking centers in order to eliminate the
limitations of the existing manual system. The proposed solution, Web based online
bus booking and tracking system designed for bus booking centers, to cover a wide
range of bus transportation administration and management processes. It is an
integrated end-to-end system that provides relevant information across the Sri Lanka
Transportation Board to support effective transportation making for passengers, bus
booking centers, administrations and profit increment, in a seamless flow. Web based
online bus booking and tracking system provides the benefits of streamlining of
operations, enhanced administration and control, improved response time, easily
accessible for passengers, cost control and improved profitability. Mainly, the
technologies such as PHP, HTML, CSS, Ajax, jQuery, MySQL, android and Google
Cloud Platform [11] (for web service) will be used in developing the solution.
The proposed solution will develop using MVC technology [8]. It will use
Ajax, HTML cascading style sheets. The system will use mysql database as the
database management system. The system is platform independent. When
implementing the solution, I will split my system into few modules such as Web
client Module, Mobile client Module, Web server Module and its sub module as Web
services Module and Database Module.
There are mainly four categories of users. The users are such as
Administrator, System Operator, Conductor, and Booker. Administrator, System
Operator has permit access the database. But there are two kinds of employees in
System Operator. We will see more description about those users in further chapters.
Conductors will View Passenger details, send message to passenger. And Booker
have to enter there details and select the appropriate seats and confirm there tickets.
As the output they would get a confirmation message.
3
Web based online bus booking and tracking system endorses to finalize their
profit and other relevant reports such as number of passengers monthly. Another
facility that system provides is they could reserve there tickets 24 hours of the day.
Passenger can book the ticket at anytime without going to the bus booking center. The
system administrator will handle the whole system access and maintenance.
Information about the employees and viewing report is managed by the system
administrator.
Rest of this final report consists of several chapters including current issues in
manual bus booking system, technology adapted for the solution, the approach for the
solution analysis and design for the system, implementation of the solution, and
finally there will be a discussion on the evaluation of the system. The Chapter 2
describes reports on a critical literature review and defines the problem addressed in
the project. Chapter 3 is a survey on technology used for similar problems with an
emphasis on technology to be used in this project. Chapter 4 is about the approach
which describes the users, inputs, outputs, process, technology and overall features of
the proposed solution and Chapter 5 demonstrates the overall design of the system
including the logical diagrams such as, top level design, ER Diagram, Data Flow
Diagram, Use case, Class and Swim lanes etc. During the Chapter 6 of this report it
will present the software, hardware, code segments, screen shots that are being used
for implementing the solution. Finally, Chapter 7 provides a discussion on the further
work.
4
Chapter 2 – Current issues in Bus Booking System
2.1 Introduction
This chapter gives a full description about background information of the
project. Based on a literature survey, here it is state about other’s approaches to solve
similar problems, bus booking system. The chapter illustrates drawbacks of other
alternative solutions also.
Some private centers use this kind of solutions. For example implement a
solution through communication system to reserve seats. In this kind of a system all
users have to have to make a phone call to book their tickets. So in this kind of way
they do other works manually. They do have more than one connection to contact but
it is very difficult to get the line, because phone connection is not like online
connection. Multi users cannot access the system simultaneously. And there is no
proper interconnection among the employees. The employees do not have a proper
system therefore information sharing is not consisted. And due to manual work, the
reliability is in a poor level. After booking the ticket if they have to stand until buses
come, then they do not have a satisfying connection with system at anytime of the day
to get the information about the bus. It does not have data security and integrity.
All the customers should use the phone connection therefore nowadays it’s an
easy way to access. So it is easily accessible but less in security. System is in a
manual way thus data transferring is not a problem. Security problems during data
transferring do not apply in this approach. As well as it has low reliability, data access
does not depend on the network solutions. Therefore the database reliability depends
only on the current manual system.
Although this solution has very few advantages it is not feasible enough for
the client’s requirements due to the following reasons:-
5
From the system, I expect to provide facility to reserve the tickets in your own
and you can book your tickets whenever you want, and customers can follow the
location of the bus through tracking system. So it is incompatible with the
Telephone-system. And it is high reliable cause to web based, online and tracking
system. Web base online bus booking and tracking system means all processes in
center which are done by manually should do via the system. Among various users,
some of the information should be shared between them. Hence standalone system is
not applicable for this requirement.
Bus booking service is to reserve the books earlier to confirm our seats at the
time of journey. If there are many passengers, one related person could reserve all
there tickets earlier. So bus booking is very useful to make sure of the journey and
feel comfort, and also time saving. Sri Lanka Transport Board Company is one of the
leading Transport service in Sri Lanka. It provides various traveling methods. SLTB
is currently having a manual system to store the details of buses, employee, and daily
income. All the processes such as employees’ attendance, customer details entering,
daily transactions, and reports are done manually. Therefore it takes much time, more
paper work and employees.
When it comes to bus booking, SLTB has a center in every district all over
the country. In Colombo, the passengers should come to the main center in Pettah to
reserve the tickets. Colombo is the capital of our country, and there will be many
booking throughout the day. So it is not only a waste of time and money for
passengers, it is also a disadvantage to SLTB. And when they have to get into the bus
they should come to the main stand. Because they can’t pickup everyone at there
bus stands due to lack of information. Passengers can’t get into the bus at there
nearest bus halt because they can’t stand there until bus comes. When they have to get
information about time of the bus arrival, information about empty seats and bus
route, it is not more efficient. They should contact with the center and get
information; sometimes the passengers are dissatisfied.
So all these kind of process are done manually. Therefore it is both waste of
time and money for passengers. And also manual bus booking is less in facilities in
6
modern world. Hence manual processing system is not applicable for this
requirement.
2.3 The Benefits of Web Based Online Bus Booking and Tracking System
The web based system keeps all the details computerized such as bus details,
passengers’ details and process them electronically, to implement the manual system
as web based online bus booking system. There is no need to keep all the records in
paper work. It handles whole things in a proper way so it is capable of easy accessing.
And it is easy to keep backups.
The information about the bus, employees, bus route, and passengers will be
managed by administrator. The user can log into online system and book there
tickets. Payment, transaction activities also will be managed by administrator. Users
will get an email or message when you had completed your booking and payment. In
web based system it provides facility such as passengers can get details from the web
based online system, therefore no need to contact the center. The system creates the
payment bills of the passenger. Web based system provides facility such as
passengers can get details from the web based online system, therefore no need to
contact the center. Another capability that can provide by the system is to
communicate between department and bus. The system creates the connections
between the centers so if they want administrators can share there common details.
Web based system endorse to finalize their profit and other relevant reports such as
number of passengers monthly, etc.
Another facility that the system provides is to book tour buses using the
system. Passengers can book the bus without going to the center.
7
• Profit increment – Due to Web based online bus booking and tracking
system users would have a certain facilities in travelling, so there will be
unimaginable increase in profit.
• No single failure location- Data is stored in multiple locations so it would be
more disaster resistive to administer.
• Highly deployable-Due to the manageability and cross platform support
deploying web applications to the end user is far easier. They are also ideal
where bandwidth is limited and the system and data is remote to the user.
• Secured activities-Typically in larger more complex systems data is stored
and moved around separate systems and data sources. In Web based online
bus booking system these details and payment will be secured and
guaranteed with an email /message which is sent by the system to your
specific email address/telephone no.
Hence web based system is most applicable for this requirement.
2.4 Comparison between Manual vs. Web based online bus booking system
8
7. Portability Data ,reports are not Data, reports are portable
easily portable due to web based online
system
Table 2.1: Comparison between Manual vs. Web based online bus booking system
2.5 Summary
This chapter gave a full description about background information about the
project.
9
Chapter 3 – Web Based Bus Booking System beyond
Manual Booking System
3.1 Introduction
This chapter will discuss about the technology that can be adapted to solve the
problem. The reasons for selecting such technologies will also be discussed. This is a
project where we adapt technology to solve problems in manual system and design
web based online and tracking system. Hence, selecting appropriate technologies
would be important in order to facilitate the intended requirements successfully.
When the clients send a request from web page in his machine, it would be
carried to the server, and it is done by HTTPS protocol. HTTPS protocol is being used
because of its high security. When we do transaction through online, secure is very
important.
The MySQL [6] is one of the most used open source databases best and the
most-used database in the world for online applications.
Continuously improved while remaining fast, secure and reliable
Free from bugs, and it has GUI interface therefore easy to access.
10
Elegantly support with the coding language for this project (PHP)
PHP is a popular general-purpose scripting language that is especially
suited for web development.
CSS provide the ability to change the appearance of text (such as fonts, colors,
spacing) on Web pages.
In manual system it takes more paper work and more employees to do all the
process. And it takes much time to get the work done. Cost more than web based
system. With the use of such technologies web based system helps to do bus booking
more efficient, attractive interface, easy procedures, quick access, less paper work and
high secured. These are the reasons why I am using those technologies to develop the
system.
Apache Server
Purpose:- The order to execute the client site of Online Bus Booking System, the
web server specified above is required as the provider of the client software at the
server site.
11
PHP
Purpose: In the order to build web pages which work with MySQL database and
Apache server.
Macromedia Dreamweaver
Purpose: The web development tool specified above is required for designing and
coding the project.
MySQL
Definition of the Interface: MySQL is the world’s most popular open source
database software. With superior speed, reliability, and ease of use, MySQL has
become the preferred choice of corporate IT Managers because it eliminates the major
problems associated with downtime, maintenance, administration and support.
3.3 Summary
This chapter discussed about the technology that can be adapted for this project and
how/why those technologies are appropriate to solve the problem. PHP, jQuery, Ajax
language has been selected for coding the application; MYSQL Server has been
selected as the Database.
12
Chapter 4 - Using Web Based Online Bus Booking
and Tracking System for Built SLTB Extraordinary
4.1 Introduction
This section will talk about the technology that is used in this project, users
that are involve, what are the inputs , what are the out puts and process which are
going to involve in this development. And this is about how we have assimilated the
technology to solve the said problems in SLTB. By changing manual system to Web
Based Online Bus Booking and Tracking System will increase the efficiency,
accuracy and performance of the SLTB.
This system will be referred to as (OBBTS) Web Based Online Bus Booking
and Tracking System in the future.
4.2 Users
The people who are interacted with the system can be defined as users. In this system,
four types of users can be identified based on their access roles. They are namely
Administrator, System Operator, Conductor and Booker.
Administrator
• Enter all bus details, user details, ticket price and etc.
Conductor
• Select destination and seat , enter passenger info, pay money and etc
Booker (Manual)
• Select destination and seat , enter passenger info, pay money and etc
13
4.3 Inputs
There are many aspects which differentiate from other bus booking system. It
is such as Bus Entry Point. In other booking system they do not have facilities to get
into the bus at their nearest bus halt. But (OBBTS) have designed to overcome all
those draw backs. They do have an option (Bus Entry Point) as input to select there
nearest bus halt.
4.4 Outputs
Available Bus, Available Seat.
Receiving confirmation SMS, Print Ticket.
Bus Location.
Admin Report, etc.
4.5 Process
4.6 Technology
For web based online and tracking system we have used the technologies such
as PHP [1], HTML, CSS, Ajax, jQuery [4], MySQL, MVC, android [7] and Google
Cloud Platform [11] for web service in developing the solution. All those
technologies used to design the system and achieve the vision of this system.
14
4.7 Features
There are many features such as
4.8 Summary
In this chapter described the approach for the proposed system. This chapter
also discussed the technology, users, inputs, output, process and over all features for
this system. The next chapter will discuss the analysis and design of the proposed
system .It is one of the most important chapters in this report.
15
Chapter 5 – Analysis and Design of OBBTS
5.1 Introduction
Since, the project should gather, analyze and review the requirements to
ensure that it meets the stated and implied needs of the SLTB, it is vital to have
documented designs for understanding the system for development and further
maintenance. Requirements shall form the basis for planning and development of
subsequent work products. Every find out derived in this phase will be documented
for the use of successful development of OBBTS and its maintenance.
5.2 Top Level Architecture of Web Based online bus booking and tracking
System
In Top Level Architecture of OBBTS (shown in Figure 5.1) have mainly four
modules. As figurer 5.1 displays they are Web client Module, Database Module,
Mobile client Module, Web server Module and its sub module as Web services
Module.
16
5.3 Use Case Diagram
Use case diagram shows the interaction between the user roles (actors) with
the system. In this system actor such as Admin, System Operator, Booker, and
Conductor interact with the system. The use case diagram for online bus booking
system is shown in (Figure 5.2).
17
Figure 5.2- Use case diagram for Online Bus Booking and Tracking System
18
5.4 Class Diagram
19
Figure 5.3 - Class diagram for Online Bus Booking Tracking System
20
5.5 Module Decomposition
21
Module 1-Database module
In this module it handles whole database which are related to this (OBBTS).
The information which has to store, are concerned in this module. This interacts with
other module, Booking Module. To create this module supposed to use MySql. This
module will be used by users such as administrator, system operators.
Because all processes which are done by this system may have taken/stored
their information in Database module such as information of buses, destinations,
employees, customers’ details and payment details
22
Figure 5.4- Entity Relationship diagram for database module
23
Module 2- System Operation Module
In this module it updates daily bus details such as bus routes, bus class, time
schedules, ticket price, bus entry points and other important information. And it has
access to create new users, drop users, etc.
The Swim lanes for System Operation are cited in “Appendix A”.
The Swim lanes for Booking Seat are cited in “Appendix C”.
The Swim lanes for Tracking Bus are cited in “Appendix D”.
24
5.6 Summary
This chapter included the overall analysis and design part of the project. As such, it
included several UML diagrams such as Use case diagram, Swim lanes and class
diagram etc. The top level architecture shows the included modules of this system.
Next Chapter will discuss about the implementation of the project thereby stepping to
the developing stage of this project.
25
Chapter 6 - Implementation of Web Based online bus
booking and tracking System
6.1 Introduction
In this chapter it is providing execution details of each module that is stated in the
design diagram. In describing the implementation, it states about, software, hardware,
and some pseudo code, code segments in modules in the design. Also the chapter
describes why those software and hardware are choosing for the solution.
26
6.3 Implementation of Web Based online bus booking and tracking System
Within this module it concerns about whole database which are related to Web
Based online bus booking and tracking System. The information which has to store,
are concerned in this module. The database is being implemented with MySQL
Graphical User Interface (use “phpMyAdmin” web tool) create all tables.
The Some screen shot of the Create Database are cited in “Appendix E”.
Begin
Display Screen (Main Bus Page)
//Add Bus Data
IF click “Add” Button
Display Screen (Enter Bus Form)
//Input
Input busNumber and Bus data from Text Fields
IF click “Save” Button
IF required fields are empty
27
Display Message "Field is Empty"
ELSE
Read all Bus Data
//Open DB
Open Database
Insert all data to Bus Master Table
IF insert is Success
Display Message “Successful Save”
ELSE
Display Message “Not Save”
END IF
//Close DB
Close Database
END IF
END IF
//Update Bus Data
IF click “Update” Button
//Input
Enter busNumber
IF click “Edit” Button
IF Field is Empty
Display Message "Fields is Empty"
ELSE
//Get the input Data
Read busNumber
//Open DB
Open Database
Get Bus Details to Bus Master Table
//Process
While (NOT End of Record)
Read Data
Fill Fields
END While
28
//Output
Output Display Bus Details on Fields
Input New Data
IF click “Update” Button
IF required fields are empty
Display Message "Field is Empty"
ELSE
Read all Bus Data
Update all data to Bus Master Table
IF Update is Success
Display Message “Successful Update”
ELSE
Display Message “Not Update”
END IF
END IF
END IF
//Close DB
Close Database
END IF
END IF
END IF
End
29
Enter and Edit Conductor Details
Begin
Display Screen (Main Page)
//Add Conductor Data
IF click “Add” Button
Display Screen (Enter conductor Form)
//Input
Input conductorNo, conductorName, mobile, busNo data
IF click “Save” Button
IF required fields are empty
Display Message "Field is Empty"
ELSE
Read all conductor Data
//Open DB
Open Database
Insert all data to conductor Master Table
IF insert is Success
Display Message “Successful Save”
ELSE
Display Message “Not Save”
END IF
//Close DB
Close Database
END IF
END IF
//Update conductor Data
IF click “Update” Button
//Input
Enter conductorNumber
IF click “Edit” Button
IF Field is Empty
Display Message "Fields is Empty"
30
ELSE
//Get the input Data
Read conductorNumber
//Open DB
Open Database
Get coductor Details to conductor Master Table
//Process
While (NOT End of Record)
Read Data
Fill Fields
END While
//Output
Output Display conductor Details on Fields
Input New Data
IF click “Update” Button
IF required fields are empty
Display Message "Field is Empty"
ELSE
Read all Bus Data
Update all data to conductor Master Table
IF Update is Success
Display Message “Successful Update”
ELSE
Display Message “Not Update”
END IF
END IF
END IF
//Close DB
Close Database
END IF
END IF
END IF
End
31
Enter and Edit Entry Point Details
Begin
Display Screen (Main Page)
//Add entry point Data
IF click “Add” Button
Display Screen (Enter conductor Form)
//Input
Input entryPointNo, entryPointName
IF click “Save” Button
IF required fields are empty
Display Message "Field is Empty"
ELSE
Read all entry Point Data
//Open DB
Open Database
Insert all data to entryPoint Master Table
IF insert is Success
Display Message “Successful Save”
ELSE
Display Message “Not Save”
END IF
//Close DB
Close Database
END IF
END IF
//Update entry Point Data
IF click “Update” Button
//Input
Enter entryPointNumber
IF click “Edit” Button
IF Field is Empty
Display Message "Fields is Empty"
32
ELSE
//Get the input Data
Read entryPointNumber
//Open DB
Open Database
Get entry Point Details to entryPoint Master Table
//Process
While (NOT End of Record)
Read Data
Fill Fields
END While
//Output
Output Display conductor Details on Fields
Input New Data
IF click “Update” Button
IF required fields are empty
Display Message "Field is Empty"
ELSE
Read all Bus Data
Update all data to entryPoint Master Table
IF Update is Success
Display Message “Successful Update”
ELSE
Display Message “Not Update”
END IF
END IF
END IF
//Close DB
Close Database
END IF
END IF
END IF
End
33
Enter and Edit New Route Details
Begin
Display Screen (Main Page)
//Add route Data
IF click “Add” Button
Display Screen (Enter route Form)
//Input
Input routeNo, routeFrom, routeTo, pirce
IF click “Save” Button
IF required fields are empty
Display Message "Field is Empty"
ELSE
Read all route Data
//Open DB
Open Database
Insert all data to route Master Table
IF insert is Success
Display Message “Successful Save”
ELSE
Display Message “Not Save”
END IF
//Close DB
Close Database
END IF
END IF
//Update route Data
IF click “Update” Button
//Input
Enter routeNumber
IF click “Edit” Button
IF Field is Empty
Display Message "Fields is Empty"
34
ELSE
//Get the input Data
Read routeNumber
//Open DB
Open Database
Get route Details to route Master Table
//Process
While (NOT End of Record)
Read Data
Fill Fields
END While
//Output
Output Display route Details on Fields
Input New Data
IF click “Update” Button
IF required fields are empty
Display Message "Field is Empty"
ELSE
Read all Bus Data
Update all data to route Master Table
IF Update is Success
Display Message “Successful Update”
ELSE
Display Message “Not Update”
END IF
END IF
END IF
//Close DB
Close Database
END IF
END IF
END IF
End
35
Enter and Edit System User Details
Begin
Display Screen (Main Page)
//Add System User Data
IF click “Add” Button
Display Screen (Enter route Form)
//Input
Input userName, emNo, emName, emMobileNo, passwaord, privilege
IF click “Save” Button
IF required fields are empty
Display Message "Field is Empty"
ELSE
Read all route Data
//Open DB
Open Database
Insert all data to systemUser Master Table
IF insert is Success
Display Message “Successful Save”
ELSE
Display Message “Not Save”
END IF
//Close DB
Close Database
END IF
END IF
//Update System User Data
IF click “Update” Button
//Input
Enter username
IF click “Edit” Button
IF Field is Empty
Display Message "Fields is Empty"
36
ELSE
//Get the input Data
Read userName
//Open DB
Open Database
Get system user Details to systemuser Master Table
//Process
While (NOT End of Record)
Read Data
Fill Fields
END While
//Output
Output Display system user Details on Fields
Input New Data
IF click “Update” Button
IF required fields are empty
Display Message "Field is Empty"
ELSE
Read all Bus Data
Update all data to systemuser Master Table
IF Update is Success
Display Message “Successful Update”
ELSE
Display Message “Not Update”
END IF
END IF
END IF
//Close DB
Close Database
END IF
END IF
END IF
End
37
Module 3 - Administration Module
Administrator controls the access level, view daily reports and manages the
system. Administration module does all these implementation using following details.
The pseudo code for Administration is show below.
Begin
Display Screen (Main Bus Page)
//Create System User
IF click “Create System User” Tab
Display Screen (Create System User Form)
//Input
Input userName, password, userType from Text Fields
IF click “Save” Button
IF required fields are empty
Display Message "Field is Empty"
ELSE
Read all Bus Data
//Open DB
Open Database
Insert all data to Bus Master Table
IF insert is Success
Display Message “Successful Save”
ELSE
Display Message “Not Save”
END IF
//Close DB
Close Database
END IF
END IF
38
//Update System User
IF click “Update” Button
//Input
Enter username
IF click “Edit” Button
IF Field is Empty
Display Message "Fields is Empty"
ELSE
//Get the input Data
Read userName
//Open DB
Open Database
Get Sytem User Details to Login Master Table
//Process
While (NOT End of Record)
Read Data
Fill Fields
END While
//Output
Output Display Bus Details on Fields
Input New password
IF click “Update” Button
IF required fields are empty
Display Message "Field is Empty"
ELSE
Read all Data
Update all data to Login Master Table
IF Update is Success
Display Message “Successful Update”
ELSE
Display Message “Not Update”
END IF
END IF
39
END IF
//Close DB
Close Database
END IF
END IF
END IF
End
Booking Report
Begin
Display Screen (Report Page)
//Input
Enter bookingDate, bookingType
IF click “Report” Button
IF Field is Empty
Display Message "Fields is Empty"
ELSE
//Get the input Data
Read bookingDate, bookingType
//Open DB
Open Database
Get Booking Details
//Process
Analysis Data
While (NOT End of Record)
Read Data
Fill row in table
END While
//Output
Output Display Booking Report
//Close DB
40
Close Database
END IF
END IF
End
Begin
Display Screen (Search Bus Page)
//Input
Enter journeyForm, journeyTo, journeyDate
IF click “Search” Button
IF Field is Empty
Display Message "Fields is Empty"
ELSE
//Get the input Data
Read journeyForm, journeyTo, journeyDate
//Open DB
Open Database
Get Available Bus Details
//Process
41
While (NOT End of Record)
Read Data
Fill row in table
END While
//Output
Output Display all Available Bus Details on the table
//Close DB
Close Database
END IF
END IF
End
Begin
Display Screen (Booking Seat Page)
Select Seat
IF Select Seat
Holed Bus Seat
//Output
Selection Seat, Time for expire seat
IF (NOT expired cookie)
//Input
Booking Data (passengerName, gender, booker NIC, mobileNo)
IF Field is Empty
Display Message "Fields is Empty"
ELSE
IF (NOT expired cookie)
//Input
Enter Payment Data
IF (Valid Payment)
42
Conform Booking
//Open DB
Open Database
Update Data
//Output
Print Ticket
ELSE
Reject Booking
END IF
ELSE
//Output
Display Message “Time is expired”
END IF
END IF
ELSE
//Output
Display Message “Time is expired”
END IF
END IF
End
43
Track Bus Location
Begin
Display Screen (Main App Window)
On “GPS” Button
IF check GPS on
Get Latitude & longitude
END IF
On “Send Latitude & longitude” Button
IF check “GPS” AND “Latitude & longitude” Button
//Open DB
Open Database
Update Latitude & longitude data to Table
END IF
End
Begin
Display Screen (Map)
//Input
busNumber
IF click “Show Location” Button
IF required fields are empty
Display Message "Field is Empty"
ELSE
Read busNumber
//Open DB
Open Database
Search Latitude & longitude form Table
//Output
44
Show Bus location on Map
END IF
END IF
End
Login Page is shown in “Figure 6.1.1” and codes are cited in “Appendix F”.
45
Display all Busses Page is shown in “Figure 6.1.2” and codes are cited in
“Appendix G”.
Enter New Bus Page is shown in “Figure 6.1.3” and codes are cited in
“Appendix H”.
46
Edit Bus Page is shown in “Figure 6.1.4” and codes are cited in “Appendix I”.
47
Bus Journey is shown in “Figure 6.1.6”.
48
Conductor Information is shown in “Figure 6.1.8”.
49
Figure 6.2.2 - Screen shot of Report
50
Module 4 – Booking Module
Available Bus page is shown in “Figure 6.3.1” and codes are cited in
“Appendix L”.
Available Seat page is shown in “Figure 6.3.2” and codes are cited in
“Appendix M”.
51
Print Ticket is shown in “Figure 6.3.3” and codes are cited in “Appendix N”.
Pay Payment
52
Show Bus Location
Android Login Interface is shown in “Figure 6.4.1” and codes are cited in
“Appendix O”.
53
Tracking Interface is shown in “Figure 6.4.2” and codes are cited in
“Appendix P”.
54
Booked Seat Interface is shown in “Figure 6.4.3”
6.4 Summary
This chapter state about, software, hardware, algorithms, pseudo codes, code
segments for each module in the design and it shows the relation between design and
implementing process.
55
Chapter 7 - System Testing and Evaluation
7.1 Introduction
In this chapter, testing of individual modules, integrated system testing and the
observations are discussed. Also, in the first phase of the project, several objectives
were set for the purpose of evaluation of final system. Therefore, this chapter is also
devoted for examining the achievement of those objectives with respect to the
evaluation criteria and outcomes.
Login Interface
Test
Description Expected Results Status
ID
Click Login Button without Display Message “All
1 enter “Use name” and required Filed” Ok
“Password”
Enter User Name Show User Name on text filed
2 Ok
as character.
Enter Password Show Password on text filed as
3 Ok
“******”
Enter incorrect “User name” Redirect Login Interface and
4 and “Password” and Click display Message “Invalid Use Ok
Login Button Name Or Password.”
Enter correct “User name” Log into the Main Page.
5 and “Password” and Click Ok
Login Button
Table 7.2.1 Test case for Login Interface
56
Add New Bus Interface
Test
Description Expected Results Status
ID
Click Submit Button Display Message “All
1 Ok
without enter Bus Data required Filed”
Enter Bus Data with Privies Display Message “This Bus
2 Ok
“Bus No” and Click Button Already exist”
Enter Bus Data with Redirect Add New Bus
3 difference “Bus No” and Interface and Display Message Ok
Click Button “Add Data Successful”
Table 7.2.2 Test case for Add New Bus Interface
Test
Description Expected Results Status
ID
Click Edit Button Go to Update Bus Page and
1 Show Bus Data in Filed Ok
relevant Bus No
Change Bus Data and Click Redirect Update Bus Interface
2 Submit Button and Display Message “Update Ok
Data Successful”
Table 7.2.3 Test case for Update Bus Data Interface
57
Change Password Interface
Test
Description Expected Results Status
ID
Click Login Button without Display Message “All
1 Ok
enter Data required Filed”
Enter “Current Password” Show Current Password on text
2 Ok
filed as “******”
Enter “New Password” Show New Password on text
3 Ok
filed as “******”
Enter “Conform New Show Conform New Password
4 Ok
Password” on text filed as “******”
Enter “Current Password” Display Message “New
and “New Password” and Password and Conform
5 Ok
enter incorrect “Conform Password Not Match.”
New Password”
Enter Incorrect “Current Display Message “Enter
Password” and “New Correct Current Password”
6 Ok
Password” and enter correct
“Conform Password”
Enter correct “Current Redirect Change Password
Password” and “New Interface and Display Message
7 Ok
Password” and enter correct “Password Change Successful”
“Conform Password”
Table 7.2.4 Test case for Change Password Interface
58
Administration Module
Test
Description Expected Results Status
ID
Click Booking Report Display Booking Report as a
1 Ok
PDF document
Click Booker Info Report Display Booker Info Report as
2 Ok
a PDF document
Click Passenger Info Report Display Passenger Info Report
3 Ok
as a PDF document
Booking Module
Test
Description Expected Results Status
ID
Click corresponding blue Changer Blue color as Green
1 color(available seat) Seat color (selecting seat). Ok
59
Click available seat and Selecting seat and after 10
4 Ok
wait 10 minutes. minutes deselect it.
Tracking Module
Test
Description Expected Results Status
ID
Enter Bus No and click Show Tracking Interface and
Submit Button Display Message “Update:
1 Longitude: 79.24242424 Ok
Latitude:6.92424242” and
Update database
Click Runing Button Display Message “Bus is
2 Ok
Runing” and Update database
Click Waiting Button Display Message “Bus is
3 Ok
Waiting” and Update database
Click Breakdown Button Display Message “Bus is
4 Breakdown” and Update Ok
database
Click Stop Button Display Message “Bus is Stop”
5 Ok
and Update database
60
7.3 Test Data and Test results
Some of the actual data which was selected by random was used for testing
purpose. Mainly users, who are having different roles with different capabilities have
added and tested with the expected results. The administrator of the system must be
preset as only one administrator allowed.
7.5 Summary
61
Chapter 8 - Conclusion & Further work
7.1 Introduction
This is the final chapter of this thesis which examines the achievements of the
overall project objectives with respect to the initial scope. Also the problems
encountered when carrying out the project (OBBTS) and the solutions found are
discussed. Thereafter, current system limitations are explained along with possible
further enhancements.
7.2 - Conclusion
Initial scope of the project is described by the objectives set at early stages,
which are listed in Aim & Objectives of this Project of Chapter 1 (Section 1.3).
According to feedback received from testers that, the initial project scope is almost
achieved by the end of final documentation. All functionality has been implemented
with proper testing. This suggests that 99% of the whole system has been achieved.
The system is under perfect working condition which can be made available for the
production with fewer enhancements
Time was a crucial factor to manage. It was a challenge to study a new subject in
the context of bus booking system, gather the required skills, and utilize new
62
technology and implement such a system within the short span of time. After creating
the system we have done system validation and verification process. However, almost
all the requirements are gathered and analyzed, the design of the system is completely
understood and thinking to implement a quality solution that goes beyond the
expectations of the current issues of this system.
The facility which does not included in this system is ticketing cancellation. In
some other web based systems, they have provided an option to cancel the ticket.
According to their company rules and regulations they will return the money. But here
I have not included the cancellation facility. In future it may be included with the
permission of SLTB. And OBBTS would be the exact way when SMS and payment
gateway is purchased. The most important thing to finish is developing the Mobile
App. It would make a revolution in online bus booking system.
63
References
Web References:
64
Appendix A - Swim lanes for System Operation
Enter Bus Details
65
Edit Bus Details
66
Enter New Conductor Details
67
Edit Conductor Details
68
Allocate Conductor for Bus
69
Update Tickets Price
70
Enter System User
71
Edit System User
72
Enter New Entry Point
73
Edit Entry Point
74
Appendix B - Swim lanes for Admin Operation
Create System User Login
75
Edit System Use Login
76
Manual Booking Report
77
Online Booking Report
78
Daly Booking Report
79
Appendix C- Swim lanes for Booking Bus Seat
Search Available Bus
80
Booking Bus Seat
81
Appendix D - Swim lanes for Bus Tracking System
82
Show Bus Location on Map
83
Appendix E - Screen shot of the Database
sltb_booking Database
84
Data Dictionary
85
86
87
88
89
90
Appendix F - Codes for Login Page
<html>
<head>
<body>
<h1>Login Page</h1>
<form action="http://localhost/SLTB/login/loginToSystem" method="post
" id="log" class="has-validation-callback">
<label>User Name</label>
<input type="text" name="userName" data-validation="required"/>
<br/>
<label>Password</label>
<input type="password" name="password" data-validation="required"/>
<br/>
<label/>
<input type="submit" name="" id="" value="Login"/>
</form>
<div id="footer">
</div>
</body>
</html>
body {
background:silver;
font-family:'Times New Roman';
font-size:14px;
}
form label {
91
display:block;
float:left;
font-size:15px;
margin-bottom:5px;
margin-top:5px;
width:100px;
}
<?php
92
$data = $sth->fetch();
$count = $sth->rowCount();
if ($count > 0) {
Session::init();
Session::set('privilege', $data['privilege']);
Session::set('loggedIn', true);
Session::set('userName', $data['userName']);
if ($data['privilege'] == 'Booker')
header('location: ../index');
else
header('location: ../systemUser');
} else {
header('location: ../login/index/User Name or Password is invalid .!');
}
}
}
?>
93
Appendix G - Codes for Display all Busses Page
<div class="main-button">
<button class="btn"><a href="<?php echo URL; ?>bus"><img class="table-
button"/></a></button>
<button class="btn"><a href="<?php echo URL; ?>bus/create"><img class="add-
button"/></a></button>
</div>
<div class="">
<div id="bodyhead"><h1>All Buss</h1></div>
<?php
$url = explode('/', $_GET['url']);
if (isset($url[2])) {
echo '<P class="magNo"> ' . $url[2] . '</p>';
}
?>
<div id="tSize">
<div class="demo_jui">
<table cellpadding="0" cellspacing="0" border="0" class="display"
id="example">
<thead>
<tr>
<th>Bus No</th>
<th>Bus Model</th>
<th>Number Of Seat</th>
<th>Departure Time</th>
<th>Arrival Time</th>
<th></th>
<th></th>
</tr>
94
</thead>
<tfoot>
<tr>
<th>Bus No</th>
<th>Bus Model</th>
<th>Number Of Seat</th>
<th>Departure Time</th>
<th>Arrival Time</th>
<th></th>
<th></th>
</tr>
</tfoot>
<tbody>
<?php
foreach ($this->searchAllBus as $key => $value) {
echo '<tr>';
echo '<td>' . $value['busNo'] . '</td>';
echo '<td>' . $value['busModel'] . '</td>';
echo '<td>' . $value['numberOfSeat'] . '</td>';
echo '<td>' . $value['departureTime'] . '</td>';
echo '<td>' . $value['arrivalTime'] . '</td>';
echo '<td><a href="' . URL . 'bus/addJourneytoBus/' . $value['busNo'] .
'">J. No</a></td>';
echo '<td>
<a href="' . URL . 'bus/updateFromTable/' . $value['busNo'] .
'"><img class="table-edit-button" alt="Update"/></a>
<a href="' . URL . 'bus/deleteBus/' . $value['busNo'] . '"><img
class="table-delete-button" alt="Delete"/></a>
</td>';
echo '</tr>';
}
?>
</tbody>
</table>
95
</div>
<div class="spacer"></div>
</div>
</div>
96
Appendix H - Codes for Enter Bus Page
The HTML and PHP code for add new bus Interface
<div class="main-button">
<button class="btn"><a href="<?php echo URL; ?>bus"><img class="table-
button"/></a></button>
<button class="btn"><a href="<?php echo URL; ?>bus/create"><img class="add-
button"/></a></button>
</div>
<div class="main-form">
<h1>Add New Bus</h1>
<?php
$url = explode('/', $_GET['url']);
if (isset($url[2])) {
if ($url[2] == 'Success')
echo '<P class="magOk"> Data Add Successful .... ! </p>';
if ($url[2] == 'Fail')
echo '<P class="magNo"> Data Add Fail error is ' . $url[3] . '</p>';
}
?>
<form id="bus_create_form" action="<?php echo URL; ?>bus/createBus/"
method="post">
<label for="Bus_busNo" class="required">Bus No</label>
<input size="10" maxlength="10" name="cBus_busNo" id="Bus_busNo"
type="text" data-validation="length" data-validation-length="max6"><br />
97
<input size="10" name="cBus_numberOfSeat" id="Bus_numberOfSeat"
type="text" data-validation="number" data-validation-
allowing="range[40;49]"><br />
<label ></label>
<input type="submit" name="addNewBus" id="addNewBus" value="Add
Data">
</form>
</div>
98
class Database extends PDO {
public function __construct($DB_TYPE, $DB_HOST, $DB_NAME, $DB_USER,
$DB_PASS) {
parent::__construct($DB_TYPE . ':host=' . $DB_HOST . ';dbname=' .
$DB_NAME, $DB_USER, $DB_PASS);
$this->setAttribute(PDO::ATTR_ERRMODE,
PDO::ERRMODE_EXCEPTION);
}
public function traInsert($arrayData) {
$this->beginTransaction();
try {
foreach ($arrayData as $key => $value) {
$table = $value['table'];
$data = $value['data'];
ksort($data);
$fieldNames = implode('`, `', array_keys($data));
$fieldValues = ':' . implode(', :', array_keys($data));
$sth = $this->prepare("INSERT INTO $table (`$fieldNames`) VALUES
($fieldValues)");
foreach ($data as $key => $value) {
$sth->bindValue(":$key", $value);
} $val = $sth->execute();
}
$this->commit();
return $val;
} catch (Exception $e) {
$this->rollBack();
return $e->getMessage();
}
}
}
99
Appendix I - Code for Update Bus Page
<div class="main-button">
<button class="btn"><a href="<?php echo URL; ?>bus"><img class="table-
button"/></a></button>
<button class="btn"><a href="<?php echo URL; ?>bus/create"><img class="add-
button"/></a></button>
</div>
<div class="main-form">
<h1>Edit Bus</h1>
<?php
$url = explode('/', $_GET['url']);
if (isset($url[2])) {
if ($url[2] == 'Success')
echo '<P class="magOk"> Data Edit Successful .... ! </p>';
if ($url[2] == 'Fail')
echo '<P class="magNo"> Data Edit Fail error is ' . $url[3] . '</p>';
}
?>
<form id="bus_update_form" action="<?php echo URL; ?>bus/updateBus/"
method="post">
<label for="Bus_busNo" class="required">Bus No</label>
<input size="10" maxlength="10" name="uBus_busNo" value="<?php
if (isset($this->bus[0]['busNo'])) {
echo $this->bus[0]['busNo'];
}
?>" id="uBus_busNo" type="text" data-validation="required" ><br />
100
<input size="15" maxlength="15" name="uBus_busModel" value="<?php if
(isset($this- >bus[0]['busModel'])) echo $this->bus[0]['busModel']; ?>"
id="uBus_busModel" type="text" data-validation="required"><br />
<label for="Bus_numberOfSeat" class="required">Number Of Seat</label>
<input size="10" name="uBus_numberOfSeat" value="<?php if (isset($this-
>bus[0]['numberOfSeat'])) echo $this->bus[0]['numberOfSeat']; ?>"
id="uBus_numberOfSeat" type="text" data-validation="number" data-validation-
allowing="range[40;49]"><br />
<label for="Bus_departureTime" class="required">Departure Time</label>
<input size="10" name="uBus_departureTime" value="<?php if (isset($this-
>bus[0]['departureTime'])) echo $this->bus[0]['departureTime']; ?>"
value="00:00 AM" id="uBus_departureTime" type="text" data-
validation="required"><br />
<label for="Bus_arrivalTime" class="required">Arrival Time</label>
<input size="10"name="uBus_arrivalTime" value="<?php if (isset($this-
>bus[0]['arrivalTime'])) echo $this->bus[0]['arrivalTime']; ?>" value="12:00 PM"
id="uBus_arrivalTime" type="text" data-validation="required"><br />
<label ></label>
<input type="submit" name="updateNewBus" id="updateNewBus" value="Save
Data
</form>
</div>
101
'busNo' => $data['uBus_busNo'],
'date' => date("Y-m-d"),
'sql' => 'U'
);
return $this->db->update_and_insert('bus', $postData_update, "`busNo` =
'{$data['uBus_busNo']}'",'assign_bus', $postData_insert);
}
103
Appendix J - Codes for Changer Password
<div class="main-form">
<h1>Change Password</h1>
<?php
$url = explode('/', $_GET['url']);
if (isset($url[2])) {
if ($url[2] == 'Success')
echo '<P class="magOk"> Password Change Successful .... ! </p>';
if ($url[2] == 'Fail')
echo '<P class="magNo"> Password Change Fail error is ' . $url[3] . '</p>';
}
?>
<form id="update_password_form" action="<?php echo URL;
?>systemUser/updatePassword/" method="post">
<label class="changer_p" for="currentPassword">Current password</label>
<input size="15" maxlength="15" name="currentPassword"
id="currentPassword" type="password" value="" data-validation="required"><br
/>
<label for="newPassword" class="changer_p">New password</label>
<input size="15" name="newPassword" id="newPassword" type="password"
value="" data-validation="required"><br />
<label for="confirmPassword" class="changer_p">Confirm new
Password</label>
<input size="15" name="confirmPassword" id="confirmPassword"
type="password" value="" ddata-validation="required" ><br />
<label class="changer_p"></label>
<input type="submit" name="updatePassword" id="updatePassword"
value="Save Data">
</form>
</div>
104
The PHP code for Change Password
105
}
$fieldDetails = rtrim($fieldDetails, ',');
$sth = $this->prepare("UPDATE $table SET $fieldDetails WHERE $where");
foreach ($data as $key => $value) {
$sth->bindValue(":$key", $value);
} $val = $sth->execute();
$this->commit();
return $val;
} catch (Exception $e) {
$this->rollBack();
return $e->getMessage();
}
}
106
Appendix K - Codes for Report Page
<div class="main">
<h3>Booking Report</h3><br/>
<form id="" target="_blank" action="<?php echo URL; ?>report/bookingData/"
method="post">
<label for="" class="repot_date_la">Date From</label>
<input size="10" name="date_from" id="" class="datepicker_repot" data-
validation="required" value="<?php echo date("Y-m-d"); ?>"><br/>
<label for="" class="repot_date_la">Date To</label>
<input size="10" name="date_to" id="" class="datepicker_repot" data-
validation="required" value="<?php echo date("Y-m-d"); ?>"><br/>
<label for="busNo" class="required">Bus Number</label>
<select name="busNo" data-validation="required">
<option value="AB">All Bus</option>
<?php
foreach ($this->searchAllBus as $key => $value) {
echo '<option value="' . $value['busNo'] . '" > ' . $value['busNo'] .
'</option>';
}
?>
</select><br/>
<label for="journeyNo" class="required">Journey No</label>
<select name="journeyNo" data-validation="required">
<option value="AJ">All Journey</option>
<?php
foreach ($this->searchAllJourney as $key => $value) {
echo '<option value="' . $value['journeyNo'] . '" > ' . $value['journeyNo'] .
'</option>';
}
?>
</select><br/>
107
<label ></label>
<input type="submit" name="" id="" value="View Report">
</form>
</div>
<div class="reportConducter1">
<h3>Booker Info Report</h3><br/>
<form id="bus_create_form" target="_blank" action="<?php echo URL;
?>report/bookerReport/" method="post">
<label for="" class="repot_date_la">Journey Date</label>
<input size="10" name="journeyDate" id="" class="datepicker_repot" data-
validation="required" value="<?php echo date("Y-m-d"); ?>"><br/>
<label for="busNo" class="required">Bus Number</label>
<select name="busNo" data-validation="required">
<option ></option>
<?php
foreach ($this->searchAllBus as $key => $value) {
echo '<option value="' . $value['busNo'] . '" > ' . $value['busNo'] .
'</option>';
}
?>
</select><br/>
<label ></label>
<input type="submit" name="" id="" value="View Report">
</form>
</div>
<div class="reportConducter2">
<h3>Passenger Info Report</h3><br/>
<form id="bus_create_form" target="_blank" action="<?php echo URL;
?>report/passengerReport/" method="post">
<label for="" class="repot_date_la">Journey Date</label>
<input size="10" name="journeyDate" id="" class="datepicker_repot" data-
validation="required" value="<?php echo date("Y-m-d"); ?>"><br/>
108
<label for="busNo" class="required">Bus Number</label>
<select name="busNo" data-validation="required">
<option ></option>
<?php
foreach ($this->searchAllBus as $key => $value) {
echo '<option value="' . $value['busNo'] . '" > ' . $value['busNo'] .
'</option>';
}
?>
</select><br/>
<label ></label>
<input type="submit" name="" id="" value="View Report">
</form>
</div>
109
return $this->db->select('SELECT
booking.bookingID,
booking.bookerNICNo,
(SELECT bookerName FROM booker WHERE bookerNICNo
= booking.bookerNICNo) AS bookerName,
(SELECT entryPoint FROM entry_point WHERE
entryPointNo = booking.entryPointNo) AS entryPointNo,
booking.no_of_seat,
booking.ammount,
(SELECT bookerMNo FROM booker WHERE bookerNICNo
= booking.bookerNICNo) AS bookerMNo
FROM booking
WHERE booking.busNo ="' . $busNo . '" AND booking.date
="' . $journeyDate . '" AND booking.payment_status ="Ok" ' );
}
function view_report($main_tabale,$reportName,$size) {
110
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '',
PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP,
PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
require_once(dirname(__FILE__) . '/lang/eng.php');
$pdf->setLanguageArray($l);
}
// set font
$pdf->SetFont('times', '', 10);
$pdf->AddPage($size, 'A4');
// output the HTML content
$pdf->writeHTML($main_tabale, true, false, true, false, '');
$pdf->Output($reportName.'.pdf', 'I');
111
Appendix L - Codes for Available Bus page
<div>
<div id="bodyhead"><h1>Available Buss</h1></div>
<form id="" action="<?php echo URL; ?>booker/booking/" method="post">
<div id="tSize">
<div class="demo_jui">
<?php if(($this->bookDate) != null){?>
<input type="hidden" name="book_date" id="book_date" value="<?php
echo $this->bookDate ?>"/>
<input type="hidden" name="book_journeyNo" id="book_journeyNo"
value="<?php if(($this->journeyNo) != null){echo $this-
>journeyNo[0]['journeyNo'];} ?>"/>
<input type="hidden" name="book_busNo" id="book_busNo" value=""/>
<input type="hidden" name="book_numberOfSeat"
id="book_numberOfSeat" value=""/>
<input type="hidden" name="book_price" id="book_price" value=""/>
<?php }?>
<table cellpadding="0" cellspacing="0" border="0" class="display"
id="exampleBooker">
<thead>
<tr>
<th>Bus No</th>
<th>No. of Seat</th>
<th>Route No</th>
<th>Dep. Time</th>
<th>Arr. Time</th>
<th>Entry Point</th>
<th>Price</th>
<th></th>
</tr>
</thead>
112
<tbody>
<?php
if (isset($this->availablelBus)) {
foreach ($this->availablelBus as $key => $value1) {
echo '<tr class="busData">';
echo '<td>' . $value1['busNo'] . '</td>';
echo '<td>' . $value1['numberOfSeat'] . '</td>';
echo '<td>' . $value1['routeNo'] . '</td>';
echo '<td>' . $value1['departureTime'] . '</td>';
echo '<td>' . $value1['arrivalTime'] . '</td>';
echo '<td><select>';
echo '<option>Entry Point</option>';
foreach ($value1['entry_Point'] as $key => $value2) {
echo '<option>' . $value2['entryPoint'] . '</option>';
}
echo '</select></td>';
echo '<td>' . $value1['price'] . '</td>';
echo '<td><input type="submit" name="bookNow" value="Book
Now"></td>';
echo '</tr>';
}
}
?>
</tbody>
</table>
</div>
<div class="spacer"></div>
</div>
</form>
</div>
113
The PHP code for Available Buses
$arrayData = array();
$arrayDataEntry = array();
$i=0;
if (isset($availablelBus)) {
foreach ($availablelBus as $key => $value) {
$arrayData[$i]['busNo'] = $value['busNo'];
$arrayData[$i]['routeNo'] = $value['routeNo'];
$arrayData[$i]['departureTime'] = $value['departureTime'];
$arrayData[$i]['arrivalTime'] = $value['arrivalTime'];
$arrayData[$i]['numberOfSeat'] = $value['numberOfSeat'];
$arrayData[$i]['price'] = $value['price'];
$entryPoint = $this->db->select('SELECT
entry_point.entryPoint
114
FROM entry_point
JOIN entrypoint_for_journey ON entry_point.entryPointNo =
entrypoint_for_journey.entryPointNo
WHERE journeyNo = "'.$value['journeyNo'].'" ');
$j=0;
if (isset($entryPoint)) {
foreach ($entryPoint as $key => $value2) {
$arrayDataEntry[$j]['entryPoint']=$value2['entryPoint'];
$j++;
}
}
$arrayData[$i]['entry_Point']=$arrayDataEntry;
$i++;
}
return $arrayData;
}
}
115
Appendix M - Codes for Available Seat
<div id="area">
<div id="print" style="text-align:center; color: #d14"></div>
<div id="holder">
<ul id="place">
<?php
Session::init();
$this->busBooker = new Booker_Model();
$busNo = $this->seatDara['busNo'];
$noOfSeat = $this->seatDara['noOfSeat'];
$bus_book_date = $this->seatDara['bus_book_date'];
$journeyNo = $this->seatDara['journeyNo'];
$bookSeat = array();
$bookStatus = array();
$selecting_s = array();
if (isset($this->seatDara['seatNo']))
$selecting_s = $this->seatDara['seatNo'];
if (isset($this->seatDara['session']))
if (($this->seatDara['session']) == 1)
if ((Session::get('sessionforSelectin_s')) == true)
$selecting_s = Session::get('sessionforSelectin_s');
/* call searchAvailableSeat funtion get Available Seat bookStatus */
$seat = $this->busBooker->xhrSearchAvailableSeat($busNo, $bus_book_date,
$journeyNo);
116
/* call displayBusSeat funtion display Bus Seat on web page */
displayBusSeat($noOfSeat, $bookSeat, $bookStatus, $selecting_s);
118
echo '<li class="' . $className . '" seatno="' . $seatNo . '"
style="top:' . ($j * $seatHeight) . 'px; left:' . ($i * $seatWidth) .
'px"><a title="' . $seatNo . '"> ' . $seatNo . ' </a></li>';
}
}
}
}
?>
</ul>
</div>
</div>
$(function(){
setSeat();
119
$('#viweSeat').html(o);
startRefresh();
}
});
}
function getselectingSeat(handleData) {
var seatNo =[];
$.each($('#place li.selectingSeat '), function (index, value) {
items = $(this).attr('seatNo');
seatNo.push(items);
});
handleData(seatNo);
}
function startRefresh() {
getselectingSeat(function(seatNo){
var busNo=document.getElementById("seat_book_busNo").value;
var bus_book_date= document.getElementById("seat_book_date").value;
var journeyNo= document.getElementById("seat_book_journeyNo").value;
var noOfSeat= document.getElementById("seat_book_numberOfSeat").value;
$.ajax({
type:'POST',
url:'/SLTB/booker/viewBusSeat',
data:{
busNo:busNo,
noOfSeat:noOfSeat,
journeyNo:journeyNo,
bus_book_date:bus_book_date,
seatNo:seatNo
},
success:function(o){ //alert(1);
$('#viweSeat').html(o);
}
120
});
});
setTimeout(startRefresh,1000);
}
});
$(function(){
cliarPrint();
sessionforSelectin_s();
function cliarPrint() {
$('#print').html('');
}
function sessionforSelectin_s() {
$.ajax({
type:'POST',
url:'/SLTB/booker/xhrgetSessionforSelectin_s',
data:{
},
dataType:'json',
beforeSend:function(o){
},
success:function(o){
document.getElementById("selecting_seate_for_booker").value = o;
},
error : function(XMLHttpRequest, textStatus, errorThrown){
}
});
$.ajax({
type:'POST',
url:'/SLTB/booker/xhrgetSessionforSelectin_s_tot',
data:{
},
dataType:'json',
121
beforeSend:function(o){
},
success:function(o){
if(o != null)
document.getElementById("total_price_for_selecting_seate").value = o;
},
error : function(XMLHttpRequest, textStatus, errorThrown){
}
});
}
** …………………………function for session Time Out ………………….…… *
sessionTimeOut();
function sessionTimeOut() {
timer = setTimeout(sessionTimeOut,1000);
$.ajax({
type:'POST',
url:'/SLTB/booker/xhrSessionTimeOut',
dataType:'json',
beforeSend:function(o){
},
success:function(o){
if(o.length > 0){
clearAllSeateformDB(o);
$('.timeOut').html('');
clearTimeout(timer);
$("#passenger_info").remove();
$("#booker_info").remove();
document.getElementById("total_price_for_selecting_seate").value = 0;
document.getElementById("selecting_seate_for_booker").value = "";
$.each($('#place li.selectingSeat '), function (index, value) {
$(this).removeClass('selectingSeat');
});
}else{
$.each($('#place li.selectingSeat '), function (index, value) {
122
if(($(this).hasClass('selectingSeat')))
$('.timeOut').html('Your Reservation Expires in ['+parseInt(o)+'] (s)');
});
}
},
error : function(XMLHttpRequest, textStatus, errorThrown){
clearTimeout(timer);
}
});
}
**…………………click on the seat ………………………………………………*
$(".seat").live('click',function(){
if ($(this).hasClass('selectedSeat')){
$('#print').html('This seat is already reserved ...');
}
** ………. function set Session for all Increment Selecting Seat ……………….. *
function setIncrementSessionforSelectin_s(seatNo) {
var price = document.getElementById("seat_book_price").value;
var tot_price =
document.getElementById("total_price_for_selecting_seate").value;
tot_price = parseInt(tot_price) + parseInt(price);
$.ajax({
type:'POST',
url:'/SLTB/booker/xhrIncrementSessionforSelectin_s',
data:{
seatNo:seatNo,
tot_price:tot_price
},
dataType:'json',
124
beforeSend:function(o){
},
success:function(o){
document.getElementById("selecting_seate_for_booker").value = o;
document.getElementById("total_price_for_selecting_seate").value =
tot_price;
},
error : function(XMLHttpRequest, textStatus, errorThrown){
}
});
}
function setSessionforTime() {
$.ajax({
type:'POST',
url:'/SLTB/booker/xhrsetSession',
beforeSend:function(o){
},
success:function(o){
sessionTimeOut();
},
127
error : function(XMLHttpRequest, textStatus, errorThrown){
}
});
}
function clearAllSeateformDB(allSeatNo) {
var seatNo = allSeatNo;
var status = 'P';
var busNo=document.getElementById("seat_book_busNo").value;
var bus_book_date= document.getElementById("seat_book_date").value;
var journeyNo= document.getElementById("seat_book_journeyNo").value;
$.ajax({
type:'POST',
url:'/SLTB/booker/xhrClearAllSeate',
data:{
seatNo:seatNo,
busNo:busNo,
journeyNo:journeyNo,
bus_book_date:bus_book_date,
status:status
},
dataType:'json',
beforeSend:function(o){
},
success:function(o){
},
error : function(XMLHttpRequest, textStatus, errorThrown){
}
});
}
128
Appendix N - Codes for Print Ticket
<?php
echo '<h1>Print Tikect</h1>';
129
}
}
echo '</div>';
echo '</div>';
echo '<div class="printBookinbtn"><input type="button" name=""
id="printBookinbtn" value="Print"></div>';
echo '<div id="bus_ticket_area_main">';
echo '<h3>Bus Tikect</h3>';
echo '<div id="bus_ticket_sub_area">';
echo '<link href="http://localhost/SLTB/public/css/booker/ticket.css"
rel="stylesheet"></link>';
if(isset($this->busTicket)){
foreach ($this->busTicket as $key => $value) {
echo '<div id="bus_ticket_area">';
echo '<label class="b_ticket_la">Ticket No : </label><label
class="">'.$value['ticketNo'].'</label><br/>';
echo '<label class="b_ticket_la"></label><label class="">From -
'.$value['journeyFrom'] .'</label>';
echo '<label class="b_ticket_la"></label><label class=""> To -
'.$value['journeyTo'].'</label><br/>';
echo '<label class="b_ticket_la">Seat No : </label><label
class="">'.$value['seatNo'].'</label>';
echo '<label class="">'.' , '.' Gender : </label><label
class="">'.$value['gender'].'</label><br/>';
echo '<label class="b_ticket_la">Date : </label><label
class="">'.$value['date'].'</label><br/>';
echo '<label class="b_ticket_la">Booking ID : </label><label
class="">'.$value['bookingID'].'</label><br/><br/>';
echo '</div>';
}
}
echo '</div>';
echo '</div>';
130
echo '<div class="printbusTicketsbtn"><label></label><input type="button" name=""
id="printbusTicketsbtn" value="Print"></div>';
?>
131
(SELECT journeyFrom FROM journey WHERE journeyNo =
booking.journeyNo) AS journeyFrom,
(SELECT journeyTo FROM journey WHERE journeyNo =
booking.journeyNo) AS journeyTo,
booking.date
FROM receive_ticke
JOIN booking ON receive_ticke.bookingID = booking.bookingID
WHERE receive_ticke.bookingID ="' . $val . '"');
$('#printbusTicketsbtn').live('click',function(){
var prtContent = document.getElementById("bus_ticket_sub_area");
var WinPrint = window.open('', '',
'letf=0,top=0,width=500,height=500,toolbar=0,scrollbars=0,status=0');
WinPrint.document.write(prtContent.innerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
});
132
Appendix O - Codes for Android Login Interface
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.sltbtrackingsystem.MainActivity"
tools:ignore="MergeRootFrame" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="22dp"
android:text="@string/bus_tracking_system"
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/button1"
android:layout_alignTop="@+id/textView2"
android:layout_marginLeft="25dp"
android:layout_toRightOf="@+id/textView2"
android:ems="10"
android:inputType="text" >
<requestFocus />
</EditText>
133
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/textView1"
android:layout_marginLeft="20dp"
android:layout_marginTop="70dp"
android:text="@string/user_name"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView2"
android:layout_below="@+id/editText1"
android:layout_marginTop="24dp"
android:text="@string/password"
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:id="@+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/textView3"
android:layout_alignBottom="@+id/textView3"
android:layout_alignLeft="@+id/editText1"
android:layout_alignRight="@+id/button1"
android:ems="10"
android:inputType="textPassword" >
</EditText>
134
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@+id/editText2"
android:layout_marginRight="15dp"
android:layout_marginTop="25dp"
android:text="@string/login" />
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/textView3"
android:layout_toRightOf="@+id/textView3"/>
</RelativeLayout>
package com.sltbtrackingsystem;
import java.util.ArrayList;
import java.util.List;
import com.parse.FindCallback;
import com.parse.Parse;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import android.support.v7.app.ActionBarActivity;
135
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import android.os.Build;
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new
PlaceholderFragment()).commit();
}
Parse.initialize(this,"w6sOkx6IXZPloTIkWcdbfX3RxKrrPJZmWPIGHeYk",
"3avqsVGqNOLwIQQMst9PMxlIArOfwzkYB6Ls9t1u");
136
ParseQuery<ParseObject> query = ParseQuery.getQuery("Tracking_Data
query.findInBackground(new FindCallback<ParseObject>()
@Override
public void done(List<ParseObject> objs, ParseException e) {
ArrayList<String> items=new ArrayList<String>();
if (e == null) {
for(ParseObject obj:objs){
items.add(obj.getString("bus_number"));
}
} else {
Toast.makeText(getBaseContext(),e.getMessage() ,
Toast.LENGTH_LONG).show();
}
Spinner spinnertech = (Spinner)
findViewById(R.id.planets_spinner);
ArrayAdapter<String> adapter = new
ArrayAdapter<String>(getBaseContext(),android.R.layout.simple_spinner_ite
m,items);
spinnertech.setAdapter(adapter);
}
});
onSubmit();
}
@Override
public void onClick(View arg0) {
137
Intent intent = new
Intent(MainActivity.this,TrackingActivity.class);
intent.putExtra("busNumber",
(String)spinnertechObj.getSelectedItem());
MainActivity.this.startActivity(intent);
}
});
}
138
Appendix P - Codes for Tracking Interface
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/textView5"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:gravity="center"
android:text="@string/tracking_system"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_marginTop="20dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:gravity="center"
139
android:text="@string/bus_number"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_marginTop="-50dp"
android:layout_marginLeft="190dp"
android:layout_marginRight="10dp"
android:gravity="center"
android:text="@string/bno"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_marginTop="0dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:gravity="center"
android:text="@string/journey_number"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_marginTop="-50dp"
android:layout_marginLeft="190dp"
android:layout_marginRight="10dp"
android:gravity="center"
android:text="@string/jno"
android:textAppearance="?android:attr/textAppearanceLarge" />
<Button
140
android:id="@+id/button2"
android:layout_width="120dp"
android:layout_height="50dp"
android:layout_marginTop="20dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:gravity="center"
android:text="@string/runing" />
<Button
android:id="@+id/button6"
android:layout_width="120dp"
android:layout_height="50dp"
android:layout_marginLeft="190dp"
android:layout_marginRight="10dp"
android:layout_marginTop="-50dp"
android:gravity="center"
android:text="@string/waiting" />
<Button
android:id="@+id/button4"
android:layout_width="120dp"
android:layout_height="50dp"
android:layout_marginTop="20dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:gravity="center"
android:text="@string/breakdown" />
<Button
android:id="@+id/button5"
android:layout_width="120dp"
android:layout_height="50dp"
android:layout_marginLeft="190dp"
android:layout_marginRight="10dp"
141
android:layout_marginTop="-50dp"
android:gravity="center"
android:text="@string/stop" />
<ProgressBar
android:id="@+id/progressBar2"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="125dp"
android:layout_marginRight="10dp"
android:layout_marginTop="0dp"
android:layout_marginBottom="0dp"
android:gravity="center"/>
<Button
android:id="@+id/button1"
android:layout_width="120dp"
android:layout_height="50dp"
android:layout_marginLeft="190dp"
android:layout_marginRight="10dp"
android:layout_marginTop="20dp"
android:layout_marginBottom="50dp"
android:gravity="center"
android:text="@string/exit" />
<TextView
android:id="@+id/textView4"
android:layout_width="300dp"
android:layout_height="50dp"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:gravity="center"
android:text="@string/booked_seat"
142
android:textAppearance="?android:attr/textAppearanceLarge" />
<DatePicker
android:id="@+id/datePicker1"
android:layout_width="300dp"
android:layout_height="120dp"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:gravity="center" />
<Button
android:id="@+id/button3"
android:layout_width="120dp"
android:layout_height="50dp"
android:layout_marginLeft="190dp"
android:layout_marginRight="10dp"
android:layout_marginTop="0dp"
android:layout_marginBottom="50dp"
android:gravity="center"
android:text="@string/view_seat" />
</LinearLayout>
</ScrollView>
package com.sltbtrackingsystem;
import java.util.List;
import com.parse.FindCallback;
import com.parse.Parse;
import com.parse.ParseException;
143
import com.parse.ParseObject;
import com.parse.ParseQuery;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
locationManager = (LocationManager)
getSystemService(Context.LOCATION_SERVICE
144
locationManager.requestLocationUpdates(LocationManager.G
PS_PROVIDER,15000,0, this);
Parse.initialize(this,"w6sOkx6IXZPloTIkWcdbfX3RxKrrPJZ
mWPIGHeYk","3avqsVGqNOLwIQQMst9PMxlIArOfwzkYB
6Ls9t1u
onRuningClick();
onWaitingClick();
onBreakdownClick();
onStopClick();
onExitClick();
@Override
public void onClick(View v) {
ParseQuery<ParseObject> query =
ParseQuery.getQuery("Tracking_Data");
query.whereEqualTo("bus_number",busNumber);
query.findInBackground(new
FindCallback<ParseObject>() {
@Override
public void
done(List<ParseObject> objs,
ParseException e) {
if (e == null) {
if(objs.size()==0){
}else{
for(ParseObject obj:objs){
145
obj.put("status", "R");
obj.saveInBackground();
Toast.makeText(getBaseContext(
),"Bus is
Runing",Toast.LENGTH_LONG)
.show();
}
}
else {
}
}
});
}
});
}
@Override
public void onClick(View v) {
ParseQuery<ParseObject> query =
ParseQuery.getQuery("Tracking_Data");
query.whereEqualTo("bus_number",busNumber);
query.findInBackground(new
FindCallback<ParseObject>() {
@Override
public void done(List<ParseObject>
objs, ParseException e) {
if (e == null) {
if(objs.size()==0){
}else{
obj.put("status", "W");
146
obj.saveInBackground();
Toast.makeText(getBaseContext(),"Bus
is
Waiting",Toast.LENGTH_LONG).sho
w();
}
}
} else {
Toast.makeText(getBaseContext(),e.get
Message() ,
Toast.LENGTH_LONG).show();
}
}
}
});
}
});
}
@Override
public void onClick(View v) {
ParseQuery<ParseObject> query =
ParseQuery.getQuery("Tracking_Data");
query.whereEqualTo("bus_number",busNumber);
query.findInBackground(new
FindCallback<ParseObject>() {
@Override
public void done(List<ParseObject>
objs, ParseException e) {
147
if (e == null) {
if(objs.size()==0){
}else{
for(ParseObject obj:objs){
obj.put("status", "B");
obj.saveInBackground();
Toast.makeText(getBaseContext(),"Bus
is
Breakdown",Toast.LENGTH_LONG).sho
w();
}
}
} else {
Toast.makeText(getBaseContext(),e.getMessage
() , Toast.LENGTH_LONG).show();
}
}
});
}
});
}
148
public void done(List<ParseObject> objs,
ParseException e) {
if (e == null) {
if(objs.size()==0){
}else{
for(ParseObject obj:objs){
obj.put("status", "S");
obj.saveInBackground();
Toast.makeText(getBaseContext(),"Bus is
Stop",Toast.LENGTH_LONG).show();
}
}
} else {
Toast.makeText(getBaseContext(),e.getMessage() ,
Toast.LENGTH_LONG).show();
}
}
});
}
});
}
private void onExitClick(){
Button btnExit = (Button) findViewById(R.id.button1);
btnExit.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
finish();
System.exit(0);
}
});
}
@Override
public void onLocationChanged(final Location location) {
149
ParseQuery<ParseObject> query =
ParseQuery.getQuery("Tracking_Data");
query.whereEqualTo("bus_number",busNumber);
query.findInBackground(new FindCallback<ParseObject>() {
@Override
public void done(List<ParseObject> objs, ParseException e) {
String lon_lat = "Longitude:
"+location.getLongitude()+" Latitude:
"+location.getLatitude();
if (e == null) {
if(objs.size()==0){
}else{
for(ParseObject obj:objs){
obj.put("longitude", location.getLongitude());
obj.put("latitude", location.getLatitude());
obj.saveInBackground();
Toast.makeText(getBaseContext(),"Update:
"+lon_lat,Toast.LENGTH_LONG).show();
}
}
} else {
Toast.makeText(getBaseContext(),e.getMessage() ,
Toast.LENGTH_LONG).show();
}
}
});
}
}
150
Supervisor Approval
....................................... .……………………….
Student Signature Date
Comments of supervisor:
.............................................................................................................................................................................................
.............................................................................................................................................................................................
.............................................................................................................................................................................................
Name of supervisor: …………………………………………………………………………………………………...
……………………………… ………………………….
151