You are on page 1of 83

INTRODUCTION

The Hotel Management Software has been conceived, developed and optimized as a part of final semester requirement for the degree of MCA from Kurukshetra University , Kurukshetra. The Software takes care of the most basic needs in day to day working of hotel managers and also generates substantial and to the point reports that help in decision making activities of a hotels Kaveri .

PRESENT SCENARIO
In the present scenario, hotel management systems are more or less manual. All records are registered in paper registers in specified rows and columns by a specialist. Customer records are kept and maintained in these registers. All calculations, modifications and bookkeeping work is done manually by persons specializing in these fields. This age-old system, though simple, has several drawbacks: Data entry process is very time consuming. Retrieval of customer records is again, time consuming and tedious. Any discrepancy in calculations by hand can have severe consequences. There is no security of customer information and other hotel records at all. Report generation is very tedious and time consuming and requires skilled personnel.

PROBLEM STATEMENT
To develop a fully automated HOTEL MANAGEMENT SYSTEM that can

totally replace the present manual systems and that can overcome the drawbacks of this present system.

USER REQUIREMENTS
The user requirements have been summarized in the following points: The software should be password protected i.e. only authorized access should be provided. Additionally, provision for a change in the security password should be made. The data entry screen for the check-in process of the customer should be well defined with a logical sequence of tab stops. Moreover, it should not ask for unnecessary information from the customers. There should be a provision for the customers to be able to pay at the time of check-out, all their dues regarding meals, taxis, laundry, etc. Additionally, the customer should be given the option to pay his dues whenever he wants during the course of his stay at the hotel. The software should be flexible enough to accommodate infrastructural changes in the hotel (addition, deletion and modification of rooms). Additionally it should facilitate changes in management policies (room rate modification, etc). The bill printing and receipt generation should be immediate and instantaneous. All data access operations and searches should be fast and all calculations should be accurate. Finally, adequate error handling features should be incorporated in the software so that the system is not in an inconsistent state in the event of a failure.

INPUT DATA FILES SPECIFICATION


All the inputs for the software are given to and taken from the HOTEL.MDB Microsoft Access Database stored in the directory where the software is installed. The tables in this database and their relationships is shown in the figure below:-

DATA FLOW DIAGRAM


Hotel Management System
LEVEL 0 DFD

Manager

Customer

1 Check In
Room type Customer info.

Room no.

Manager

2 Voucher Entry

Voucher type, amount

Customer

Bill Receipt Amount

Room No , discount

3 Check Out

Room Information

4 Room Modification

LEVEL 1 DFD

Customer
Customer info.

Room type

Manager
No. of rooms available

1.1 Check Room Availability


Room type

If available

1.2 Allot Room


Customer info.

Cust. No. , Room No.

Room Info table

Room status table

Customer Table

LEVEL 2 DFD (CHECK IN)

Room no.

Manager

2.1 Voucher entry

Voucher type, amount

Customer

Voucher type, amount, cust. No.

Voucher Table
LEVEL 2 DFD (VOUCHER ENTRY)

Voucher Table
Voucher amount Advance

Customer table
Cust. No. , total amount, amount paid, bill no. etc

Room Info. table


Room Rent

3.1 Calculate total


Amount, cust. Info.

Balance amount

Room no, Discount

Manager

3.2 Print Bill


Amount paid

Bill

Customer

3.3 Print Receipt

Receipt

LEVEL 2 DFD (CHECK OUT)

New room no, room type, rent

4.1 Room Addition

Room no.

Manager

4.2 Room Deletion 4.3 Room Rate modificatio n

Room info. table

Room type, new rate

LEVEL 2 DFD (ROOM MODIFICATION)

DESCRIPTION OF FUNCTIONS USED IN DFDs


8

LEVEL 0 DFD:
OBJECTS: 1. Manager 2. Customer PROCESS: 1. Hotel Management system: Taking input and generating output for facilitating the needs of customer and user LEVEL 1 DFD: OBJECTS: 1. Manager 2. Customer FILES: 1. Hotel Information 2. Room Information table PROCESSES: 1. Login: Allows manager to use the database 2. Check in: Records the check in details of customer 3. Voucher Entry: Updates the voucher entries of customer 4. Check out: Creates bill and calculated amount to be paid by customer 5. Modification: Updates the room information table

LEVEL 2 DFD:

VOUCHER ENTRY
OBJECTS: 1. Manager 2. Customer FILES: 1. Voucher table PROCESSES: 1. Voucher entry: Takes voucher type, amount, room number and updates voucher type, amount and customer number.

CHECK IN:OBJECTS: 1. Manager 2. Customer FILES: 1. Room status 2. Room information PROCESSES: 1. Check room availability: Takes room type as input and checks how many rooms are available 2. Room allotment: Takes customer information as input allots room.

10

CHECK OUT
OBJECTS:
1. Manager 2. Customer

FILES:
1. Room information table 2. Voucher table 3. Customer table

PROCESSES:
1. Calculate total: 2. Print bill 3. Print receipt

ROOM MODIFICATION OBJECTS:


1. Manager

FILES:
1.Room information table

PROCESSES:
1.Room addition: 2.Room deletion: 3.Room rate modification

11

CONSTRAINTS
The system works under the sole constraint that the outdated customer records have to be deleted explicitly by the administrator using a database management program such as Microsoft Access from time to time. This should be done to avoid huge search times in searching for a record in the database and hence improve system performance. Another constraint on the system is that the customer records must be kept for sufficient length of time so as to facilitate report generation.

12

OUTPUT DATA SPECIFICATION


The output of the system should be in the form of reports. The reports should allow the users to choose a criterion. The reports should be easily converted to common file formats or printed directly.

The various reports should be:


SEARCH REPORTS o Based on customer name o Based on customer number o Based on arrival date o Based on departure date DATE TO DATE REPORTS o That returns customers who arrived between two given dates o That returns customers who departed between two given dates PREVIOUS MONTH REPORT that should return all customers who arrived or departed in the previous month plus the revenue generated by the hotel through those customers in that month. IN-HOUSE CUSTOMER REPORT that returns all the customers who are currently in the hotel.

13

14

LOGIN FORM

15

MAIN FORM

16

ROOM STATUS FORM

17

CHECK IN FORM

18

VOUCHER ENTRY FORM

19

CHECK OUT FORM

20

ROOM ADDITION FORM

21

ROOM DELETION FORM

22

ROOM RATE MODIFICATION FORM

23

SEARCH FORM

24

BILL

25

RECEIPT

26

CODING
MODULE.BAS
Global DB As Database Sub CenterForm(F As Form) F.Move (Screen.Width - F.Width) \ 2, (Screen.Height - F.Height) \ 2 End Sub Public Sub Errorhandler() Dim errdesc As String, errnum As Integer errdesc = err.Description errnum = err.number If errnum <> 0 Then Select Case errnum Case 482 'printer error MsgBox "PRINTER ERROR", vbCritical Case 3004, 3024 'DATABASE error MsgBox "FILE NOT FOUND ", vbCritical Case 3021 'TABLE error MsgBox "TABLE IS EMPTY ", vbCritical Case 3022 'TABLE error MsgBox "DUPLICATE KEY FIELDS", vbCritical Case 3058, 3315 'KEYFIELD ERROR MsgBox "NO ENTRY IN KEYFIELD", vbCritical Case 6 'OVERFLOW ERROR MsgBox "OVERFLOW ERROR", vbCritical Case 11 'DIVIDED BY ZERO MsgBox "DIVIDE BY ZERO ERROR", vbCritical Case Else MsgBox "Error: " & errdesc, vbCritical, "Error" End Select End If End Sub

27

FRMLOGIN.FRM
Option Explicit Dim DB As Database Dim login As Recordset Public LoginSucceeded As Boolean Private Sub cmdcancel_Click() End End Sub Private Sub cmdOK_Click() If Text1.Text = login.Fields("p1") Then cmdOK.Visible = False cmdCancel.Visible = False Text1.Visible = False Label2.Visible = False Label3.Visible = True Label5.Visible = True Timer1.Interval = 200 ProgressBar1.Visible = True Else MsgBox "INVALID PASSWORD!,TRY AGAIN.", vbCritical, "Login" Text1.SetFocus SendKeys "{Home}+{End}" End If End Sub Private Sub Form_Load() On Error Resume Next Me.Icon = MDIForm1.ImageList1.ListImages(3).Picture Image1.Height = Me.Height - 100 Image1.Width = Me.Width - 100 Image1.Picture = MDIForm1.ImageList1.ListImages("splash").Picture 'OPEN TABLE AND DATABASE Set DB = OpenDatabase(App.Path & "\HOTEL.MDB") Set login = DB.OpenRecordset("LOGIN", dbOpenTable) End Sub Private Sub Form_Unload(cancel As Integer) login.Close Set login = Nothing DB.Close Set DB = Nothing End Sub

