how to create a car booking system from scratch

83
PREPAID CAR BOOKING SYSTEM COLLEGE NAME: BATANAGAR INSTITUTE OF ENGINEERING,MANAGEMENT & SCIENCE GROUP MEMBERS: Arkamit Dutta Nilotpal Mukherjee Sandip Das Satyaki Guha Sidartha Dutta UNIVERSITY ROLL NO: 33200112006 33200112015 33200112022 33200112023 33200112026

Upload: satyaki

Post on 11-Jan-2016

237 views

Category:

Documents


0 download

DESCRIPTION

Stuck on a project on database? don't know oracle sql?do not worry.this guide will teach you o create a full project from scratch

TRANSCRIPT

Page 1: how to create a car booking system from scratch

PREPAID CAR

BOOKING SYSTEM

COLLEGE NAME: BATANAGAR INSTITUTE OF

ENGINEERING,MANAGEMENT & SCIENCE

GROUP MEMBERS: Arkamit Dutta

Nilotpal Mukherjee

Sandip Das

Satyaki Guha

Sidartha Dutta

UNIVERSITY ROLL NO:

33200112006

33200112015

33200112022

33200112023

33200112026

Page 2: how to create a car booking system from scratch

ACKNOWLEDGEMENT

We take upon this opportunity endowed upon us by the grace of the

almighty, to thank all those who have been part of this endeavor.

Firstly, we would like to thank GLOBSYN FINISHING SCHOOL for

giving us the opportunity as well as lending us the resources to fulfill our

work.

We would like to thank our mentor PROF. ARNAB CHAKRABORTY

for giving us the right direction to follow and proper guidance regarding

the topic. Without his active involvement and the right guidance this

would not have been possible .we sincerely thank him for giving us the

chance as well as the support for all the time being.

Last but not the least, we heartily appreciate all those people who have

helped us directly or indirectly in making these task a success.

Page 3: how to create a car booking system from scratch

INDEX

1.INTRODUCTION

1.1 Scope of work

2. REQUIREMENT SPECIFICATION

2.1 Domain description

2.2 Problem definition

2.3 Functional requirements

2.4 Hardware & Software requirements

3. DATABASE DESIGN

3.1 ER diagram

3.2 Table description

4. SCREEN SHOTS

5. FUTURE SCOPE OF IMPROVEMENTS

6. CODE

7. TEST CASES

Page 4: how to create a car booking system from scratch

This is a project work undertaken during SUMMER TRAINING at

GLOBSYN FINISHING SCHOOL. We have tried our best to make this

project which is PREPAID CAR BOOKING SYSTEM using ORACLE

10g and ORACLE DEVELOPER SUITE as simple as possible which

could help the administrators and operator to deal with Car Booking

System.Further expansion is possible without much effort.

This project consists of two types of users:

1. Operator(Car book for customer)

2. Administrator (Who are involved in the updation and

manipulation of the tables)

REQUIREMENT SPECIFICATION

DOMAIN DESCRIPTION

In the Car Booking System we are having two types of user

Operator and Administrator where Operator will book the car for customer

and also allocate driver to a paticular car .Administrator are involved in the

updatation and manipulation of the tables.

PROBLEM DEFINITION

Nowadays it is very difficult for a person to maintain records manually, so

in order to provide the multiplex with such a system that helps them

severely in maintaining the records of the multiplex transactions, we are

going with this project. The operations performed by this project are

maintenance of the information of the transactions that are performed by

the multiplex.

Data redundancy and inconsistency.

Difference in accessing data.

Data isolation.

Security problem

Page 5: how to create a car booking system from scratch

Communication gap

Updating problem

FUNCTIONAL REQUIREMENTS

The functions that the Prepaid Car Booking System provides

are as follows:-

Activities that only the administrator can perform are:-

Create a new account for operator.

Update Fare Chart Details.

View report about individual car income..

Adding a new driver with all relevant details.(for example-

driver_id,driver_name,address,age ....etc)

Adding new car with all relevant details.(for example-

car_id,car_name,eng........etc)

Adding new customer with all relevant details.(for example-

cus_id,cus_name,email,ph_no.......etc) (if required)

Deleting or Updating car details.

Booking car against customer with relevant driver.(if required).

Activities that only the Operator can perform are:-

Booking car against customer.

Allocate driver to a particular car.

Create new customer id against new customer.

Create new car id against new car.

Create new driver id against new driver.

View Fare Chart details.

Routine refresh database.

Page 6: how to create a car booking system from scratch

HARDWARE/ SOFTWARE REQUIREMENTS

oHARDWARE REQUIREMENTS:

MOTHERBOARD

PROCESSORS

RAM (64MB MINIMUM)

HARD DISK

MONITOR

KEYBOARD

MOUSE

PRINTER

oSOFTWARE REQUIREMENTS:

OPERATING SYSTEM :- WINDOWS XP/ WINDOWS

7/WINDOWS 8

PLATFORM :- ORACLE 10G EXPRESS EDITION

FILE SYSTEM :- ORACLE DEVELOPER SUITE

BROWSER :-MOZILLA FIREFOX 2.0.0.2, 3 or 3.5

SOFTWARE: ORACLE VIRTUAL BOX

MICROSOFT WORD

Page 7: how to create a car booking system from scratch

Fare_chart_details

Destination

Source

Distance

Driver_Details

Driver_id

Driver_Name

Driver_lic Address Age

Hiredate

Salary

Dph_num

Allocated

Car_Details

Car_id

Car_Eng

Car_type Car_Model

Availability

Driver_id

Booking_Details

Book_id

Cus_id Car_id

Jour_date

e

Source

Destination

Loc

Loc_Name

Located

Booking

Customer_Details

Cus_id Cus_Name

Address

Cph_num

Email

AVAIL

ABLE

Page 8: how to create a car booking system from scratch

Login_Details

User_Name

m

Password

Page 9: how to create a car booking system from scratch

TABLE DESCRIPTION

Car Details

Attribute Constraint Data Type

Car_id Primary Key Varchar2(20)

Car_eng Varchar2(20)

