Railway Reservation System Build in Visual Basic
Railway Reservation System Build in Visual Basic
Submitted in Partial Fulfillment of the Requirement for the Degree of Bachelor of Computer Applications
Submitted By:
Mohd. Mohsin Roll No.915124
CERTIFICATE
This is to certify that Mr. Mohd. Mohsin, student of B.C.A. course of M. J. P. Rohailkhand University, has undergone a mandatory FINAL SEMESTER PROJECT in our institute . During the course of his project development he has completed a project on RAILWAY RESERVATION SYSTEM . This project is in partial fulfillment for the requirement of B.C.A. Curriculum as per university norms .We wish him all the best in his carrier.
ACKNOWLEDGEMENT
All praise to almighty God under whose auspicious blessing I have been able to accomplish my dissertation successfully. This presentation is based on my study and practice during sixth semester of B.C.A. through I have tried my best for making this project unique in itself, still flexible at few points. Its with pride and deepest sense of gratitude that I place my profound expression towards. My college INVERTIS INSTITUTE OF MANAGEMENT STUDIES
BAREILLY
And its illustrious staffs especially our most respected Mr. Arpan Khastgeer
(Director, IIMS)
(HOD, B.C.A.) & Mr. Kushal Johari For their matured and inspiring
guidance. I would like to thank lab faculties namely Mr. Mahmood Sir for their sincere help in completion of my project work. I am also grateful to my friends for their valuable suggestions and words o f inspiration for my project work i.e. RAILWAY RESERVATION SYSTEM my sincere thanks are due to my parents for their co -operation and encouragement.
Index
1. INTRODUCTION 2. PROBLEM DEFINITION 3. SYSTEM ANALYSIS AND FEASIBLITY STUDY 4. SCOPE OF PROPOSED SYSTEM 5. SYSTEM REQUIREMENT A. HARDWARE REQUIREMENT B. SOFTWARE REQUIREMENT I. FRONT END II. BACK END 6. SYSTEM LOGICAL DESIGN A. DFD B. DATA DICTIONARY C. E-R DIAGRAM 7. SYSTEM PHYSICAL DESIGN 8. INPUT/OUTPUT SCREEN 9. TESTING 10. 11. 12. IMPLEMENTATION LIMITATIONS AND FUTURE SCOPE BIBLIOGRAPHY 3 7 9 13 15 16 16 17 19 21 24 25 26 27 49 54 57 59 63
LIST OF ABBREVIATIONS
Examid-examination identity VB- Visual basic Ghz- Gegahertz VGA-Video Graphic Array SVGA-Super Video Graphic Array Ms-access 2003/07-Ms.Access 2003 or Ms. Access 2007 Loginid-Username identity Txt.username-text username Txt.password-text password Rslt- result Db- database 1NF-first normal form 2NF-second normal form 3NF- third normal form
INTRODUCTION
INTRODUCTION
Proposed Railway Reservation System is developed for to automate the railway reservation system. It includes modules required to successfully operate railway reversion process smoothly. It has train master to add modify train information, Train schedule to enter train journey details include all the station name, arrival time and departure time. It includes automatic fare calculation as per the distance between two stations. Reservation module consist of automatic seat no and coach no allocation system. Daily schedule for updation of not confirm seat and coach no. All master like train master, train schedule, reservation fees, cancellation fees charges can be modified individually from front end and changes reflect in all modules immediately. Therefore proposed Railway Reservation System has been designed to automate the process of railway for ticket reservation and back office activities. System can make the daily activities efficient and providing the fast response.
Maintain user master- Each user identified by the user name and user type. Only admin user can create, edit user information.
y y y
Password must be 6 characters long. Password must be alpha numeric. While creating user system assign default password for the user, user must change default password for first time login.
All login time stamp stored in the system for security audit.
Access level and roles and privileges are set for different type of users.
Master Management module - Master management module includes following sub modules.
Station Master Every station is uniquely identified by system generated Station ID. It also includes station code, station name and railway division name.
Train Master Every train uniquely identified by train no, it includes train name, train schedule which days of the week train will run. No of coaches available for 3 tier AC, First Class, Slipper Class etc.
Train Schedule It includes train journey details from start station to end station, all in between station, distances between 2 station, arrival and departure time.
Fare Rule It help to calculate fare by distance, support different type of fare calculation for different class like AC1, AC3 etc.
Cancellation Fees Rule - It provide the master data for all ticket cancellation fees calculation. Reservation and Super Fast Fees It provide the master data for all ticket cancellation fees calculation.
Reservation This module used to make reservation, it asks for input data like train no, journey date, from station code, end station code. System has powerful validation rule to check validation like journey date must be greeter than system date, journey date must be within 90 days. Train should run for the selected day. Check for from station and to station. Seat availability, While saving the record system generate PRN no, seat no and coach no. Before save the system ask for final confirmation. System automatically calculates the fare and save the details.
Cancellation For cancellation of ticket it ask for PRN no, after entering the correct PRN no system check for validity of the PRN no, whether it already cancelled, journey date already expired. I it validate system display all the details of the reservation. System automatically calculates the cancellation fees from the cancellation rule master. Before save the record system ask for the confirmation.
Update Seat no for unconfirmed passenger It is schedule activity, system query for all cancelled ticket for particular journey date and allocates all vacant seat to unconfirmed passenger.
Daily Cash Transaction It shows daily transaction, like how much money received and how much money refund. All data can be exported to MS Excel for review and save in file system.
Query Module - A powerful query module give on screen information for particular PRN NO, it shows all the reservation details and cancellation details, include current status for the seat no, coach no.
Complete end to end system for all the activities related to railway reservation system. Supports the full life cycle of ticket reservation, seat allocation, and ticket cancellation. Reschedule the cancel seat to unconfirmed passenger. It is a scalable system. Has a clearly arranged and user-friendly interface Easy to use and minimum data entry, all important details is mater driven and provide in drop down list to make fast operation and avoid mistake.
y y y
Automatic fare calculation from stage master, in new updation of fare in stage master will automatically reflect in all new reservation.
y y y
All important details can be updated by front end master module only. Retrieval of forgotten passwords. Integrated security features.
10
PROBLEM
DEFINITION
11
Problem definition
Existing system
In the existing system the exams are done only manually and proposed system we have to computerize all the exams using this software. The whole process of assigning test and evaluating their scores after the test ,was done manually till date. Processing the test paper i.e. checking and distributing respective scores used to take time when the software was not installed.
12
13
SYSTEM ANALYSIS
Introduction to System Analysis
System analysis is a process of gathering and interpreting facts, diagnosing problems and the information to recommend improvements on the system. It is a problem solving activity that requires intensive communication between the system users and system developers. System analysis or study is an important phase of any system development process. The system is studied to the minutest detail and analyzed. The system analyst plays the role of the interrogator and dwells deep into the working of the present system. The system is viewed as a whole and the input to the system are identified. The outputs from the organizations are traced to the various processes. System analysis is concerned with becoming aware of the problem, identifying the relevant and decisional variables, analyzing and synthesizing the various factors and determining an optimal or at least a satisfactory solution or program of action. A detailed study of the process must be made by various techniques like interviews, questionnaires etc. The data collected by these sources must be scrutinized to arrive to a conclusion. The conclusion is an understanding of how the system functions. This system is called the existing system. Now the existing system is subjected to close study and problem areas are identified. The designer now functions as a problem solver and tries to sort out the difficulties that the enterprise faces. The solutions are given as proposals. The proposal is then weighed with the existing system analytically and the best one is selected. The proposal is presented to the user for an endorsement by the user. The proposal is reviewed on user request and suitable changes are made. This is loop that ends as soon as the user is satisfied with proposal. Preliminary study is the process of gathering and interpreting facts, using the information for further studies on the system. Preliminary study is problem solving
14
activity that requires intensive communication between the system users and system developers. It does various feasibility studies. In these studies a rough figure of the system activities can be obtained, from which the decision about the strategies to be followed for effective system study and analysis can be take
FEASIBILITY STUDY
Feasibility study is made to see if the project on completion will serve the purpose of the organization for the amount of work, effort and the time that spend on it. Feasibility study lets the developer foresee the future of the project and the usefulness. A feasibility study of a system proposal is according to its workability, which is the impact on the organization, ability to meet their user needs and effective use of resources. Thus when a new application is proposed it normally goes through a feasibility study before it is approved for development. The document provide the feasibility of the project that is being designed and lists various areas that were considered very carefully during the feasibility study of this project such as Technical, Economic and Operational feasibilities. The following are its features:
TECHNICAL FEASIBILITY
The system must be evaluated from the technical point of view first. The assessment of this feasibility must be based on an outline design of the system requirement in the terms of input, output, programs and procedures. Having identified an outline system, the investigation must go on to suggest the type of equipment, required method developing the system, of running the system once it has been designed. Technical issues raised during the investigation are:
Does the existing technology sufficient for the suggested one? Can the system expand if developed?
15
The project should be developed such that the necessary functions and performance are achieved within the constraints. The project is developed within latest technology. Through the technology may become obsolete after some period of time, due to the fact that never version of same software supports older versions, the system may still be used. So there are minimal constraints involved with this project. The system has been developed using Java the project is technically feasible for development.
ECONOMIC FEASIBILITY
The developing system must be justified by cost and benefit. Criteria to ensure that effort is concentrated on project, which will give best, return at the earliest. One of the factors, which affect the development of a new system, is the cost it would require. The following are some of the important financial questions asked during preliminary investigation:
The costs conduct a full system investigation. The cost of the hardware and software. The benefits in the form of reduced costs or fewer costly errors.
Since the system is developed as part of project work, there is no manual cost to spend for the proposed system. Also all the resources are already available, it give an indication of the system is economically possible for development.
BEHAVIORAL FEASIBILITY
This includes the following questions: Is there sufficient support for the users? Will the proposed system cause harm?
16
The project would be beneficial because it satisfies the objectives when developed and installed. All behavioral aspects are considered carefully and conclude that the project is behaviorally feasible.
17
y y y y y y y y y
Security of data. Ensure data accuracys. Proper control of the higher officials. Minimize manual data entry. Minimum time needed for the various processing. Greater efficiency. Better service. User friendliness and interactive. Minimum time required.
18
System Requirement
19
System Requirement
: VGA/SVGA
Keyboard
: 104 Keys
Mouse
: 2 buttons/ 3 buttons
Software Requirements
Operating System Front end Back end : Windows 2000/XP : Visual Ba sic 6.0 : Ms-Access 2003/07
20
Front end
21
Visual Basic 6.0 is Microsofts latest version of the Visual Basic Programming language. Although writing programs can be a tedious chore at time. Visual Basic reduces the effort required on your part, and makes programming enjoyable. Visual Basic makes many aspects of programming as simple as dragging graphics objects on to screen with your mouse. Visual Basic 6.0 is more than just a programming language; the secret to Visual Basic is in its name Visual. With to days Windows Operating System, a program must be able to interact with the screen. Keyboard , mouse and printer graphically. The environment provided by Visual Basic is suitable for any type of application. Using this environment, the user can visually design the objects that your application uses. Visual Basic is not just a languages, its an integrated development environment in which you can develop, run, test and debug your applications. The impressive array of programming resources provided by Visual Basic enables to create the objects extemporaneously which can range from pop-up menu to a message box. A form is a major part of Visual Basic application, which allows the user to enter the data as well as view the result. A control is an object that we draw on a form to enable or enhance user interaction with an application. Hence a Visual Basic application is a combination of object like forms and controls, procedures that can respond to Events and other generalpurpose procedures.
22
Backend
23
Access now includes support for a broader range of data types, including documents and images. Whenever any table is updated, all reports referencing the table are also updated. Dropdown lists for a table can be modified in place. Lookup Fields, which get their values by "looking up" some value in a table, have been updated to support multi valued lookups. Many new preset schemata are included. Access can synchronize with Windows SharePoint Services 3.0 and Office SharePoint Server 2007. This feature enables a user to use Access reports while using a serverbased, backed-up, IT managed version of the data.
24
25
_ Process
26
_ Storage
27
28
Data dictionary
A data dictionary is a structured repository of data about data. It is a set of rigorous definitions of all DFD data elements and data structures. A data dictionary has many advantages .The most obvious is documentation ;it is a valuable reference in any organization . Another advantage is improving analyst/user communication by establishing consistent definitions of various elements , terms , and procedures . also control information maintained for each data element is cross-referenced in the data dictionary. A data dictionary is an important step in developing a database. Database users and application developers can benefit from an authoritative data dictionary document that catalogs the organization, contents, and conventions of one or more databases. This typically includes the names and descriptions of various tables and fields in each database, plus additional details, like the type and length of each data element. There is no universal standard as to the level of detail in such a document, but it is primarily a weak kind of data. The three classes to be defined are data elements, data structures, and data flows and data stores.
y
Data element is the smallest unit of data that provides for no further decomposition. Data structure is a group of data elements handled as a unit.
Data flows and data stores are data structures in motion and data structures at rest, respectively.
29
30
31
SYSTEM DESIGN
Introduction to System Design
Design is the first step into the development phase for any engineered product or system. Design is a creative process. A good design is the key to effective system. The term design is defined as the process of applying various techniques and principles for the purpose of defining a process or a system in sufficient detail to permit its physical realization. It may be defined as a process of applying various techniques and principles for the purpose of defining a device, a process or a system in sufficient detail to permit its physical realization. Software design sits at the technical kernel of the software engineering process and is applied regardless of the development paradigm that is used. The system design develops the architectural detail required to build a system or product. As in the case of any systematic approach, this software too has undergone the best possible design phase fine tuning all efficiency, performance and accuracy levels. The design phase is a transition from a user oriented document to a document to the programmers or database personnel. System design goes through two phases of development: Logical and Physical Design.
Input design
The design of input focuses on controlling the amount of input required, controlling the errors, avoiding delay, avoiding extra steps and keeping the process simple. The input is designed in such a way so that it provides security and ease of use with retaining the privacy. Input Design considered the following things:
32
o How the data should be arranged or coded? o The dialog to guide the operating personnel in providing input. o Methods for preparing input validations and steps to follow when error occur.
OUTPUT DESIGN A quality output is one, which meets the requirements of the end user and presents the information clearly. In output design it is determined how the information is to be displaced for immediate need and also the hard copy output. It is the most important and direct source information to the user. Efficient and intelligent output design improves the systems relationship to help user decision-making.
Designing computer output should proceed in an organized, well thought out manner; the right output must be developed while ensuring that each output element is designed so that people will find the system can use easily and effectively. When analysis design computer output, they should : Identify the specific output that is needed to meet the requirements. Select methods for presenting information. Create document, report, or other formats that contain information produced by the system.
33
Sample Coding
Dim SSQL As String Dim rs4a As New ADODB.Recordset Private Sub Command1_Click() Load Form2 Form2.Show End Sub Private Sub Command2_Click() PNR = InputBox("ENTER THE PNR NO") If Len(PNR) > 0 Then If rs4a.State = 1 Then rs4a.Close rs4a.CursorLocation = adUseClient rs4a.Open "select * FROM PASSENGER WHERE PNR_NO = '" & PNR & "'", Cn, adOpenDynamic, adLockOptimistic TRAINNO = rs4a.Fields(2) SOURCE = rs4a.Fields(4) DESTINATION = rs4a.Fields(5) COACH = rs4a.Fields(7) JORDATE = rs4a.Fields(9) Load unres unres.Show End If End Sub Private Sub Command3_Click() Load trainlist trainlist.Show End Sub Private Sub Command4_Click() Load FARE FARE.Show End Sub Private Sub Command5_Click() Load Form1 Form1.Show End Sub Private Sub Command6_Click() Load TRAININFO_DETAILS
34
TRAININFO_DETAILS.Show End Sub Private Sub Command7_Click() PNR = InputBox("ENTER THE PNR NO") If Len(PNR) > 0 Then If rs4a.State = 1 Then rs4a.Close rs4a.CursorLocation = adUseClient rs4a.Open "select * FROM PASSENGER WHERE PNR_NO = '" & PNR & "'", Cn, adOpenDynamic, adLockOptimistic TRAINNO = rs4a.Fields(2) SOURCE = rs4a.Fields(4) DESTINATION = rs4a.Fields(5) COACH = rs4a.Fields(7) JORDATE = rs4a.Fields(9) Load printticket printticket.Show End If End Sub Private Sub Form_Load() End Sub Private Sub second_Click() Unload seco Load ir ir.Show End Sub TRAIN INFO DETAILS Dim SQL As String Dim COACH As String Private Sub CAN_Click() Unload Me Me.Hide End Sub Private Sub Command1_Click() Dim DT As Date Dim I As Integer Dim N As Integer
35
DT = FROMDATE.Value If Text1.Text = "" Then Text1.Text = "0" Text5.Text = "0" End If If Text2.Text = "" Then Text2.Text = "0" Text6.Text = "0" End If If Text3.Text = "" Then Text3.Text = "0" Text7.Text = "0" End If If Text8.Text = "" Then Text4.Text = "0" Text8.Text = "0" End If
Cn.BeginTrans SSQL = "insert into INFO_TRAIN(TRAIN_NO, SLEEPER_SEATS, 1AC_SEATS, 2AC_SEATS, 3AC_SEATS,SLEEPER_FARE,1AC_FARE,2AC_FARE,3AC_FAR E,FROMDATE,TODA TE) values ('" & Label3.Caption & "'," & Text1.Text & "," & Text2.Text & "," & Text3.Text & "," & Text4.Text & "," & Text5.Text & "," & Text6.Text & "," & Text7.Text & "," & Text8.Text & ",'" & Format$(FROMDATE.Value, "d/M/yyyy") & "','" & Format$(TODATE.Value, "d/M/yyyy") & "' )" Cn.Execute SSQL Cn.CommitTrans MsgBox "TRAIN " & TRAINNO & " created.", vbInformation For I = 1 To 90 DT = DT + 1 If Len(Text1.Text) > 0 Then N = Val(Text1.Text) For J = 1 To N COACH = "S" & J Cn.BeginTrans SSQL = "INSERT INTO COACH (TRAIN_NO,COACHES,SEATS,DATEOFJOUR) VALUES ( '" & TRAINNO & "','" & COACH & "', 30 ,'" & Format$(DT, "d/M/yyyy") & "' )" Cn.Execute SSQL Cn.CommitTrans Next J End If If Len(Text2.Text) > 0 Then
36
N = Val(Text2.Text) For J = 1 To N COACH = "A1" & J Cn.BeginTrans SSQL = "INSERT INTO COACH (TRAIN_NO,COACHES,SEATS,DATEOFJOUR) VALUES ( '" & TRAINNO & "','" & COACH & "', 30 ,'" & Format$(DT, "d/M/yyyy") & "' )" Cn.Execute SSQL Cn.CommitTrans Next J End If If Len(Text3.Text) > 0 Then N = Val(Text3.Text) For J = 1 To N COACH = "A2" & J Cn.BeginTrans SSQL = "INSERT INTO COACH (TRAIN_NO,COACHES,SEATS,DATEOFJOUR) VALUES ( '" & TRAINNO & "','" & COACH & "', 30 ,'" & Format$(DT, "d/M/yyyy") & "' )" Cn.Execute SSQL Cn.CommitTrans Next J End If If Len(Text4.Text) > 0 Then N = Val(Text4.Text) For J = 1 To N COACH = "A3" & J Cn.BeginTrans SSQL = "INSERT INTO COACH (TRAIN_NO,COACHES,SEATS,DATEOFJOUR) VALUES ( '" & TRAINNO & "','" & COACH & "', 30 ,'" & Format$(DT, "d/M/yyyy") & "' )" Cn.Execute SSQL Cn.CommitTrans Next J End If Next I
37
' Exit Sub 'ErrorHandler: 'cn.RollbackTrans ' MsgBox "TRAIN " & TRAIN_NO.Text & " not created.", vbInformation End Sub Private Sub Form_Load() If F = 0 Then TRAINNO = InputBox("ENTER TRAIN NO") End If Label3.Caption = TRAINNO FROMDATE.Value = Now TODATE.Value = DateAdd("m", 3, Now) End Sub
SEARCH FOR TRAIN Dim SSQL As String Public TempRS As New ADODB.Recordset Dim ds4 As Connection Dim rs4 As Recordset Dim rs4a As New ADODB.Recordset Dim RS As New ADODB.Recordset Private Sub Command1_Click() Dim rs4a As New ADODB.Recordset rs4a.CursorLocation = adUseClient rs4a.Open "select TRAIN_NO,TRAIN_NAME,SOUR_CODE,DEST_CODE,SOU_TIME,DEST_TIME from TRAIN WHERE SOUR_CODE = '" & Combo1.Text & "' AND DEST_CODE= '" & Combo2.Text & "'", Cn, adOpenDynamic, adLockOptimistic On Error GoTo ErrorHandler 'ErrorHandler: 'Print 'rs4a.Close 'Set RS = New ADODB.Recordset 'RS.CursorLocation = adUseClient 'RS.Open "SELECT ", Cn, adOpenDynamic, adLockOptimistic, ADDCMD.Text Set MSF.DataSource = rs4a ErrorHandler: Print rs4a.Close
38
End Sub Private Sub Command2_Click() If rs4a.State = 1 Then rs4a.Close JORDATE = DTPicker1.Value SOURCE = Combo1.Text DESTINATION = Combo2.Text If Option1.Value = True Then COACH = "S1" ElseIf Option2.Value = True Then COACH = "A1" ElseIf Option3.Value = True Then COACH = "A21" ElseIf Option4.Value = True Then COACH = "A31" End If TRAINNO = MSF.TextMatrix(MSF.Row, 1) Load reserveform reserveform.Show Unload Me Me.Hide End Sub Private Sub Form_Load() DTPicker1.Value = Now 'Set rs4a = New Recordset 'Me.print1.Enabled = False End Sub Sub MsfInit() MSF.Clear MSF.ColWidth(0) = 800 MSF.ColWidth(1) = 1000 MSF.TextMatrix(0, 0) = "Site No." MSF.TextMatrix(0, 1) = "Dimantion" End Sub Sub DisRecords() If TempRS.State = 1 Then TempRS.Close TempRS.Open "select SiteId,Sdie from SiteDet order by SiteId,SName", Conn RNo = 1 MsfInit Do While Not TempRS.EOF MSF.TextMatrix(RNo, 0) = TempRS(0) MSF.TextMatrix(RNo, 1) = TempRS(1) TempRS.MoveNext
39
RNo = RNo + 1 Loop End Sub Private Sub Option1_Click() If rs4a.State = 1 Then rs4a.Close Command2.Enabled = False Dim N As String Label5.Caption = "" 'MsgBox ("HELLO" & MSF.TextMatrix(MSF.Row, 1)) 'If MSF.TextMatrix(MSF.Row, 0) = "" Then Exit Sub N = MSF.TextMatrix(MSF.Row, 1) MsgBox (Format$(DTPicker1.Value, "d/M/yyyy")) If Option1.Value = True Then rs4a.Open "SELECT SUM(SEATS) FROM COACH WHERE COACHES LIKE 'S%' AND DATEOFJOUR LIKE '" & Format$(DTPicker1.Value, "M/d/yyyy") & "' AND TRAIN_NO = '" & N & "'", Cn, adOpenDynamic, adLockOptimistic Label5.Caption = "NO OF SEATS AVAILABLE = " & rs4a.Fields(0) End If If rs4a.Fields(0) > 0 Then Command2.Enabled = True End If rs4a.Close End Sub Private Sub Option2_Click() If rs4a.State = 1 Then rs4a.Close Command2.Enabled = False Dim N As String Label5.Caption = "" 'MsgBox ("HELLO" & MSF.TextMatrix(MSF.Row, 1)) 'If MSF.TextMatrix(MSF.Row, 0) = "" Then Exit Sub N = MSF.TextMatrix(MSF.Row, 1) MsgBox (Format$(DTPicker1.Value, "d/M/yyyy")) If Option2.Value = True Then rs4a.Open "SELECT SUM(SEATS) FROM COACH WHERE COACHES LIKE 'A1%' AND DATEOFJOUR LIKE '" & Format$(DTPicker1.Value, "M/d/yyyy") & "' AND TRAIN_NO = '" & N & "'", Cn, adOpenDynamic, adLockOptimistic Label5.Caption = "NO OF SEATS AVAILABLE = " & rs4a.Fields(0) End If If rs4a.Fields(0) > 0 Then Command2.Enabled = True End If
40
'rs4a.Close End Sub Private Sub Option3_Click() If rs4a.State = 1 Then rs4a.Close Command2.Enabled = False Dim N As String Label5.Caption = "" 'MsgBox ("HELLO" & MSF.TextMatrix(MSF.Row, 1)) 'If MSF.TextMatrix(MSF.Row, 0) = "" Then Exit Sub N = MSF.TextMatrix(MSF.Row, 1) MsgBox (Format$(DTPicker1.Value, "d/M/yyyy")) If Option3.Value = True Then rs4a.Open "SELECT SUM(SEATS) FROM COACH WHERE COACHES LIKE 'A2%' AND DATEOFJOUR LIKE '" & Format$(DTPicker1.Value, "M/d/yyyy") & "' AND TRAIN_NO = '" & N & "'", Cn, adOpenDynamic, adLockOptimistic Label5.Caption = "NO OF SEATS AVAILABLE = " & rs4a.Fields(0) End If If rs4a.Fields(0) > 0 Then Command2.Enabled = True End If 'rs4a.Close End Sub Private Sub Option4_Click() If rs4a.State = 1 Then rs4a.Close Command2.Enabled = False Dim N As String Label5.Caption = "" 'MsgBox ("HELLO" & MSF.TextMatrix(MSF.Row, 1)) 'If MSF.TextMatrix(MSF.Row, 0) = "" Then Exit Sub N = MSF.TextMatrix(MSF.Row, 1) MsgBox (Format$(DTPicker1.Value, "d/M/yyyy")) If Option4.Value = True Then rs4a.Open "SELECT SUM(SEATS) FROM COACH WHERE COACHES LIKE 'A3%' AND DATEOFJOUR LIKE '" & Format$(DTPicker1.Value, "M/d/yyyy") & "' AND TRAIN_NO = '" & N & "'", Cn, adOpenDynamic, adLockOptimistic Label5.Caption = "NO OF SEATS AVAILABLE = " & rs4a.Fields(0) End If If rs4a.Fields(0) <> Null Then
41
Command2.Enabled = True End If 'rs4a.Close End Sub Private Sub Text1_Change() If rs4a.State = 1 Then rs4a.Close rs4a.Open "select DISTINCT(SOUR_CODE) from TRAIN WHERE SOURCE LIKE '" & Text1.Text & "%'", Cn, adOpenStatic, adLockOptimistic Combo1.Clear On Error GoTo ErrorHandler rs4a.MoveFirst While (Not rs4a.EOF) Me.Combo1.AddItem (rs4a.Fields(0)) 'Me.Combo2.AddItem (rs4a.Fields(6)) rs4a.MoveNext Wend ErrorHandler: Print rs4a.Close End Sub Private Sub Text2_Change() If rs4a.State = 1 Then rs4a.Close rs4a.Open "select DISTINCT(DEST_CODE) from TRAIN WHERE DESTINATION LIKE'" & Text2.Text & "%'", Cn, adOpenStatic, adLockOptimistic Combo2.Clear On Error GoTo ErrorHandler rs4a.MoveFirst While (Not rs4a.EOF) 'Me.Combo1.AddItem (rs4a.Fields(4)) Me.Combo2.AddItem (rs4a.Fields(0)) rs4a.MoveNext Wend ErrorHandler: Print rs4a.Close End Sub
RESERVATION
42
Dim SSQL As String Dim rs4a As New ADODB.Recordset Dim pn As String Dim SEAT As Integer Dim NO As Integer Private Sub back_Click() Unload reserveform Load seco seco.Show End Sub
Private Sub Command1_Click() PNR = pn Load printticket printticket.Show Unload Me Me.Hide End Sub Private Sub Command2_Click() AA: pn = InputBox("ENTER THE THE PNR NO") If pn = "" Then GoTo AA End If If rs4a.State = 1 Then rs4a.Close rs4a.CursorLocation = adUseClient On Error GoTo ERR rs4a.Open "select MAX(SEAT) from PASSENGER WHERE TRAIN_NO = '" & TRAINNO & "' AND SOURCE = '" & SOURCE & "' AND DESTINATION = '" & DESTINATION & "' AND COACH_NO LIKE '" & COACH & "' AND DATE_OFJOUR LIKE '" & Format$(JORDATE, "M/d/yyyy") & "'", Cn, adOpenDynamic, adLockOptimistic NO = rs4a.Fields(0) ERR: N0 = 0 SEAT = NO For I = 0 To 5 SEAT = SEAT + 1 If Text3(I).Text = "" Then Exit For Cn.BeginTrans SSQL = "INSERT INTO PASSENGER (PNR_NO,TRAIN_NO,TRAIN_NAME,SOURCE,DESTINATION,PASS_NAME,COACH _NO,SEAT,DATE_OFJOUR,AGE,SEX,CITIZEN,BIRTH ) VALUES ( '" & pn & "','" &
43
TRAINNO & "','" & TRAIN_NAME.Text & "','" & SOURCE & "','" & DESTINATION & "','" & Text3(I).Text & "','" & COACH & "'," & SEAT & ",'" & Format$(JORDATE, "d/M/yyyy") & "'," & Val(Text9(I).Text) & ",'" & Combo1(I).Text & "','NO' ,'" & Combo2(I).Text & "' )" Cn.Execute SSQL Cn.CommitTrans Cn.BeginTrans SSQL = "UPDATE COACH SET SEATS = SEATS - 1 WHERE COACHES LIKE '" & COACH & "' AND DATEOFJOUR LIKE '" & Format$(JORDATE, "M/d/yyyy") & "' AND TRAIN_NO = '" & TRAINNO & "'" Cn.Execute SSQL Cn.CommitTrans Next I Exit Sub MsgBox ("TICKET CREATED") Command2.Visible = False Command1.Value = True 'ERR: 'MsgBox ("VALUES ARE NOT PROPERLY HANDLE") End Sub Private Sub Command3_Click() End Sub Private Sub Form_Load() tr = TRAINNO Text15.Text = SOURCE Text16.Text = DESTINATION Text17.Text = JORDATE lass = COACH If rs4a.State = 1 Then rs4a.Close rs4a.CursorLocation = adUseClient rs4a.Open "select TRAIN_NAME from TRAIN WHERE TRAIN_NO = '" & TRAINNO & "'", Cn, adOpenDynamic, adLockOptimistic TRAIN_NAME = rs4a.Fields(0)
For I = 0 To 5 Combo1(I).AddItem ("MALE") Combo1(I).AddItem ("FEMALE") Combo2(I).AddItem ("LOWER") Combo2(I).AddItem ("MIDDLE") Combo2(I).AddItem ("UPPER")
44
PRINT TICKET Dim SSQL As String Dim rs4a As New ADODB.Recordset Dim NO As Integer Dim FARE As Integer
Private Sub back_Click() Unload Me Load seco seco.Show Mode End Sub Private Sub Form_Load() Text1.Text = PNR Text3.Text = Format$(JORDATE, "M/d/yyyy") Text4.Text = TRAINNO Text6.Text = SOURCE Text7.Text = DESTINATION Text10 = COACH If rs4a.State = 1 Then rs4a.Close rs4a.CursorLocation = adUseClient rs4a.Open "select TRAIN_NAME from TRAIN WHERE TRAIN_NO = '" & TRAINNO & "'", Cn, adOpenDynamic, adLockOptimistic Text5.Text = rs4a.Fields(0) If rs4a.State = 1 Then rs4a.Close rs4a.CursorLocation = adUseClient rs4a.Open "select PASS_NAME,COACH_NO,SEAT,AGE,SEX,CITIZEN,BIRTH from PASSENGER WHERE PNR_NO = '" & PNR & "'", Cn, adOpenDynamic, adLockOptimistic Set MSF.DataSource = rs4a If rs4a.State = 1 Then rs4a.Close
45
rs4a.CursorLocation = adUseClient rs4a.Open "select COUNT(*) from PASSENGER WHERE PNR_NO = '" & PNR & "'", Cn, adOpenDynamic, adLockOptimistic NO = rs4a.Fields(0) If Left(COACH, 1) = "S" Then If rs4a.State = 1 Then rs4a.Close rs4a.CursorLocation = adUseClient rs4a.Open "select SLEEPER_FARE from INFO_TRAIN WHERE TRAIN_NO = '" & TRAINNO & "'", Cn, adOpenDynamic, adLockOptimistic FARE = rs4a.Fields(0) ElseIf Left(COACH, 2) = "A1" Then If rs4a.State = 1 Then rs4a.Close rs4a.CursorLocation = adUseClient rs4a.Open "select [1AC_FARE] from INFO_TRAIN WHERE TRAINNO & "'", Cn, adOpenDynamic, adLockOptimistic FARE = rs4a.Fields(0) ElseIf Left(COACH, 2) = "A2" Then If rs4a.State = 1 Then rs4a.Close rs4a.CursorLocation = adUseClient rs4a.Open "select [2AC_FARE] from INFO_TRAIN WHERE TRAINNO & "'", Cn, adOpenDynamic, adLockOptimistic FARE = rs4a.Fields(0) TRAIN_NO = '" & TRAIN_NO = '" &
ElseIf Left(COACH, 2) = "A3" Then If rs4a.State = 1 Then rs4a.Close rs4a.CursorLocation = adUseClient rs4a.Open "select [3AC_FARE] from INFO_TRAIN WHERE TRAINNO & "'", Cn, adOpenDynamic, adLockOptimistic FARE = rs4a.Fields(0) End If FARE = FARE * NO Label2.Caption = Label2.Caption & FARE End Sub TRAIN_NO = '" &
46
DATABASE DESIGN
A database is an organized mechanism that has the capability of storing information through which a user can retrieve stored information in an effective and efficient manner. The data is the purpose of any database and must be protected. The database design is a two level process. In the first step, user requirements are gathered together and a database is designed which will meet these requirements as clearly as possible. This step is called Information Level Design and it is taken independent of any individual DBMS.
In the second step, this Information level design is transferred into a design for the specific DBMS that will be used to implement the system in question. This step is called Physical Level Design, concerned with the characteristics of the specific DBMS that will be used. A database design runs parallel with the system design. The organization of the data in the database is aimed to achieve the following two major objectives. Data Integrity Data independence Normalization is the process of decomposing the attributes in an application, which results in a set of tables with very simple structure. The purpose of normalization is to make tables as simple as possible. Normalization is carried out in this system for the following reasons.
y y y y
To structure the data so that there is no repetition of data , this helps in saving. To permit simple retrieval of data in response to query and report request. To simplify the maintenance of the data through updates, insertions, deletions. To reduce the need to restructure or reorganize data which new application requirements arise.
47
A relational model represents the database as a collection of relations. Each relation resembles a table of values or file of records. In formal relational model terminology, a row is called a tuple, a column header is called an attribute and the table is called a relation. A relational database consists of a collection of tables, each of which is assigned a unique name. A row in a tale represents a set of related values.
A table is a relation. The rows in a table are called tuples. A tuple is an ordered set of n elements. Columns are referred to as attributes. Relationships have been set between every table in the database. This ensures both Referential and Entity Relationship Integrity. A domain D is a set of atomic values. A common method of specifying a domain is to specify a data type from which the data values forming the domain are drawn. It is also useful to specify a name for the domain to help in interpreting its values. Every value in a relation is atomic, that is not decomposable.
RELATIONSHIPS:
Table relationships are established using Key. The two main keys of prime importance are Primary Key & Foreign Key. Entity Integrity and Referential Integrity Relationships can be established with these keys.Entity Integrity enforces that no Primary Key can have null values.Referential Integrity enforces that no Primary Key can have null values.
48
Referential Integrity for each distinct Foreign Key value, there must exist a matching Primary Key value in the same domain. Other key are Super Key and Candidate Keys.
Relationships have been set between every table in the database. This ensures both Referential and Entity Relationship Integrity.
NORMALIZATION:
As the name implies, it denoted putting things in the normal form. The application developer via normalization tries to achieve a sensible organization of data into proper tables and columns and where names can be easily correlated to the data by the user. Normalization eliminates repeating groups at data and thereby avoids data redundancy which proves to be a great burden on the computer resources. These includes:
Normalize the data. Choose proper names for the tables and columns. Choose the proper name for the data.
The first step is to put the data into First Normal Form. This can be donor by moving data into separate tables where the data is of similar type in each table. Each table is given a Primary Key or Foreign Key as per requirement of the project. In this we form new relations for each nonatomic attribute or nested relation. This eliminated repeating groups of data.
49
A relation is said to be in first normal form if only if it satisfies the constraints that contain the primary key only.
In this we decompose and setup a new relation for each partial key with its dependent attributes. Make sure to keep a relation with the original primary key and any attributes that are fully functionally dependent on it. This step helps in taking out data that is only dependant on apart of the key. A relation is said to be in second normal form if and only if it satisfies all the first normal form conditions for the primary key and every non-primary key attributes of the relation is fully dependent on its primary key alone.
In this we decompose and set up relation that includes the non-key attributes that functionally determines other non-key attributes. This step is taken to get rid of anything that does not depend entirely on the Primary Key.
A relation is said to be in third normal form if only if it is in second normal form and more over the non key attributes of the relation should not be depend on other non key attribute.
50
Table Design
TABLE : TRAIN Train_no Train_name Source Source code Destination Destination code Source time Destination time text text text text text text text text
TABLE TRAIN_INFO Train_no Sleeper seats 1ac seats 2ac seats 3ac seats Sleeper fare 1ac fare 2ac fare 3ac fare Fromdate Todate text number number number number number number number number date date
51
TABLE Pass number Pnr num Train no Train name Source Destination Pass name Coach no Seat Date of jour Age Sex Citizen Birth
PASSENGER auto number text text text text text text text number date number text text text
52
53
54
55
56
57
TESTING
58
SYSTEM TESTING
System testing is a critical aspect of Software Quality Assurance and represents the ultimate review of specification, design and coding. Testing is a process of executing a program with the intent of finding an error . A good test is one that has a probability of finding an as yet undiscovered error. The purpose of testing is to identify and correct bugs in the developed system. Nothing is complete without testing. Testing is the vital to the succes s of the system. In the code testing the logic of the developed system is tested. For this every module of the program is executed to find an error. To perform specification test, the examination of the specifications stating what the program should do and how it should perform under various conditions. Unit testing focuses first on the modules in the proposed system to locate errors. This enables to detect errors in the coding and logic that are contained within that module alone. Those resulting from the interaction between modules are initially avoided. In unit testing step each module has to be checked separately. System testing does n ot test the software as a whole, but rather than integration of each module in the system. The primary concern is the compatibility of individual modules. One has to find areas where modules have been designed with different specifications of data lengths, type and data element name. Testing and validation are the most important steps after the implementation of the developed system. The system testing is performed to ensure that there are no errors in the implement ed system. The software must be executed several times in order to find out the errors in the different modules of the system. Validation refers to the process of using the new software for the developed system in a live environment i.e., new software inside the organization, in order to find out the errors. The validation phase reveals the failures and the bugs in the developed system. It will be come to know about the practical difficulties the system faces when operated in the true environment. By testing the code of the implemented software, the logic of the program can be examined. A specification test is conducted to check whether the specifications stating the program are performing under various conditions. Apart from these tests, there are some special tests conducted which are given below: Peak Load Tests: This determines whether the new system will handle the volume of activities when the system is at the peak of its processing demand. The test has revealed that the new software for the agency is capable of handling the demands at the peak time. Storage Testing: This determines the capacity of the new system to store transaction dat a on a disk or on other files. The proposed software has the required storage space available, because of the use of a number of hard disks. Performance Time Testing: This test determines the length of the time used by the system to process transaction dat a. In this phase the software developed Testing is exercising the software to uncover errors and ensure the system meets defined requirements. Testing may be done at 4 levels Unit Level Module Level
59
UNIT TESTING
A Unit corresponds to a screen /form in the package. Unit testing focuses on verification of the corresponding class or Screen. This testing includes testing of control paths, interfaces, local data structures, logical decisions, bo undary conditions, and error handling. Unit testing may use Test Drivers, which are control programs to co -ordinate test case inputs and outputs, and Test stubs, which replace low -level modules. A stub is a 40 dummy subprogram.
INTEGRATION TESTING
Integration testing is used to verify the combining of the software modules. Integration testing addresses the issues associated with the dual problems of verification and program construction. System testing is used to verify, whether the developed system meets the requirements.
REGRESSION TESTING
Each modification in software impacts unmodified areas, which results serious injuries t o that software. So the process of re-testing for rectification of errors due to modification is known as regression testing. Installation and Delivery Installation and Delivery is the process of delivering the developed and tested software to the customer .
60
IMPLEMENTATION
61
SYSTEM IMPLEMENTATION
Implementation includes all those activities that take place to convert from the old system to the new. The old system consists of manual operations, which is operated in a very different manner from the proposed new system. A proper imple mentation is essential to provide a reliable system to meet the requirements of the organizations. An improper installation may affect the success of the computerized system
IMPLEMENTATION METHODS:
There are several methods for handling the implementation and the consequent conversion from the old to the new computerized system.
The most secure method for conversion from the old system to the new system is to run the old and new system in parallel. In this approach, a person may operate in the manual older processing system as well as start operating the new computerized system. This method offers high security, because even if there is a flaw in the computerized system, we can depend upon the manual system. However, the cost for maintaining two system s in parallel is very high. This outweighs its benefits. Another commonly method is a direct cut over from the existing manual system to the computerized system. The change may be with in a week or with in a day. There are no parallel activities. However, there is no remedy in case of a problem. This strategy requires careful planning. A working version of the system can also be implemented in one part of the organization and the personnel will be piloting the system and changes can be made as and when required. But this method is less preferable due to the loss of entirety of the system.
IMPLEMENTATION PLAN:
The implementation plan includes a description of all the activities that must occur to implement the new system and to put it into operation. It i dentifies the personnel responsible for the activities and prepares a time chart for implementing the system. The implementation plan consists of the following steps. o List all files required for implementation. o Identify all data required to build new files during the implementation. o List all new documents and procedures that go into the new system .
62
The implementation plan should anticipate possible problems and must be able to deal with them. The usual problems may be missing documents; mixed data formats between current and files, errors in data translation, missing data etc
63
Limitations
The new system has been designed to meet almost all of the user requirements but it too has certain limitations some of which can be enhanced in the future enhancements or updates.
No Image Support
The existing system has no image support at present and so images and diagrams cannot be included in the exam which would make it very difficult to ask certain questions in certain subjects. Providing diagrams externally is at present the only feasible choice available.
64
The existing system allows the exam time to be set only once at the time of system set up which cannot be changed as per desired and all the exams will be conducted for the preset time only. If the user wants to increase or decrease the time for exams the system will have to be set up again. This is also one of the proposed enhancements.
Future Scope
Enhancements are the perquisite for development of a system. Every existing system has proposed enhancements which make it better and easier to use and more secure. The enhancements that have been proposed for this system are listed here.
65
CONCLUSION
This project is about the designing the railway reservation system using M S Access, as back end and Visual Basic 6.0 as front end. This project presents an investigative view of present railway reservation system including the history of booking tickets and cancelled tickets. Present system of railway reservation system is having some shortcoming on which we have tried to work on that to eliminate the disadvantages. We have made a database for passengers and trains and connected these two tables from the custom made data entry form built in Visual Basic 6.0. There are options for new entry which will be stored in M S Access database and retrieved from database in future. This project was a small attempt to make the railway reservation system using M S Access, and Visual Basic 6.0. In the last we conclude that Indian Railway is having a strong IT Infrastructure and a wellequipped railway reservation system but there is some shortcoming in the system on which we have tried to work on it and successfully completed our project.
66
BIBLIOGRAPHY
Books
y y
A Complete Guide to Programming in Visual Basic .Net A Complete Visual Basic 6 Training Course: How to Programme: Package Advanced Programming Using Visual Basic: Version 6.0 Access 2003 Power Programming with VBA Advanced MS Visual Basic
y y y
Site Address
y y y
67
List of Tables
1. Train InfoDetails 2. Search For Train 3. Reservation 4. Print Ticket 21 24 38 41
68
List of Figures
1. Data Flow Diagram 2. ER Diagram 24 26