28

Private Sub Timer1_Timer() ProgressBar1.Value = ProgressBar1.Value + 5 If ProgressBar1.Value = 100 Then Timer1.Enabled = False MDIForm1.Show Unload Me End If End Sub

MDIFORM.FRM
Private Sub ABOUT_Click() ABOUT_FORM.Show 1 End Sub Private Sub ADD_Click() frmaddroom.Show End Sub Private Sub C_PASS_Click() frmchapass.Left = 2500 frmchapass.Top = 0 frmchapass.Width = 8000 frmchapass.Height = 5000 frmchapass.Show End Sub0 Private Sub checkout_Click() checkout_cust.Show End Sub Private Sub DAILY_STATICS_Click() daily_statitics.Left = 2800 daily_statitics.Top = 0 daily_statitics.Width = 5000 daily_statitics.Height = 6200 daily_statitics.Show End Sub Private Sub DELETE_Click() frmdelete.Show End Sub Private Sub EXIT_Click() If MsgBox("Exit KAVERI?", vbQuestion + vbOKCancel, "Confirm Exit") = vbOK Then End

29

End If End Sub Private Sub EXTBEDCHARGE_Click() FRMEXTRABED.Show End Sub Private Sub MDIForm_Load() On Error Resume Next Picture1.Picture = ImageList1.ListImages(1).Picture Me.Icon = ImageList1.ListImages(3).Picture Set DB = OpenDatabase(App.Path & "\HOTEL.MDB") End Sub Private Sub MDIForm_QueryUnload(cancel As Integer, UnloadMode As Integer) If MsgBox("Exit KAVERI?", vbOKCancel + vbQuestion, "Confirm Exit") = vbCancel Then cancel = True End If End Sub Private Sub MDIForm_Unload(cancel As Integer) End End Sub Private Sub mnu_arr_date_Click() frmenterdate.opdate = True frmenterdate.Show 1 End Sub Private Sub mnu_dep_date_Click() frmenterdate.Show 1 frmenterdate.opdate = False End Sub Private Sub mnuall_Click() env1.Connection4.Open env1.cmdall rptall.Show mnuall.Enabled = False End Sub Private Sub mnubook_Click() frmstatus.Show End Sub

30

Private Sub mnusearch_Click() frmsearch.Show End Sub Private Sub MODIFYROOM_Click() MODIFY_RATE.Show End Sub Private Sub mnuinhouse_Click() env1.Connection5.Open env1.cmdinhouse rptinhouse.Show mnuinhouse.Enabled = False End Sub Private Sub R_STATUS_Click() frmstatus.Show End Sub Private Sub v_entry_Click() frmvoucher.Show End Sub

FRMSTATUS.FRM
Dim ARS As Recordset Private Sub BOOK_Click() 'LOADING ROOM-INFORMATION FORM frmstatus.Hide Load room_infor room_infor.Show End Sub Private Sub cmdexit_Click() 'UNLOAD ROOM-STATUS FORM ARS.Close Set ARS = Nothing Unload Me End Sub Private Sub Combo1_CLICK() Call Search_roominfor End Sub Private Sub Form_Load() 'OPEN DATABASE TABLE On Error GoTo ERROR1 Set ARS = DB.OpenRecordset("ROOM_INFORMATION", dbOpenTable)

31

'Calling Procedure Roomtype_avail Call Roomtype_avail Exit Sub ERROR1: Call Errorhandler End Sub Private Sub Search_roominfor() On Error GoTo error ARS.MoveFirst 'SEARCHING ROOM INFORMATION While Not ARS.EOF If combo1.Text = ARS.Fields("ROOM_TYPE") Then ROOMRATE.Text = ARS.Fields("ROOM_RENT") TOTALROOM.Text = ARS.Fields("TOTAL_ROOM") R_AVAIL.Text = ARS.Fields("ROOM_AVAIL") R_BOOK.Text = ARS.Fields("ROOM_BOOKED") 'CHECK THE ROOM AVAILABILITY If ARS.Fields("total_room") = 0 Or ARS.Fields("Room_avail") = 0 Then BOOK.Enabled = False MsgBox "NO ROOM AVAILABLE -PLEASE CHOOSE ANOTHER TYPE" Exit Sub Else BOOK.Enabled = True BOOK.SetFocus End If End If ARS.MoveNext Wend Exit Sub error: Call Errorhandler Exit Sub End Sub Private Sub Roomtype_avail() 'CHECK THE AVAILABILITY OF ROOM-TYPE On Error GoTo ERROR2 If ARS.RecordCount = 0 Then MsgBox "NO ROOM AVAILABLE!" combo1.Enabled = False

32

Else BOOK.Visible = True BOOK.Enabled = False ROOMRATE.Text = "" TOTALROOM.Text = "" R_AVAIL.Text = "" ROOMRATE.Text = "" ARS.MoveFirst While Not ARS.EOF combo1.AddItem (ARS.Fields("ROOM_TYPE")) ARS.MoveNext Wend End If Exit Sub ERROR2: Call Errorhandler Exit Sub End Sub

FRMROOM_INFOR.FRM
Dim RS As Recordset Private Sub Combo1_CLICK() 'CALL PROCEDURE DISP_ROOMINFOR Call disp_roominfor End Sub Private Sub Command1_Click() room_infor.Hide 'LOADING BOOKING FORM Load frmentry frmentry.Show frmentry.Text1.Enabled = True frmentry.Text1.SetFocus frmentry.Text2.Enabled = True frmentry.Text3.Enabled = True frmentry.Text4.Enabled = True frmentry.Text5.Enabled = True frmentry.Text6.Enabled = True frmentry.Text7.Enabled = True frmentry.Text8.Enabled = True RS.Close Set RS = Nothing End Sub

33

Private Sub Command2_Click() room_infor.Hide Unload room_infor Unload frmstatus RS.Close Set RS = Nothing End Sub Private Sub Command3_Click() 'BACK-LOAD ROOM-STATUS FORM room_infor.Hide Unload Me frmstatus.Show End Sub Private Sub Form_Load() 'OPEN DATABASE TABLE Set RS = DB.OpenRecordset("ROOM_STATUS", dbOpenTable) Command1.Visible = True Command1.Enabled = False 'CALLING AVAIL_ROOM PROCEDURE Call avail_room End Sub Private Sub disp_roominfor() On Error GoTo error 'SEARCHING FOR ROOM AND THEIR INFORMATON While Not RS.EOF If Combo1.Text = RS.Fields("ROOM_NO") Then Label6.Caption = frmstatus.ROOMRATE.Text Label7.Caption = RS.Fields("FLOOR") Label8.Caption = RS.Fields("ROOM_TYPE") Command1.Enabled = True Command1.SetFocus Exit Sub End If RS.MoveNext Wend RS.MoveFirst Exit Sub error: Call Errorhandler End Sub

34

Private Sub avail_room() On Error GoTo ERROR1 'SEARCH AVAILABLE ROOM While Not RS.EOF If frmstatus.Combo1.Text = RS.Fields("ROOM_TYPE") And RS.Fields("R_STATUS") = False Then Combo1.AddItem (RS.Fields("ROOM_NO")) End If RS.MoveNext Wend RS.MoveFirst Exit Sub ERROR1: Call Errorhandler End Sub

FRMENTRY.FRM
Dim RS As Recordset Dim ARS As Recordset Dim BRS As Recordset Dim crs As Recordset Dim CNT As Integer Dim flag As Integer, errnumber As Integer Const number$ = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" Private Sub Command1_Click() On Error GoTo ERROR2 If MsgBox("CANCEL BOOKING?", vbQuestion + vbYesNo) = vbYes Then Me.Hide frmstatus.Hide room_infor.Hide Unload Me Unload frmstatus Unload room_infor Exit Sub End If ERROR2: Call Errorhandler

35