Car_type Varchar2(20)

Car_model Varchar2(20)

Availability Varchar2(10)

Driver_id Foreign Key Varchar2(20)

Customer Details

Attribute Constraint Data Type

Cus_id Primary Key Varchar2(20)

Cus_name Varchar2(20)

Address Varchar2(40)

Cph_num Varchar2(20)

email Varchar2(30)

Booking Details

Attribute Constraint Data Type

Book_id Primary Key Varchar2(20)

Cus_id Foreign Key Varchar2(20)

Car_id Foreign Key Varchar2(20)

Jour_date Date

Source Foreign Key Varchar2(20)

Destination Foreign Key Varchar2(20)

Page 10: how to create a car booking system from scratch

Fare Chart Details

Attribute Constraint Data Type

Source Primary Key Varchar2(20)

Destination Primary Key Varchar2(20)

Distance Number

Driver Details

Attribute Constraint Data Type

Driver_id Primary Key Varchar2(20)

Driver_name Varchar2(20)

Driver_lic Varchar2(20)

Address Varchar2(40)

Age Number

Hiredate Date

Salary Number

Dph_no Varchar2(20)

Login Details

Attribute Constraint Data Type

User_name Primary Key Varchar2(20)

Password Varchar2(20)

Loc Details

Attribute Constraint Data Type

Loc_name Primary Key Varchar2(20)

RATE

Attribute Constraint Data Type

Car_type Primary Key Varchar2(20)

Rate Number

Page 11: how to create a car booking system from scratch

SCREEN SHOTS

Login Page

Page 12: how to create a car booking system from scratch

Admin Home Page:

Page 13: how to create a car booking system from scratch

Add Route:

Page 14: how to create a car booking system from scratch

Car Master:

Page 15: how to create a car booking system from scratch

Check Fare:

Page 16: how to create a car booking system from scratch

Collection Car Wise:

Page 17: how to create a car booking system from scratch

Collection Day Wise:

Page 18: how to create a car booking system from scratch

Customer Master:

Page 19: how to create a car booking system from scratch

Delete Route:

Page 20: how to create a car booking system from scratch

Driver Details:

Page 21: how to create a car booking system from scratch

Long Car:

Page 22: how to create a car booking system from scratch

Medium Car:

Page 23: how to create a car booking system from scratch

Small Car:

Page 24: how to create a car booking system from scratch

Operator Home Page:

Page 25: how to create a car booking system from scratch

Return Car:

Page 26: how to create a car booking system from scratch

Update Fare Chart:

Page 27: how to create a car booking system from scratch

BOOKING DETAILS:

Page 28: how to create a car booking system from scratch

The booking form allows us to book cars to travel from one place to

another.

Booking can be of two types-

1)ADVANCED BOOKING

In this type of booking the customer can book a car in advance for a future

date.That particular car will not be available for booking to any other

customer for that particular day.

The initial status of the cars are as follows the availability of all cars is

'yes'.

Now suppose we make make the following advanced bookings for

a day say 8th july.

The availabilty of the booked cars are set to 'no' by the refresh button for

that particular day and they will not be available for instant booking on

that day 8 july.

Page 29: how to create a car booking system from scratch

Now on the next day after the refresh button is clicked the following

events will take place

i)The availability of the booked cars will be made yes.

ii)The booking details will be deleted from the booking_details table

as the table contains only current bookings.

iii)The deleted tuples from table booking_details will be added to the

journey tables for billing and recording of booking history.

The following picture illustrate this-

Adavanced booking will cost Rs500 extra on the normal fare.

2)Instant booking-

Instant booking can only be done for that particular date when a car is

booked by instant booking that car is allocated to the customer and its

availability is set to no.

Page 30: how to create a car booking system from scratch

Now it will be available for booking only after it is returned by the

customer.

After a car is returned the following events occur-

i)The availability of the car is set to yes.

ii) The booking _details of the car is deleted from the booking_table

and added to the journey table.

iii)The deleted tuple gets inserted in the journey table.

This is illustrated by yhe following pic-

Page 31: how to create a car booking system from scratch
Page 32: how to create a car booking system from scratch

FUTURE SCOPE OF

IMPROVEMENTS Log For car accident.

Comlain Box

Online Customer Account Creation

Online Booking Procedure

Car tracking Option

Hour Wise profit calculation.

Route Creation using via location.

Page 33: how to create a car booking system from scratch

CODING

TABLE CREATION CODE:

CAR DETAILS:

Drop table Car_Details;

create table Car_Details (

car_idvarchar2(20) primary key, --car's license number

car_engvarchar2(20),

car_typevarchar2(20),

car_modelvarchar2(20),

availability varchar2(10),

driver_idvarchar2(20) references Driver_Details(driver_id) unique

);

DRIVER DETAILS:

Drop table Driver_Details;

create table Driver_Details (

driver_idvarchar2(20) primary key,

driver_namevarchar2(20),

driver_licvarchar2(20),

address varchar2(40),

age number,

hiredate date,

salary number,

dph_numvarchar2(20)

check(length(dph_num)=10)

);

Page 34: how to create a car booking system from scratch

FARE CHART DETAILS:

drop table fare_chart_details;

create table fare_chart_details(

src varchar2(30) references loc(loc_name),

dest varchar2(30) references loc(loc_name),

distance number

);

LOC:

drop table loc;

create table loc(

loc_name varchar2(30) primary key

);

BOOKING DETAILS:

drop table Booking_Details;

create table Booking_Details (

book_idvarchar2(20) primary key,

cus_idvarchar2(20) references Customer_Details(cus_id),

car_idvarchar2(20) references Car_Details(car_id),

jour_date date,

cost number,

booking_typevarchar2(20),

source varchar2(20) references loc(loc_name),

destination varchar2(20) references loc(loc_name)

);

Page 35: how to create a car booking system from scratch

create sequence booking

start with 1

increment by 1;

CUTOMER DETAILS:

drop table Customer_Details;

create table Customer_Details (

cus_idvarchar2(20) primary key,

cus_namevarchar2(20),

address varchar2(40),

cph_nummvarchar2(20),

email varchar2(30),

check(length(cph_numm)=10),

check(email like '%@%')

);

