-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOnlineBusBooking.sql
More file actions
688 lines (688 loc) · 61.1 KB
/
OnlineBusBooking.sql
File metadata and controls
688 lines (688 loc) · 61.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
create DATABASE [OnlineBusBooking]
GO
USE [OnlineBusBooking]
GO
/****** Object: Table [dbo].[ScheduleMaster] Script Date: 04/30/2017 19:37:11 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[ScheduleMaster](
[ScheduleId] [int] IDENTITY(1,1) NOT NULL,
[BusId] [int] NULL,
[Date] [varchar](50) NULL,
[Fare] [decimal](18, 2) NULL,
[EstimatedTime] [varchar](50) NULL,
[ArivalTime] [varchar](50) NULL,
[DepartureTime] [varchar](50) NULL,
[RouteID] [int] NULL,
[BookedSeats] [int] NULL,
[AvailableSeats] [int] NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[ScheduleMaster] ON
INSERT [dbo].[ScheduleMaster] ([ScheduleId], [BusId], [Date], [Fare], [EstimatedTime], [ArivalTime], [DepartureTime], [RouteID], [BookedSeats], [AvailableSeats]) VALUES (5, 3, N'25/03/2017', CAST(800.00 AS Decimal(18, 2)), N'01hr 05Mints', N'06:00 PM', N'04:00 PM', 3, 3, 32)
INSERT [dbo].[ScheduleMaster] ([ScheduleId], [BusId], [Date], [Fare], [EstimatedTime], [ArivalTime], [DepartureTime], [RouteID], [BookedSeats], [AvailableSeats]) VALUES (6, 3, N'20/03/2017', CAST(150.00 AS Decimal(18, 2)), N'1hr50mins', N'10:25 AM', N'12;00 PM', 3, 0, 35)
INSERT [dbo].[ScheduleMaster] ([ScheduleId], [BusId], [Date], [Fare], [EstimatedTime], [ArivalTime], [DepartureTime], [RouteID], [BookedSeats], [AvailableSeats]) VALUES (7, 3, N'22/03/2017', CAST(150.00 AS Decimal(18, 2)), N'1hr50mins', N'10:25 AM', N'12;00 PM', 3, 0, 35)
INSERT [dbo].[ScheduleMaster] ([ScheduleId], [BusId], [Date], [Fare], [EstimatedTime], [ArivalTime], [DepartureTime], [RouteID], [BookedSeats], [AvailableSeats]) VALUES (8, 5, N'30/03/2017', CAST(800.00 AS Decimal(18, 2)), N'2Hr', N'08:00 PM', N'06:00 PM', 5, 3, 32)
INSERT [dbo].[ScheduleMaster] ([ScheduleId], [BusId], [Date], [Fare], [EstimatedTime], [ArivalTime], [DepartureTime], [RouteID], [BookedSeats], [AvailableSeats]) VALUES (9, 5, N'30/03/2017', CAST(500.00 AS Decimal(18, 2)), N'01hr 05Mints', N'08:00 PM', N'06:00 PM', 5, 3, 32)
INSERT [dbo].[ScheduleMaster] ([ScheduleId], [BusId], [Date], [Fare], [EstimatedTime], [ArivalTime], [DepartureTime], [RouteID], [BookedSeats], [AvailableSeats]) VALUES (10, 5, N'29/03/2017', CAST(500.00 AS Decimal(18, 2)), N'01hr 05Mints', N'08:00 PM', N'06:00 PM', 5, 3, 32)
INSERT [dbo].[ScheduleMaster] ([ScheduleId], [BusId], [Date], [Fare], [EstimatedTime], [ArivalTime], [DepartureTime], [RouteID], [BookedSeats], [AvailableSeats]) VALUES (11, 5, N'28/03/2017', CAST(500.00 AS Decimal(18, 2)), N'01hr 05Mints', N'08:00 PM', N'06:00 PM', 5, 4, 31)
INSERT [dbo].[ScheduleMaster] ([ScheduleId], [BusId], [Date], [Fare], [EstimatedTime], [ArivalTime], [DepartureTime], [RouteID], [BookedSeats], [AvailableSeats]) VALUES (12, 5, N'27/03/2017', CAST(500.00 AS Decimal(18, 2)), N'01hr 05Mints', N'08:00 PM', N'06:00 PM', 5, 3, 32)
INSERT [dbo].[ScheduleMaster] ([ScheduleId], [BusId], [Date], [Fare], [EstimatedTime], [ArivalTime], [DepartureTime], [RouteID], [BookedSeats], [AvailableSeats]) VALUES (15, 3, N'25/03/2017', CAST(150.00 AS Decimal(18, 2)), N'10:25', N'10:25 AM', N'06:00 PM', 3, 0, 35)
INSERT [dbo].[ScheduleMaster] ([ScheduleId], [BusId], [Date], [Fare], [EstimatedTime], [ArivalTime], [DepartureTime], [RouteID], [BookedSeats], [AvailableSeats]) VALUES (13, 6, N'30/03/2017', CAST(320.00 AS Decimal(18, 2)), N'2Hr', N'03:25', N'02:30', 6, 0, 54)
INSERT [dbo].[ScheduleMaster] ([ScheduleId], [BusId], [Date], [Fare], [EstimatedTime], [ArivalTime], [DepartureTime], [RouteID], [BookedSeats], [AvailableSeats]) VALUES (14, 3, N'30/03/2017', CAST(250.00 AS Decimal(18, 2)), N'10:25', N'02:50', N'5', 3, 2, 33)
SET IDENTITY_INSERT [dbo].[ScheduleMaster] OFF
/****** Object: Table [dbo].[RouteDetails] Script Date: 04/30/2017 19:37:11 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[RouteDetails](
[RouteID] [int] IDENTITY(1,1) NOT NULL,
[Origin] [varchar](50) NULL,
[Destination] [varchar](50) NULL,
[CreatedDate] [datetime] NULL,
[BusID] [int] NULL,
CONSTRAINT [PK_RouteDetails] PRIMARY KEY CLUSTERED
(
[RouteID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[RouteDetails] ON
INSERT [dbo].[RouteDetails] ([RouteID], [Origin], [Destination], [CreatedDate], [BusID]) VALUES (3, N'Mumbai', N'Pune', CAST(0x0000A739009C967D AS DateTime), 3)
INSERT [dbo].[RouteDetails] ([RouteID], [Origin], [Destination], [CreatedDate], [BusID]) VALUES (4, N'Nallasopara', N'Churchgate', CAST(0x0000A73B0138888C AS DateTime), 4)
INSERT [dbo].[RouteDetails] ([RouteID], [Origin], [Destination], [CreatedDate], [BusID]) VALUES (5, N'Mumbai', N'Surat', CAST(0x0000A73B013F93CD AS DateTime), 5)
INSERT [dbo].[RouteDetails] ([RouteID], [Origin], [Destination], [CreatedDate], [BusID]) VALUES (6, N'Vasai', N'Virar', CAST(0x0000A73D017932D2 AS DateTime), 6)
SET IDENTITY_INSERT [dbo].[RouteDetails] OFF
/****** Object: Table [dbo].[Registration] Script Date: 04/30/2017 19:37:11 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Registration](
[regId] [int] IDENTITY(1,1) NOT NULL,
[Fname] [varchar](50) NULL,
[Lname] [varchar](50) NULL,
[EmailId] [varchar](50) NULL,
[Address] [varchar](200) NULL,
[City] [varchar](50) NULL,
[Picode] [varchar](15) NULL,
[Contact] [varchar](50) NULL,
[Password] [varchar](50) NULL,
[CreatedDate] [datetime] NULL,
CONSTRAINT [PK_Registration] PRIMARY KEY CLUSTERED
(
[regId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[Registration] ON
INSERT [dbo].[Registration] ([regId], [Fname], [Lname], [EmailId], [Address], [City], [Picode], [Contact], [Password], [CreatedDate]) VALUES (1, N'Anand', N'Singh', N'abc@gmail.com', N'Santosh Nagar', N'Mumbai', N'400065', N'8291951419', N'12345', CAST(0x0000A7340176CD0C AS DateTime))
INSERT [dbo].[Registration] ([regId], [Fname], [Lname], [EmailId], [Address], [City], [Picode], [Contact], [Password], [CreatedDate]) VALUES (2, N'Jitendra', N'Dubey', N'jitendra@gmail.com', N'Address goes her', N'Mumbai', N'400064', N'9029451159', N'123456', CAST(0x0000A73B0135BBA0 AS DateTime))
INSERT [dbo].[Registration] ([regId], [Fname], [Lname], [EmailId], [Address], [City], [Picode], [Contact], [Password], [CreatedDate]) VALUES (3, N'Atul', N'Dubey', N'atuldubey12@gmail.com', N'nallasopara east', N'vasai', N'401209', N'9561454638', N'123456', CAST(0x0000A73B01360DB8 AS DateTime))
INSERT [dbo].[Registration] ([regId], [Fname], [Lname], [EmailId], [Address], [City], [Picode], [Contact], [Password], [CreatedDate]) VALUES (4, N'rahul', N'shedge', N'rahul@gmail.com', N'navghar road', N'bhayander', N'400065', N'8237525022', N'123456', CAST(0x0000A73B013DE893 AS DateTime))
SET IDENTITY_INSERT [dbo].[Registration] OFF
/****** Object: Table [dbo].[PNRDetails] Script Date: 04/30/2017 19:37:11 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[PNRDetails](
[PNRDetailsID] [bigint] IDENTITY(1,1) NOT NULL,
[PNRNo] [varchar](50) NULL,
[TotalAmount] [decimal](18, 2) NULL,
[TotalTickets] [int] NULL,
[CreatedBy] [int] NULL,
CONSTRAINT [PK_PNRDetails] PRIMARY KEY CLUSTERED
(
[PNRDetailsID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[PNRDetails] ON
INSERT [dbo].[PNRDetails] ([PNRDetailsID], [PNRNo], [TotalAmount], [TotalTickets], [CreatedBy]) VALUES (12, N'OR9IJW', CAST(1600.00 AS Decimal(18, 2)), 2, 1)
INSERT [dbo].[PNRDetails] ([PNRDetailsID], [PNRNo], [TotalAmount], [TotalTickets], [CreatedBy]) VALUES (13, N'6422EK', CAST(800.00 AS Decimal(18, 2)), 1, 3)
INSERT [dbo].[PNRDetails] ([PNRDetailsID], [PNRNo], [TotalAmount], [TotalTickets], [CreatedBy]) VALUES (14, N'W3TBAF', CAST(2400.00 AS Decimal(18, 2)), 3, 1)
INSERT [dbo].[PNRDetails] ([PNRDetailsID], [PNRNo], [TotalAmount], [TotalTickets], [CreatedBy]) VALUES (15, N'8DB5W0', CAST(500.00 AS Decimal(18, 2)), 1, 2)
INSERT [dbo].[PNRDetails] ([PNRDetailsID], [PNRNo], [TotalAmount], [TotalTickets], [CreatedBy]) VALUES (16, N'4ZEV3G', CAST(500.00 AS Decimal(18, 2)), 2, 2)
SET IDENTITY_INSERT [dbo].[PNRDetails] OFF
/****** Object: Table [dbo].[PickUpStand] Script Date: 04/30/2017 19:37:11 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[PickUpStand](
[StandId] [int] IDENTITY(1,1) NOT NULL,
[RouteId] [int] NULL,
[PlaceName] [varchar](50) NULL,
[PlaceTime] [varchar](50) NULL,
[BusID] [int] NULL,
CONSTRAINT [PK_PickUpStand] PRIMARY KEY CLUSTERED
(
[StandId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[PickUpStand] ON
INSERT [dbo].[PickUpStand] ([StandId], [RouteId], [PlaceName], [PlaceTime], [BusID]) VALUES (5, 3, N'Dadar', N'04:00 PM', 3)
INSERT [dbo].[PickUpStand] ([StandId], [RouteId], [PlaceName], [PlaceTime], [BusID]) VALUES (6, 3, N'Borivali', N'04:50 PM', 3)
INSERT [dbo].[PickUpStand] ([StandId], [RouteId], [PlaceName], [PlaceTime], [BusID]) VALUES (7, 3, N'Achole Talav', N'10:25 AM', 3)
INSERT [dbo].[PickUpStand] ([StandId], [RouteId], [PlaceName], [PlaceTime], [BusID]) VALUES (8, 3, N'Dwaraka Hotel', N'11:00 PM', 3)
INSERT [dbo].[PickUpStand] ([StandId], [RouteId], [PlaceName], [PlaceTime], [BusID]) VALUES (9, 5, N'Dadar', N'00:06 PM', 5)
INSERT [dbo].[PickUpStand] ([StandId], [RouteId], [PlaceName], [PlaceTime], [BusID]) VALUES (10, 5, N'Borivali', N'06:45 PM', 5)
INSERT [dbo].[PickUpStand] ([StandId], [RouteId], [PlaceName], [PlaceTime], [BusID]) VALUES (11, 3, N'Dwarka Hotel', N'02:30 PM', 3)
SET IDENTITY_INSERT [dbo].[PickUpStand] OFF
/****** Object: Table [dbo].[CityDetails] Script Date: 04/30/2017 19:37:11 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CityDetails](
[CityID] [bigint] IDENTITY(1,1) NOT NULL,
[CityName] [varchar](50) NULL,
CONSTRAINT [PK_CityDetails] PRIMARY KEY CLUSTERED
(
[CityID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[CityDetails] ON
INSERT [dbo].[CityDetails] ([CityID], [CityName]) VALUES (7, N'Mumbai')
INSERT [dbo].[CityDetails] ([CityID], [CityName]) VALUES (8, N'Pune')
INSERT [dbo].[CityDetails] ([CityID], [CityName]) VALUES (9, N'Nallasopara')
INSERT [dbo].[CityDetails] ([CityID], [CityName]) VALUES (10, N'Churchgate')
INSERT [dbo].[CityDetails] ([CityID], [CityName]) VALUES (11, N'Surat')
INSERT [dbo].[CityDetails] ([CityID], [CityName]) VALUES (12, N'Vasai')
INSERT [dbo].[CityDetails] ([CityID], [CityName]) VALUES (13, N'Virar')
SET IDENTITY_INSERT [dbo].[CityDetails] OFF
/****** Object: Table [dbo].[CardDetails] Script Date: 04/30/2017 19:37:11 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CardDetails](
[CardID] [bigint] IDENTITY(1,1) NOT NULL,
[UserID] [int] NULL,
[CardType] [varchar](20) NULL,
[BankName] [varchar](50) NULL,
[CVVNo] [varchar](10) NULL,
[CardNo] [nvarchar](100) NULL,
[TotalAmount] [decimal](18, 2) NULL,
[CreatedBy] [int] NULL,
CONSTRAINT [PK_CardDetails] PRIMARY KEY CLUSTERED
(
[CardID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[CardDetails] ON
INSERT [dbo].[CardDetails] ([CardID], [UserID], [CardType], [BankName], [CVVNo], [CardNo], [TotalAmount], [CreatedBy]) VALUES (12, 1, N'Credit Card', N'State Bank Of India', N'MOV', N'A102556845546868', CAST(1600.00 AS Decimal(18, 2)), NULL)
INSERT [dbo].[CardDetails] ([CardID], [UserID], [CardType], [BankName], [CVVNo], [CardNo], [TotalAmount], [CreatedBy]) VALUES (13, 3, N'Credit Card', N'ICICI Bank', N'456', N'656565446', CAST(800.00 AS Decimal(18, 2)), NULL)
INSERT [dbo].[CardDetails] ([CardID], [UserID], [CardType], [BankName], [CVVNo], [CardNo], [TotalAmount], [CreatedBy]) VALUES (14, 1, N'Debit Card', N'Bank Of India', N'MKV', N'A12345694', CAST(2400.00 AS Decimal(18, 2)), NULL)
INSERT [dbo].[CardDetails] ([CardID], [UserID], [CardType], [BankName], [CVVNo], [CardNo], [TotalAmount], [CreatedBy]) VALUES (15, 2, N'Credit Card', N'Bank Of India', N'MKV', N'45645465466', CAST(500.00 AS Decimal(18, 2)), NULL)
INSERT [dbo].[CardDetails] ([CardID], [UserID], [CardType], [BankName], [CVVNo], [CardNo], [TotalAmount], [CreatedBy]) VALUES (16, 2, N'Credit Card', N'State Bank Of India', N'456', N'254654644', CAST(500.00 AS Decimal(18, 2)), NULL)
SET IDENTITY_INSERT [dbo].[CardDetails] OFF
/****** Object: Table [dbo].[BusMaster] Script Date: 04/30/2017 19:37:11 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[BusMaster](
[BusId] [int] IDENTITY(1,1) NOT NULL,
[BusNo] [varchar](50) NULL,
[BustType] [varchar](50) NULL,
[TotalSeat] [int] NULL,
[SeatColumn] [int] NULL,
[SeatRow] [int] NULL,
[BookedSeat] [int] NULL,
[AvailableSeats] [int] NULL,
[BusName] [varchar](50) NULL,
CONSTRAINT [PK_BusMaster] PRIMARY KEY CLUSTERED
(
[BusId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[BusMaster] ON
INSERT [dbo].[BusMaster] ([BusId], [BusNo], [BustType], [TotalSeat], [SeatColumn], [SeatRow], [BookedSeat], [AvailableSeats], [BusName]) VALUES (3, N'NV245632', N'AC', 35, 7, 5, 0, 35, N'Neeta Volvo')
INSERT [dbo].[BusMaster] ([BusId], [BusNo], [BustType], [TotalSeat], [SeatColumn], [SeatRow], [BookedSeat], [AvailableSeats], [BusName]) VALUES (4, N'64656', N'AC', 54, 9, 6, 0, 54, N'Atul Bus')
INSERT [dbo].[BusMaster] ([BusId], [BusNo], [BustType], [TotalSeat], [SeatColumn], [SeatRow], [BookedSeat], [AvailableSeats], [BusName]) VALUES (5, N'A254635', N'AC', 35, 7, 5, 0, 35, N'Abhinav Transporters')
INSERT [dbo].[BusMaster] ([BusId], [BusNo], [BustType], [TotalSeat], [SeatColumn], [SeatRow], [BookedSeat], [AvailableSeats], [BusName]) VALUES (6, N'A254635', N'Normal', 54, 9, 6, 0, 54, N'Vasai-Virar')
SET IDENTITY_INSERT [dbo].[BusMaster] OFF
/****** Object: Table [dbo].[BookingMaster] Script Date: 04/30/2017 19:37:11 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[BookingMaster](
[BookingId] [int] IDENTITY(1,1) NOT NULL,
[RegId] [int] NULL,
[BusId] [int] NULL,
[Fname] [varchar](50) NULL,
[Lname] [varchar](50) NULL,
[Email] [varchar](50) NULL,
[Contact] [varchar](50) NULL,
[City] [varchar](50) NULL,
[SeatNo] [nvarchar](50) NULL,
[TravelDate] [varchar](50) NULL,
[Origin] [varchar](50) NULL,
[Destination] [varchar](50) NULL,
[BoardingID] [int] NULL,
[Fare] [decimal](18, 2) NULL,
[PNRNo] [varchar](50) NULL,
[ScheduleID] [int] NULL,
CONSTRAINT [PK_BookingMaster] PRIMARY KEY CLUSTERED
(
[BookingId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[BookingMaster] ON
INSERT [dbo].[BookingMaster] ([BookingId], [RegId], [BusId], [Fname], [Lname], [Email], [Contact], [City], [SeatNo], [TravelDate], [Origin], [Destination], [BoardingID], [Fare], [PNRNo], [ScheduleID]) VALUES (13, 1, 3, N'Anand', N'Singh', N'abc@gmail.com', N'8291951419', N'Mumbai', N'34', N'25/03/2017', N'Mumbai', N'Pune', 5, CAST(800.00 AS Decimal(18, 2)), N'OR9IJW', 5)
INSERT [dbo].[BookingMaster] ([BookingId], [RegId], [BusId], [Fname], [Lname], [Email], [Contact], [City], [SeatNo], [TravelDate], [Origin], [Destination], [BoardingID], [Fare], [PNRNo], [ScheduleID]) VALUES (14, 1, 3, N'Anmo', N'Sharma', N'abc@gmail.com', N'9029451159', N'Mumbai', N'35', N'25/03/2017', N'Mumbai', N'Pune', 5, CAST(800.00 AS Decimal(18, 2)), N'OR9IJW', 5)
INSERT [dbo].[BookingMaster] ([BookingId], [RegId], [BusId], [Fname], [Lname], [Email], [Contact], [City], [SeatNo], [TravelDate], [Origin], [Destination], [BoardingID], [Fare], [PNRNo], [ScheduleID]) VALUES (15, 3, 3, N'Atul', N'Dubey', N'atul@gmail.com', N'98989898', N'mumbai', N'32', N'25/03/2017', N'Mumbai', N'Pune', 6, CAST(800.00 AS Decimal(18, 2)), N'6422EK', 5)
INSERT [dbo].[BookingMaster] ([BookingId], [RegId], [BusId], [Fname], [Lname], [Email], [Contact], [City], [SeatNo], [TravelDate], [Origin], [Destination], [BoardingID], [Fare], [PNRNo], [ScheduleID]) VALUES (16, 1, 5, N'Atul', N'Dubey', N'atul@gmail.com', N'9561454638', N'Mumbai', N'31', N'30/03/2017', N'Mumbai', N'Surat', 10, CAST(800.00 AS Decimal(18, 2)), N'W3TBAF', 8)
INSERT [dbo].[BookingMaster] ([BookingId], [RegId], [BusId], [Fname], [Lname], [Email], [Contact], [City], [SeatNo], [TravelDate], [Origin], [Destination], [BoardingID], [Fare], [PNRNo], [ScheduleID]) VALUES (17, 1, 5, N'Amit', N'Dubey', N'a@gmail.com', N'8888245689', N'Mumbai', N'32', N'30/03/2017', N'Mumbai', N'Surat', 10, CAST(800.00 AS Decimal(18, 2)), N'W3TBAF', 8)
INSERT [dbo].[BookingMaster] ([BookingId], [RegId], [BusId], [Fname], [Lname], [Email], [Contact], [City], [SeatNo], [TravelDate], [Origin], [Destination], [BoardingID], [Fare], [PNRNo], [ScheduleID]) VALUES (18, 1, 5, N'Suraj', N'Dubey', N'a@gmail.com', N'8945621547', N'Mumbai', N'33', N'30/03/2017', N'Mumbai', N'Surat', 10, CAST(800.00 AS Decimal(18, 2)), N'W3TBAF', 8)
INSERT [dbo].[BookingMaster] ([BookingId], [RegId], [BusId], [Fname], [Lname], [Email], [Contact], [City], [SeatNo], [TravelDate], [Origin], [Destination], [BoardingID], [Fare], [PNRNo], [ScheduleID]) VALUES (19, 2, 5, N'Neha', N'Dubey', N'neha@gmail.com', N'9029451159', N'Mumbai', N'26', N'28/03/2017', N'Mumbai', N'Surat', 9, CAST(500.00 AS Decimal(18, 2)), N'8DB5W0', 11)
INSERT [dbo].[BookingMaster] ([BookingId], [RegId], [BusId], [Fname], [Lname], [Email], [Contact], [City], [SeatNo], [TravelDate], [Origin], [Destination], [BoardingID], [Fare], [PNRNo], [ScheduleID]) VALUES (20, 2, 3, N'Atul', N'Dubey', N'atul@gmail.com', N'9029451159', N'Mumbai', N'11', N'30/03/2017', N'Mumbai', N'Pune', 6, CAST(250.00 AS Decimal(18, 2)), N'4ZEV3G', 14)
INSERT [dbo].[BookingMaster] ([BookingId], [RegId], [BusId], [Fname], [Lname], [Email], [Contact], [City], [SeatNo], [TravelDate], [Origin], [Destination], [BoardingID], [Fare], [PNRNo], [ScheduleID]) VALUES (21, 2, 3, N'Kiran', N'Dubey', N'kiran@tiwari.com', N'8888245689', N'Alamganj', N'12', N'30/03/2017', N'Mumbai', N'Pune', 6, CAST(250.00 AS Decimal(18, 2)), N'4ZEV3G', 14)
SET IDENTITY_INSERT [dbo].[BookingMaster] OFF
/****** Object: StoredProcedure [dbo].[addBordingDetails] Script Date: 04/30/2017 19:37:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create procedure [dbo].[addBordingDetails](
@RouteID int,
@PlaceName varchar(50),
@PlaceTime varchar(50),
@BusID int
)
as
set nocount on
begin
insert into dbo.PickUpStand
(RouteId,PlaceName,PlaceTime,BusID)
values(@RouteID,@PlaceName,@PlaceTime,@BusID)
end
GO
/****** Object: StoredProcedure [dbo].[ispUserRegistration] Script Date: 04/30/2017 19:37:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[ispUserRegistration](
@FName varchar(50)='',
@LName varchar(50),
@EmailId varchar(50),
@Address varchar(50),
@City varchar(50),
@PinCode varchar(15),
@ContactNo varchar(50),
@Password varchar(50),
@Ret_Val bigint output
)
as
set nocount on
begin
if exists(select Contact from dbo.Registration where Contact=@ContactNo)
begin
set @Ret_Val=-1;
end
else
begin
insert into dbo.Registration
(Fname,Lname,EmailId,Address,City,Picode,Contact,Password,CreatedDate)
values (@FName,@LName,@EmailId,@Address,@City,@PinCode,@ContactNo,@Password,GETDATE())
set @Ret_Val=@@IDENTITY;
end
end
GO
/****** Object: StoredProcedure [dbo].[ispUserLogin] Script Date: 04/30/2017 19:37:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create procedure [dbo].[ispUserLogin](
@MobileNo varchar(50),
@Password varchar(50)
)
as
set nocount on
begin
select * from dbo.Registration where Contact=@MobileNo and Password=@Password
end
GO
/****** Object: StoredProcedure [dbo].[ispUpdateBusData] Script Date: 04/30/2017 19:37:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create procedure [dbo].[ispUpdateBusData]( --ispGetBusDataByBusID 1
@BusID int,
@BusNo varchar(50),
@BusType varchar(50),
@seatColumn int,
@SeatRow int,
@BusName varchar(50),
@Origin varchar(50),
@Destination varchar(50)
)
as
set nocount on
begin
update dbo.BusMaster set
BusNo=@BusNo,BustType=@BusType,SeatColumn=@seatColumn,SeatRow=@SeatRow,BusName=@BusName
where BusId=@BusID
update dbo.RouteDetails set
Origin=@Origin,Destination=@Destination where BusID=@BusID
end
GO
/****** Object: StoredProcedure [dbo].[ispGetRouteDetails] Script Date: 04/30/2017 19:37:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create procedure [dbo].[ispGetRouteDetails]
as
set nocount on
begin
select * from dbo.RouteDetails
end
GO
/****** Object: StoredProcedure [dbo].[ispGetPNRDetails] Script Date: 04/30/2017 19:37:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create procedure [dbo].[ispGetPNRDetails](
@UserID int
)
as
set nocount on
begin
select * from dbo.PNRDetails where CreatedBy=@UserID
end
GO
/****** Object: StoredProcedure [dbo].[ispGetCity] Script Date: 04/30/2017 19:37:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create procedure [dbo].[ispGetCity]
as
set nocount on
begin
select * from dbo.CityDetails
end
GO
/****** Object: StoredProcedure [dbo].[ispGetBusDetailsForUpdation] Script Date: 04/30/2017 19:37:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[ispGetBusDetailsForUpdation]
as
set nocount on
begin
select BM.BusId,BM.BusNo,BM.BusName,BM.BustType,BM.SeatColumn,BM.SeatRow,RD.Origin,RD.Destination,RD.RouteID
from dbo.BusMaster BM
left join dbo.RouteDetails RD
on BM.BusId=RD.BusID
end
GO
/****** Object: StoredProcedure [dbo].[ispGetBusDataByBusID] Script Date: 04/30/2017 19:37:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[ispGetBusDataByBusID]( --ispGetBusDataByBusID 1
@BusID int
)
as
set nocount on
begin
select BM.BusId,BM.BusNo,BM.BustType,BM.SeatColumn,BM.BusName,BM.SeatRow,RD.Origin,RD.Destination,RD.RouteID
from dbo.BusMaster BM
left join dbo.RouteDetails RD
on BM.BusId=RD.BusID
where BM.BusId=@BusID
end
GO
/****** Object: StoredProcedure [dbo].[ispGetBookingReportByAdmin] Script Date: 04/30/2017 19:37:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[ispGetBookingReportByAdmin]
as
set nocount on
begin
select BM.Fname+''+BM.Lname as PaxName,BM.Email,BM.Contact,BM.SeatNo,Convert(varchar(11),CONVERT(SMALLDATETIME, BM.TravelDate, 103),13) as TravelDate,BM.Origin,BM.Destination,
Fare,UM.Fname+''+UM.Lname as BookedBy,BB.BusName From dbo.BookingMaster BM
left join dbo.BusMaster BB on BM.BusId=BB.BusId
left join dbo.Registration UM on UM.regId=BM.RegId
end
GO
/****** Object: StoredProcedure [dbo].[ispGetBookedSeatNo] Script Date: 04/30/2017 19:37:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[ispGetBookedSeatNo]( -- ispGetBookedSeatNo 1
@BusID int,
@TravelDate varchar(50)
)
as
set nocount on
begin
declare @scheduleId int;
select @scheduleId=ScheduleId from dbo.ScheduleMaster where BusId=@BusID and Date=@TravelDate
select isnull(SeatNo,0) as SeatNo from dbo.BookingMaster
where ScheduleId=@scheduleId
end
GO
/****** Object: StoredProcedure [dbo].[ispGetBoardingPoints] Script Date: 04/30/2017 19:37:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create procedure [dbo].[ispGetBoardingPoints](
@BusID int
)
as
set nocount on
begin
select * from dbo.PickUpStand where BusID=@BusID
end
GO
/****** Object: StoredProcedure [dbo].[ispGetAvailableBusDetails] Script Date: 04/30/2017 19:37:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[ispGetAvailableBusDetails]( --ispGetAvailableBusDetails 'Mumbai','Pune','03/25/2017'
@Origin varchar(50),
@Destination varchar(50),
@TravelDate varchar(50)
)
as
set nocount on
begin
declare @scheduleid int;
select @scheduleid=ScheduleId from dbo.ScheduleMaster where Date=@TravelDate
select BM.BusId,BM.BusName,BM.BusNo,BM.SeatColumn,BM.SeatRow,BM.BustType,BM.TotalSeat,SM.AvailableSeats,SM.Fare,SM.EstimatedTime,SM.DepartureTime,SM.ArivalTime
from dbo.BusMaster BM
left join dbo.ScheduleMaster SM
on SM.BusId=BM.BusId
left join dbo.RouteDetails RD
on RD.RouteID=SM.RouteID
where SM.Date=@TravelDate and RD.Origin=@Origin and RD.Destination=@Destination and SM.ScheduleId=@scheduleid
end
GO
/****** Object: StoredProcedure [dbo].[ispAddPNRDetails] Script Date: 04/30/2017 19:37:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[ispAddPNRDetails](
@PNRNo varchar(50),
@TotalAmount decimal(18,2),
@TotalTicket int,
@CreatedBy int
)
as
set nocount on
begin
insert into dbo.PNRDetails
(PNRNo,TotalAmount,TotalTickets,CreatedBy)
values(@PNRNo,@TotalAmount,@TotalTicket,@CreatedBy)
end
GO
/****** Object: StoredProcedure [dbo].[ispAddPassengerDetails] Script Date: 04/30/2017 19:37:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[ispAddPassengerDetails](
@RegId int,
@BusId int,
@Fname varchar(50),
@Lname varchar(50),
@Email varchar(50),
@Contact varchar(50),
@City varchar(50),
@SeatNo nvarchar(50),
@TravelDate varchar(50),
@Origin varchar(50),
@Destination varchar(50),
@BoardingId int,
@Fare decimal(18,2),
@TotalSeats int,
@PNRNo varchar(50)
)
as
set nocount on
begin
declare @BookedSeat int;
declare @AvailableSeats int;
declare @scheduleID int;
select @scheduleID=ScheduleId from dbo.ScheduleMaster where Date=@TravelDate
insert into dbo.BookingMaster
(RegId,BusId,Fname,Lname,Email,Contact,City,SeatNo,TravelDate,Origin,Destination,BoardingID,Fare,PNRNo,ScheduleID)
values(@RegId,@BusId,@Fname,@Lname,@Email,@Contact,@City,@SeatNo,@TravelDate,@Origin,@Destination,@BoardingId,@Fare,@PNRNo,@scheduleID)
select @BookedSeat=BookedSeats from dbo.ScheduleMaster where ScheduleId=@scheduleID
select @AvailableSeats=AvailableSeats from dbo.ScheduleMaster where ScheduleId=@scheduleID
update dbo.ScheduleMaster set BookedSeats=(@BookedSeat+1) where ScheduleId=@scheduleID
update dbo.ScheduleMaster set AvailableSeats=(@AvailableSeats-1) where ScheduleId=@scheduleID
end
GO
/****** Object: StoredProcedure [dbo].[ispAddCardDetails] Script Date: 04/30/2017 19:37:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[ispAddCardDetails](
@UserID int,
@CardType varchar(20),
@BankName varchar(50),
@CVVNo varchar(10),
@CardNo nvarchar(100),
@TotalAmount decimal(18,2)
)
as
set nocount on
begin
insert into dbo.CardDetails
(UserID,CardType,BankName,CVVNo,CardNo,TotalAmount)
values(@UserID,@CardType,@BankName,@CVVNo,@CardNo,@TotalAmount)
end
GO
/****** Object: StoredProcedure [dbo].[ispAddBusSchedule] Script Date: 04/30/2017 19:37:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[ispAddBusSchedule]( --ispGetBusDataByBusID 1
@Date varchar(50) ,
@BusID int,
@Fare decimal(18,2),
@EstimatdTime varchar(50),
@ArrivalTime varchar(50),
@DepartureTime varchar(50),
@RouteID int
)
as
set nocount on
begin
declare @AvailableSeats int;
select @AvailableSeats=AvailableSeats from dbo.BusMaster where BusId=@BusID
insert into dbo.ScheduleMaster
(Date,Fare,EstimatedTime,ArivalTime,DepartureTime,RouteID,BusId,AvailableSeats,BookedSeats)
values(@Date,@Fare,@EstimatdTime,@ArrivalTime,@DepartureTime,@RouteID,@BusID,@AvailableSeats,0)
end
GO
/****** Object: StoredProcedure [dbo].[ispAddBusDetails] Script Date: 04/30/2017 19:37:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[ispAddBusDetails](
@BusNo varchar(50),
@BustType varchar(50),
@SeatColumn int,
@SeatRow int,
@Origin varchar(50),
@Destination varchar(50),
@BusName varchar(50)
)
as
set nocount on
begin
declare @Ret_Val int;
insert into dbo.BusMaster(BusNo,BustType,TotalSeat,SeatColumn,SeatRow,BookedSeat,AvailableSeats,BusName)
values(@BusNo,@BustType,(@SeatRow*@SeatColumn),@SeatColumn,@SeatRow,0,(@SeatRow*@SeatColumn),@BusName)
set @Ret_Val=@@IDENTITY;
if(@@ROWCOUNT>0)
begin
insert into dbo.RouteDetails(Origin,Destination,CreatedDate,BusID) values(@Origin,@Destination,GETDATE(),@Ret_Val)
end
if not exists (select CityName from dbo.CityDetails where CityName=@Origin)
begin
insert into dbo.CityDetails (CityName) values(@Origin)
end
if not exists (select CityName from dbo.CityDetails where CityName=@Destination)
begin
insert into dbo.CityDetails (CityName) values(@Destination)
end
end
GO
/****** Object: StoredProcedure [dbo].[GetPassengerDetails] Script Date: 04/30/2017 19:37:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[GetPassengerDetails]( --GetPassengerDetails '48TF1G'
@PNRNo varchar(50)
)
as
set nocount on
begin
select BM.Fname,BM.Lname,BM.Contact,BM.SeatNo,BM.TravelDate,BM.Origin,BM.Destination,PS.PlaceName
from dbo.BookingMaster BM
inner join dbo.PickUpStand PS on
PS.StandId=BM.BoardingID and BM.PNRNo=@PNRNo
declare @BusID int
select @BusID=(BusId) from dbo.BookingMaster where PNRNo=@PNRNo
declare @BusName varchar(50)
declare @DeptTime varchar(50)
declare @PlaceName varchar(50)
declare @TotalAmount decimal(18,2)
declare @TotalTickets int;
select @PlaceName=PlaceName from dbo.PickUpStand where BusID=@BusID
select @BusName=BusName from dbo.BusMaster where BusId=@BusID
select @PNRNO=PNRNo from dbo.BookingMaster where PNRNo=@PNRNo
select @DeptTime=PlaceTime from dbo.PickUpStand where PlaceName=@PlaceName
select @TotalAmount=TotalAmount,@TotalTickets=TotalTickets from dbo.PNRDetails where PNRNo=@PNRNo
select @BusName as BusName,@PNRNO as PNRNo,@DeptTime as DeptTime,@TotalAmount as Amount,@TotalTickets as TotalTickets
end
GO