End Sub Private Sub Form_Load() On Error GoTo ERROR1 'OPEN DATABASE TABLE Set RS = DB.OpenRecordset("entry", dbOpenTable) Set ARS = DB.OpenRecordset("room_status", dbOpenTable) Set BRS = DB.OpenRecordset("room_booking", dbOpenTable) Set crs = DB.OpenRecordset("room_information", dbOpenTable) CNT = 2 save.Visible = True If BRS.RecordCount > 0 Then BRS.MoveLast Text10.Text = BRS.Fields("cust_no") + 1 Else Text10.Text = 1 End If Text9.Text = room_infor.Combo1.Text MaskEdBox1.Text = Date MaskEdBox3.Text = Format(Time, "hh:mm;ss ampm") Exit Sub ERROR1: Call Errorhandler End Sub Private Sub Form_Unload(cancel As Integer) RS.Close ARS.Close crs.Close BRS.Close Set RS = Nothing Set ARS = Nothing Set crs = Nothing Set BRS = Nothing End Sub Private Sub SAVE_Click() flag = 1 On Error GoTo ERROR2 ' CALLING PROCEDURE CHECKING_NULL VALUES Call check_nullvalues If flag = 1 Then

36

crs.MoveFirst 'CALLING PROCEDURE CHECK_MAXPERSON Call check_maxperson End If crs.MoveFirst If flag = 1 Then 'frmentry.Hide 'CALLING PROCEDURE UPDATE_TABLE Call update_table If MsgBox("SAVE NEW RECORD?", vbYesNo, "Confirm Save") = vbYes Then crs.Update ARS.Update RS.Update BRS.Update MsgBox "RECORD SAVED!", vbInformation save.Visible = False GoTo othercust Else Call updatecancel MsgBox "RECORD NOT SAVED!", vbInformation End If ' STORING OTHER CUSTOMER INFORMATION othercust: If errnumber = 0 Then If Val(Text7.Text) > 1 Then For CNT = 2 To Val(Trim(Text7.Text)) OTHER_CUST.Label10.Alignment = 2 OTHER_CUST.Label10.Caption = "" OTHER_CUST.Label10.Caption = "CUSTOMER : " + Str(CNT) OTHER_CUST.Show (1) Next End If Unload Me End If Unload frmstatus Unload room_infor End If Exit Sub

37

ERROR2: Call Errorhandler Call updatecancel End Sub Private Sub TEXT1_KeyPress(KeyAscii As Integer) 'RESTRICTING INPUT If KeyAscii = 13 Then Text2.SetFocus Else If KeyAscii <> 8 Then If InStr(number, Chr(KeyAscii)) = 0 Then MsgBox "ONLY ALPHABETS ALLOWED.", vbOKOnly + vbInformation, "" KeyAscii = 0 Exit Sub End If End If End If End Sub Private Sub Text2_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Text4.SetFocus End If End Sub Private Sub Text3_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Text7.SetFocus Else If KeyAscii <> 8 Then If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then MsgBox "ONLY NUMBERS ALLOWED.", vbOKOnly + vbInformation, "" KeyAscii = 0 End If End If End If End Sub Private Sub Text8_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then save.Enabled = True save.SetFocus Else If KeyAscii <> 8 Then

38

If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then MsgBox "ONLY NUMBERS ALLOWED.", vbOKOnly + vbInformation, "" KeyAscii = 0 End If End If End If End Sub Private Sub Text7_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Text8.SetFocus Else If KeyAscii <> 8 Then If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then MsgBox "ONLY NUMBERS ALLOWED.", vbOKOnly + vbInformation, "" KeyAscii = 0 End If End If End If End Sub Private Sub Text4_KeyPress(KeyAscii As Integer) 'RESTRICTING INPUT If KeyAscii = 13 Then Text5.SetFocus Else If KeyAscii <> 8 Then If InStr(number, Chr(KeyAscii)) = 0 Then MsgBox "ONLY ALPHABETS ALLOWED.", vbOKOnly + vbInformation, "" KeyAscii = 0 Exit Sub End If End If End If End Sub Private Sub Text5_KeyPress(KeyAscii As Integer) 'RESTRICTING INPUT If KeyAscii = 13 Then Text6.SetFocus Else If KeyAscii <> 8 Then If InStr(number, Chr(KeyAscii)) = 0 Then MsgBox "ONLY ALPHABETS ALLOWED.", vbOKOnly + vbInformation, "" KeyAscii = 0 Exit Sub

39

End If End If End If End Sub Private Sub Text6_KeyPress(KeyAscii As Integer) 'RESTRICTING INPUT If KeyAscii = 13 Then Text3.SetFocus Else If KeyAscii <> 8 Then If InStr(number, Chr(KeyAscii)) = 0 Then MsgBox "ONLY ALPHABETS ALLOWED.", vbOKOnly + vbInformation, "" KeyAscii = 0 Exit Sub End If End If End If End Sub Private Sub check_nullvalues() On Error GoTo ERROR2 'CHECKING NULL VALUES If Text1.Text = "" Then MsgBox "ENTER THE NAME", vbExclamation flag = 0 Text1.SetFocus ElseIf Text2.Text = "" Then MsgBox "ENTER THE ADDRESS", vbExclamation Text2.SetFocus flag = 0 ElseIf Text4.Text = "" Then MsgBox "ENTER THE COUNTRY NAME ", vbExclamation Text4.SetFocus flag = 0 ElseIf Text5.Text = "" Then MsgBox "ENTER THE STATE ", vbExclamation Text5.SetFocus flag = 0 ElseIf Text6.Text = "" Then MsgBox "ENTER THE CITY", vbExclamation Text6.SetFocus flag = 0 ElseIf Text7.Text = "" Then MsgBox "ENTER NO. OF PERSON", vbExclamation Text7.SetFocus

40

flag = 0 ElseIf Text8.Text = "" Then MsgBox "ENTER ADVANCE", vbExclamation Text8.SetFocus flag = 0 End If If flag = 1 Then Exit Sub End If 'CALL PROCEDURE ERRORHANDLER ERROR2: Call Errorhandler End Sub Private Sub check_maxperson() On Error GoTo ERROR2 'CHECKING MAX-PERSON Do While Not crs.EOF If crs.Fields("ROOM_TYPE") = frmstatus.Combo1.Text Then If Val(Text7.Text) > crs.Fields("MAX-PERSON") Then MsgBox "ENTER NO. OF PERSONS LESS THAN OR EQUAL TO " + Str(crs.Fields("Max-person")) Text7.Text = "" Text7.SetFocus flag = 2 Exit Do ElseIf Val(Text7.Text) = 0 Then MsgBox "NUMBER OF PERSON IS ZERO - PLEASE ENTER 1 OR ABOVE VALUE", vbExclamation Text7.Text = "" Text7.SetFocus flag = 2 Exit Do End If End If crs.MoveNext Loop If flag = 1 Then Exit Sub End If ERROR2: Call Errorhandler

41

End Sub Private Sub update_table() On Error GoTo ERROR2 'UPDATING ROOM_INFORMATION TABLE Do While Not crs.EOF If crs.Fields("ROOM_TYPE") = frmstatus.Combo1.Text Then crs.Edit crs.Fields("ROOM_AVAIL") = crs.Fields("ROOM_AVAIL") - 1 crs.Fields("ROOM_BOOKED") = crs.Fields("ROOM_BOOKED") + 1 Exit Do End If crs.MoveNext Loop 'UPDATING ROOM_STATUS TABLE Do While Not ARS.EOF If ARS.Fields("ROOM_NO") = room_infor.Combo1.Text Then ARS.Edit ARS.Fields("R_STATUS") = True ARS.Fields("cust_no") = Val(Trim(Text10.Text)) Exit Do End If ARS.MoveNext Loop 'UPDATING ENTRY TABLE RS.AddNew RS.Fields("cust_name") = UCase(Trim(Text1.Text)) RS.Fields("ADDRESS") = UCase(Trim(Text2.Text)) RS.Fields("ARR_DATE") = Format(CDate(MaskEdBox1.Text), "mm / dd /yyyy") RS.Fields("ARR_TIME") = Format(MaskEdBox3.Text, "hh:mm:ss am/pm") RS.Fields("ADVANCE") = Text8.Text RS.Fields("NO_OF_PERSON") = Val(Text7.Text) RS.Fields("CUST_NO") = Text10.Text RS.Fields("COUNTRY") = UCase(Trim(Text4.Text)) RS.Fields("STATE") = UCase(Trim(Text5.Text)) RS.Fields("CITY") = UCase(Trim(Text6.Text)) RS.Fields("PHONE") = Trim(Text3.Text) 'UPDATING ROOM_BOOKING TABLE BRS.AddNew 'ADD NEW RECORD BRS.Fields("ROOM_NO") = Val(room_infor.Combo1.Text) Exit Sub ERROR2:

42

Call Errorhandler End Sub Private Sub updatecancel() RS.CancelUpdate ARS.CancelUpdate BRS.CancelUpdate crs.CancelUpdate End Sub

FRMVOUCHERENTRY.FRM
Dim RS As Recordset Dim ARS As Recordset Dim BRS As Recordset Dim crs As Recordset Dim VNO As Recordset Dim PAID As Recordset Dim flag As Integer Private Sub cmdexit_Click() Unload Me ARS.Close BRS.Close crs.Close VNO.Close RS.Close Set RS = Nothing Set ARS = Nothing Set BRS = Nothing Set crs = Nothing Set VNO = Nothing End Sub Private Sub CMDSAVE_Click() On Error GoTo error If Text5.Text = "" Then MsgBox "ENTER THE AMOUNT" Text5.SetFocus Else If flag = 1 Then ''*****UPDATING VOUCHER TABLE RS.AddNew RS.Fields("CUST_NO") = Val(Trim(Text1.Text)) RS.Fields("VOUCHER_NO") = Int(Trim(Text4.Text))

43

RS.Fields("V_TYPE") = UCase(Trim(List1.Text)) RS.Fields("DATEofpaid") = CDate(MaskEdBox1.Text) If List1.Text = "EXTRA-BED" Then 'CALCULATING EXTRA BED CHARGE RS.Fields("AMOUNT") = Val(Trim(Text5.Text)) * crs.Fields("E_BED_CHARGE") Else RS.Fields("AMOUNT") = Val(Trim(Text5.Text)) End If RS.Update 'UPDATE COMPLETE Text4.Text = "" Text4.Visible = False Text4.Locked = True Label4.Visible = False Label6.Visible = False Option1.Value = False Option2.Visible = True List1.Visible = False Label7.Caption = "Amount" 'UPDATING VOUCHER NUMBER GENERATOR TABLE VNO.Edit VNO.Fields("V_NO") = VNO.Fields("V_NO") + 1 VNO.Update 'UPDATE COMPLETE Else If flag = 2 Then 'UPDATING PAID OUT TABLE Set PAID = DB.OpenRecordset("PAIDTABLE", dbOpenTable) PAID.AddNew PAID.Fields("CUST_NO") = Val(Text1.Text) PAID.Fields("AMT") = Val(Text5.Text) PAID.Fields("DATEOFPAID") = MaskEdBox1.Text PAID.Update PAID.Close 'UPDATE COMPLETE Option2.Value = False Option1.Visible = True Text5.Locked = True End If End If Text1.Text = ""

44

Text2.Text = "" Text3.Text = "" Text5.Text = "" Text5.Visible = False MaskEdBox1.Text = "" MaskEdBox1.Visible = False Label7.Visible = False Label5.Visible = False flag = 1 Frame1.Enabled = False cmdsave.Enabled = False End If Exit Sub error: If flag = 1 Then RS.CancelUpdate VNO.CancelUpdate Else PAID.CancelUpdate End If Call Errorhandler End Sub Private Sub Combo1_CLICK() Dim FLAG1 As Integer Dim VNTBOOKMARK As Variant Frame1.Enabled = True BRS.Index = "r_no" VNTBOOKMARK = BRS.Bookmark 'BRS is room_status table BRS.Seek "=", Combo1.Text If BRS.NoMatch Then MsgBox "NO RECORD FOUND!" BRS.Bookmark = VNTBOOKMARK Else Text1.Text = Val(BRS.Fields("CUST_NO")) FLAG1 = 1 End If If FLAG1 = 1 Then ARS.MoveFirst 'ARS is entry table ARS.Index = "C_NO" VNTBOOKMARK = ARS.Bookmark ARS.Seek "=", Val(Trim(Text1.Text)) If ARS.NoMatch Then MsgBox "NO RECORD FOUND!"

45

ARS.Bookmark = VNTBOOKMARK Else Text2.Text = ARS.Fields("cust_name") Text3.Text = ARS.Fields("ADDRESS") Text4.Text = VNO.Fields("V_NO") 'VNO is V_NO_GENERATE table MaskEdBox1.Text = Date End If End If End Sub Private Sub Form_Load() On Error GoTo ERROR1 flag = 1 Set RS = DB.OpenRecordset("VOUCHER_ENTRY", dbOpenTable) Set ARS = DB.OpenRecordset("entry", dbOpenTable) Set BRS = DB.OpenRecordset("ROOM_status", dbOpenTable) Set crs = DB.OpenRecordset("extra bed", dbOpenTable) Set VNO = DB.OpenRecordset("V_NO_GENERATE", dbOpenTable) Frame1.Enabled = False If Not BRS.BOF Then BRS.MoveFirst While Not BRS.EOF If BRS.Fields("r_status") = True Then Combo1.AddItem (BRS.Fields("room_no")) End If BRS.MoveNext Wend BRS.MoveFirst MaskEdBox1.Enabled = False List1.Enabled = False Else MsgBox "NO CURRENT RECORD!", vbExclamation End If Exit Sub ERROR1: Call Errorhandler End Sub Private Sub List1_Click() Text5.Locked = False Text5.SetFocus If List1.Text = "EXTRA-BED" Then Label7.FontSize = 8 Label7.Caption = "No of Ext-Bed" End If

46

End Sub Private Sub Option1_Click() Text5.Visible = True Text5.Enabled = True Text5.Text = "" Label4.Visible = True Text4.Visible = True Label5.Visible = True Text5.Visible = True Label6.Visible = True Label7.Visible = True MaskEdBox1.Visible = True List1.Visible = True List1.Enabled = True cmdsave.Enabled = True flag = 1 End Sub Private Sub Option2_Click() Label4.Visible = False Text4.Visible = False Label6.Visible = False List1.Visible = False Label5.Visible = True Label7.Visible = True Label7.FontSize = 10 Label7.Caption = "Amount" MaskEdBox1.Visible = True Text5.Visible = True Text5.Locked = False Text5.Enabled = True cmdsave.Enabled = True flag = 2 Text5.SetFocus End Sub Private Sub Text5_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmdsave.SetFocus Else If KeyAscii <> 8 Then If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then MsgBox "ONLY NUMBERS ALLOWED.", vbOKOnly + vbInformation, "" KeyAscii = 0 End If

47

End If End If End Sub

FRMCHECKOUT.FRM
Dim RS1 As Recordset, rd5 As Recordset, rd6 As Recordset, rd7 As Recordset Dim RS2 As Recordset Dim ARS As Recordset Dim BRS As Recordset Dim crs As Recordset Dim paidout As Currency Dim CNT1 As Integer Dim cust_no As Long Dim stay_dur As Long Dim misc As Long Private Sub calculate_Click() Dim tmp_tot As Integer On Error GoTo ERROR2 If Text10.Text = "" Then MsgBox "ENTER DISCOUNT" Text10.SetFocus Else tmp_tot = Text5.Text * Text6.Text + Text8.Text + Text9.Text tmp_tot = tmp_tot - (tmp_tot * Val(Text10.Text) / 100) Text4.Text = Int((tmp_tot * 5) / 100) Text11.Text = tmp_tot + Int(Text4.Text) Text12.Text = paidout Text13.Text = ARS.Fields("advance") Text14.Text = Val(Text11.Text) - Val(Text12.Text) - Val(Text13.Text) Text3.Locked = False Text3.SetFocus Text10.Locked = True End If Exit Sub ERROR2: Call Errorhandler End Sub Private Sub checkout_Click() Dim tax As Double Dim str1 As String

48