create sequence cus

start with 1

increment by 1;

RATE:

drop table rate;

create table rate(

car_typevarchar2(20) primary key,

rate number

);

Page 36: how to create a car booking system from scratch

desc Car_Details;`

desc Driver_Details;

desc fare_chart_details;

desc loc;

descBooking_Details;

descCustomer_Details;

descrate;

Program Code:

LOGIN PAGE:

declare

my_username varchar2(20) :=:block7.ti1;

my_password varchar2(20) :=:block7.ti2;

choice_num integer;

rec_count integer;

begin

if(:block7.ti1 is null) or(:block7.ti2 is null) or (:block7.rg1 is

null) then

choice_num:=show_alert('blank');

end if;

if(:rg1=1) then

select count(*) into rec_count from

( select user_name,passwd from login_details where

user_name like 'op%')

where user_name=my_username and

passwd=my_password;

if(rec_count>0) then

open_form('\\VBOXSVR\xp_shared\Oracle

project\CUS_DT_INS_UPD.fmx',activate,no_session);

choice_num:=show_alert('login_success');

Page 37: how to create a car booking system from scratch

else

choice_num:=show_alert('login_unsuccess');

end if;

elsif(:rg1=2) then

select count(*) into rec_count from

( select user_name,passwd from login_details where

user_name like 'ad%')

where user_name=my_username and

passwd=my_password;

if(rec_count>0) then

open_form('\\VBOXSVR\xp_shared\Oracle

project\CUS_DT_INS_UPD.fmx',activate,no_session);

choice_num:=show_alert('login_success');

else

choice_num:=show_alert('login_unsuccess');

end if;

end if;

end;

Add Route:

declare

a number;

b number;

mysrc fare_chart_details.src%type:= :tx1;

mydest fare_chart_details.dest%type:= :tx2;

mydist fare_chart_details.distance%type:= :tx3;

begin

if :tx1 is null or :tx2 is null or :tx3 is null then

a:= show_alert('blank');

Page 38: how to create a car booking system from scratch

else

select count(*) into b

from fare_chart_details

where ((src=:tx1 and dest=:tx2) or (src=:tx2 and

dest=:tx1));

if (b<>0) then

a:= show_alert('existing');

else

select count(*) into b

from loc

where loc_name=mysrc;

if(b=0) then

insert into loc values(:tx1);

standard.commit;

end if;

select count(*) into b

from loc

where loc_name=mydest;

if(b=0) then

insert into loc values(:tx2);

standard.commit;

end if;

insert into fare_chart_details values(:tx1,:tx2,:tx3);

standard.commit;

a:= show_alert('success');

Page 39: how to create a car booking system from scratch

end if;

end if;

end;

Reset

:tx1:='';

:tx2:='';

:tx3:='';

go_item('tx1');

Exit

exit_form;

Booking:

Refresh:

declare

choice_num number;

begin

update car_details

set availability='yes'

where car_id in (

select car_id

from booking_details

where trunc(jour_date) < trunc(sysdate) and

booking_type='advanced');

standard.commit;

Page 40: how to create a car booking system from scratch

delete

from booking_details

where (trunc(jour_date) < trunc(sysdate) and

booking_type='advanced');

choice_num:=show_alert('Refresh_success');

end;

Refresh 2:

declare

choice_num number;

begin

update car_details

set availability='no'

where car_id in (

select car_id

from booking_details

where trunc(jour_date)=trunc(sysdate) and

booking_type='advanced');

standard.commit;

choice_num:=show_alert('Refresh_success');

end;

Book:

declare

myrownum number;

mycarid Car_details.car_id%type;

mycusid varchar2(20):=:block4.ti1;

Page 41: how to create a car booking system from scratch

mycartype varchar2(20):=:block4.li3;

mydate varchar2(20):=:block4.ti2;

mysrc varchar2(20):=:block4.li1;

mydes varchar2(20):=:block4.li2;

mydriverid varchar2(20);

mycount number;

mybookid number;

myac number:=:rg2;

fare number;

choice_num number;

no_cars_available exception;

date_instant exception;

date_advanced exception;

blank exception;

route_not_found exception;

b number;

begin

--mybookid:=booking.nextval;

if :rg1 is null or :ti1 is null or :rg2 is null or :li1 is null or :li2 is

null or :li3 is null or :ti2 is null then

raise blank;

end if;

select count(*) into b

from fare_chart_details

where ((src=:li1 and dest=:li2) or (src=:li2 and dest=:li1));

if (b=0) then

raise route_not_found;

end if;

fare:=fare_cal(:li1,:li2,:rg2,:li3);

Page 42: how to create a car booking system from scratch

if(:rg1=20) then

if (to_date(mydate,'DD-MON-YY')) =

(to_date(sysdate,'DD-MON-YY')) or (to_date(mydate,'DD-MON-

YY')) < (to_date(sysdate,'DD-MON-YY')) then

raise date_advanced;

end if;

message('advanced booking will cost Rs 500 extra');

message('advanced booking will cost Rs 500 extra');

fare:= fare + 500 ;

select count(car_id) into mycount

from Car_Details

where car_id in(select car_id

from car_details

where car_id not in (

select car_id

from booking_details

where (to_date(mydate,'DD-MON-

YY')) = jour_date )) and car_type=mycartype and driver_id is not

null and rownum=1;

if(mycount=0) then

raise no_cars_available;

else

select rownum,car_id,driver_id into

myrownum,mycarid,mydriverid

from Car_Details

where car_id in(select car_id

from car_details

where car_id not in (

select car_id

from booking_details

Page 43: how to create a car booking system from scratch

where (to_date(mydate,'DD-MON-

YY')) = jour_date )) and car_type=mycartype and driver_id is not

null and rownum=1;

insert into booking_details values

(booking.nextval,mycusid,mycarid,to_date(mydate,'DD-MON-

YY'),fare,'advanced',mysrc,mydes);

choice_num:=show_alert('Book_success');

standard.commit;

end if;

elsif(:rg1=10) then

if (to_date(mydate,'DD-MON-

YY'))<>(to_date(sysdate,'DD-MON-YY')) then

raise date_instant;

end if;

select count(*) into mycount

from car_details

where availability='yes' and car_type=mycartype;

if(mycount=0) then

raise no_cars_available;

else

select rownum,car_id,driver_id into

myrownum,mycarid,mydriverid

from car_details

where availability='yes' and car_type=mycartype and

rownum=1;

update car_details set availability='no' where

Page 44: how to create a car booking system from scratch

car_id=mycarid;

standard.commit;

insert into booking_details values

(booking.nextval,mycusid,mycarid,to_date(sysdate,'DD-MON-

YY'),fare,'instant',mysrc,mydes);

standard.commit;

choice_num:=show_alert('Book_instant');

end if;

end if;

:di2:=mycarid;

:di3:=mydriverid;

:di1:=mybookid;

:di4:=fare;

exception

when date_instant then

choice_num:= show_alert('date_instant');

when no_cars_available then

choice_num:= show_alert('no_cars_available');

when date_advanced then

choice_num:= show_alert('date_advanced');

when blank then

choice_num:= show_alert('blank');

when route_not_found then

choice_num:= show_alert('route_not_found');

end;

Exit:

exit_form;

Page 45: how to create a car booking system from scratch

Car :

Insert

declare

a number;

choice_num number;

blank_field exception;

begin

if :ti1 is null or :ti2 is null or :ti3 is null or :ti4 is null or :ti5

is null then

raise blank_field;

else

insert into car_details values (:ti1,:ti2,:ti3,:ti4,:ti5,:ti6);

standard.commit;

:global.reccount:=:global.reccount+1;

:global.currecno:=:global.reccount;

:di1:=:global.currecno||'/'||:global.reccount;

end if;

exception

when blank_field then

choice_num:=show_alert('blank_field');

end;

Update

declare

a number;

choice_num number;

enter_car exception;

begin

if :ti1 is null or :ti6 is null then

Page 46: how to create a car booking system from scratch

raise enter_car;

else

update car_details

set driver_id = :ti6

where car_id = :ti1;

standard.commit;

end if;

exception

when enter_car then

choice_num:=show_alert('enter_car');

end;

Delete

declare

a number;

choice_num number;

enter_car exception;

car_does_not_exist exception;

begin

if :ti1 is null or :ti2 is not null or :ti3 is not null or :ti4 is

not null or :ti5 is not null then

raise enter_car;

else

select count(*) into a

from car_details

where car_id=:ti1;

if(a=0) then

raise car_does_not_exist;

else

delete from car_details where car_id=:ti1;

Page 47: how to create a car booking system from scratch

standard.commit;

end if;

:global.reccount:=:global.reccount-1;

:global.currecno:=1;

:di1:=:global.currecno||'/'||:global.reccount;

end if;

exception

when enter_car then

choice_num:=show_alert('enter_car');

when car_does_not_exist then

choice_num:=show_alert('car_does_not_exist');

end;

Move First

declare

a number;

mycar_id Car_Details.car_id%type;

mycar_eng Car_Details.car_eng%type;

mycar_type Car_Details.car_type%type;

mycar_model Car_Details.car_model%type;

myavailability Car_Details.availability%type;

mydriver_id Car_Details.driver_id%type;

begin

select count(*) into a

from Car_Details;

if (a=0) then

:global.reccount:=0;

:global.currecno:=0;

Page 48: how to create a car booking system from scratch

message('I am in the then block...');

else

message('I am in the else block...');

:global.currecno:=1;

:global.reccount:=a;

:di1:=:global.currecno||'/'||:global.reccount;

select car_id, car_eng, car_type,

car_model, availability,driver_id into mycar_id, mycar_eng,

mycar_type, mycar_model,myavailability,mydriver_id

from

(

select rownum rn,car_id, car_eng,

car_type,car_model, availability, driver_id

from car_details

order by rownum

)

where rn=1;

:ti1:=mycar_id;

:ti2:=mycar_eng;

:ti3:=mycar_type;

:ti4:=mycar_model;

:ti5:=myavailability;

:ti6:=mydriver_id;

end if;

end;

Page 49: how to create a car booking system from scratch

Move Last

declare

a number;

mycar_id Car_Details.car_id%type;

mycar_eng Car_Details.car_eng%type;

mycar_type Car_Details.car_type%type;

mycar_model Car_Details.car_model%type;

myavailability Car_Details.availability%type;

mydriver_id Car_Details.driver_id%type;

begin

select count(*) into a

from Car_Details;

if (a=0) then

:global.reccount:=0;

:global.currecno:=0;

else

:global.reccount:=a;

:di1:=:global.reccount||'/'||:global.reccount;

select car_id, car_eng, car_type,

car_model, availability,driver_id into mycar_id, mycar_eng,

mycar_type, mycar_model,myavailability,mydriver_id

from

(

select rownum rn,car_id, car_eng,

car_type,car_model, availability, driver_id

from car_details

Page 50: how to create a car booking system from scratch

order by rownum

)

where rn=:global.reccount;

:ti1:=mycar_id;

:ti2:=mycar_eng;

:ti3:=mycar_type;

:ti4:=mycar_model;

:ti5:=myavailability;

:ti6:=mydriver_id;

:global.currecno:=:global.reccount;

end if;

end;

Move Previous

declare

a number;

mycar_id Car_Details.car_id%type;

mycar_eng Car_Details.car_eng%type;

mycar_type Car_Details.car_type%type;

mycar_model Car_Details.car_model%type;

myavailability Car_Details.availability%type;

mydriver_id Car_Details.driver_id%type;

no_more_data exception;

choice_num number;

begin

select count(*) into a

from Car_Details;

if (a=0) then

:global.reccount:=0;

:global.currecno:=0;

Page 51: how to create a car booking system from scratch

else

if (:global.currecno=1) then

raise no_more_data;

else

:global.currecno:=:global.currecno - 1;

select car_id, car_eng, car_type, car_model,

availability,driver_id into mycar_id, mycar_eng, mycar_type,

mycar_model, myavailability, mydriver_id

from

(

select rownum rn,car_id, car_eng,

car_type,car_model, availability, driver_id

from car_details

order by rownum

)

where rn=:global.currecno;

:ti1:=mycar_id;

:ti2:=mycar_eng;

:ti3:=mycar_type;

:ti4:=mycar_model;

:ti5:=myavailability;

:ti6:=mydriver_id;

:di1:=:global.currecno||'/'||:global.reccount;

end if;

end if;

exception

Page 52: how to create a car booking system from scratch

when no_more_data then

choice_num:=show_alert('no_more_data');

end;

Move Next

declare

a number;

mycar_id Car_Details.car_id%type;

mycar_eng Car_Details.car_eng%type;

mycar_type Car_Details.car_type%type;

mycar_model Car_Details.car_model%type;

myavailability Car_Details.availability%type;

mydriver_id Car_Details.driver_id%type;

no_more_data exception;

choice_num number;

begin

select count(*) into a

from Car_Details;

if (a=0) then

:global.reccount:=0;

:global.currecno:=0;

else

if (:global.currecno=:global.reccount) then

raise no_more_data;

else

:global.currecno:=:global.currecno + 1;

select car_id, car_eng, car_type, car_model,

availability,driver_id into mycar_id, mycar_eng, mycar_type,

Page 53: how to create a car booking system from scratch

mycar_model, myavailability, mydriver_id

from

(

select rownum rn,car_id, car_eng,

car_type,car_model, availability, driver_id

from car_details

order by rownum

)

where rn=:global.currecno;

:ti1:=mycar_id;

:ti2:=mycar_eng;

:ti3:=mycar_type;

:ti4:=mycar_model;

:ti5:=myavailability;

:ti6:=mydriver_id;

:di1:=:global.currecno||'/'||:global.reccount;

end if;

end if;

exception

when no_more_data then

choice_num:=show_alert('no_more_data');

end;

Reset

:ti1:='';

:ti2:='';

:ti3:='';

Page 54: how to create a car booking system from scratch

:ti4:='';

:ti5:='';

:ti6:='';

:di1:='';

go_item('ti1');

Exit

exit_form;

Check Fare:

declare

fare number;

b number;

choice_num number;

begin

select count(*) into b

from fare_chart_details

where ((src=:li1 and dest=:li2) or (src=:li2 and dest=:li1));

if :li1 is null or :li2 is null or :li3 is null or :rg1 is null then

choice_num:=show_alert('blank_field');

elsif (b=0) then

choice_num:= show_alert('not_found');

else

fare:=fare_cal(:li1,:li2,:rg1,:li3,:global.s,:global.m,:global.l

);

:di1:=fare;

end if;

end;

Page 55: how to create a car booking system from scratch

Customer Details:

Insert

declare

a number;

choice_num number;

blank_field exception;

begin

if :ti2 is null or :ti3 is null or :ti4 is null or :ti5 is null then

raise blank_field;

end if;

if(((:ti4 not like '__________') or (:ti5 not like

'%@%.com')) or ((:ti4 not like '__________') and (:ti5 not like

'%@%.com'))) then

choice_num:= show_alert('invalid_ph_email');

else

insert into customer_details values

(cus.nextval,:ti2,:ti3,:ti4,:ti5);

standard.commit;

choice_num:=show_alert('Insert_success');

:global.reccount1:=:global.reccount1+1;

:global.currecno1:=:global.reccount1;

:di1:=:global.currecno1||'/'||:global.reccount1;

end if;

exception

when blank_field then

choice_num:=show_alert('blank_field');

end;

Delete

declare

Page 56: how to create a car booking system from scratch

a number;

choice_num number;

enter_cus exception;

cus_does_not_exist exception;

begin

if :ti1 is null or :ti2 is not null or :ti3 is not null or :ti4 is

not null or :ti5 is not null then

raise enter_cus;

else

select count(*) into a

from customer_details

where cus_id=:ti1;

if(a=0) then

raise cus_does_not_exist;

else

delete from customer_details where cus_id=:ti1;

standard.commit;

choice_num:=show_alert('delete_success');

end if;

:global.reccount1:=:global.reccount-1;

:global.currecno1:=1;

:di1:=:global.currecno1||'/'||:global.reccount1;

end if;

exception

when cus_does_not_exist then

choice_num:=show_alert('cus_does_not_exist');

when enter_cus then

choice_num:=show_alert('enter_cus');

Page 57: how to create a car booking system from scratch

end;

Move Next

declare

a number;

mycus_id Customer_Details.cus_id%type;

mycus_name Customer_Details.cus_name%type;

mycus_address Customer_Details.address%type;

mycus_phne Customer_Details.cph_numm%type;

mycus_email Customer_Details.email%type;

choice_num number;

no_more_data exception;

begin

select count(*) into a

from Customer_Details;

if (a=0) then

:global.reccount1:=0;

:global.currecno1:=0;

else

if (:global.currecno1=:global.reccount1) then

raise no_more_data;

else

:global.currecno1:=:global.currecno1 + 1;

select cus_id, cus_name, address,

cph_numm,email into mycus_id, mycus_name, mycus_address,

mycus_phne,mycus_email

Page 58: how to create a car booking system from scratch

from

(

select rownum rn,cus_id,

cus_name,address,cph_numm,email

from customer_details

order by rownum

)

where rn=:global.currecno1;

:ti1:=mycus_id;

:ti2:=mycus_name;

:ti3:=mycus_address;

:ti4:=mycus_phne;

:ti5:=mycus_email;

:di1:=:global.currecno1||'/'||:global.reccount1;

end if;

end if;

exception

when no_more_data then

choice_num:=show_alert('no_more_data');

end;

Move Previous

declare

a number;

mycus_id customer_Details.cus_id%type;

mycus_name customer_Details.cus_name%type;

mycus_add customer_Details.address%type;

mycus_ph customer_Details.cph_numm%type;

mycus_email customer_Details.email%type;

no_more_data exception;

Page 59: how to create a car booking system from scratch

choice_num number;

begin

select count(*) into a

from customer_Details;

if (a=0) then

:global.reccount1:=0;

:global.currecno1:=0;

else

if (:global.currecno1=1) then

raise no_more_data;

else

:global.currecno1:=:global.currecno1 - 1;

select cus_id, cus_name, address, cph_numm, email into

mycus_id, mycus_name, mycus_add, mycus_ph, mycus_email

from

(

select rownum rn,cus_id, cus_name, address,

cph_numm, email

from customer_details

order by rownum

)

where rn=:global.currecno1;

:ti1:=mycus_id;

:ti2:=mycus_name;

:ti3:=mycus_add;

:ti4:=mycus_ph;

:ti5:=mycus_email;

Page 60: how to create a car booking system from scratch

:di1:=:global.currecno1||'/'||:global.reccount1;

end if;

end if;

exception

when no_more_data then

choice_num:=show_alert('no_more_data');

end;

Move First

declare

a number;

mycus_id Customer_Details.cus_id%type;

mycus_name Customer_Details.cus_name%type;

mycus_address Customer_Details.address%type;

mycus_phne Customer_Details.cph_numm%type;

mycus_email Customer_Details.email%type;

begin

select count(*) into a

from Customer_Details;

if (a=0) then

:global.reccount1:=0;

:global.currecno1:=0;

message('I am in the then block...');

else

message('I am in the else block...');

:global.currecno1:=1;

:global.reccount1:=a;

:di1:=:global.currecno1||'/'||:global.reccount1;

Page 61: how to create a car booking system from scratch

select cus_id, cus_name, address,

cph_numm,email into mycus_id, mycus_name, mycus_address,

mycus_phne,mycus_email

from

(

select rownum rn,cus_id,

cus_name,address,cph_numm,email

from customer_details

order by rownum

)

where rn=1;

:ti1:=mycus_id;

:ti2:=mycus_name;

:ti3:=mycus_address;

:ti4:=mycus_phne;

:ti5:=mycus_email;

end if;

end;

Move Last

declare

a number;

mycus_id customer_Details.cus_id%type;

mycus_name customer_Details.cus_name%type;

mycus_add customer_Details.address%type;

mycus_ph customer_Details.cph_numm%type;

mycus_email customer_Details.email%type;

begin

Page 62: how to create a car booking system from scratch

select count(*) into a

from customer_Details;

if (a=0) then

:global.reccount1:=0;

:global.currecno1:=0;

message('I am in the then block...');

else

message('I am in the else block...');

:global.reccount1:=a;

:di1:=:global.reccount1||'/'||:global.reccount1;

select cus_id, cus_name, address,

cph_numm, email into mycus_id, mycus_name, mycus_add,

mycus_ph, mycus_email

from

(

select rownum rn,cus_id, cus_name, address,

cph_numm, email

from customer_details

order by rownum

)

where rn=:global.reccount1;

:ti1:=mycus_id;

:ti2:=mycus_name;

:ti3:=mycus_add;

:ti4:=mycus_ph;

:ti5:=mycus_email;

:global.currecno1:=:global.reccount1;

Page 63: how to create a car booking system from scratch

end if;

end;

Reset

:ti1 :='';

:ti2 :='';

:ti3 :='';

:ti4 :='';

:ti5 :='';

:di1 :='';

go_item('ti1');

Exit

exit_form;

Delete Route Details:

declare

a number;

b number;

c number;

d number;

e number;

begin

select count(*) into b

from fare_chart_details

where ((src=:li1 and dest=:li2) or (src=:li2 and dest=:li1));

if (b<>0) then

delete from fare_chart_details where ((:li1=src and

Page 64: how to create a car booking system from scratch

:li2=dest) or (:li1=dest and :li2=src));

standard.commit;

d:= show_alert('delete');

select count(*) into a

from fare_chart_details

where (src=:li1 or dest=:li1);

if(a=0) then

delete from loc where loc_name=:li1;

standard.commit;

end if;

select count(*) into c

from fare_chart_details

where (src=:li2 or dest=:li2);

if(c=0) then

delete from loc where loc_name=:li2;

standard.commit;

end if;

else

e :=show_alert('not_found');

end if;

end;

Driver Details:

Insert

declare

temp date;

a number;

Page 65: how to create a car booking system from scratch

mysal number;

myage number;

choice_num number;

blank exception;

begin

if :ti1 is null or :ti2 is null or :ti3 is null or :ti4 is null or :ti5

is null or:ti6 is null or :ti7 is null or :ti8 is null then

raise blank;

end if;

if(:ti7 not like '__________') then

choice_num:= show_alert('invalid_ph');

else

insert into driver_details values

(:ti1,:ti2,:ti8,:ti3,:ti4,to_date(:ti5,'DD-MON-YY'),:ti6,:ti7);

standard.commit;

choice_num:=show_alert('insert_success');

:global.reccount2:=:global.reccount2 + 1;

:global.currecno2:=:global.reccount2;

:di2:=:global.currecno2||'/'||:global.reccount2;

end if;

exception

when blank then

choice_num := show_alert('blank');

end;

Delete

declare

Page 66: how to create a car booking system from scratch

a number;

choice_num number;

blank_id exception;

wrong_input exception;

begin

if :ti1 is null or :ti2 is not null or :ti3 is not null or :ti4 is

not null or :ti5 is not null or :ti6 is not null or :ti7 is not null or :ti8

is not null then

raise blank_id;

else

select count(*) into a

from driver_details

where driver_id=:ti1;

if(a=0) then

raise wrong_input;

else

delete from driver_details where driver_id=:ti1;

standard.commit;

choice_num:=show_alert('Delete_Success');

end if;

:global.reccount2:=:global.reccount2 - 1;

:global.currecno2:=1;

:di2:=:global.currecno2||'/'||:global.reccount2;

end if;

exception

when blank_id then

choice_num := show_alert('blank_id');

when wrong_input then

choice_num := show_alert('wrong_input');

Page 67: how to create a car booking system from scratch

end;

Move First

declare

a number;

mydriver_id driver_details.driver_id%type;

mydriver_name driver_details.driver_name%type;

mydriver_lic driver_details.driver_lic%type;

myaddress driver_details.address%type;

myage driver_details.age%type;

myhiredate driver_details.hiredate%type;

mysal driver_details.salary%type;

myphno driver_details.dph_num%type;

begin

select count(*) into a

from driver_details;

if (a=0) then

:global.reccount2:=0;

:global.currecno2:=0;

message('I am in the then block...');

else

message('I am in the else block...');

:global.currecno2:=1;

:global.reccount2:=a;

:di2:=:global.currecno2||'/'||:global.reccount2;

select

driver_id,driver_name,driver_lic,address,age,hiredate,salary,dph_

num into

mydriver_id,mydriver_name,mydriver_lic,myaddress,myage,myhi

Page 68: how to create a car booking system from scratch

redate,mysal,myphno

from

(

select rownum

rn,driver_id,driver_name,driver_lic,address,age,hiredate,salary,dp

h_num

from driver_details

order by rownum

)

where rn=1;

:ti1:=mydriver_id;

:ti2:=mydriver_name;

:ti3:=myaddress;

:ti4:=to_char(myage);

:ti5:=to_char(myhiredate);

:ti6:=to_char(mysal);

:ti7:=to_char(myphno);

:ti8:=mydriver_lic;

end if;

end;

Move Last

declare

a number;

mydriver_id driver_details.driver_id%type;

mydriver_name driver_details.driver_name%type;

mydriver_lic driver_details.driver_lic%type;

myaddress driver_details.address%type;

myage driver_details.age%type;

Page 69: how to create a car booking system from scratch

myhiredate driver_details.hiredate%type;

mysal driver_details.salary%type;

myphno driver_details.dph_num%type;

begin

select count(*) into a

from driver_details;

if (a=0) then

:global.reccount2:=0;

:global.currecno2:=0;

message('I am in the then block...');

else

message('I am in the else block...');

:global.reccount2:=a;

:di2:=:global.reccount2||'/'||:global.reccount2;

select

driver_id,driver_name,driver_lic,address,age,hiredate,salary,dph_

num into

mydriver_id,mydriver_name,mydriver_lic,myaddress,myage,myhi

redate,mysal,myphno

from

(

select rownum

rn,driver_id,driver_name,driver_lic,address,age,hiredate,salary,dp

h_num

from driver_details

order by rownum

)

where rn=:global.reccount2;

Page 70: how to create a car booking system from scratch

:ti1:=mydriver_id;

:ti2:=mydriver_name;

:ti3:=myaddress;

:ti4:=to_char(myage);

:ti5:=to_char(myhiredate);

:ti6:=to_char(mysal);

:ti7:=to_char(myphno);

:ti8:=mydriver_lic;

:global.currecno2:=:global.reccount2;

end if;

end;

Move Previous

declare

a number;

mydriver_id driver_details.driver_id%type;

mydriver_name driver_details.driver_name%type;

mydriver_lic driver_details.driver_lic%type;

myaddress driver_details.address%type;

myage driver_details.age%type;

myhiredate driver_details.hiredate%type;

mysal driver_details.salary%type;

myphno driver_details.dph_num%type;

choice_num number;

no_more_data exception;

begin

select count(*) into a

from driver_details;

if (a=0) then

:global.reccount2:=0;

:global.currecno2:=0;

Page 71: how to create a car booking system from scratch

else

if (:global.currecno2 = 1) then

raise no_more_data;

else

:global.currecno2:=:global.currecno2 - 1;

select

driver_id,driver_name,driver_lic,address,age,hiredate,salary,dph_

num into

mydriver_id,mydriver_name,mydriver_lic,myaddress,myage,myhi

redate,mysal,myphno

from

(

select rownum

rn,driver_id,driver_name,driver_lic,address,age,hiredate,salary,dp

h_num

from driver_details

order by rownum

)

where rn=:global.currecno2;

:ti1:=mydriver_id;

:ti2:=mydriver_name;

:ti3:=myaddress;

:ti4:=to_char(myage);

:ti5:=to_char(myhiredate);

:ti6:=to_char(mysal);

:ti7:=to_char(myphno);

:ti8:=mydriver_lic;

:di2:=:global.currecno2||'/'||:global.reccount2;

Page 72: how to create a car booking system from scratch

end if;

end if;

exception

when no_more_data then

a:=show_alert('no_more_data');

end;

Move Next

declare

a number;

mydriver_id driver_details.driver_id%type;

mydriver_name driver_details.driver_name%type;

mydriver_lic driver_details.driver_lic%type;

myaddress driver_details.address%type;

myage driver_details.age%type;

myhiredate driver_details.hiredate%type;

mysal driver_details.salary%type;

myphno driver_details.dph_num%type;

choice_num number;

no_more_data exception;

begin

select count(*) into a

from driver_details;

if (a=0) then

:global.reccount2:=0;

:global.currecno2:=0;

else

if (:global.currecno2=:global.reccount2) then

raise no_more_data;

else

Page 73: how to create a car booking system from scratch

:global.currecno2:=:global.currecno2 + 1;

select

driver_id,driver_name,driver_lic,address,age,hiredate,salary,dph_

num into

mydriver_id,mydriver_name,mydriver_lic,myaddress,myage,myhi

redate,mysal,myphno

from

(

select rownum

rn,driver_id,driver_name,driver_lic,address,age,hiredate,salary,dp

h_num

from driver_details

order by rownum

)

where rn=:global.currecno2;

:ti1:=mydriver_id;

:ti2:=mydriver_name;

:ti3:=myaddress;

:ti4:=to_char(myage);

:ti5:=to_char(myhiredate);

:ti6:=to_char(mysal);

:ti7:=to_char(myphno);

:ti8:=mydriver_lic;

:di2:=:global.currecno2||'/'||:global.reccount2;

end if;

end if;

exception

when no_more_data then

choice_num := show_alert('no_more_data');

Page 74: how to create a car booking system from scratch

end;

Reset

:ti1:='';

:ti2:='';

:ti3:='';

:ti4:=null;

:ti5:='';

:ti6:=null;

:ti7:='';

:ti8:='';

:di2:='';

go_item('ti1');

Exit

exit_form;

Return Car Instance:

declare

mycar_id Car_Details.car_type%type := :ti1;

a number;

available_book exception;

blank_field exception;

choice_num number;

begin

if :ti1 is null then

raise blank_field;

end if;

select count(*) into a

from car_details,booking_details where

Page 75: how to create a car booking system from scratch

car_details.car_id = booking_details.car_id

and booking_type = 'instant' and availability = 'no'

and car_details.car_id=car_details.car_id;

if(a=0) then

raise available_book;

else

update car_details

set availability ='yes'

where car_id = mycar_id;

choice_num:=show_alert('Updated');

standard.commit;

delete from booking_details

where car_id=mycar_id

and booking_type='instant';

standard.commit;

end if;

exception

when blank_field then

choice_num:=show_alert('Blank_field');

when available_book then

choice_num:=show_alert('Available_book');

end;

Code For From Instance:

Add Route:

:tx1:='';

:tx2:='';

:tx3:='';

go_item ('tx1');

Page 76: how to create a car booking system from scratch

Booking:

declare

a number;

begin

a := populate_group('rc1');

populate_list('li1','rc1');

end;

Car Details:

declare

a number;

begin

select count(*) into a

from Car_Details;

:global.reccount:=a;

end;

Check Fare:

declare

a number;

begin

a:=populate_group('rg1');

populate_list('li1','rg1');

:global.s :=10;

:global.m :=15;

:global.l :=20;

end;

Customer Details:

declare

Page 77: how to create a car booking system from scratch

a number;

begin

select count(*) into a

from Customer_Details;

:global.reccount1:=a;

:global.currecno1:=0;

end;

Delete Route:

declare

a number;

begin

a := populate_group('rg1');

populate_list('li1','rg1');

end;

Driver Details:

declare

a number;

begin

select count(*) into a

from driver_Details;

:global.reccount2:=a;

:global.currecno2:=0;

end;

Page 78: how to create a car booking system from scratch

Certificate THIS IS TO CERTIFY THAT Arkamit Dutta OF

BATANAGAR INSTITUTE OF

ENGINEERING,MANAGEMENT AND SCIENCE HAS

SUCCESSFULLY COMPLETED THE PROJECT

ON PREPAID CAR BOOKING SYSTEM UNDER

THE GUIDANCE OF PROF. ARNAB

CHAKRABORTY

USING ORACLE 10g FROM GLOBSYN

FINISHING SCHOOL IN SUMMER TRAINING

PROGRAM 2014-2015. ___________________ ___________________________

Signature and date PROF.ARNAB CHAKRABORTY

Page 79: how to create a car booking system from scratch

Certificate THIS IS TO CERTIFY THAT Nilotpal Mukherjee

OF

BATANAGAR INSTITUTE OF

ENGINEERING,MANAGEMENT AND SCIENCE HAS

SUCCESSFULLY COMPLETED THE PROJECT

ON PREPAID CAR BOOKING SYSTEM UNDER

THE GUIDANCE OF PROF. ARNAB

CHAKRABORTY

USING ORACLE 10g FROM GLOBSYN

FINISHING SCHOOL IN SUMMER TRAINING

PROGRAM 2014-2015. ___________________ ___________________________

Signature and date PROF.ARNAB CHAKRABORTY

Page 80: how to create a car booking system from scratch

Certificate THIS IS TO CERTIFY THAT SANDIP DAS OF

BATANAGAR INSTITUTE OF

ENGINEERING,MANAGEMENT AND SCIENCE HAS

SUCCESSFULLY COMPLETED THE PROJECT

ON PREPAID CAR BOOKING SYSTEM UNDER

THE GUIDANCE OF PROF. ARNAB

CHAKRABORTY

USING ORACLE 10g FROM GLOBSYN

FINISHING SCHOOL IN SUMMER TRAINING

PROGRAM 2014-2015. ___________________ ___________________________

Signature and date PROF.ARNAB CHAKRABORTY

Page 81: how to create a car booking system from scratch

Certificate THIS IS TO CERTIFY THAT Satayki Guha OF

BATANAGAR INSTITUTE OF

ENGINEERING,MANAGEMENT AND SCIENCE HAS

SUCCESSFULLY COMPLETED THE PROJECT

ON PREPAID CAR BOOKING SYSTEM UNDER

THE GUIDANCE OF PROF. ARNAB

CHAKRABORTY

USING ORACLE 10g FROM GLOBSYN

FINISHING SCHOOL IN SUMMER TRAINING

PROGRAM 2014-2015. ___________________ ___________________________

Signature and date PROF.ARNAB CHAKRABORTY

Page 82: how to create a car booking system from scratch

Certificate THIS IS TO CERTIFY THAT Sidartha Dutta

OF

BATANAGAR INSTITUTE OF

ENGINEERING,MANAGEMENT AND SCIENCE HAS

SUCCESSFULLY COMPLETED THE PROJECT

ON PREPAID CAR BOOKING SYSTEM UNDER

THE GUIDANCE OF PROF. ARNAB

CHAKRABORTY

USING ORACLE 10g FROM GLOBSYN

FINISHING SCHOOL IN SUMMER TRAINING

PROGRAM 2014-2015. ___________________ ___________________________

Signature and date PROF.ARNAB CHAKRABORTY

Page 83: how to create a car booking system from scratch

CONCLUSION The PREPAID CAR BOOKING SYSTEM

is a step in the direction to ease the structure of CAR booking and

reservation system. Some of the advantages that it enjoys over

Manual System are:

Data retrieval process becomes easy when it is needed, if we use

computer management instead of manually.

Storage capacity of the computer is also excellent.

Updating of data is easy in computerized system.

Data consistency is required for neat and proper management that

is achieved by computer easily.

Time is precious and speed is the order of today. Our software

supports this statement.

With the help of software, data redundancy reduces as compared

to manual.