'On Error GoTo ERROR1 If Text3.Text = "" Or Text2.Text = "" Or Text10.Text = "" Then MsgBox "Complete the entries first!", vbExclamation, "Incomplete Entries" Text3.SetFocus Else 'UPDATING TABLE ENTRY ARS.Edit 'ARS is ENTRY table ARS.Fields("DEP_DATE") = CDate(MaskEdBox1.Text) ARS.Fields("DEP_TIME") = MaskEdBox2.Text ARS.Fields("Bill_no") = RS1.Fields("bill_no") 'RS1 is BILL table ARS.Fields("Reciept_no") = RS2.Fields("reciept") 'RS2 is Reciept table ARS.Fields("discount") = Val(Text10.Text) ARS.Fields("tot_amt") = Text11.Text ARS.Fields("tax") = Text4.Text ARS.Fields("paid") = Val(Text12.Text) + Val(Text3.Text) ARS.Fields("balance") = Val(Text14.Text) - Val(Text3.Text) ARS.Fields("stay_dura") = Text5.Text ARS.Fields("inhouse") = "F" ARS.Update 'UPDATE COMPLETE 'UPDATING BILL_NO AND RECIEPT_NO TABLE RS1.Edit RS1.Fields("Bill_no") = RS1.Fields("bill_no") + 1 RS1.Update RS2.Edit RS2.Fields("reciept") = RS2.Fields("reciept") + 1 RS2.Update 'UPDATE COMPLETE 'UPDTING TABLE room_information crs.Edit crs.Fields("ROOM_AVAIL") = crs.Fields("ROOM_AVAIL").Value + 1 crs.Fields("ROOM_BOOKED") = crs.Fields("ROOM_BOOKED").Value - 1 crs.Update 'UPDATE COMPLETE 'UPDATING room_status BRS.Edit BRS.Fields("R_STATUS") = False BRS.Fields("cust_no") = 0 BRS.Update 'UPDATE COMPLETE Combo1.RemoveItem (CNT1)

49

Text3.Locked = True Printbill.Enabled = True Printbill.SetFocus MsgBox "Customer Checked Out.", vbInformation 'store customer number in a temporary variable before clearing cust_no = Val(Text1.Text) 'clear all the text boxes Text1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" Text5.Text = "" Text6.Text = "" Text8.Text = "" Text9.Text = "" Text10.Text = "" Text11.Text = "" Text12.Text = "" Text13.Text = "" Text14.Text = "" MaskEdBox1.Text = "" MaskEdBox2.Text = "" End If Exit Sub ERROR1: ARS.Edit ARS.CancelUpdate Call Errorhandler End Sub Private Sub Combo1_CLICK() Dim extbed As Integer, sduration As Integer, ext_amt As Currency Dim CNT As Integer Dim flag As Integer Dim VNTBOOKMARK As Variant extbed = 0 ext_amt = 0 paidout = 0 Printbill.Enabled = False PRINT_RECIPT.Enabled = False BRS.MoveFirst 'BRS is room_status table BRS.Index = "r_no"

50

For CNT = 0 To Combo1.ListCount If Combo1.Text = Combo1.List(CNT) Then CNT1 = CNT End If Next VNTBOOKMARK = BRS.Bookmark BRS.Seek "=", Combo1.Text If BRS.NoMatch Then MsgBox "THIS ROOM IS NOT BOOKED" BRS.Bookmark = VNTBOOKMARK Else Text1.Text = Val(BRS.Fields("CUST_NO")) 'ROOM_STATUS table flag = 1 End If If flag = 1 Then ARS.MoveFirst 'ARS is ENTRY table ARS.Index = "C_NO" VNTBOOKMARK = ARS.Bookmark ARS.Seek "=", Val(Trim(Text1.Text)) If ARS.NoMatch Then MsgBox "NO RECORD FOUND." ARS.Bookmark = VNTBOOKMARK Else 'if record found Text2.Text = ARS.Fields("cust_name") MaskEdBox1.Text = Date MaskEdBox2.Text = Format(Time, "hh:mm:ss am/pm") 'calculate stay duration If CDate(MaskEdBox1) = ARS.Fields("arr_date") Then Text5.Text = 1 Else Text5.Text = CDate(MaskEdBox1) - ARS.Fields("arr_date") If Val(MaskEdBox2.Text) > 12 Then 'if current day's time> 12:00 Text5.Text = Text5.Text + 1 End If End If stay_dur = Text5.Text crs.MoveFirst 'crs is room_information table Do While Not crs.EOF If crs.Fields("room_type") = BRS.Fields("room_type") Then Exit Do End If

51

crs.MoveNext Loop 'crs now has the same room type as BRS Text6.Text = crs.Fields("room_rent") Do While Not rd5.EOF 'rd5 is voucher _entry table If rd5.Fields("cust_no") = Text1.Text Then If rd5.Fields("v_type") = "EXTRA-BED" Then extbed = extbed + rd5.Fields("amount") Else ext_amt = ext_amt + rd5.Fields("amount") End If End If rd5.MoveNext Loop Do While Not rd7.EOF 'rd7 is paidtable table If rd7.Fields("cust_no") = Text1.Text Then paidout = paidout + rd7.Fields("amt") End If rd7.MoveNext Loop Text8.Text = extbed Text9.Text = ext_amt misc = extbed + ext_amt Text10.Locked = False Text10.SetFocus Combo1.Enabled = False End If End If End Sub Private Sub EXIT_FORM_Click() ARS.Close BRS.Close crs.Close RS1.Close RS2.Close rd5.Close rd6.Close rd7.Close Set BRS = Nothing Set ARS = Nothing Set crs = Nothing Set RS1 = Nothing Set RS2 = Nothing Set rd5 = Nothing Set rd7 = Nothing Set rd6 = Nothing

52

checkout_cust.Hide Unload checkout_cust End Sub Private Sub Form_Load() On Error GoTo ERROR1 Set BRS = DB.OpenRecordset("room_status", dbOpenTable) Set ARS = DB.OpenRecordset("entry", dbOpenTable) Set crs = DB.OpenRecordset("room_information", dbOpenTable) Set RS1 = DB.OpenRecordset("BILL", dbOpenTable) Set RS2 = DB.OpenRecordset("Reciept", dbOpenTable) Set rd5 = DB.OpenRecordset("voucher_entry", dbOpenTable) Set rd6 = DB.OpenRecordset("extra bed", dbOpenTable) Set rd7 = DB.OpenRecordset("paidtable", dbOpenTable) If Not BRS.BOF Then BRS.MoveFirst While Not BRS.EOF If BRS.Fields("r_status") = True Then Combo1.AddItem (BRS.Fields("room_no")) End If BRS.MoveNext Wend BRS.MoveFirst EXIT_FORM.Enabled = True Printbill.Enabled = False PRINT_RECIPT.Enabled = False Else MsgBox "NO RECORD FOUND." Combo1.Enabled = False Label2.Enabled = False End If Exit Sub ERROR1: Call Errorhandler End Sub Private Sub PRINT_RECIPT_Click() env1.Connection2.Open On Error GoTo ERROR3 env1.cmdreceipt cust_no rptReceipt.Show PRINT_RECIPT.Enabled = False

53

ERROR3: Call Errorhandler End Sub Private Sub Printbill_Click() On Error Resume Next 'GoTo err env1.Connection1.Open PRINT_RECIPT.Enabled = True PRINT_RECIPT.SetFocus env1.cmdcustinfo stay_dur, paidout, misc, cust_no rptBill.Show Printbill.Enabled = False Exit Sub err: Call Errorhandler End Sub Private Sub Text10_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then calculate.SetFocus calculate_Click Else If KeyAscii <> 8 Then If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then MsgBox "ONLY NUMBERS ALLOWED.", vbOKOnly + vbInformation, "" KeyAscii = 0 End If End If End If End Sub Private Sub Text3_KeyPress(KeyAscii As Integer) If KeyAscii <> 8 Then If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then MsgBox "ONLY NUMBERS ALLOWED.", vbOKOnly + vbInformation, "" KeyAscii = 0 End If End If End Sub

FRMADD_ROOM.FRM
Dim RS As Recordset Dim RS1 As Recordset Dim CURREC As Variant

54

Dim check As Integer Dim OP As Integer Const number$ = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" Private Sub cmdadd_Click() On Error GoTo ERROR2 Dim A As Integer A=1 If OP = 1 Then 'if new room added If Combo1.Text = "" Or Combo2.Text = "" Then MsgBox "Select both 'Room Type' and 'Floor' first!", vbInformation Exit Sub End If RS1.Edit RS1.Fields("room_avail") = RS1.Fields("room_avail") + 1 RS1.Fields("total_room") = RS1.Fields("total_room") + 1 RS1.Update RS.AddNew RS.Fields("room_no") = Trim(Text3.Text) RS.Fields("floor") = Trim(Combo2.Text) RS.Fields("room_type") = UCase(Trim(Combo1.Text)) RS.Fields("r_status") = False RS.Update RS.MoveFirst Label1.Visible = False Label2.Visible = False Label6.Visible = False Label3.Visible = False Text3.Text = "" Text3.Visible = False RS.Close Combo2.Clear Combo1.Clear Combo1.Visible = False Combo2.Visible = False Text4.Text = "" Text4.Visible = False Option1.Enabled = True Option2.Enabled = True Option2.Value = False

55

Option1.Value = False cmdexit.Enabled = True cmdadd.Visible = False ElseIf OP = 2 Then 'if new type of room added If Text1.Text = "" Then MsgBox "Please Enter A No.Of Max.Person" Text1.SetFocus A=2 ElseIf Text2.Text = "" Then MsgBox "Please Enter A Room-Type" Text2.SetFocus A=2 ElseIf Text4.Text = "" Then MsgBox " Please Enter A Room-rent" Text4.SetFocus A=2 End If If A = 1 Then If Not RS1.BOF Then RS1.MoveFirst CURREC = RS1.Bookmark RS1.Index = "RTYPE" RS1.Seek "=", UCase(Text2.Text) If Not RS1.NoMatch Then MsgBox "Duplicate Entries Not Allowed" RS1.Bookmark = CURREC Else RS1.AddNew RS1.Fields("ROOM_TYPE") = UCase(Trim(Text2.Text)) RS1.Fields("ROOM_RENT") = Text4.Text RS1.Fields("TOTAL_ROOM") = 0 RS1.Fields("ROOM_AVAIL") = 0 RS1.Fields("ROOM_BOOKED") = 0 RS1.Update RS1.MoveFirst End If Else RS1.AddNew RS1.Fields("ROOM_TYPE") = UCase(Trim(Text2.Text)) RS1.Fields("ROOM_RENT") = Text4.Text RS1.Fields("TOTAL_ROOM") = 0 RS1.Fields("ROOM_AVAIL") = 0

56

RS1.Fields("ROOM_BOOKED") = 0 RS1.Fields("MAX-PERSON") = Val(Text1.Text) RS1.Update RS1.MoveFirst End If Text1.Text = "" Text1.Visible = False Text2.Text = "" Text2.Visible = False Label8.Visible = False Label9.Visible = False Label10.Visible = False Text4.Text = "" Text4.Visible = False Option1.Enabled = True Option2.Enabled = True Option2.Value = False Option1.Value = False cmdexit.Enabled = True cmdadd.Visible = False End If End If Exit Sub ERROR2: Call Errorhandler End Sub Private Sub cmdexit_Click() RS1.Close Set RS1 = Nothing Unload Me End Sub Private Sub Combo1_CLICK() RS1.MoveFirst RS1.Index = "rtype" RS1.Seek "=", UCase(Trim(Combo1.Text)) If Not RS1.NoMatch Then Text4.Text = RS1.Fields("room_rent") End If cmdadd.Enabled = True 'cmdadd.SetFocus End Sub

57

Private Sub Combo2_click() max_room Combo1.Enabled = True End Sub Private Sub Form_Load() On Error GoTo ERROR1 Set RS1 = DB.OpenRecordset("ROOM_INFORMATION", dbOpenTable) Exit Sub ERROR1: Call Errorhandler End Sub Sub max_room() Dim max As Integer If Val(Trim(Combo2.Text)) = 1 Then max = 100 ElseIf Val(Trim(Combo2.Text)) = 2 Then max = 200 ElseIf Val(Trim(Combo2.Text)) = 3 Then max = 300 End If If RS.RecordCount > 0 Then RS.MoveFirst While Not RS.EOF If Val(Trim(Combo2.Text)) = RS.Fields("floor") Then If max < RS.Fields("room_no") Then max = RS.Fields("room_no") End If End If RS.MoveNext Wend End If max = max + 1 Text3.Text = max End Sub Private Sub Option1_Click() If RS1.RecordCount <= 0 Then

58

MsgBox "First Enter New Type of Room!", vbInformation Option1.Value = False Else Text2.Text = "" Text3.Text = "" Text4.Text = "" Text3.Locked = True Text4.Locked = True OP = 1 Combo1.Clear Label8.Visible = False Label9.Visible = False Combo2.List(0) = 1 Combo2.List(1) = 2 Combo2.List(2) = 3 Set RS = DB.OpenRecordset("ROOM_status", dbOpenTable) Combo1.Visible = True Combo2.Visible = True Combo1.Enabled = False Label1.Visible = True Label2.Visible = True Label6.Visible = True Label3.Visible = True Text3.Visible = True Text4.Visible = True Text1.Visible = False Label10.Visible = False cmdadd.Visible = True RS1.MoveFirst While Not RS1.EOF Combo1.AddItem (RS1.Fields("ROOM_TYPE")) RS1.MoveNext Wend RS1.MoveFirst End If End Sub Private Sub Option2_Click() 'Option1.Enabled = False OP = 2 Text1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" Text1.Visible = True Label10.Visible = True

59

Label1.Visible = False Label2.Visible = False Combo1.Visible = False Combo2.Visible = False Label3.Visible = False Label6.Visible = False cmdadd.Visible = True cmdadd.Enabled = False Label8.Visible = True Label9.Visible = True Label10.Visible = True Text2.Visible = True Text3.Visible = False Text4.Visible = True Text2.Locked = False Text4.Locked = False Text2.Enabled = True Text4.Enabled = True Text1.Visible = True Text2.SetFocus cmdadd.Enabled = True End Sub Private Sub TEXT1_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmdadd.SetFocus Else If KeyAscii <> 8 Then If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then MsgBox "Only Numbers Allowed.", vbOKOnly + vbInformation, "" KeyAscii = 0 End If End If End If End Sub Private Sub Text2_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Text4.SetFocus Else If KeyAscii <> 8 Then If InStr(number, Chr(KeyAscii)) = 0 Then MsgBox "Only alphabets allowed.", vbOKOnly + vbInformation, "" KeyAscii = 0 Exit Sub End If

60

End If End If End Sub Private Sub Text4_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Else If KeyAscii <> 8 Then If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then MsgBox "Only Numbers Allowed.", vbOKOnly + vbInformation, "" KeyAscii = 0 End If End If End If End Sub

FRMDELETE_ROOM.FRM
Dim RS1 As Recordset Dim RS As Recordset Dim OP As Integer Dim CURREC As Variant Dim check As Integer Const number$ = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" Private Sub cancel_Click() RS.Close RS1.Close Set RS = Nothing Set RS1 = Nothing Me.Hide Unload Me End Sub Private Sub cmddel_Click() On Error GoTo ERROR1 If OP = 1 Then If Text1.Text = "" Then MsgBox "PLEASE ENTER THE ROOM No. TO DELETE" Text1.SetFocus

61

Else If RS.RecordCount <= 0 Then MsgBox "NO ROOM AVAILABLE!", vbExclamation GoTo EXIT4 End If RS.MoveFirst CURREC = RS.Bookmark 'SEARCH ROOM RS.Index = "r_no" RS.Seek "=", Val(Text1.Text) If RS.NoMatch Then MsgBox " Room No. " + Text1.Text + " Not Found.", vbExclamation RS.Bookmark = CURREC Text1.Visible = False Text1.Text = "" Label2.Visible = False GoTo EXIT4 End If If RS.Fields("R_STATUS") = True Then MsgBox "ROOM No. " + Text1.Text + " IS IN USE.", vbExclamation GoTo EXIT4 Else CURREC = RS1.Bookmark RS1.Index = "RTYPE" RS1.Seek "=", RS.Fields("ROOM_TYPE") If Not RS1.NoMatch Then RS1.Edit RS1.Fields("TOTAL_ROOM") = RS1.Fields("TOTAL_ROOM") - 1 RS1.Fields("ROOM_AVAIL") = RS1.Fields("ROOM_AVAIL") - 1 RS1.Update RS.DELETE RS.MovePrevious MsgBox "Room " + Text1.Text + " Is Deleted" GoTo EXIT4 End If End If End If ElseIf OP = 2 Then If Text2.Text = "" Then MsgBox "Please Enter Room-Type To Delete" Text2.SetFocus Else

62

If RS1.RecordCount <= 0 Then MsgBox "NO ROOM TYPE AVAILABLE!", vbExclamation GoTo EXIT5 End If RS1.MoveFirst CURREC = RS1.Bookmark RS1.Index = "RTYPE" RS1.Seek "=", Text2.Text If RS1.NoMatch Then MsgBox "Room-Type " + Text2.Text + " Not Found.", vbExclamation RS1.Bookmark = CURREC Text2.Text = "" GoTo EXIT5 End If If RS.RecordCount > 0 Then Do While Not RS.EOF If RS.Fields("ROOM_TYPE") = RS1.Fields("ROOM_TYPE") Then If RS.Fields("R_STATUS") = True Then MsgBox "SORRY, Room Type" + Text2.Text + " Cannot Be Deleted " check = 2 GoTo EXIT5 End If End If RS.MoveNext Loop RS.MoveFirst If check = 1 Then While Not RS.EOF If RS.Fields("ROOM_TYPE") = RS1.Fields("ROOM_TYPE") Then 'DELETING ROOM-UPDATING ROOM STATUS TABLE RS.DELETE End If RS.MoveNext Wend End If End If RS1.DELETE RS1.MovePrevious MsgBox "ROOM TYPE " + Text2.Text + " DELETED" If RS.RecordCount > 0 Then RS.MoveFirst End If

63

GoTo EXIT5 End If End If Exit Sub EXIT4: Label2.Visible = False Text1.Text = "" Text1.Visible = False cmddel.Enabled = False Option1.Value = False EXIT5: Label3.Visible = False Text2.Text = "" Text2.Visible = False cmddel.Enabled = False Option2.Value = False ERROR1: Call Errorhandler End Sub Private Sub Form_Load() 'OPEN DATABASE AND TABLE On Error GoTo ERROR2 Set RS = DB.OpenRecordset("ROOM_STATUS", dbOpenTable) Set RS1 = DB.OpenRecordset("ROOM_INFORMATION", dbOpenTable) Exit Sub ERROR2: Call Errorhandler End Sub Private Sub Option1_Click() If OP = 2 Then Option2.Value = False Text2.Visible = False Label3.Visible = False End If OP = 1 Label2.Visible = True Text1.Visible = True Text1.Text = "" Text1.SetFocus cmddel.Enabled = True End Sub

64

Private Sub Option2_Click() check = 1 If OP = 1 Then Option1.Value = False Label2.Visible = False Text1.Visible = False End If OP = 2 Label3.Visible = True Text2.Visible = True Text2.SetFocus cmddel.Enabled = True End Sub Private Sub TEXT1_KeyPress(KeyAscii As Integer) 'RESTRICTING INPUT If KeyAscii = 13 Then cmddel.Enabled = True cmddel.SetFocus Else If KeyAscii <> 8 Then If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then MsgBox "Only Numbers Allowed.", vbOKOnly + vbInformation, "" KeyAscii = 0 End If End If End If End Sub Private Sub Text2_KeyPress(KeyAscii As Integer) 'RESTRICTING INPUT If KeyAscii = 13 Then cmddel.SetFocus Else If KeyAscii <> 8 Then If InStr(number, Chr(KeyAscii)) = 0 Then MsgBox "Only alphabets allowed.", vbOKOnly + vbInformation, "" KeyAscii = 0 Exit Sub / End If / End If / End If / End Sub

FRMMODIFY_RATE.FRM
Dim RD As Recordset

65

Private Sub Combo1_CLICK() Dim CUREC As Variant RD.Index = "RTYPE" CUREC = RD.Bookmark RD.Seek "=", Combo1.Text If RD.NoMatch Then MsgBox "NO MATCH FOUND-PLEASE TRY LATER" RD.Bookmark = CUREC Unload Me Else Text1.Text = RD.Fields("ROOM_RENT") Text2.Locked = False End If Text2.SetFocus SAVE.Enabled = True End Sub Private Sub cancel_Click() RD.Close Set RD = Nothing Unload Me End Sub Private Sub Form_Load() On Error GoTo ERROR2 Set RD = DB.OpenRecordset("ROOM_INFORMATION", dbOpenTable) If Not RD.BOF Then RD.MoveFirst While Not RD.EOF Combo1.AddItem (RD.Fields("ROOM_TYPE")) RD.MoveNext Wend RD.MoveFirst Else MsgBox "NO ROOM AVAILABLE-PLEASE TRY LATER" End If Exit Sub ERROR2: Call Errorhandler End Sub

66

Private Sub SAVE_Click() On Error GoTo ERROR1 If Text2.Text = "" Then MsgBox "PLEASE ENTER NEW RATE" Text2.SetFocus Else RD.Edit RD.Fields("ROOM_RENT") = Text2.Text RD.Update Text1.Text = "" Text2.Text = "" Text2.Locked = True SAVE.Enabled = False End If Exit Sub ERROR1: Call Errorhandler End Sub Private Sub Text2_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SAVE.Enabled = True SAVE.SetFocus Else If KeyAscii <> 8 Then If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then MsgBox "ONLY NUMBERS ALLOWED.", vbOKOnly + vbInformation, "" KeyAscii = 0 End If End If End If End Sub

FRMSEARCH.FRM
Dim start As Boolean Dim flag As Integer Dim cust_name As String Dim cust_no As Integer Dim arr_date As Date Dim dep_date As Date Dim RS As Recordset Dim mess_array(1 To 4) As String

67

Private Sub cmdcancel_Click() frmsearch.Hide RS.Close Set RS = Nothing Unload Me End Sub Private Sub cmdnext_Click() If start = True Then RS.MoveFirst start = False Else RS.MoveNext cmdpre.Enabled = True End If Select Case flag Case 1 If txtoption.Text = "" Then MsgBox "Enter the customer's Name!", vbExclamation txtoption.SetFocus Exit Sub Else cust_name = UCase(txtoption.Text) Do While Not RS.EOF If RS.Fields("cust_name") = UCase(txtoption.Text) Then Call fill_textboxes Exit Sub End If RS.MoveNext Loop 'if no record found MsgBox "No Record Found!", vbInformation cmdnext.Enabled = False End If Case 2 If txtoption.Text = "" Then MsgBox "Enter the customer number!", vbExclamation txtoption.SetFocus Exit Sub Else cust_no = Val(txtoption.Text) Do While Not RS.EOF If RS.Fields("cust_no") = Val(txtoption.Text) Then Call fill_textboxes

68

Exit Sub End If RS.MoveNext Loop 'if no record found MsgBox "No Record Found!", vbInformation cmdnext.Enabled = False End If Case 3 If txtoption.Text = "" Then MsgBox "Enter the Arrival Date!", vbExclamation txtoption.SetFocus Exit Sub Else arr_date = CDate(txtoption.Text) Do While Not RS.EOF If RS.Fields("ARR_DATE") = CDate(txtoption.Text) Then Call fill_textboxes Exit Sub End If RS.MoveNext Loop 'if no record found MsgBox "No Record Found!", vbInformation cmdnext.Enabled = False End If Case 4 If txtoption.Text = "" Then MsgBox "Enter the Departure Date!", vbExclamation txtoption.SetFocus Exit Sub Else dep_date = CDate(txtoption.Text) Do While Not RS.EOF If RS.Fields("DEP_DATE") = CDate(txtoption.Text) Then Call fill_textboxes Exit Sub End If RS.MoveNext Loop 'if no record found MsgBox "No Record Found!", vbInformation cmdnext.Enabled = False End If

69

End Select End Sub Private Sub cmdpre_Click() On Error Resume Next cmdnext.Enabled = True RS.MovePrevious Select Case flag Case 1 If txtoption.Text = "" Then MsgBox "Enter the customer's Name!", vbExclamation txtoption.SetFocus Exit Sub Else Do While Not RS.EOF If RS.Fields("cust_name") = UCase(txtoption.Text) Then Call fill_textboxes Exit Sub End If RS.MovePrevious Loop 'if no record found MsgBox "No Record Found!", vbInformation cmdpre.Enabled = False End If Case 2 If txtoption.Text = "" Then MsgBox "Enter the customer number!", vbExclamation txtoption.SetFocus Exit Sub Else Do While Not RS.EOF If RS.Fields("cust_no") = Val(txtoption.Text) Then Call fill_textboxes 'VNTBOOKMARK = RS.Bookmark Exit Sub End If RS.MovePrevious Loop 'if no record found MsgBox "No Record Found!", vbInformation cmdpre.Enabled = False End If Case 3

70

If txtoption.Text = "" Then MsgBox "Enter the Arrival Date!", vbExclamation txtoption.SetFocus Exit Sub Else Do While Not RS.EOF If RS.Fields("ARR_DATE") = CDate(txtoption.Text) Then Call fill_textboxes Exit Sub End If RS.MovePrevious Loop 'if no record found MsgBox "No Record Found!", vbInformation cmdpre.Enabled = False End If Case 4 If txtoption.Text = "" Then MsgBox "Enter the Departure Date!", vbExclamation txtoption.SetFocus Exit Sub Else Do While Not RS.EOF If RS.Fields("DEP_DATE") = CDate(txtoption.Text) Then Call fill_textboxes Exit Sub End If RS.MovePrevious Loop 'if no record found MsgBox "No Record Found!", vbInformation cmdpre.Enabled = False End If End Select End Sub Private Sub cmdprint_Click() env1.Connection3.Open Frame1.Enabled = False txtoption.Enabled = False cmdprint.Enabled = False cmdsearch.Enabled = False Select Case flag Case 1 'search by name env1.cmdsearchname cust_name

71

rptsearchname.Show Case 2 'search by customer number env1.cmdsearch_custno cust_no rptsearch_custno.Show Case 3 'search by arrival date env1.cmdsearch_arrdate arr_date rptsearch_arrdate.Show Case 4 'search by departure date env1.cmdsearch_depdate dep_date rptsearch_depdate.Show End Select End Sub Private Sub cmdsearch_Click() Call clear_textboxes If Not txtoption.Text = "" Then If flag = 3 Or flag = 4 Then If Not IsDate(txtoption.Text) Then MsgBox "Not a Valid Date!", vbExclamation txtoption.Text = "" txtoption.SetFocus Exit Sub End If End If cmdprint.Enabled = True start = True cmdnext.Enabled = True cmdpre.Enabled = False If RS.RecordCount <= 0 Then MsgBox "NO CUSTOMER AVAILABLE!", vbExclamation Else cmdnext_Click End If Else If Not txtoption.Visible = False Then txtoption.SetFocus End If End If End Sub Private Sub Form_Load() On Error GoTo ERROR2 'OPEN DATABASE TABLE Set RS = DB.OpenRecordset("Entry", dbOpenTable) mess_array(1) = "Enter Customer Name"

72

mess_array(2) = "Enter Customer No" mess_array(3) = "Enter Arrival Date [MM/DD/YYYY]" mess_array(4) = "Enter Departure Date [MM/DD/YYYY]" cmdprint.Enabled = False Exit Sub ERROR2: Call Errorhandler End Sub Private Sub Option1_Click() Call clear_textboxes txtoption.Visible = True txtoption.Text = "" txtoption.SetFocus Label1.Visible = True Label1.Caption = mess_array(1) cmdpre.Enabled = False cmdnext.Enabled = False cmdprint.Enabled = False flag = 1 End Sub Private Sub Option2_Click() Call clear_textboxes txtoption.Visible = True txtoption.Text = "" txtoption.SetFocus Label1.Visible = True Label1.Caption = mess_array(2) cmdpre.Enabled = False cmdnext.Enabled = False cmdprint.Enabled = False flag = 2 End Sub Private Sub Option3_Click() Call clear_textboxes txtoption.Visible = True txtoption.Text = "" txtoption.SetFocus Label1.Visible = True Label1.Caption = mess_array(3) cmdpre.Enabled = False

73

cmdnext.Enabled = False cmdprint.Enabled = False flag = 3 End Sub Private Sub Option4_Click() Call clear_textboxes txtoption.Visible = True txtoption.Text = "" txtoption.SetFocus Label1.Visible = True Label1.Caption = mess_array(4) cmdpre.Enabled = False cmdnext.Enabled = False cmdprint.Enabled = False flag = 4 End Sub Sub clear_textboxes() For i = 0 To 13 Text1(i).Text = "" Next i End Sub Sub fill_textboxes() Text1(0).Text = RS.Fields("cust_name") Text1(1).Text = RS.Fields("ADDRESS") Text1(2).Text = RS.Fields("COUNTRY") Text1(3).Text = RS.Fields("STATE") Text1(4).Text = RS.Fields("PHONE") Text1(5).Text = RS.Fields("INHOUSE") Text1(7).Text = RS.Fields("CUST_NO") Text1(8).Text = RS.Fields("ARR_DATE") Text1(9).Text = RS.Fields("ARR_TIME") 'if customer is not inhouse If Not RS.Fields("DEP_DATE") = "" Then Text1(6).Text = RS.Fields("BILL_NO") 'calculate stay duration If RS.Fields("DEP_DATE") = RS.Fields("arr_date") Then Text1(10).Text = 1 Else Text1(10).Text = CDate(RS.Fields("DEP_DATE")) - CDate(RS.Fields("arr_date")) If Val(RS.Fields("DEP_TIME")) > 12 Then 'if current day's time> 12:00 Text1(10).Text = Text1(10).Text + 1

74

End If End If Text1(11).Text = RS.Fields("TOT_AMT") Text1(12).Text = RS.Fields("PAID") Text1(13).Text = RS.Fields("BALANCE") Else 'if customer is inhouse Text1(6).Text = "" Text1(10).Text = "" Text1(11).Text = "" Text1(12).Text = "" Text1(13).Text = "" End If End Sub Private Sub txtoption_KeyPress(KeyAscii As Integer) Const numbers$ = "-/0123456789" If flag = 3 Or flag = 4 Then If KeyAscii <> 8 Then If InStr(numbers, Chr(KeyAscii)) = 0 Then MsgBox "ONLY NUMBERS, HYPHEN(-) AND FORWARD SLASH(/) ALLOWED.", vbOKOnly + vbInformation, "" KeyAscii = 0 Exit Sub End If End If End If End Sub

75

SYSTEM DESCRIPTION
The entry to the system is password protected. Once entry is granted, the user is faced with the main screen with all the menus as can be seen in the user screen section. The information menu provides the user with room status information and an option to change the login password. Needless to say, only authorized persons can change the login password. The customer menu provides the user with the options that are basically, needed for tasks related to customers such as: Check in Check out Voucher entry

The room menu is needed in case of a modification in the number, type or rate of the rooms. The search menu provides various search options based on user criterion. The report menu has the options of choosing from various types of reports.

76

UNIT TESTING
Each and every unit or module of program is tested whether it is giving output properly or not. Thus the functionality of the program is tested unit wise.

PROJECT TESTING
In this the project is tested as a whole entity. Inputs are given and outputs are received from program.

77

PACKAGE CREATION
The package for the hotel management software has been created using the Package and Deployment wizard that comes with the Microsoft Visual Studio Professional 6.0 (or Enterprise 6.0) edition software package. The wizard first compiles the project code and then displays a list of files necessary for the project to run properly on the destination machine. An extra file can also be included, if necessary (for example, the HOTEL.MDB database file is also included in the package). The wizard then creates project CAB files along with a setup.exe program in the destination directory and then displays a report reporting the successful (or unsuccessful) creation of the package. The list of files that were included with the software package is: KAVERI.exe Hotel.mdb DAO350.dll EXPSRV.dll MDAC_TYP.exe MSADO20.tlb MSBIND.dll Mscomctl.ocx MSDBRPTR.dll MSDERRUN.dll MSJET35.dll MSJINT35.dll MSJTER.dll

78

MSMASK32.ocx Setup.exe VB%DB.dll VB6 Runtime and OLE Automation ST6UNST.exe VB6STKIT.dll VBAJET32.dll

79

INSTALLATION
The software package that was created in the previous step contains a setup program that installs the Hotel Management software on the destination machine. Once initiated, the program asks for the destination directory where the installation files would be copied. The program then automatically copies all the needed files to the destination directory (some files are also copied to the directory where windows system files are stored).

The setup program also creates necessary shortcuts and start menu entries.

80

SYSTEM REQUIREMENT
The minimum hardware and software requirements for running the Hotel Management Software on the destination machine are listed below: Pentium-class processor Microsoft Windows 98 Second Edition, Windows Millennium Edition, Windows NT Workstation 4.0 with Service Pack 6, Windows 2000 Professional with Service Pack 2, Windows XP Professional or Home, or Windows XP Tablet PC. 64 MB of RAM (128 MB recommended). 60 MB of available hard-disk space.

The installer creates temporary files during installation so the actual hard disk space required during installation is greater than the values listed above.

81

RESULT OR CONCLUSION
The Hotel Management System has been developed, optimized, tested and installed successfully. Adequate troubleshooting features have been incorporated and no strenuous training is required to operate it.

82

REFERENCES
Database Programming with Visual Basic 6 in 21 days: - Smith and Amundsen. Visual basic 6 in 21 days - Smith and Amundsen. MSDN Library Microsoft Corporation Visual basic 6 programming Black Book - Steven Holzner. System Analysis and Design - Hoffer.

83

You might also like