Escolar Documentos
Profissional Documentos
Cultura Documentos
ROLL NO
(352503) (352518) (352519)
SUBMITTED TO :
DEPARTMENT OF COMPUTER SCIENCE & APPLICATION IN PARTIAL FULFILLMENT OF THE DEGREE. MSc.cs (final yr.)
UNIVERSITY OF KOTA
UNIVERSITY OF KOTA
2008-09 UNDER THE ESTEMMED GUIDENCE: Mr. JOGINDER SINGH (LECTURER) DEPARTMENT OF COMPUTER SCIENCE &APPLICATION, MIMT, KOTA
CERTIFICATE
Certified that project work entitled HOTEL MANAGEMENT SYSTEM is a bonafide work carried out by Bhuvanesh Rathod, Suman Nagar, Sunita Rathod at MIMT, Kota. In partial fulfillment for the award of M.Sc. (c.s.)Final Yr. in Computer Science from University of Kota, Kota during the academic year 2008-2009
(NAME OF EXTERNAL)
ACKNOWLEDGEMENT
I Would Like To Express Our Immense Gratitude To Our Project Guide Mr. Joginder Singh (Lecturer) Department Of Computer Science Mimt College. Kota For The Kind Guidance Support Encouragement And Suggestions At Every Stage Of The Project .It Was His Indispensable Suggestion And Laudable Patience That Enable Us To Carry One Of The Project. We Give Special Thanks To Mr. N.K. Joshi Head Of Department Of Computer Science, Who Permitted Us To Use The All-Available Facilities Needed For This Work. Finally We Knowledge with Sincere Thanks for the Valuable Support from All of Our Colleges.
ABSTRACT
Project Name: Hotel Management System Project Team: Bhuvnesh Rathod, Suman Nagar, and Sunita Rathod Term: 2008-09: Year (Final)
Though the software has a high demand commercially in the different hotels with slight modifications to suit their specific hotel requirements for the implementations basic Infrastructure is required to be established that must consist of the followings. A lease celeron computer along with a print Windows operating system (window XP). A separate accommodation with air condition and required furniture. A person /operator with a hand-on experience of data punching. A proper small training to the staff regarding use and various facilities provide to them by this software etc.
I have implemented it at my home pc to enter test data into it and check all the contents and the outputs generated through the system my self and my project guide Mr. Joginder Sing are fully satisfied with it and I hope you will also appreciate it with some good suggestions to further improve it to enhanced its quality aspect.
TABLE OF CONTENTS
Page ACKNOWLEDGEMENTS........................................................................................ iii ABSTRACT ................................................................................................................ IV 1. INTRODUCTION............................................................................6-9 2. STATEMENT OF PROBLEM ......................................................10 3. PROPOSED SOLUTIONS.11 4. DATABASE LAYER .................................................................... 12-22
4.1 4.2 E-R Diagram /DFD ................................................................................. 13 Table. 14-22
5. EXTERNAL INTERFACE..................................................................... 23-24 5.1. Hardware Interface........................................................................................... 23 5.2. Software Interface.............................................................................................24 6. PROCESS LOGIC LAYER ..............................................................30 6.1. Input Specification .........................................................................................36 6.2. Coding........................................................................................................39 6.3 Output Specification.. 42 7. FUTURE SCOPE .............44
REFERENCES ............................................................................................................... 49
INTRODUCTION
INTRODUCTION
1.1 About HMS (Hotel Management System) Hotels as a concept originated in the 6th century BC in the forms of inns. These were Fun by couples and provided sleeping arrangements in big Rooms similar to todays dormitories in youth hostels Hotels as is known Toadys emerged in Switzerland and was patronized by aristocracy. Hotel is defined as a place where a traveler can receive food And shelter provided he can pay for it. They are categorized Depending upon their location, number of rooms type of Clientele, length of stay and facilities available. Some of them Are below. 1. Downtown: -
These are also referred to as commercial hotels. They are situated in the heart of the city and are frequented by businessmen on travel. Owing to their prime location their rates are high.
2. Suburban Hotels: These are ideal for study tours and conferences. Rates are moderate.
3. Resorts: These are normally located outside cities in sites abounding in scenic beauty, catering to those on holidays. It is ideal for relaxation and recreation. It is divided into beach resorts, winter resorts, hill resorts health resorts and summer resorts. The rates here are normally on American plan.
4. Airport Hotel: -Rats are normally on European plan. These are ideal for transit
Passengers.
5. Motels: - These are situated on highways. These are on European plan only.
6. Residential Hotel: - Here the rooms are leased out for a minimum period of one
month.The rooms are more or less like a self-contained apartment with hotel facilities.
7. Inns: - These are smaller in size and ideal for people traveling on a small budget.
8. Flotels: -These are situated on the surface of water-sea, river or lake. Old luxury
ships are converted into hotels and provide a very exotic atmosphere.
Our objective of this project is to computerized Hotel Management system so that a number of problems are removed from manually Hotel Management system. Advantages of computerized Hotel Management systems are given below.
1. Increased speed. Simultaneous posting in one operation can save time and labour. About five times faster than posting by hand. 2. Greater accuracy. Some of the human errors can be reduced, especially 3. Improved records. Bills prepared by machine are neater and more legible, therefore more helpful to the staff and more pleasing to the customer. 4. Elimination of tedious repetitive work such as casting and balancing. Information for management can be quickly and easily produced.
It is the software package developed in Visual environment for Supporting hotel management in managing their activities in systematic manner using computer. The HMS is a totally menu-driven And provides graphical user interfaces having menus, buttons, text boxes, combo boxes etc. It is very easy to operate but sideby-side provides vary powerful security features to ensure safety to the system. The software has two security levels one for Operator and other for System Administrator. The HMS uses ADO Data Objects to access the data to & from Access object instances works as the bridge between Visual Basic and Access. Which data travels from application to the tables and vice versa with full flexibility? 1.2 Objectives
This system is basically designed not only to assist low level operation staff but also to assist to the middle & top-level management to monitor the progress and improve the infrastructures or educational environment of the institute. On-line progress evaluation of reservation, cheack in, cheack out, other services like telephone facility etc. and various other useful reports for the management can be generated through this system.
By using this system one can spare his/her all attention towards the expansion of hotel and still can manage the increased work load because of use of this wonderfully fast & accurate assistant (i.e. computer). The success of every organization lies in form of inflow of revenue earned. Its even more important to manage or monitor the financial inflows rather then just getting it earned. The system fulfills that basic need and furnishes management with latest updated status of fees paid by each every student so that they can plan their future activities according to present income and expenditure information.
STATEMENT OF PROBLEMS
This is one of the major activities of the analysis phase. The problem area is discussed from a number of prospective. One of the most critical and important tasks of the system development is the identification and careful specification of the problem. After we had studied existing system, problem specification becomes more comprehensive. The problem, which has to be tackled, was the reduction of the data in reports so that they become more manageable.
Develop hotel management software for use by small to medium sized property.
Software package must allow for. Fast check INS and reservation. Quick retrieval of guest information /history. Simply filling /accounting system. Software is not for use by large properties therefore software should not contain any function, which would cause any slowness confusion or inefficiency for the end user.
PROPOSED SOLUTIONS
The main objective of this System is to increase the detail of daily routine for needs of people to stay in the Hotel. Today world required computerization in every field with increase in complexity in monitoring detail of HOTEL MANAGEMENT SYSTEM has decided to go for a computerized customer. Its daily routine things to easy to task of their hotel spot. In this project our main need to developed software that can store information about customer. The main objective of this project to provide the information for about Hotel, Resarvation, rooms, restaurant, bar, facility etc.
To achieve our goal we divide the project in the following: Check in Detail Check Out Detail Rooms Detail Restaurant & Bar Detail Customer Detail Order by Customer Employee Details
DATABASE LAYER
TABLES
Check In
Fields Name Customer _Code Customer_ Name Age Address City State Country Pin code Phone No Room Type Room No Email Id Do Check In Do Checkout Children Adults Advance ToCheckIn
Data Type Number Text Text Text Text Text Text Number Text Text Text Text Date/Time Date/Time Number Number Currency Date/Time
Description Primary Key Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null
Checkout
Fields Name Customer_ Code Customer Name Age Address City State Country Pin code Phone No Room No Room Type Email Id Adults Children Check In Checkout Advance Restaurant Bill Bar Bill Total Room Charges Bill-Aspect
Data Type Number Text Text Text Text Text Text Number Text Text Text Text Text Text Date/Time Date/Time Text Currency Currency Currency Currency Yes/No
Description Primary key Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null
Emp_Table
Fields Name Emp _Id Emp _Name Age Do Birth Address City State Pin code Phone No Education Experience Do Joining Designation Department Salary Do leaving
Data Type Number Text Number Date/Time Text Text Text Text Text Text Text Date/Time Text Text Currency Date/Time
Description Primary Key Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null
Payroll
Fields Name Emp _Id Emp_ Name Department Designation Basic salary Month Hour Rate Hour Time Transport House rent Medical Pension Net pay Processed date Data Type Number Text Text Text Currency Text Currency Number Currency Currency Currency Currency Currency Date/Time Description Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null
Reservation
Fields Name Customer_ Code Customer Name Age Address City State Country Pin code Phone No Do Check In Do Checkout Advance50% Room Type Room No Etime Adults Children EmailId Data Type Number Text Text Text Text Text Text Text Text Date/Time Date/Time Currency Text Text Date/Time Text Text Text Description Primary Key Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null Not Null
Tbill
Fields Name Bill _No Customer _Code Customer Name Advance Restaurant Bill Bar Bill Room Charges Total
Data Type Number Number Text Currency Currency Currency Currency Currency
Description Primary key Not Null Not Null Not Null Not Null Not Null Not Null Not Null
R-veg
Fields Name Veg V Price Data Type Text Text
Login
Fields Name Username Password Data Type Text Text
Suite
Data Type
Text Text Yes/No
Deluxe-Single
Fields Name Room No Type Code Status Data Type Text Text Yes/No
Executive-Double
Fields Name Room No Type Code Status Data Type Text Text Yes/No
Executive-Double
Standard-Double
Fields Name Room No Type Code Status Data Type Text Text Yes/No
Non-Veg
Fields Name NonVeg N price Data Type Text Text
Soft Drink
R-order
Fields Name Customer Name Table No Item PPitmen Quantity Total price
R-Bill
Fields Name Customer Code Customer Name Total Amount Data Type Number Text Text
Hard Drink
Fields Name Drink Price Data Type Text Text
Room Charges
Fields Name Suite (double a/c) Deluxe (double a/c) Deluxe (Single a/c) Executive (double a/c) Executive (single a/c) Standard (double a/c) Standard (single a/c)
Bar-Order
Fields Name Customer Name Table No Item Pitmen Quantity Total Price Data Type Text Text Text Text Text Text
B-Bill
EXTERNAL INTERFACE
HARDWARE INTERFACE
Processor p4 generation Clock speed 223MHZ Ram 256MB Hard disk capacity 10.2GB Floppy disk drive 1.44 MB Monitor 13svga monitor color Keyboard 125keys Keyboard 125 keys
SOFTWARE INTERFACE: 1). PLATEFORM: -visual basic 6.0is required OS like window 9X, window 2000, window xp
MICROSOFT ACCESS AS BACK AND: MS ACESS is a relational date base management system through which we can have multiple tables, are linked to each other through command field, each table containing a Specific type of information. Access also gives the option of working with one access table by itself or with different kind of database, fields and records.
Database: a database is a simple collection of useful data or collection of related tables. Entity: an entity is any object, please, person, &concept, activity about which can have instance. Should be capable of being uniquely identified Entity set: it is a collection of similar entities Attribute: attribute is a data element that describe an entity Relationship: this is an association between entities Primary key: it is an attributes or set of attributes used to identified an entity in a entity
SCREENSHOT
FORM NAME:-LOGIN
TO SHOW OPENING SCREEN OF HMS PACKAGE WHICH VERFIES LEGAL 30 ENTRY TO SOFTWARE BY ASKING USER NAME & PASSWORD.
SCREENSHOT
SCREENSHOT
FORM NAME:-CHECKIN
TO INPUT THE CUSTOMER ENTRY IN THE HOTEL.
SCREENSHOT
FORM NAME:-CHECK_OUT
TO MAKE AN ENTRY WHEN PERSON LEAVE THE HOTEL.
SCREENSHOT
FORM NAME:-RESERVATION
TO MAKE RESERVATION FOR THE CUSTOMER.
SCREENSHOT
SCREENSHOT
FORM NAME:-REST_ORDER
TO TAKE RESTAURANT ORDER FORM HOTEL GUEST & CUSTOMER.
SCREENSHOT
SCREENSHOT
FORM NAME:-EMPLOYEE
TO ADDNEW, DELETE, EDIT &VIEW THE LIST OF EMPLOYEE WHO WORKS IN HOTEL.
SCREENSHOT
SCREENSHOT
FORM NAME:-SEARCHGUEST
TO SEARCH THE RECORD OF THE CUSTOMER WHO STAY IN THE HOTEL. 40
SCREENSHOT
FORM NAME:-SEARCHEMP
TO SEARCH THE RECORD OF THE EMPLOYEE WHO WORKSSYSYTEM HOTEL MANAGEMENT IN THE HOTEL. 41
SCREENSHOT
SCREENSHOT
SCREENSHOT
SCREENSHOT
SYSYTEM
SCREENSHOT
CODE
Option Explicit Private Sub Form_KeyPress (Key ASCII as Integer) Unload Me End Sub Private Sub Frame1_Click () Unload Me End Sub Private Sub Timer1_Timer () ProgressBar1.Value = ProgressBar1.Value + 1 If ProgressBar1.Value = 100 Then Unload Me Login. Show End If End Sub
CODING :- LOGIN
CODE
Private Sub cmdCancel_Click () Unload Me End Sub Private Sub cmdOK_Click () Dim StrSql as String If rs_login. State = adStateOpen Then rs_login. Close rs_login. Open "select * from login where Username='" + txtUname. Text + "' and pwd='" + txtPsd. Text + "'" If Not rs_login. EOF Then MsgBox "WELCOME TO THE HOTEL MANAGEMENT PROJECT" MDIForm1.Show Unload Me Else MsgBox "PLEASE ENETR THE CORRECT USERNAME & PASSWORD" End If rs_login. Close End Sub
CODING :- MDIFORM1
CODE
Private Sub MDIForm_Load() Tip.Show End Sub Private Sub mnuAbout_Click() HELP.Show End Sub Private Sub mnuBar_Click() B_order.Show End Sub Private Sub mnuBill_Click() bill.Show End Sub Private Sub mnuCalculator_Click() On Error GoTo errHandle Dim a As Double a = Shell("calc.exe", vbNormalFocus) Exit Sub errHandle: MsgBox "Unable to run Calculator Utility on your computer", vbInformation, "Error in opening!!!" Resume Next End Sub Private Sub mnuCharges_Click() Rcharges.Show End Sub Private Sub mnuCheckin_Click() CkeckIn.Show End Sub Private Sub mnuCheckout_Click() check_out.Show End Sub Private Sub mnuchkin_Click() CrystalReport1.ReportFileName = "\\Cs\cs0703\final\Project\CHKIN.RPT" CrystalReport1.Action = 1
End Sub Private Sub mnuchkout_Click() CrystalReport1.ReportFileName = "\\Cs\cs0703\final\Project\CHKOUT.rpt" CrystalReport1.Action = 1 End Sub Private Sub mnuCPassword_Click() Password.Show End Sub Private Sub mnudetail_Click() CrystalReport1.ReportFileName = "\\Cs\cs0703\final\Project\REPORT1.RPT" CrystalReport1.Action = 1 End Sub Private Sub mnuEDetail_Click() Employee.Show End Sub Private Sub mnuEmp_Click() SearchEmp.Show End Sub Private Sub mnuempreport_Click() CrystalReport1.ReportFileName = "\\Cs\cs0703\final\Project\EMPLOYEE.RPT" CrystalReport1.Action = 1 End Sub Private Sub mnuEPayroll_Click() Payroll.Show End Sub Private Sub mnuExit_Click() Unload Me End Sub Private Sub mnuGuest_Click() SearchGuest.Show End Sub Private Sub mnuHStatus_Click() RStatus.Show
End Sub Private Sub mnuNotepad_Click() On Error GoTo errHandle Dim a As Double a = Shell("notepad.exe", vbNormalFocus) Exit Sub errHandle: MsgBox "Unable to run Notepad Utility on your computer", vbInformation, "Error in opening!!!" Resume Next End Sub Private Sub mnuReservation_Click() reservation.Show End Sub Private Sub mnuReserve_Click() CrystalReport1.ReportFileName = "\\Cs\cs0703\final\Project\RESERVE.RPT" CrystalReport1.Action = 1 End Sub Private Sub mnuRestaurent_Click() rest_order.Show End Sub
CODING :- CHECKIN
CODE
HOTEL MANAGEMENT SYSYTEM
51
Option Explicit Dim i As Integer Dim gcode As Integer Private Sub remove_data() txtGid.Text = " " txtName.Text = " " txtAge.Text = " " txtPhone.Text = " " txtEmail.Text = " " txtAddress.Text = " " txtCity.Text = " " txtState.Text = " " txtCountry.Text = " " txtPincode.Text = " " txtAdults.Text = " " txtChildren.Text = " " cmbRtype.Text = " " cmbRoomNo.Text = " " txtAdvance.Text = " " txtCitime.Text = " " End Sub Private Sub cmbRtype_Click() If cmbRtype.List(cmbRtype.ListIndex) = "Suite(Double A/c)" Then If rs_suite.State = adStateOpen Then rs_suite.Close rs_suite.Open "select * from suite where status=0 ", con, adOpenDynamic, adLockOptimistic cmbRoomNo.Clear With rs_suite .MoveFirst Do Until .EOF cmbRoomNo.AddItem .Fields("RoomNo") .MoveNext Loop End With ElseIf cmbRtype.List(cmbRtype.ListIndex) = "Executive(Double A/c)" Then If rs_executivedouble.State = adStateOpen Then rs_executivedouble.Close
rs_executivedouble.Open "select * from executive_double where status=0", con, adOpenDynamic, adLockOptimistic cmbRoomNo.Clear With rs_executivedouble .MoveFirst Do Until .EOF cmbRoomNo.AddItem .Fields(0) .MoveNext Loop End With ElseIf cmbRtype.List(cmbRtype.ListIndex) = "Executive(Single A/c)" Then If rs_executivesingle.State = adStateOpen Then rs_executivesingle.Close rs_executivesingle.Open "select * from executive_single where status=0", con, adOpenDynamic, adLockOptimistic cmbRoomNo.Clear With rs_executivesingle .MoveFirst Do Until .EOF cmbRoomNo.AddItem .Fields(0) .MoveNext Loop End With ElseIf cmbRtype.List(cmbRtype.ListIndex) = "Delux(Double A/c)" Then If rs_deluxdouble.State = adStateOpen Then rs_deluxdouble.Close rs_deluxdouble.Open "select * from delux_double where status=0 ", con, adOpenDynamic, adLockOptimistic cmbRoomNo.Clear With rs_deluxdouble .MoveFirst Do Until .EOF cmbRoomNo.AddItem .Fields(0) .MoveNext Loop End With ElseIf cmbRtype.List(cmbRtype.ListIndex) = "Delux(Single A/c)" Then If rs_deluxsingle.State = adStateOpen Then rs_deluxsingle.Close rs_deluxsingle.Open "select * from delux_single where status=0 ", con, adOpenDynamic, adLockOptimistic cmbRoomNo.Clear With rs_deluxsingle .MoveFirst Do Until .EOF cmbRoomNo.AddItem .Fields(0)
.MoveNext Loop End With ElseIf cmbRtype.List(cmbRtype.ListIndex) = "Standard(Double A/c)" Then If rs_standarddouble.State = adStateOpen Then rs_standarddouble.Close rs_standarddouble.Open "select * from standard_double where status=0 ", con, adOpenDynamic, adLockOptimistic cmbRoomNo.Clear With rs_standarddouble .MoveFirst Do Until .EOF cmbRoomNo.AddItem .Fields(0) .MoveNext Loop End With ElseIf cmbRtype.List(cmbRtype.ListIndex) = "Standard(Single A/c)" Then If rs_standardsingle.State = adStateOpen Then rs_standardsingle.Close rs_standardsingle.Open "select * from standard_single where status=0 ", con, adOpenDynamic, adLockOptimistic cmbRoomNo.Clear With rs_standardsingle .MoveFirst Do Until .EOF cmbRoomNo.AddItem .Fields(0) .MoveNext Loop End With End If End Sub Private Sub cmdCheckIn_Click() If txtGid.Text = " " Or txtName.Text = " " Or txtPhone.Text = " " Or txtCity.Text = " " Or txtAdults.Text = " " Or txtChildren.Text = " " Or txtAddress.Text = "" Or txtEmail.Text = " " Or txtState.Text = " " Or txtCountry.Text = " " Or txtAge.Text = " " Or txtPincode.Text = " " Or txtAdvance.Text = " " Then MsgBox "Fill The Complete Information", vbInformation, "HOTEL" txtName.SetFocus Exit Sub ElseIf cmbRtype.ListIndex = -1 Then MsgBox "Select Room Type" cmbRtype.SetFocus
Exit Sub ElseIf cmbRoomNo.ListIndex = -1 Then MsgBox "Select Room No." cmbRoomNo.SetFocus Exit Sub End If With rs_checkin .AddNew .Fields("customer_code") = Val(Mid(txtGid.Text, 4)) .Fields("customer_name") = Trim(UCase(txtName.Text)) .Fields("age") = Trim(UCase(txtAge.Text)) .Fields("address") = Trim(UCase(txtAddress.Text)) .Fields("phoneno") = Trim(UCase(txtPhone.Text)) .Fields("emailid") = Trim(UCase(txtEmail.Text)) .Fields("adults") = Trim(UCase(txtAdults.Text)) .Fields("children") = Trim(UCase(txtChildren.Text)) .Fields("city") = Trim(UCase(txtCity.Text)) .Fields("state") = Trim(UCase(txtState.Text)) .Fields("country") = Trim(UCase(txtCountry.Text)) .Fields("pincode") = Trim(UCase(txtPincode.Text)) .Fields("roomtype") = Trim(UCase(cmbRtype.Text)) .Fields("roomno") = Trim(UCase(cmbRoomNo.Text)) .Fields("docheckin") = cid.Value .Fields("docheckout") = cod.Value .Fields("tocheckin") = Trim(UCase(txtCitime.Text)) .Fields("advance") = Trim(UCase(txtAdvance.Text)) If cmbRtype.Text = "Suite(Double A/c)" Then If rs_suite.State = adStateOpen Then rs_suite.Close rs_suite.Open "select * from suite where status=0", con, adOpenDynamic, adLockOptimistic With rs_suite Do Until .EOF If .Fields(0) = cmbRoomNo.Text Then .Fields("status") = 1 .Update Exit Do End If .MoveNext Loop End With
ElseIf cmbRtype.Text = "Executive(Double A/c)" Then If rs_executivedouble.State = adStateOpen Then rs_executivedouble.Close rs_executivedouble.Open "select * from executive_double where status=0", con, adOpenDynamic, adLockOptimistic With rs_executivedouble Do Until .EOF If .Fields(0) = cmbRoomNo.Text Then .Fields("status") = 1 .Update Exit Do End If .MoveNext Loop End With ElseIf cmbRtype.Text = "Executive(Single A/c)" Then If rs_executivesingle.State = adStateOpen Then rs_executivesingle.Close rs_executivesingle.Open "select * from executive_single where status=0", con, adOpenDynamic, adLockOptimistic With rs_executivesingle Do Until .EOF If .Fields(0) = cmbRoomNo.Text Then .Fields("status") = 1 .Update Exit Do End If .MoveNext Loop End With ElseIf cmbRtype.Text = "Delux(Double A/c)" Then If rs_deluxdouble.State = adStateOpen Then rs_deluxdouble.Close rs_deluxdouble.Open "select * from delux_double where status=0", con, adOpenDynamic, adLockOptimistic With rs_deluxdouble Do Until .EOF If .Fields(0) = cmbRoomNo.Text Then .Fields("status") = 1 .Update Exit Do End If .MoveNext Loop End With
ElseIf cmbRtype.Text = "Delux(Single A/c)" Then If rs_deluxsingle.State = adStateOpen Then rs_deluxsingle.Close rs_deluxsingle.Open "select * from delux_single where status=0", con, adOpenDynamic, adLockOptimistic With rs_deluxsingle Do Until .EOF If .Fields(0) = cmbRoomNo.Text Then .Fields("status") = 1 .Update Exit Do End If .MoveNext Loop End With ElseIf cmbRtype.Text = "Standard(Double A/c)" Then If rs_standarddouble.State = adStateOpen Then rs_standarddouble.Close rs_standarddouble.Open "select * from standard_double where status=0", con, adOpenDynamic, adLockOptimistic With rs_standarddouble Do Until .EOF If .Fields(0) = cmbRoomNo.Text Then .Fields("status") = 1 .Update Exit Do End If .MoveNext Loop End With ElseIf cmbRtype.Text = "Standard(Single A/c)" Then If rs_standardsingle.State = adStateOpen Then rs_standardsingle.Close rs_standardsingle.Open "select * from standard_single where status=0", con, adOpenDynamic, adLockOptimistic With rs_standardsingle Do Until .EOF If .Fields(0) = cmbRoomNo.Text Then .Fields("status") = 1 .Update Exit Do End If .MoveNext Loop End With .Update
Else MsgBox "PLEASE SELECT THE ROOM ", vbInformation, "HOTEL" End If End With MsgBox "THE CUSTOMER HAS BEEN SUCCESSFULLY CHECK_IN THE HOTEL", vbInformation, "HOTEL" Call remove_data With rs_checkin .MoveLast gcode = .Fields("customer_code") txtGid.Text = "GID" & str(gcode + 1) End With End Sub Private Sub cmdMain_Click() If MsgBox("ARE YOU SURE YOU WANT TO EXIT FROM THIS FORM ?", vbYesNo + vbExclamation, "EXIT???") = vbYes Then Unload Me End If End Sub Private Sub Form_Load() cmbRtype.AddItem "Suite(Double A/c)" cmbRtype.AddItem "Executive(Double A/c)" cmbRtype.AddItem "Executive(Single A/c)" cmbRtype.AddItem "Delux(Double A/c)" cmbRtype.AddItem "Delux(Single A/c)" cmbRtype.AddItem "Standard(Double A/c)" cmbRtype.AddItem "Standard(Single A/c)" Dim gcode With rs_checkin If rs_checkin.BOF And rs_checkin.EOF Then gcode = 500 gcode = (gcode + 1) txtGid.Text = gcode
Else .MoveLast gcode = .Fields("customer_code") txtGid.Text = "GID" & str(gcode + 1) End If End With End Sub Private Sub txtAdults_KeyPress(KeyAscii As Integer) Call Num(KeyAscii) End Sub Private Sub txtAdvance_KeyPress(KeyAscii As Integer) Call Num(KeyAscii) End Sub Private Sub txtAdvance_LostFocus() txtCitime.Text = Time End Sub Private Sub txtChildren_KeyPress(KeyAscii As Integer) Call Num(KeyAscii) End Sub Private Sub txtCity_KeyPress(KeyAscii As Integer) Call char(KeyAscii) End Sub Private Sub txtCountry_KeyPress(KeyAscii As Integer) Call char(KeyAscii) End Sub Private Sub txtName_KeyPress(KeyAscii As Integer) Call char(KeyAscii) End Sub Private Sub txtPhone_KeyPress(KeyAscii As Integer) Call Num(KeyAscii) End Sub Private Sub txtPhone_LostFocus() Dim count count = Len(txtPhone.Text) If count > 12 Or count < 10 Then
MsgBox "PLEASE ENTER THE CORRECT MOBILE NO.", vbCritical, "ERROR" txtPhone.SetFocus End If End Sub Private Sub txtPincode_KeyPress(KeyAscii As Integer) Call Num(KeyAscii) End Sub Private Sub txtPincode_LostFocus() Dim count count = Len(txtPincode.Text) If count > 6 Or count < 6 Then MsgBox "PLEASE ENTER THE CORRECT PINCODE NUMBER.", vbCritical, "ERROR" txtPincode.SetFocus End If End Sub Private Sub txtState_KeyPress(KeyAscii As Integer) Call char(KeyAscii) End Sub
CODING :- CHECK_OUT
CODE
Dim TOTAL as Integer
Private Sub cmbCode_Click () Dim X as Integer Dim Y as Integer Cmdckout. Enabled = True With rs_checkin . MoveFirst While not .EOF If cmbCode. List (cmbCode. ListIndex) = "GID" & (.Fields (0)) Then TxtName. Text = UCase (.Fields ("customer_name")) TxtAge. Text =. Fields ("age") TxtAddress. Text = UCase (.Fields ("address")) TxtCity. Text = UCase (.Fields ("city")) TxtCountry. Text = UCase (.Fields ("country")) TxtPincode. Text =. Fields ("pincode") TxtRtype. Text = UCase (.Fields ("roomtype")) TxtRoomno. Text =. Fields ("roomno") TxtAdults. Text =. Fields ("adults") TxtChildren. Text =. Fields ("children") Txtcid. Text = UCase (.Fields ("docheckin")) Cod. Value =. Fields ("docheckout") TxtState. Text = UCase (.Fields ("state")) TxtEmail. Text = UCase (.Fields ("emailid")) TxtPhone. Text =. Fields ("phoneno") TxtAdvance. Text = UCase (.Fields ("advance")) End If . MoveNext Wend End With With rs_rbill . MoveFirst While not .EOF If cmbCode. List (cmbCode. ListIndex) = "GID" & (.Fields ("customer_code")) Then TxtRBill. Text =. Fields ("totalamount") End If . MoveNext Wend End With With rs_bbill . MoveFirst While not .EOF
If cmbCode. List (cmbCode. ListIndex) = "GID" & (.Field ("customer_code")) Then TxtBbill. Text =. Fields ("totalamount") End If . MoveNext Wend End With X = DateDiff ("Y", txtcid. Text, cod. Value) TxtNdays = X If txtRtype. Text = "SUITE (DOUBLE A/C)" Then TxtRcharge. Text = Val (txtNdays. Text) * 2500 ElseIf txtRtype. Text = "EXECUTIVE (DOUBLE A/C)" Then TxtRcharge. Text = Val (txtNdays. Text) * 2100 ElseIf txtRtype. Text = "EXECUTIVE (SINGLE A/C)" Then TxtRcharge. Text = Val (txtNdays. Text) * 1600 ElseIf txtRtype. Text = "DELUX (DOUBLE A/C)" Then TxtRcharge. Text = Val (txtNdays. Text) * 2300 ElseIf txtRtype. Text = "DELUX (SINGLE A/C)" Then TxtRcharge. Text = Val (txtNdays. Text) * 1700 ElseIf txtRtype. Text = "STANDARD (DOUBLE A/C)" Then TxtRcharge. Text = Val (txtNdays. Text) * 1800 ElseIf txtRtype. Text = "STANDARD (SINGLE A/C)" Then TxtRcharge. Text = Val (txtNdays. Text) * 1500 End If TxtTamount. Text = ((Val (txtRcharge. Text)) + (Val (txtBbill. Text)) + (Val (txtRBill. Text))) - (Val (txtAdvance. Text)) End Sub Private Sub cmdckout_Click () With rs_check_out . AddNew . Fields ("customer_code") = Val (Mid (cmbCode. Text, 4)) . Fields ("customer_name") = Trim (UCase (txtName. Text)) . Fields ("age") = txtAge. Text
. Fields ("address") = Trim (UCase (txtAddress. Text)) . Fields ("phoneno") = txtPhone. Text . Fields ("emailid") = txtEmail. Text . Fields ("adults") = txtAdults. Text . Fields ("children") = txtChildren. Text . Fields ("city") = Trim (UCase (txtCity. Text)) . Fields ("state") = Trim (UCase (txtState. Text)) . Fields ("country") = Trim (UCase (txtCountry. Text)) . Fields ("pincode") = txtPincode. Text . Fields ("roomtype") = Trim (UCase (txtRtype. Text)) . Fields ("roomno") = txtRoomno. Text . Fields ("docheckin") = txtcid. Text . Fields ("docheckout") = cod. Value . Fields ("advance") = txtAdvance. Text . Fields ("roomcharge") = Val (txtRcharge. Text) . Fields ("restaurantbill") = Val (txtRBill. Text) . Fields ("barbill") = Val (txtBbill. Text) . Fields ("total") = txtTamount. Text If txtRtype. Text = "SUITE (DOUBLE A/C)" Then If rs_suite. State = adStateOpen Then rs_suite. Close Rs_suite. Open "select * from suite ", con, adOpenDynamic, adLockOptimistic With rs_suite Do Until .EOF If. Fields (0) = txtRoomno. Text Then . Fields ("status") = 0 . Update Exit Do End If . MoveNext Loop End With ElseIf txtRtype. Text = "EXECUTIVE (DOUBLE A/C)" Then If rs_executivedouble. State = adStateOpen Then rs_executivedouble. Close Rs_executivedouble. Open "select * from executive_double ", con, adOpenDynamic, adLockOptimistic With rs_executivedouble Do Until .EOF If. Fields (0) = txtRoomno. Text Then . Fields ("status") = 0 . Update Exit Do End If
. MoveNext Loop End With ElseIf txtRtype. Text = "EXECUTIVE (SINGLE A/C)" Then If rs_executivesingle. State = adStateOpen Then rs_executivesingle. Close Rs_executivesingle. Open "select * from executive_single ", con, adOpenDynamic, adLockOptimistic With rs_executivesingle Do Until .EOF If. Fields (0) = txtRoomno. Text Then . Fields ("status") = 0 . Update Exit Do End If . MoveNext Loop End With ElseIf txtRtype. Text = "DELUX (DOUBLE A/C)" Then If rs_deluxdouble. State = adStateOpen Then rs_deluxdouble. Close Rs_deluxdouble. Open "select * from delux_double ", con, adOpenDynamic, adLockOptimistic With rs_deluxdouble Do Until .EOF If. Fields (0) = txtRoomno. Text Then . Fields ("status") = 0 . Update Exit Do End If . MoveNext Loop End With ElseIf txtRtype. Text = "DELUX (SINGLE A/C)" Then If rs_deluxsingle. State = adStateOpen Then rs_deluxsingle. Close Rs_deluxsingle. Open "select * from delux_single ", con, adOpenDynamic, adLockOptimistic With rs_deluxsingle Do Until .EOF If. Fields (0) = txtRoomno. Text Then . Fields ("status") = 0 . Update Exit Do End If . MoveNext
Loop End With ElseIf txtRtype. Text = "STANDARD (DOUBLE A/C)" Then If rs_standarddouble. State = adStateOpen Then rs_standarddouble. Close rs_standarddouble.Open "select * from standard_double", con, adOpenDynamic, adLockOptimistic With rs_standarddouble Do Until .EOF If. Fields (0) = txtRoomno. Text Then . Fields ("status") = 0 . Update Exit Do End If . MoveNext Loop End With ElseIf txtRtype. Text = "STANDARD (SINGLE A/C)" Then If rs_standardsingle. State = adStateOpen Then rs_standardsingle. Close rs_standardsingle.Open "select * from standard_single ", con, adOpenDynamic, adLockOptimistic With rs_standardsingle Do Until .EOF If. Fields (0) = txtRoomno. Text Then . Fields ("status") = 0 . Update Exit Do End If . MoveNext Loop End With End If . Update End With With rs_checkin . MoveFirst Smart: If cmbCode. List (cmbCode. ListIndex) = "GID" & (.Fields (0)) Then . Delete CmbCode. RemoveItem cmbCode. ListIndex Else . MoveNext GoTo smart End If
MsgBox "CUSTOMER HAS BEEN SUCCESSFULLY CHECK OUT FROM THE HOTEL", vbInformation, "HOTEL" Cmdckout. Enabled = False CmbCode. SetFocus End With Call blank Cmdckout. Enabled = False End Sub Private Sub cmdMain_Click () If MsgBox ("ARE YOU SURE YOU WANT TO EXIT FROM CHECK OUTFROM) vbYesNo + vbExclamation "EXIT???") = VbYes then Unload Me End If End Sub Private Sub cod_LostFocus () Dim X as Integer X = DateDiff ("Y", txtcid.Text, cod.Value) TxtNdays. Text = X If txtRtype. Text = "SUITE (DOUBLE A/C)" Then TxtRcharge. Text = Val (txtNdays. Text) * 2500 ElseIf txtRtype. Text = "EXECUTIVE (DOUBLE A/C)" Then TxtRcharge. Text = Val (txtNdays. Text) * 2100 ElseIf txtRtype. Text = "EXECUTIVE (SINGLE A/C)" Then TxtRcharge. Text = Val (txtNdays. Text) * 1600 ElseIf txtRtype. Text = "DELUX (DOUBLE A/C)" Then TxtRcharge. Text = Val (txtNdays. Text) * 2300 ElseIf txtRtype. Text = "DELUX (SINGLE A/C)" Then TxtRcharge. Text = Val (txtNdays. Text) * 1700 ElseIf txtRtype. Text = "STANDARD (DOUBLE A/C)" Then TxtRcharge. Text = Val (txtNdays. Text) * 1800 ElseIf txtRtype. Text = "STANDARD (SINGLE A/C)" Then TxtRcharge. Text = Val (txtNdays. Text) * 1500 End If
TxtTamount. Text = ((Val (txtRcharge. Text)) + (Val (txtBbill. Text)) + (Val (txtRBill. Text))) - (Val (txtAdvance. Text)) End Sub Private Sub Form_Load () Cmdckout. Enabled = False TxtName. Locked = True TxtAge. Locked = True TxtAddress. Locked = True TxtCity. Locked = True TxtCountry. Locked = True TxtPincode. Locked = True TxtRtype. Locked = True TxtRoomno. Locked = True TxtAdults. Locked = True TxtChildren. Locked = True Txtcid. Locked = True TxtState. Locked = True TxtEmail. Locked = True TxtPhone. Locked = True With rs_checkin . MoveFirst While not .EOF CmbCode. AddItem "GID" & (.Fields (0)) . MoveNext Wend End With End Sub Private Sub blank () CmbCode. Text = " " TxtName. Text = " " TxtAge. Text = " " TxtAddress. Text = " " TxtCity. Text = " " TxtCountry. Text = " " TxtPincode. Text = " "
TxtState. Text = " " TxtAdults. Text = " " TxtChildren. Text = " " TxtRtype. Text = " " TxtRoomno. Text = " " Txtcid. Text = " " TxtAdvance. Text = " " TxtBbill. Text = " " TxtRBill. Text = " " TxtTamount. Text = " " TxtEmail. Text = " " TxtPhone. Text = " " TxtRcharge. Text = " " TxtNdays. Text = " " End Sub
CODING :- RESERVATION
CODE
Option Explicit Dim i as Integer Dim code As Integer Dim strMonth, strYear, result As String
Private Sub cmbCode_Click () With rs_reservation . MoveFirst While not .EOF If cmbCode. List (cmbCode. ListIndex) = "GID" & (.Fields (0)) Then TxtGid. Text = "GID" & (.Fields ("customer_code")) TxtName. Text =. Fields ("customer_name") TxtAge. Text =. Fields ("age") TxtAddress. Text =. Fields ("address") TxtPhone. Text =. Fields ("phoneno") TxtCity. Text =. Fields ("city") TxtState. Text =. Fields ("state") TxtCountry. Text =. Fields ("country") TxtPincode. Text =. Fields ("pincode") CmbRtype. Text =. Fields ("roomtype") CmbRoomno. Text =. Fields ("roomno") Cid. Value =. Fields ("docheckin") Cod. Value =. Fields ("docheckout") TxtAdvance. Text =. Fields ("advance 50 %") TxtTime. Text = Format (.Fields ("etime"), "HH:MM") TxtAdults. Text =. Fields ("adults") TxtChildren. Text =. Fields ("children") TxtEmail. Text =. Fields ("emailid") End If . MoveNext Wend End With TxtGid. Locked = True TxtName. Locked = True TxtAge. Locked = True TxtAddress. Locked = True TxtPhone. Locked = True TxtCity. Locked = True TxtState. Locked = True TxtCountry. Locked = True TxtPincode. Locked = True CmbRtype. Locked = True CmbRoomno. Locked = True TxtAdvance. Locked = True ' TxtTime. Locked = True TxtAdults. Locked = True TxtChildren. Locked = True
TxtEmail. Locked = True End Sub Private Sub cmbRtype_Click () If cmbRtype. List (cmbRtype. ListIndex) = "Suite (Double A/c)" Then If rs_suite. State = adStateOpen Then rs_suite. Close Rs_suite. Open "select * from suite where status=0 ", con, adOpenDynamic, adLockOptimistic CmbRoomno. Clear With rs_suite . MoveFirst Do Until .EOF CmbRoomno. AddItem. Fields ("RoomNo") . MoveNext Loop End With ElseIf cmbRtype. List (cmbRtype. ListIndex) = "Executive (Double A/c)" Then If rs_executivedouble. State = adStateOpen Then rs_executivedouble. Close Rs_executivedouble. Open "select * from executive_double where status=0", con, adOpenDynamic, adLockOptimistic CmbRoomno. Clear With rs_executivedouble . MoveFirst Do Until .EOF CmbRoomno. AddItem. Fields (0) . MoveNext Loop End With ElseIf cmbRtype. List (cmbRtype. ListIndex) = "Executive (Single A/c)" Then If rs_executivesingle. State = adStateOpen Then rs_executivesingle. Close Rs_executivesingle. Open "select * from executive_single where status=0", con, adOpenDynamic, adLockOptimistic CmbRoomno. Clear With rs_executivesingle . MoveFirst Do Until .EOF CmbRoomno. AddItem. Fields (0) . MoveNext Loop End With
ElseIf cmbRtype. List (cmbRtype. ListIndex) = "Delux (Double A/c)" Then If rs_deluxdouble. State = adStateOpen Then rs_deluxdouble. Close Rs_deluxdouble. Open "select * from delux_double where status=0 ", con, adOpenDynamic, adLockOptimistic CmbRoomno. Clear With rs_deluxdouble . MoveFirst Do Until .EOF CmbRoomno. AddItem. Fields (0) . MoveNext Loop End With ElseIf cmbRtype. List (cmbRtype. ListIndex) = "Delux (Single A/c)" Then If rs_deluxsingle. State = adStateOpen Then rs_deluxsingle. Close rs_deluxsingle.Open "select * from delux_single where status=0 ", con, adOpenDynamic, adLockOptimistic CmbRoomno. Clear With rs_deluxsingle . MoveFirst Do Until .EOF CmbRoomno. AddItem. Fields (0) . MoveNext Loop End With ElseIf cmbRtype. List (cmbRtype. ListIndex) = "Standard (Double A/c)" Then If rs_standarddouble. State = adStateOpen Then rs_standarddouble. Close Rs_standarddouble. Open "select * from standard_double where status=0 ", con, adOpenDynamic, adLockOptimistic CmbRoomno. Clear With rs_standarddouble . MoveFirst Do Until .EOF CmbRoomno. AddItem. Fields (0) . MoveNext Loop End With ElseIf cmbRtype. List (cmbRtype. ListIndex) = "Standard (Single A/c)" Then If rs_standardsingle. State = adStateOpen Then rs_standardsingle. Close Rs_standardsingle. Open "select * from standard_single where status=0 ", con, adOpenDynamic, adLockOptimistic CmbRoomno. Clear With rs_standardsingle . MoveFirst
Do Until .EOF CmbRoomno. AddItem. Fields (0) . MoveNext Loop End With End If End Sub Private Sub cmdCheckIn_Click () Frmchk. Visible = True CmdMain. Enabled = True CmdCheckin. Enabled = False End Sub Private Sub cmdMain_Click () If MsgBox ("ARE YOU SURE YOU WANT TO EXIT FROM THIS FORM)", vbYesNo + vbExclamation, "EXIT???") = vbYes then Unload Me End If End Sub Private Sub cmdOK_Click () With rs_checkin . MoveLast Code =. Fields ("customer_code") Code = code + 1 End With If cmbCode. ListIndex = -1 Then Frmchk. Visible = False Else With rs_checkin . AddNew . Fields ("customer_code") = code . Fields ("customer_name") = Trim (UCase (txtName. Text)) . Fields ("age") = Trim (UCase (txtAge. Text)) . Fields ("address") = Trim (UCase (txtAddress. Text)) . Fields ("phoneno") = Trim (UCase (Val (txtPhone. Text))) . Fields ("emailid") = Trim (UCase (txtEmail. Text)) . Fields ("adults") = Trim (UCase (txtAdults. Text)) . Fields ("children") = Trim (UCase (txtChildren. Text)) . Fields ("city") = Trim (UCase (txtCity. Text)) . Fields ("state") = Trim (UCase (txtState. Text)) . Fields ("country") = Trim (UCase (txtCountry. Text))
. Fields ("pincode") = Trim (UCase (Val (txtPincode. Text))) . Fields ("roomtype") = Trim (UCase (cmbRtype. Text)) . Fields ("roomno") = Trim (UCase (cmbRoomno. Text)) . Fields ("docheckin") = cid. Value . Fields ("docheckout") = cod. Value . Fields ("tocheckin") = Format (txtTime. Text, "HH:MM") . Fields ("advance") = Trim (UCase (txtAdvance. Text)) Frmchk. Visible = False With rs_reservation . MoveFirst Smart: If cmbCode. List (cmbCode. ListIndex) = "GID" & (.Fields (0)) Then . Delete CmbCode. RemoveItem cmbCode. ListIndex Else . MoveNext GoTo smart End If MsgBox "CUSTOMER HAS BEEN SUCCESSFULLY CHECK_IN IN THE HOTEL", vbInformation, "HOTEL" End With . Update End With End If TxtGid. Text = " " Call remove_data With rs_reservation . MoveLast Code =. Fields (0) TxtGid. Text = "GID" & STR (code + 1) End With CmdCheckin. Enabled = True CmdMain. Enabled = True End Sub
Private Sub cmdReservation_Click () If txtGid. Text = " " Or txtName. Text = " " Or txtPhone. Text = " " Or txtCity. Text = " " Or txtAddress. Text = "" Or txtState. Text = " " Or txtCountry. Text = " " Or txtAge. Text = " " Or txtPincode. Text = " " Or txtAdvance. Text = " " Then MsgBox "Fill the Complete Information", vbInformation, "HOTEL" TxtName. SetFocus Exit Sub ElseIf cmbRtype. ListIndex = -1 Then MsgBox "Select Room Type" CmbRtype. SetFocus Exit Sub ElseIf cmbRoomno. ListIndex = -1 Then MsgBox "Select Room No." CmbRoomno. SetFocus Exit Sub End If With rs_reservation . AddNew . Fields ("customer_code") = Val (Mid (txtGid. Text, 4)) . Fields ("customer_name") = Trim (UCase (txtName. Text)) . Fields ("age") = txtAge. Text . Fields ("address") = Trim (txtAddress. Text) . Fields ("phoneno") = (txtPhone. Text) . Fields ("city") = Trim (UCase (txtCity. Text)) . Fields ("state") = Trim (UCase (txtState. Text)) . Fields ("country") = Trim (UCase (txtCountry. Text)) . Fields ("pincode") = (txtPincode. Text) . Fields ("roomtype") = Trim (UCase (cmbRtype. Text)) . Fields ("roomno") = (cmbRoomno. Text) . Fields ("docheckin") = cid. Value . Fields ("docheckout") = cod. Value . Fields ("advance50 %") = (txtAdvance. Text) . Fields ("etime") = Format (txtTime. Text, "HH:MM") . Fields ("adults") = (txtAdults. Text) . Fields ("children") = (txtChildren. Text) . Fields ("emailid") = (txtEmail. Text) If cmbRtype. Text = "Suite (Double A/c)" Then If rs_suite. State = adStateOpen Then rs_suite. Close Rs_suite. Open "select * from suite where status=0", con, adOpenDynamic, adLockOptimistic With rs_suite Do Until .EOF If. Fields (0) = cmbRoomno. Text Then
. Fields ("status") = 1 . Update Exit Do End If . MoveNext Loop End With ElseIf cmbRtype. Text = "Executive (Double A/c)" Then If rs_executivedouble. State = adStateOpen Then rs_executivedouble. Close Rs_executivedouble. Open "select * from executive_double where status=0", con, adOpenDynamic, adLockOptimistic With rs_executivedouble Do Until .EOF If. Fields (0) = cmbRoomno. Text Then . Fields ("status") = 1 . Update Exit Do End If . MoveNext Loop End With ElseIf cmbRtype. Text = "Executive (Single A/c)" Then If rs_executivesingle. State = adStateOpen Then rs_executivesingle. Close rs_executivesingle.Open "select * from executive_single where status=0", con, adOpenDynamic, adLockOptimistic With rs_executivesingle Do Until .EOF If. Fields (0) = cmbRoomno. Text Then . Fields ("status") = 1 . Update Exit Do End If . MoveNext Loop End With ElseIf cmbRtype. Text = "Delux (Double A/c)" Then If rs_deluxdouble. State = adStateOpen Then rs_deluxdouble. Close rs_deluxdouble. Open "select * from delux_double where status=0", con, adOpenDynamic, adLockOptimistic With rs_deluxdouble Do Until .EOF If. Fields (0) = cmbRoomno. Text Then . Fields ("status") = 1
. Update Exit Do End If . MoveNext Loop End With ElseIf cmbRtype. Text = "Delux (Single A/c)" Then If rs_deluxsingle. State = adStateOpen Then rs_deluxsingle. Close rs_deluxsingle.Open "select * from delux_single where status=0", con, adOpenDynamic, adLockOptimistic With rs_deluxsingle Do Until .EOF If. Fields (0) = cmbRoomno. Text Then . Fields ("status") = 1 . Update Exit Do End If . MoveNext Loop End With ElseIf cmbRtype. Text = "Standard (Double A/c)" Then If rs_standarddouble. State = adStateOpen Then rs_standarddouble. Close rs_standarddouble.Open "select * from standard_double where status=0", con, adOpenDynamic, adLockOptimistic With rs_standarddouble Do Until .EOF If. Fields (0) = cmbRoomno. Text Then . Fields ("status") = 1 . Update Exit Do End If . MoveNext Loop End With ElseIf cmbRtype. Text = "Standard (Single A/c)" Then If rs_standardsingle. State = adStateOpen Then rs_standardsingle. Close rs_standardsingle.Open "select * from standard_single where status=0", con, adOpenDynamic, adLockOptimistic With rs_standardsingle Do Until .EOF If. Fields (0) = cmbRoomno. Text Then . Fields ("status") = 1 . Update
Exit Do End If . MoveNext Loop End With Else MsgBox "PLEASE SELECT THE ROOM ", vbInformation, "HOTEL" End If CmbCode. AddItem "GID" & (.Fields ("customer_code")) . Update End With MsgBox "THE RESERVATION HAS BEEN MADE SUCCESSFULLY FOR THE CUSTOMER", vbInformation, "HOTEL" Call remove_data With rs_reservation . MoveLast Code =. Fields (0) TxtGid. Text = "GID" & STR (code + 1) End With End Sub Private Sub Form_Load () CmbRtype. AddItem "Suite (Double A/c)" CmbRtype. AddItem "Executive (Double A/c)" CmbRtype. AddItem "Executive (Single A/c)" CmbRtype. AddItem "Delux (Double A/c)" CmbRtype. AddItem "Delux (Single A/c)" CmbRtype. AddItem "Standard (Double A/c)" CmbRtype. AddItem "Standard (Single A/c)" Frmchk. Visible = False With rs_reservation . MoveFirst While not .EOF CmbCode. AddItem "GID" & (.Fields (0)) . MoveNext Wend
End With Dim gcode With rs_reservation If rs_reservation. BOF and rs_reservation. EOF Then Gcode = 501 Gcode = (gcode + 1) TxtGid. Text = gcode Else . MoveLast Gcode =. Fields ("customer_code") TxtGid. Text = "GID" & STR (gcode + 1) End If End With End Sub Private Sub remove_data () TxtName. Text = " " TxtAge. Text = " " TxtPhone. Text = " " TxtAddress. Text = " " TxtCity. Text = " " TxtState. Text = " " TxtCountry. Text = " " TxtPincode. Text = " " CmbRtype. ListIndex = -1 CmbRoomno. ListIndex = -1 TxtAdvance. Text = " " TxtTime. Text = "__:__" TxtAdults. Text = " " TxtChildren. Text = " " TxtEmail. Text = " " CmbRtype. Text = " " CmbRoomno. Text = " " End Sub Private Sub txtAdvance_KeyPress (KeyAscii As Integer) Call Num (KeyAscii) End Sub Private Sub txtAge_KeyPress (KeyAscii as Integer) Call Num (KeyAscii) End Sub
Private Sub txtCity_KeyPress (KeyAscii as Integer) Call char (KeyAscii) End Sub Private Sub txtCountry_KeyPress (KeyAscii as Integer) Call char (KeyAscii) End Sub Private Sub txtName_KeyPress (KeyAscii as Integer) Call char (KeyAscii) End Sub Private Sub txtPhone_KeyPress (KeyAscii as Integer) Call Num (KeyAscii) End Sub Private Sub txtPhone_LostFocus () Dim count Count = Len (txtPhone. Text) If count > 12 or count < 10 Then MsgBox "PLEASE ENTER THE CORRECT MOBILE NO.", vbCritical, "ERROR" TxtPhone. SetFocus End If End Sub Private Sub txtPincode_KeyPress (KeyAscii as Integer) Call Num (KeyAscii) End Sub Private Sub txtPincode_LostFocus () Dim count Count = Len (txtPincode. Text) If count > 6 or count < 6 Then MsgBox "PLEASE ENTER THE CORRCT PINCODE NUMBER.", vbCritical, "ERROR" End If End Sub Private Sub txtState_KeyPress (KeyAscii as Integer) Call char (KeyAscii) End Sub
CODING :- B_ORDER
CODE
CmdOrder1. Enabled = True With rs_checkin . MoveFirst While not .EOF If cmbCode. List (cmbCode. ListIndex) = "GID" & (.Fields (0)) Then TxtName1. Text =. Fields ("customer_name") End If . MoveNext Wend End With End Sub Private Sub cmbDrink_Click () If optSoft. Value = True Then With rs_soft . MoveFirst While not .EOF If cmbDrink. List (cmbDrink. ListIndex) = UCase (.Fields (0)) Then TxtPdrink. Text =. Fields ("price") End If . MoveNext Wend End With End If If optHard. Value = True Then With rs_hard . MoveFirst While not .EOF If cmbDrink. List (cmbDrink. ListIndex) = UCase (.Fields (0)) Then TxtPdrink. Text =. Fields ("price") End If . MoveNext Wend End With End If End Sub Private Sub cmbDrink1_Click () If optSoft1. Value = True Then With rs_soft
. MoveFirst While not .EOF If cmbDrink1. List (cmbDrink1. ListIndex) = UCase (.Fields (0)) Then TxtPdrink1. Text =. Fields ("price") End If . MoveNext Wend End With End If If optHard1. Value = True Then With rs_hard . MoveFirst While not .EOF If cmbDrink1. List (cmbDrink1. ListIndex) = UCase (.Fields (0)) Then TxtPdrink1. Text =. Fields ("price") End If . MoveNext Wend End With End If End Sub Private Sub cmdBill_Click () With rs_border BARBILL.Sections ("section2"). Controls ("lblName"). Caption =. Fields ("customer_name") BARBILL.Sections ("section2"). Controls ("lblTno"). Caption =. Fields ("tableno") BARBILL.Sections ("section3"). Controls ("lblTAMOUNT"). Caption = B_order.TAMT Set BARBILL.DataSource = rs_border BARBILL.Show End With CmdBill. Visible = False End Sub Private Sub cmdNorder_Click () TxtName. Locked = False TxtTable. Locked = False
Call blank If rs_border. State = adStateOpen Then rs_border. Close rs_border.Open "select * from b_order", con, adOpenDynamic, adLockOptimistic Con. Execute "delete from b_order CmdNorder. Enabled = False CmdOrder. Enabled = True End Sub Private Sub cmdNorder1_Click () CmbCode. Locked = False TxtTable. Locked = False TxtName1. Locked = False Call blank1 CmdNorder1. Enabled = False CmdOrder1. Enabled = True End Sub Private Sub cmdOrder_Click () If txtName. Text = "" Then MsgBox "PLEASE ENETR THE NAME", vbInformation, "HOTEL" TxtName. SetFocus Exit Sub ElseIf txtTable. Text = "" Then MsgBox "PLEASE ENETR THE TABLE NUMBER", vbInformation, "HOTEL" TxtTable. SetFocus Exit Sub ElseIf txtQuantity. Text = "" Then MsgBox "PLEASE ENTER THE QUANTITY", vbInformation, "HOTEL" TxtQuantity. SetFocus Exit Sub ElseIf cmbDrink. ListIndex = -1 Then MsgBox "PLEASE SELECT THE ITEM ", vbInformation, "HOTEL" CmbDrink. SetFocus Exit Sub
Else TxtName. Locked = True TxtTable. Locked = True With rs_border . AddNew . Fields ("customer_name") = Trim (UCase (txtName. Text)) . Fields ("pitem") = txtPdrink. Text . Fields ("item") = cmbDrink. Text . Fields ("tableno") = txtTable. Text . Fields ("quantity") = txtQuantity. Text . Fields ("totalprice") = txtTprice. Text MsgBox "YOUR ORDER HAVE BEEN TAKEN", vbInformation, "HOTEL" TAMT = TAMT + Val (txtTprice. Text) TxtTmt. Text = TAMT If MsgBox ("ANY MORE ORDER", vbYesNo, "HOTEL") = vbYes Then TxtPdrink. Text = " " TxtQuantity. Text = " " TxtTprice. Text = " " Else MsgBox "TO GET TOTAL BILL CLICK ON THE BILL BUTTON", vbOKOnly + vbInformation, "HOTEL" CmdBill. Visible = True Command5.Visible = True CmdNorder. Enabled = True CmdOrder. Enabled = False End If End With End If End Sub Private Sub cmdOrder1_Click () If txtTable1. Text = "" Then MsgBox "PLEASE ENETR THE TABLE NUMBER", vbInformation, "HOTEL" TxtTable1. SetFocus Exit Sub ElseIf cmbDrink1. ListIndex = -1 Then MsgBox "PLEASE SELECT THE ITEM", vbInformation, "HOTEL" CmbDrink1. SetFocus
Exit Sub ElseIf txtQuantity1. Text = "" Then MsgBox "PLEASE ENTER THE QUANTITY", vbInformation, "HOTEL" TxtQuantity1. SetFocus Exit Sub Else CmbCode. Locked = True TxtTable. Locked = True TxtName1. Locked = True MsgBox "YOUR ORDER HAVE BEEN TAKEN", vbInformation, "HOTEL" TAMT1 = TAMT1 + Val (txtTprice1. Text) TxtTmt1. Text = TAMT1 If MsgBox ("ANY MORE ORDER", vbYesNo, "HOTEL") = vbYes Then TxtPdrink1. Text = " " TxtQuantity1. Text = " " TxtTprice1. Text = " " Else MsgBox "TO SAVE TOTAL AMOUNT CLICK ON THE SAVE BUTTON", vbInformation, "HOTEL" CmdSave. Visible = True Command4.Visible = True CmdNorder1. Enabled = True CmdOrder1. Enabled = False End If End If End Sub Private Sub cmdSave_Click () With rs_bbill . AddNew . Fields ("customer_code") = Val (Mid (cmbCode. Text, 4)) . Fields ("customer_name") = Trim (UCase (txtName1. Text)) . Fields ("totalamount") = UCase (txtTmt1. Text) . Update End With MsgBox "YOUR AMOUNT HAVE BEEN SAVED", vbInformation, "HOTEL" CmdSave. Visible = False
End Sub Private Sub Command4_Click () Unload Me End Sub Private Sub Command5_Click () Unload Me End Sub Private Sub Form_Load () If optSoft. Value = True Then With rs_soft . MoveFirst While not .EOF CmbDrink. AddItem (UCase (.Fields ("drink"))) . MoveNext Wend End With End If If optSoft1. Value = True Then With rs_soft . MoveFirst While not .EOF CmbDrink1. AddItem (UCase (.Fields ("drink"))) . MoveNext Wend End With End If TAMT = 0 TAMT1 = 0 If rs_border. State = adStateOpen Then rs_border. Close rs_border.Open "select * from b_order", con, adOpenDynamic, adLockOptimistic Con. Execute "delete from b_order CmdNorder. Enabled = False CmdNorder1. Enabled = False CmdBill. Visible = False Command5.Enabled = True Command4.Enabled = True
CmdSave. Visible = False CmdOrder1. Enabled = False With rs_checkin . MoveFirst While not .EOF CmbCode. AddItem "GID" & (.Fields (0)) . MoveNext Wend End With End Sub Private Sub optHard_Click () CmbDrink. Clear If optHard. Value = True Then With rs_hard . MoveFirst While not .EOF CmbDrink. AddItem (UCase (.Fields ("drink"))) . MoveNext Wend End With End If End Sub Private Sub optHard1_Click () CmbDrink1. Clear If optHard1. Value = True Then With rs_hard . MoveFirst While not .EOF CmbDrink1. AddItem (UCase (.Fields ("drink"))) . MoveNext Wend End With End If End Sub Private Sub optSoft_Click () CmbDrink. Clear If optSoft. Value = True Then With rs_soft . MoveFirst While not .EOF CmbDrink. AddItem (UCase (.Fields ("drink")))
. MoveNext Wend End With End If End Sub Private Sub optSoft1_Click () CmbDrink1. Clear If optSoft1. Value = True Then With rs_soft . MoveFirst While not .EOF CmbDrink1. AddItem (UCase (.Fields ("drink"))) . MoveNext Wend End With End If End Sub Private Sub blank () TxtName. Text = " " TxtTable. Text = " " TxtQuantity. Text = " " TxtPdrink. Text = " " CmbDrink. Clear TxtTprice. Text = " " TxtTmt. Text = " " End Sub Private Sub blank1 () TxtName1. Text = " " CmbCode. Text = " " TxtTable1. Text = " " TxtQuantity1. Text = " " TxtPdrink1. Text = " " CmbDrink1. Clear TxtTprice1. Text = " " TxtTmt1. Text = " " End Sub Private Sub txtQuantity_Change () TxtTprice. Text = (Val (txtPdrink. Text)) * (Val (txtQuantity. Text)) End Sub Private Sub txtQuantity_KeyPress (KeyAscii As Integer) Call Num (KeyAscii)
End Sub Private Sub txtQuantity1_Change () TxtTprice1. Text = (Val (txtPdrink1. Text)) * (Val (txtQuantity1. Text)) End Sub Private Sub txtQuantity1_KeyPress (KeyAscii as Integer) Call Num (KeyAscii) End Sub Private Sub txtTable_KeyPress (KeyAscii as Integer) Call Num (KeyAscii) End Sub Private Sub txtTable1_KeyPress (KeyAscii as Integer) Call Num (KeyAscii) End Sub
CODING :- REST_ORDER
CODE
Dim ch, item, qt As String Public TAMT, TAMT1 as Integer
Private Sub cmbCode_Click () cmdOrder1.Enabled = True With rs_checkin .MoveFirst While not .EOF If cmbCode.List (cmbCode.ListIndex) = "GID" & (.Fields (0)) Then txtName1.Text = .Fields ("customer_name") End If .MoveNext Wend End With End Sub Private Sub cmbMenu_Click () If optVeg.Value = True Then With rs_veg .MoveFirst While not .EOF If cmbMenu.List (cmbMenu.ListIndex) = UCase (.Fields ("veg")) Then txtPitem.Text = .Fields ("vprice") End If . MoveNext Wend End With End If If optNveg.Value = True Then With rs_nveg .MoveFirst While not .EOF If cmbMenu.List (cmbMenu.ListIndex) = UCase (.Fields ("nonveg")) Then txtPitem.Text = .Fields ("nprice") End If .MoveNext Wend End With End If End Sub Private Sub cmbMenu1_Click ()
If optVeg1.Value = True Then With rs_veg .MoveFirst While not .EOF If cmbMenu1.List (cmbMenu1.ListIndex) = UCase (.Fields ("veg")) Then txtPitem1.Text = .Fields ("vprice") End If .MoveNext Wend End With End If If optNveg1.Value = True Then With rs_nveg .MoveFirst While not .EOF If cmbMenu1.List (cmbMenu1.ListIndex) = UCase (.Fields ("nonveg")) Then txtPitem1.Text = .Fields ("nprice") End If .MoveNext Wend End With End If End Sub Private Sub cmdBill_Click () With rs_rorder DATABILL.Sections ("section2").Controls ("lblName").Caption = .Fields ("customer_name") DATABILL.Sections ("section2").Controls ("lblTno").Caption = .Fields ("tableno") DATABILL.Sections ("section3").Controls ("lblTAMOUNT").Caption = rest_order.TAMT Set DATABILL.DataSource = rs_rorder DATABILL.Show End With cmdBill.Visible = False End Sub Private Sub cmdMain_Click () Unload Me End Sub Private Sub cmdMain1_Click ()
Unload Me End Sub Private Sub cmdNorder_Click () txtName.Locked = False txtTable.Locked = False cmdNorder.Enabled = False If rs_rorder.State = adStateOpen Then rs_rorder.Close rs_rorder.Open "select * from r_order", con, adOpenDynamic, adLockOptimistic con.Execute "delete from r_order" Call blank cmdOrder.Enabled = True End Sub Private Sub cmdNorder1_Click () cmbCode.Locked = False txtTable1.Locked = False txtName1.Locked = False cmdOrder1.Enabled = True cmdNorder1.Enabled = False Call blank1 End Sub Private Sub cmdOrder_Click () If txtName.Text = "" Then MsgBox "PLEASE ENETR THE NAME", vbInformation, "HOTEL" txtName.SetFocus Exit Sub ElseIf txtTable.Text = "" Then MsgBox "PLEASE ENETR THE TABLE NUMBER", vbInformation, "HOTEL" txtTable.SetFocus Exit Sub ElseIf cmbMenu.ListIndex = -1 Then MsgBox "PLEASE SELECT THE ITEM", vbInformation, "HOTEL" cmbMenu.SetFocus Exit Sub ElseIf txtQuantity.Text = "" Then MsgBox "PLEASE ENTER THE QUANTITY", vbInformation, "HOTEL" txtQuantity.SetFocus Exit Sub
Else txtName.Locked = True txtTable.Locked = True With rs_rorder .AddNew .Fields ("customer_name") = Trim (UCase (txtName.Text)) .Fields ("ppitem") = txtPitem.Text .Fields ("item") = cmbMenu.Text .Fields ("tableno") = txtTable.Text .Fields ("quantity") = txtQuantity.Text .Fields ("totalprice") = txtTprice.Text MsgBox "YOUR ORDER HAVE BEEN TAKEN", vbInformation, "HOTEL" TAMT = TAMT + Val (txtTprice.Text) txtTAMT.Text = TAMT If MsgBox ("ANY MORE ORDER", vbYesNo, "HOTEL") = vbYes Then txtPitem.Text = " " txtQuantity.Text = " " txtTprice.Text = " " Else MsgBox "TO GET THE BILL CLICK ON THE BILL BUTTON", vbInformation, "HOTEL" cmdBill.Visible = True cmdMain1.Enabled = True cmdNorder.Enabled = True cmdOrder.Enabled = False End If End With End If End Sub Private Sub cmdOrder1_Click () If txtTable1.Text = "" Then MsgBox "PLEASE ENETR THE TABLE NUMBER", vbInformation, "HOTEL" txtTable1.SetFocus Exit Sub ElseIf cmbMenu1.ListIndex = -1 Then MsgBox "PLEASE SELECT THE ITEM ", vbInformation, "HOTEL" cmbMenu1.SetFocus Exit Sub ElseIf txtQuantity1.Text = "" Then
MsgBox "PLEASE ENTER THE QUANTITY", vbInformation, "HOTEL" txtQuantity1.SetFocus Exit Sub Else cmbCode.Locked = True txtTable1.Locked = True txtName1.Locked = True MsgBox "YOUR ORDER HAVE BEEN TAKEN", vbInformation, "HOTEL" TAMT1 = TAMT1 + Val (txtTprice1.Text) txtTAMT1.Text = TAMT1 If MsgBox ("ANY MORE ORDER", vbYesNo, "HOTEL") = vbYes Then txtPitem1.Text = " " txtQuantity1.Text = " " txtTprice1.Text = " " Else MsgBox "TO SAVE THE AMOUNT CLICK ON THE SAVE BUTTON", vbInformation, "HOTEL" cmdSave.Visible = True cmdMain.Enabled = True cmdNorder1.Enabled = True cmdOrder1.Enabled = False End If End If End Sub Private Sub cmdSave_Click () With rs_rbill .AddNew .Fields ("customer_code") = Val (Mid (cmbCode.Text, 4)) .Fields ("customer_name") = (Trim (UCase (txtName1.Text))) .Fields ("totalamount") = (Trim (UCase (txtTAMT1.Text))) .Update End With MsgBox "AMOUNT IS SAVED SUCCESSFULLY", vbInformation, "HOTEL" cmdSave.Visible = False End Sub Private Sub Form_Load ()
If rs_rorder.State = adStateOpen Then rs_rorder.Close rs_rorder.Open "select * from r_order", con, adOpenDynamic, adLockOptimistic con.Execute "delete from r_order" TAMT = 0 TAMT1 = 0 cmdOrder1.Enabled = False cmdBill.Visible = False cmdSave.Visible = False cmdMain.Enabled = True cmdMain1.Enabled = True cmdNorder.Enabled = False cmdNorder1.Enabled = False With rs_checkin .MoveFirst While not .EOF cmbCode.AddItem "GID" & (.Fields (0)) .MoveNext Wend End With If optVeg.Value = True Then With rs_veg .MoveFirst While not .EOF If cmbMenu.List (cmbMenu.ListIndex) = .Fields ("veg") Then txtprice.Text = .Fields ("vprice") End If .MoveNext Wend End With End If If optVeg1.Value = True Then With rs_veg .MoveFirst While not .EOF cmbMenu1.AddItem (UCase (.Fields(0))) .MoveNext Wend End With End If End Sub
Private Sub optNveg_Click () cmbMenu.Clear With rs_nveg .MoveFirst While not .EOF cmbMenu.AddItem (UCase (.Fields ("nonveg"))) .MoveNext Wend End With End Sub Private Sub optNveg1_Click () cmbMenu.Clear With rs_nveg .MoveFirst While not .EOF cmbMenu1.AddItem (UCase (.Fields ("nonveg"))) .MoveNext Wend End With End Sub Private Sub optVeg_Click () cmbMenu.Clear With rs_veg .MoveFirst While not .EOF cmbMenu.AddItem (UCase (.Fields (0))) .MoveNext Wend End With End Sub Private Sub optVeg1_Click () CmbMenu1.Clear
With rs_veg .MoveFirst While not .EOF CmbMenu1.AddItem (UCase (.Fields (0))) .MoveNext Wend End With End Sub Private Sub blank () TxtName.Text = " " txtTable.Text = " " cmbMenu.ListIndex = -1 txtQuantity.Text = " " txtPitem.Text = " " txtTprice.Text = " " txtTAMT.Text = " " End Sub Private Sub blank1 () cmbCode.Text = " " txtName1.Text = " " txtTable1.Text = " " cmbMenu1.ListIndex = -1 txtQuantity1.Text = " " txtPitem1.Text = " " txtTprice1.Text = " " txtTAMT1.Text = " " End Sub
Private Sub txtQuantity_Change () txtTprice.Text = (Val (txtPitem.Text)) * (Val (txtQuantity.Text)) End Sub Private Sub txtQuantity_KeyPress (KeyAscii as Integer) Call Num (KeyAscii) End Sub Private Sub txtQuantity1_Change () txtTprice1.Text = (Val (txtPitem1.Text)) * (Val (txtQuantity1.Text)) End Sub
Private Sub txtQuantity1_KeyPress (KeyAscii as Integer) Call Num (KeyAscii) End Sub Private Sub txtTable_KeyPress (KeyAscii as Integer) Call Num (KeyAscii) End Sub Private Sub txtTable1_KeyPress (KeyAscii as Integer) Call Num (KeyAscii) End Sub
CODING :- BILL
CODE
Private Sub cmbCode_Click () cmdPrint.Enabled = True
With rs_check_out .MoveFirst While not .EOF If cmbCode.List (cmbCode.ListIndex) = "GID" & (.Fields ("customer_code")) Then txtName.Text = UCase (.Fields ("customer_name")) txtAdvance.Text = .Fields ("advance") txtRcharge.Text = .Fields ("roomcharge") txtTotal.Text = .Fields ("total") With rs_rbill .MoveFirst While not .EOF If cmbCode.List (cmbCode.ListIndex) = "GID" & (.Fields (0)) Then txtRest.Text = .Fields ("totalamount") End If .MoveNext Wend End With With rs_bbill .MoveFirst While not .EOF If cmbCode.List (cmbCode.ListIndex) = "GID" & (.Fields (0)) Then txtBar.Text = .Fields ("totalamount") End If .MoveNext Wend End With With rs_tbill .MoveFirst While not .EOF If cmbCode.List (cmbCode.ListIndex) = "GID" & (.Fields ("customer_code")) Then txtName.Text = UCase (.Fields ("customer_name")) txtAdvance.Text = .Fields ("advance") txtRcharge.Text = .Fields ("room_charges") txtTotal.Text = .Fields ("total") txtRest.Text = .Fields ("restaurant_bill") txtBar.Text = .Fields ("bar_bill") MsgBox "YOU HAVE ALREADY GENERATE BILL FOR THIS CUSTOMER", vbInformation, "HOTEL" cmdPrint.Enabled = False Else
cmdPrint.Enabled = True End If .MoveNext Wend End With Exit Sub Else cmdPrint.Enabled = False .MoveNext End If Wend End With End Sub Private Sub cmdMain_Click () Unload Me End Sub Private Sub cmdPrint_Click () Dim intloopindex As Integer On Error GoTo cancel CommonDialog1.PrinterDefault = True CommonDialog1.ShowPrinter For intloopindex = 1 to commandialog1.Copies PrintForm Next intloopindex Cancel: If rs_check_out.State = adStateOpen Then rs_check_out.Close rs_check_out.Open "select * from check_out where bill_accept=0", con, adOpenDynamic, adLockOptimistic With rs_check_out Do Until .EOF If cmbCode.Text = "GID" & (.Fields (0)) Then .Fields ("bill_accept") = 1 .Update Exit Do End If .MoveNext Loop
End With With rs_tbil .AddNew .Fields ("bill_no") = Val (Mid (txtBill.Text, 4)) .Fields ("customer_code") = (Val (Mid (cmbCode.Text, 4))) .Fields ("customer_name") = Trim (UCase (txtName.Text)) .Fields ("advance") = Val (txtAdvance.Text) .Fields ("restaurant_bill") = Val (txtRest.Text) .Fields ("bar_bill") = Val (txtBar.Text) .Fields ("room_charges") = Val (txtRcharge.Text) .Fields ("total") = Val (txtTotal.Text) .Update End With MsgBox "YOUR BILL HAVE BEEN SAVED" With rs_check_out .MoveFirst Smart: If cmbCode.List (cmbCode.ListIndex) = "GID" & (.Fields (0)) Then cmbCode.RemoveItem cmbCode.ListIndex Else .MoveNext GoTo smart End If End With txtName.Text = " " txtAdvance.Text = " " txtRest.Text = " " txtBar.Text = " " txtRcharge.Text = " " txtTotal.Text = " " txtBill.Text = " " Dim bill With rs_tbill .MoveLast Bill = .Fields ("bill_no") txtBill.Text = "BID" & STR (bill + 1) End With
End Sub Private Sub Form_Load () Dim bill With rs_tbill If rs_tbill.BOF and rs_tbill.EOF Then Bill = 100 Bill = (bill + 1) txtBill.Text = bill Else .MoveLast Bill = .Fields ("bill_no") txtBill.Text = "BID" & (bill + 1) End If End With If rs_check_out.State = adStateOpen Then rs_check_out.Close rs_check_out.Open "select * from check_out where bill_accept=0", con, adOpenDynamic, adLockOptimistic With rs_check_out .MoveFirst While not .EOF cmbCode.AddItem "GID" & (.Fields (0)) .MoveNext Wend End With End Sub
CODING: - EMPLOYEE
CODE
Dim neflag As Boolean Dim Rno as Integer Private Sub remove_data () txtEname.Text = " " txtEage.Text = " "
txtEaddress.Text = " " txtEcity.Text = " " txtEstate.Text = " " txtEpicode.Text = " " txtEphone.Text = " " cmbEducation.Text = " " txtExperience.Text = " " cmbdesignation.Text = " " cmbDepartment.Text = " " txtEsalary.Text = " " dob.Refresh doj.Refresh dol.Refresh End Sub Private Sub Display_data () If Not rs_emp_table.EOF then txtEcode.Text = "EMP" & (rs_emp_table.Fields ("empid")) txtEname.Text = Trim (UCase (rs_emp_table.Fields ("empname"))) txtEage.Text = Trim (UCase (rs_emp_table.Fields ("age"))) dob.Value = rs_emp_table.Fields ("dobirth") txtEaddress.Text = Trim (UCase (rs_emp_table.Fields ("address"))) txtEcity.Text = Trim (UCase (rs_emp_table.Fields ("city"))) txtEstate.Text = Trim (UCase (rs_emp_table.Fields ("state"))) txtEpicode.Text = Trim (UCase (rs_emp_table.Fields ("pincode"))) txtEphone.Text = Trim (UCase (rs_emp_table.Fields ("phoneno"))) cmbEducation.Text = Trim (UCase (rs_emp_table.Fields ("education"))) txtExperience.Text = Trim (UCase (rs_emp_table.Fields ("experience"))) doj.Value = rs_emp_table.Fields ("dojoining") cmbdesignation.Text = Trim (UCase (rs_emp_table.Fields ("designation"))) cmbDepartment.Text = Trim (UCase (rs_emp_table.Fields ("department"))) txtEsalary.Text = Trim (UCase (rs_emp_table.Fields ("salary"))) dol.Value = rs_emp_table.Fields ("doleaving") End If End Sub Private Sub cmbDepartment_Click () If cmbDepartment.Text = "Front Office" Then cmbdesignation.Clear cmbdesignation.AddItem "Gen.Manager" cmbdesignation.AddItem "Asst.Manager"
cmbdesignation.AddItem "Receptionist" ElseIf cmbDepartment.Text = "House Keeping" Then cmbdesignation.Clear cmbdesignation.AddItem "Supervisor" cmbdesignation.AddItem "Room Boy" cmbdesignation.AddItem "Laundary Boy" cmbdesignation.AddItem "Utility Worker" ElseIf cmbDepartment.Text = "Restaurent" Then cmbdesignation.Clear cmbdesignation.AddItem "Rest.Supervisor" cmbdesignation.AddItem "Helper" cmbdesignation.AddItem "Rest. Manager" cmbdesignation.AddItem "Cook" cmbdesignation.AddItem "Asst. Cook" cmbdesignation.AddItem "Waiter" End If End Sub Private Sub cmdAdd_Click () With rs_emp_table .MoveLast Ecode = rs_emp_table.Fields ("empid") txtEcode.Text = "EMP" & STR (Ecode + 1) End With cmdAdd.Enabled = False cmdUpdate.Enabled = False cmdDelete.Enabled = False cmdSave.Enabled = True cmdMain.Enabled = False cmdCancel.Enabled = True Frame4.Enabled = False dol.Enabled = False txtEcode.Locked = True txtEname.Locked = False txtEage.Locked = False txtEaddress.Locked = False txtEcity.Locked = False txtEstate.Locked = False txtEpicode.Locked = False txtEphone.Locked = False cmbEducation.Locked = False
txtExperience.Locked = False cmbdesignation.Locked = False cmbDepartment.Locked = False txtEsalary.Locked = False Call remove_data Neflag = True txtEname.SetFocus End Sub Private Sub cmdCancel_Click () cmdCancel.Enabled = False cmdSave.Enabled = False Call Display_data cmdAdd.Enabled = True cmdUpdate.Enabled = True cmdDelete.Enabled = True cmdMain.Enabled = True dol.Enabled = True Frame4.Enabled = True End Sub Private Sub cmdDelete_Click () Dim DEL as Boolean e_name = InputBox ("PLEASE ENTER THE EMPLOYEE NAME TO BE DELETED") If rs_emp_table.State = adStateOpen Then rs_emp_table.Close rs_emp_table.Open "SELECT * FROM emp_table WHERE empname LIKE'" & UCase (e_name) & "'", con, adOpenDynamic, adLockOptimistic If Not rs_emp_table.EOF then Call Display_data Else MsgBox THIS EMPLOYEE DOESN'T WORK IN THE HOTEL End If If (MsgBox ("ARE YOU SURE THAT YOU WANT TO DELETE THIS ENTRY", vbYesNo + vbInformation, "HOTEL") = vbYes) Then Rs_emp_table.Delete adAffectCurrent MsgBox RECORD HAS DELETED SUCCESSFULLY. ", vbInformation, "DELETE" Call remove_data
rs_emp_table.MoveFirst Call Display_data Else MsgBox RECORD HAS NOT DELETED End If If rs_emp_table.State = adStateOpen Then rs_emp_table.Close rs_emp_table.Open "select * from emp_table order by empid", con, adOpenDynamic, adLockOptimistic rs_emp_table.MoveFirst Call Display_data End Sub Private Sub cmdFirst_Click () Rno = 1 rs_emp_table.MoveFirst Call Display_data MsgBox "THIS IS FIRST RECORD", vbInformation, "FIRST RECORD" End Sub Private Sub cmdLast_Click () Rno = rs_emp_table.RecordCount rs_emp_table.MoveLast Call Display_data MsgBox "THIS IS LAST RECORD", vbInformation, "LAST RECORD" End Sub Private Sub cmdNext_Click () Rno = Rno + 1 rs_emp_table.MoveNext If rs_emp_table.EOF Then MsgBox "THIS IS THE LAST RECORD", vbInformation, "LAST RECORD" End If Call Display_data End Sub Private Sub cmdPrevious_Click () Rno = Rno - 1 rs_emp_table.MovePrevious
If rs_emp_table.BOF Then rs_emp_table.MoveFirst Rno = 1 MsgBox "THIS IS THE FIRST RECORD.", vbInformation, "FIRST RECORD" End If Call Display_data End Sub Private Sub cmdMain_Click () If MsgBox ("ARE YOU SURE YOU WANT TO EXIT FROM EMPLOYEE DETAIL FORM ?", vbYesNo + vbExclamation, "EXIT") = vbYes Then Unload Me End If End Sub Private Sub cmdSave_Click () If txtEname.Text = " " Then MsgBox "PLEASE ENTER THE NAME" txtEname.SetFocus Exit Sub ElseIf txtEage.Text = " " Then MsgBox "PLEASE ENTER THE AGE" txtEage.SetFocus Exit Sub ElseIf txtEaddress.Text = "" Then MsgBox "PLEASE ENTER THE ADDRESS" txtEaddress.SetFocus Exit Sub ElseIf txtEcity.Text = " " Then MsgBox "PLEASE ENTER THE CITY" txtEcity.SetFocus Exit Sub ElseIf txtEstate.Text = " " Then MsgBox "PLEASE ENTER THE STATE" txtEstate.SetFocus Exit Sub ElseIf txtEpicode.Text = " " Then
MsgBox "PLEASE ENTER THE PINCODE" txtEpicode.SetFocus Exit Sub ElseIf txtEphone.Text = "" Then MsgBox "PLEASE ENTER THE PHONE NUMBER" txtEphone.SetFocus Exit Sub ElseIf cmbEducation.Text = " " Then MsgBox "SELECT THE EDUCATION" cmbEducation.SetFocus Exit Sub ElseIf txtExperience.Text = " " Then MsgBox "PLEASE ENTER WORK EXPERIENCE" txtExperience.SetFocus Exit Sub ElseIf txtEsalary.Text = " " Then MsgBox "PLEASE ENTER SALARY" txtEsalary.SetFocus Exit Sub ElseIf cmbdesignation.Text = "" Then MsgBox "SELECT DESIGNATION" cmbdesignation.SetFocus Exit Sub ElseIf cmbDepartment.Text = "" Then MsgBox "SELECT DEPARTMENT." cmbDepartment.SetFocus Exit Sub End If If neflag = True Then With rs_emp_table .MoveLast .AddNew .Fields("empid") = Val(Mid(txtEcode.Text, 4)) .Fields("empname") = (Trim(UCase(txtEname.Text))) .Fields("age") = (Trim(UCase(txtEage.Text))) .Fields("dobirth") = (Trim(UCase(dob.Value))) .Fields("address") = (Trim(UCase(txtEaddress.Text)))
.Fields("city") = (Trim(UCase(txtEcity.Text))) .Fields("state") = (Trim(UCase(txtEstate.Text))) .Fields("pincode") = (Trim(UCase(Val(txtEpicode.Text)))) .Fields("phoneno") = (Trim(UCase(txtEphone.Text))) .Fields("education") = (Trim(UCase(cmbEducation.Text))) .Fields("experience") = (Trim(UCase(txtExperience.Text))) .Fields("dojoining") = (Trim(UCase(doj.Value))) .Fields("designation") = (Trim(UCase(cmbdesignation.Text))) .Fields("department") = (Trim(UCase(cmbDepartment.Text))) .Fields("salary") = (Trim(UCase(txtEsalary.Text))) .Fields("doleaving") = (Trim(UCase(dol.Value))) MsgBox " RECORD SAVED SUCCESSFULLY", vbInformation, "HOTEL" rs_emp_table.MoveFirst Call Display_data cmdAdd.Enabled = True cmdSave.Enabled = False cmdUpdate.Enabled = True cmdCancel.Enabled = False Frame4.Enabled = True cmdDelete.Enabled = True cmdMain.Enabled = True End With Else With rs_emp_table .Fields("empname") = (Trim(UCase(txtEname.Text))) .Fields("age") = (Trim(UCase(txtEage.Text))) .Fields("dobirth") = (Trim(UCase(dob.Value))) .Fields("address") = (Trim(UCase(txtEaddress.Text))) .Fields("city") = (Trim(UCase(txtEcity.Text))) .Fields("state") = (Trim(UCase(txtEstate.Text))) .Fields("pincode") = (Trim(UCase(Val(txtEpicode.Text)))) .Fields("phoneno") = (Trim(UCase(txtEphone.Text))) .Fields("education") = (Trim(UCase(cmbEducation.Text))) .Fields("experience") = (Trim(UCase(txtExperience.Text))) .Fields("dojoining") = (Trim(UCase(doj.Value))) .Fields("designation") = (Trim(UCase(cmbdesignation.Text))) .Fields("department") = (Trim(UCase(cmbDepartment.Text))) .Fields("salary") = (Trim(UCase(txtEsalary.Text))) .Fields("doleaving") = (Trim(UCase(dol.Value))) If MsgBox(" DO YOU WANT TO SAVE THE CHANGES CURRENTLY MADE ?", vbYesNo + vbQuestion, "UPDATE") = vbYes Then .Update MsgBox " RECORD UPDATED SUCCESSFULLY", vbInformation, "HOTEL" Else
.CancelUpdate End If End With cmdAdd.Enabled = True cmdSave.Enabled = False cmdUpdate.Enabled = True cmdCancel.Enabled = False cmdMain.Enabled = True Frame4.Enabled = True cmdDelete.Enabled = True rs_emp_table.Close If rs_emp_table.State = adStateOpen Then rs_emp_table.Close rs_emp_table.Open "select * from emp_table order by empid", con, adOpenDynamic, adLockOptimistic rs_emp_table.MoveFirst Call Display_data End If cmdSave.Enabled = False End Sub Private Sub cmdUpdate_Click() cmdUpdate.Enabled = False cmdAdd.Enabled = False cmdSave.Enabled = True cmdDelete.Enabled = False cmdCancel.Enabled = True cmdMain.Enabled = False Frame4.Enabled = False dol.Enabled = True neflag = False e_name = InputBox("PLEAZE ENTER THE EMPLOYEE NAME TO BE SEARCHED") If rs_emp_table.State = adStateOpen Then rs_emp_table.Close rs_emp_table.Open "SELECT * FROM emp_table WHERE empname LIKE'" & UCase(e_name) & "'", con, adOpenDynamic, adLockOptimistic If Not rs_emp_table.EOF Then Call Display_data Else MsgBox " THIS EMPLOYEE DOESN'T WORK IN THE HOTEL "
End If txtEcode.Locked = True txtEname.Locked = False txtEage.Locked = False txtEaddress.Locked = False txtEcity.Locked = False txtEstate.Locked = False txtEpicode.Locked = False txtEphone.Locked = False cmbEducation.Locked = False txtExperience.Locked = False cmbdesignation.Locked = False cmbDepartment.Locked = False txtEsalary.Locked = False txtEname.SetFocus End Sub Private Sub dob_LostFocus() Dim X As Integer Dim Y As Integer X = DateDiff("y", dob.Value, doj.Value) MsgBox "value of x" & str(X) X = X / 365 txtEage.Text = X End Sub Private Sub doj_LostFocus() Dim X Dim Y X = DateDiff("y", dob.Value, doj.Value) X = X / 365 If X < 18 Then MsgBox "THE PERSON IS IN UNDER AGE", vbCritical, "HOTEL" dob.SetFocus End If End Sub Private Sub Form_Load() cmdSave.Enabled = False dol.Enabled = False
dol.Refresh cmdCancel.Enabled = False Call Display_data cmbDepartment.AddItem "Front Office" cmbDepartment.AddItem "House Keeping" cmbDepartment.AddItem "Restaurent" txtEcode.Locked = True txtEname.Locked = True txtEage.Locked = True txtEaddress.Locked = True txtEcity.Locked = True txtEstate.Locked = True txtEpicode.Locked = True txtEphone.Locked = True cmbEducation.Locked = True txtExperience.Locked = True cmbdesignation.Locked = True cmbDepartment.Locked = True txtEsalary.Locked = True cmbEducation.AddItem "10TH PASS" cmbEducation.AddItem "12TH PASS" cmbEducation.AddItem "B.A." cmbEducation.AddItem "B.Sc." cmbEducation.AddItem "B.Com." cmbEducation.AddItem "M.A." cmbEducation.AddItem "M.Sc." cmbEducation.AddItem "M.Com." Dim Ecode With rs_emp_table If rs_emp_table.BOF And rs_emp_table.EOF Then Ecode = 100 Ecode = (Ecode + 1) txtEcode.Text = Ecode End If End With End Sub Private Sub txtEage_KeyPress(KeyAscii As Integer) Call Num(KeyAscii) End Sub
Private Sub txtEcity_KeyPress(KeyAscii As Integer) Call char(KeyAscii) End Sub Private Sub txtEname_KeyPress(KeyAscii As Integer) Call char(KeyAscii) End Sub Private Sub txtEphone_KeyPress(KeyAscii As Integer) Call Num(KeyAscii) End Sub Private Sub txtEphone_LostFocus() Dim count count = Len(txtEphone.Text) If count <= 10 Or count >= 12 Then MsgBox "PLEASE ENTER THE CORRECT PHONE NUMBER.", vbCritical, "ERROR" txtEphone.SetFocus End If End Sub Private Sub txtEpicode_KeyPress(KeyAscii As Integer) Call Num(KeyAscii) End Sub Private Sub txtEpicode_LostFocus() Dim count count = Len(txtEpicode.Text) If count < 6 Or count > 6 Then MsgBox "PLEAZE ENTER THE CORRECT PIN CODE.", vbCritical, "ERROR" txtEpicode.SetFocus End If End Sub Private Sub txtEsalary_KeyPress(KeyAscii As Integer) Call Num(KeyAscii) End Sub Private Sub txtEstate_KeyPress(KeyAscii As Integer) Call char(KeyAscii) End Sub
CODING: - PAYROLL
CODE
Dim hra, tr, md, pf, nt, bs, ep As Integer Private Sub cmbEcode_Click() With rs_emp_table .MoveFirst While Not .EOF
If cmbEcode.List(cmbEcode.ListIndex) = "GID" & (.Fields(0)) Then lblName.Caption = UCase(.Fields("empname")) lblDept.Caption = UCase(.Fields("department")) lbldegi.Caption = UCase(.Fields("designation")) lblBsal.Caption = UCase(.Fields("salary")) End If .MoveNext Wend End With End Sub Private Sub cmdDelete_Click() cmdDelete.Enabled = True With rs_payroll .MoveFirst While Not .EOF If cmbEcode.Text = .Fields(0) Or Combo1.Text = .Fields("MONTH") Then .Delete adAffectCurrent End If .MoveNext Wend MsgBox " RECORD HAS DELETED SUCCESSFULLY.", vbInformation, "DELETE" Call blank End With GridEmpinfo.Refresh End Sub Private Sub cmdMain_Click() If MsgBox("ARE YOU SURE YOU WANT TO EXIT FROM THIS FORM ?", vbYesNo + vbExclamation, "EXIT???") = vbYes Then Unload Me End If End Sub Private Sub cmdSave_Click() cmdDelete.Enabled = False If txtHrate.Text = " " Or txtHtime.Text = " " Then MsgBox "PLEASE INSERT THE HOUR SALARY & HOUR TIME TO PROCESS THE NET SALARY", vbInformation, "HOTEL" End If With rs_payroll
While Not .EOF If cmbEcode.Text = "GID" & (.Fields(0)) Then If Combo1.Text = .Fields("month") Then MsgBox "YOU HAVE ALREADY PROCESSED PAYMENT FOR THIS MONTH ", vbCritical, "PROCESS ERROR" End If End If .MoveNext Wend .AddNew .Fields("empid") = Val(Mid(cmbEcode.Text, 4)) .Fields("empname") = lblName.Caption .Fields("department") = lblDept.Caption .Fields("designation") = lbldegi.Caption .Fields("basicsalary") = lblBsal.Caption .Fields("month") = Combo1.Text .Fields("HourRate") = txtHrate.Text .Fields("HourTime") = txtHtime.Text .Fields("transport") = txtTransport.Text .Fields("houserent") = txtHrent.Text .Fields("medical") = txtMedical.Text .Fields("pansion") = txtPension.Text .Fields("netpay") = txtNsalary.Text .Fields("processeddate") = txtDate.Text .Update MsgBox "PAYROLL PROCESSED FOR THIS MONTH", vbInformation, "PROCESS PAYROLL" End With Call blank cmdSave.Enabled = False End Sub Private Sub Combo1_Click() cmdSave.Enabled = False With rs_payroll While Not .EOF If Combo1.List(Combo1.ListIndex) = .Fields("month") Then txtHrate.Text = .Fields("HourRate") txtHtime.Text = .Fields("HourTime") txtMedical.Text = .Fields("medical") txtTransport.Text = .Fields("transport")
txtPension.Text = .Fields("pansion") txtNsalary.Text = .Fields("basicsalary") txtHrent.Text = .Fields("houserent") txtDate.Text = .Fields("processeddate") MsgBox "RECORD ALREADY EXIST FOR THIS MONTH", vbInformation, "HOTEL" End If .MoveNext Wend End With cmdDelete.Enabled = True End Sub Private Sub Form_Load() Me.Top = 3000 Me.Left = 3000 cmdSave.Enabled = False With rs_emp_table .MoveFirst While Not .EOF cmbEcode.AddItem "GID" & (.Fields(0)) .MoveNext Wend End With Combo1.AddItem "January" Combo1.AddItem "February" Combo1.AddItem "March" Combo1.AddItem "April" Combo1.AddItem "May" Combo1.AddItem "June" Combo1.AddItem "July" Combo1.AddItem "August" Combo1.AddItem "September" Combo1.AddItem "October" Combo1.AddItem "November" Combo1.AddItem "December" cmdSave.Enabled = False cmdDelete.Enabled = False End Sub
Private Sub calculate() bs = lblBsal.Caption hra = 20 / 100 * bs txtHrent.Text = hra tr = 5 / 100 * bs txtTransport.Text = tr md = 12 / 100 * bs txtMedical.Text = md pf = 15 / 100 * bs txtPension.Text = pf ep = (Val(txtHrate.Text)) * (Val(txtHtime.Text)) txtNsalary = (bs + hra + md + tr + ep) - pf txtDate.Text = Date End Sub Private Sub blank() txtHrate.Text = " " txtHtime.Text = " " txtTransport.Text = " " txtHrent.Text = " " txtMedical.Text = " " txtPension.Text = " " txtNsalary.Text = " " Combo1.ListIndex = -1 cmbEcode.Text = " " lblName.Caption = " " lblDept.Caption = " " lbldegi.Caption = " " lblBsal.Caption = " " txtDate.Text = " " End Sub Private Sub txtHtime_LostFocus() If txtHrate.Text = " " Or txtHtime.Text = " " Then MsgBox " PLEASE ENTER THE HOUR RATE & EXTRA TIME WHICH IS DONE BY WORKER ", vbInformation, "HOTEL"
CODING :- SEARCHGUEST
CODE
Option Explicit Dim StrSql As String Public Sub FindX() Dim count As Integer lblcount.Caption = "" count = 0 If rs_checkin.State = adStateOpen Then rs_checkin.Close
rs_checkin.Open "select * from chechkin order by customer_code", con, adOpenDynamic, adLockOptimistic With rs_checkin .MoveFirst .Find "customer_name LIKE '" & txtName.Text & "%'" Do While Not rs_checkin.EOF txtGid.Text = "GID" & (.Fields("customer_code")) txtName1.Text = .Fields("customer_name") txtAge.Text = .Fields("age") txtPhone.Text = .Fields("phoneno") txtEmail.Text = .Fields("emailid") txtAddress.Text = .Fields("address") txtCity.Text = .Fields("city") txtState.Text = .Fields("state") txtCountry.Text = .Fields("country") txtPincode.Text = .Fields("pincode") txtAdults.Text = .Fields("adults") txtChildren.Text = .Fields("children") txtRtype.Text = .Fields("roomtype") txtRoomno.Text = .Fields("roomno") txtAdvance.Text = .Fields("advance") txtCitime.Text = .Fields("tocheckin") txtdatechin.Text = .Fields("docheckin") txtdatechout.Text = .Fields("docheckout") .MoveNext count = count + 1 .Find "customer_name LIKE '" & txtName.Text & "%'", 1, adSearchForward Loop If count = 0 Then MsgBox "No Match Found", vbOKOnly + vbInformation, "Information" txtName.SetFocus Else lblcount.Caption = "Total Matches found " & count End If End With End Sub Private Sub cmdCancel_Click() If MsgBox("ARE YOU SURE YOU WANT TO EXIT FROM THIS FORM ?", vbYesNo + vbExclamation, "EXIT???") = vbYes Then Unload Me End If End Sub Private Sub cmdGo_Click()
lstGuestName.Clear 'fraDetails.Visible = False If txtName.Text = "" Then MsgBox "Enter the name", vbOKOnly + vbCritical, "Error" txtName.SetFocus Exit Sub End If FindX Exit Sub End Sub Private Sub Command1_Click() lstGuestName.Clear FINDALL End Sub Private Sub Form_Load() 'fraDetails.Visible = True lblcount.Visible = False Me.Top = 3000 Me.Left = 3000 lstGuestName.Clear End Sub Private Sub lstGuestName_Click() With rs_checkin .MoveFirst While Not .EOF If lstGuestName.List(lstGuestName.ListIndex) = .Fields("customer_name") Then txtGid.Text = "GID" & (.Fields("customer_code")) txtName1.Text = .Fields("customer_name") txtAge.Text = .Fields("age") txtPhone.Text = .Fields("phoneno") txtEmail.Text = .Fields("emailid") txtAddress.Text = .Fields("address") txtCity.Text = .Fields("city") txtState.Text = .Fields("state") txtCountry.Text = .Fields("country") txtPincode.Text = .Fields("pincode") txtAdults.Text = .Fields("adults") txtChildren.Text = .Fields("children") txtRtype.Text = .Fields("roomtype")
txtRoomno.Text = .Fields("roomno") txtAdvance.Text = .Fields("advance") txtCitime.Text = .Fields("tocheckin") txtdatechin.Text = .Fields("docheckin") txtdatechout.Text = .Fields("docheckout") End If .MoveNext Wend End With Exit Sub ' fraDetails.Visible = True End Sub Public Sub FINDALL() txtName.Text = " " Dim count As Integer lblcount.Caption = " " count = 0 With rs_checkin .MoveFirst While Not .EOF lstGuestName.AddItem .Fields("customer_name") .MoveNext Wend count = count + 1 End With If count = 0 Then MsgBox "No Match Found", vbOKOnly + vbInformation, "Information" txtName.SetFocus Else lblcount.Caption = "Total Matches found " & count End If End Sub
CODING :- SEARCHEMP
CODE
Option Explicit Public Sub FindX() Dim count As Integer lblcount.Caption = "" count = 0
If rs_emp_table.State = adStateOpen Then rs_emp_table.Close rs_emp_table.Open "select * from emp_table order by empid", con, adOpenDynamic, adLockOptimistic With rs_emp_table .MoveFirst .Find "empname LIKE '" & txtName.Text & "%'" Do While Not rs_emp_table.EOF txtEcode.Text = "EMP" & (rs_emp_table.Fields("empid")) txtEname.Text = Trim(UCase(rs_emp_table.Fields("empname"))) txtEage.Text = Trim(UCase(rs_emp_table.Fields("age"))) txtdob.Text = rs_emp_table.Fields("dobirth") txtEaddress.Text = Trim(UCase(rs_emp_table.Fields("address"))) txtEcity.Text = Trim(UCase(rs_emp_table.Fields("city"))) txtEstate.Text = Trim(UCase(rs_emp_table.Fields("state"))) txtEpicode.Text = Trim(UCase(rs_emp_table.Fields("pincode"))) txtEphone.Text = Trim(UCase(rs_emp_table.Fields("phoneno"))) txtedu.Text = Trim(UCase(rs_emp_table.Fields("education"))) txtExperience.Text = Trim(UCase(rs_emp_table.Fields("experience"))) txtdatej.Text = rs_emp_table.Fields("dojoining") txtDesignation.Text = Trim(UCase(rs_emp_table.Fields("designation"))) txtdepartment.Text = Trim(UCase(rs_emp_table.Fields("department"))) txtEsalary.Text = Trim(UCase(rs_emp_table.Fields("salary"))) txtdatel.Text = rs_emp_table.Fields("doleaving") .MoveNext count = count + 1 rs_emp_table.Find "empname LIKE '" & txtName.Text & "%'", 1, adSearchForward Loop If count = 0 Then MsgBox "No Match Found", vbOKOnly + vbInformation, "HOTEL" txtName.SetFocus Else lblcount.Caption = "Total Matches found " & count End If End With End Sub Private Sub cmdCancel_Click() If MsgBox("ARE YOU SURE YOU WANT TO EXIT FROM THIS FORM ?", vbYesNo + vbInformation, "EXIT") = vbYes Then Unload Me End If End Sub Private Sub cmdGo_Click()
lstEmpName.Clear fraDetails.Visible = True If txtName.Text = "" Then MsgBox "Enter the name", vbOKOnly + vbCritical, "Error" txtName.SetFocus Exit Sub End If FindX End Sub Private Sub Command1_Click() Me.Width = 9705 Me.Height = 6240 lstEmpName.Width = 2175 lstEmpName.Height = 3376.123 FINDALL End Sub Private Sub Form_Load() Me.Width = 9705 Me.Height = 7935 lblcount.Visible = False fraDetails.Visible = True Me.Top = 3000 Me.Left = 3000 lstEmpName.Clear End Sub Private Sub lstEmpName_Click() With rs_emp_table .MoveFirst While Not .EOF If lstEmpName.List(lstEmpName.ListIndex) = .Fields("empname") Then txtEcode.Text = "EMP" & (rs_emp_table.Fields("empid")) txtEname.Text = Trim(UCase(rs_emp_table.Fields("empname"))) txtEage.Text = Trim(UCase(rs_emp_table.Fields("age"))) txtdob.Text = rs_emp_table.Fields("dobirth") txtEaddress.Text = Trim(UCase(rs_emp_table.Fields("address")))
txtEcity.Text = Trim(UCase(rs_emp_table.Fields("city"))) txtEstate.Text = Trim(UCase(rs_emp_table.Fields("state"))) txtEpicode.Text = Trim(UCase(rs_emp_table.Fields("pincode"))) txtEphone.Text = Trim(UCase(rs_emp_table.Fields("phoneno"))) txtedu.Text = Trim(UCase(rs_emp_table.Fields("education"))) txtExperience.Text = Trim(UCase(rs_emp_table.Fields("experience"))) txtdatej.Text = rs_emp_table.Fields("dojoining") txtDesignation.Text = Trim(UCase(rs_emp_table.Fields("designation"))) txtdepartment.Text = Trim(UCase(rs_emp_table.Fields("department"))) txtEsalary.Text = Trim(UCase(rs_emp_table.Fields("salary"))) txtdatel.Text = rs_emp_table.Fields("doleaving") End If .MoveNext Wend fraDetails.Visible = True End With End Sub Public Sub FINDALL() lstEmpName.Clear txtName.Text = " " Dim count As Integer lblcount.Caption = "" count = 0 With rs_emp_table .MoveFirst While Not .EOF lstEmpName.AddItem .Fields("empname") .MoveNext Wend count = .RecordCount End With If count = 0 Then MsgBox "THERE IS NO EMPLOYEE", vbOKOnly + vbInformation, "Information" txtName.SetFocus Else lblcount.Caption = "Total Matches found " & count End If Exit Sub FindX Exit Sub End Sub
CODING :- RCHARGES
CODE
Private Sub Command1_Click() If MsgBox("ARE YOU SURE YOU WANT TO EXIT FROM EMPLOYEE DETAIL FORM ?", vbYesNo + vbExclamation, "EXIT???") = vbYes Then Unload Me End If End Sub Private Sub Form_Load() Me.Top = 2000
Me.Left = 2000 With rs_charges Label9.Caption = .Fields(0) Label10.Caption = .Fields(1) Label11.Caption = .Fields(2) Label12.Caption = .Fields(3) Label13.Caption = .Fields(4) Label14.Caption = .Fields(5) Label15.Caption = .Fields(6) End With End Sub
CODING :- PASSWORD
CODE
Option Explicit Dim i As Integer Dim str, UserName, StrSql As String Private Sub cmdCancel_Click() Unload Me End Sub
Private Sub cmdChangePassword_Click() If txtoldpassword.Text = " " Then MsgBox "Enter Complete Information", vbOKOnly + vbInformation, "Information" txtoldpassword.SetFocus End If If txtnewpassword.Text = " " Then MsgBox "Enter Complete Information", vbOKOnly + vbInformation, "Information" txtnewpassword.SetFocus End If If txtconfirmpassword.Text = " " Then MsgBox "Enter Complete Information", vbOKOnly + vbInformation, "Information" txtconfirmpassword.SetFocus End If If txtnewpassword.Text <> txtconfirmpassword Then MsgBox "CONFIRM PASSWORD & NEW PASSWORD DOESN'T MATCH", vbCritical, "ERROR" End If If rs_login.State = adStateOpen Then rs_login.Close rs_login.Open "select * from login order by pwd", con, adOpenDynamic, adLockOptimistic With rs_login .MoveFirst While Not .EOF If .Fields("pwd") <> txtoldpassword.Text Then MsgBox "Old Password Doesn't Match", vbOKOnly + vbCritical, "Error" txtoldpassword.SetFocus ElseIf txtnewpassword.Text <> txtconfirmpassword.Text Then MsgBox "New Password Doesn't Match", vbOKOnly + vbCritical, "Error" txtnewpassword.SetFocus txtoldpassword.Text = " " txtnewpassword.Text = " " txtconfirmpassword.Text = " " Else StrSql = "UPDATE login SET pwd = '" & txtconfirmpassword.Text & "' " con.Execute StrSql .Update MsgBox "THE PASSWORD HAS BEEN CHANGED", vbOKOnly + vbExclamation, "DONE" Unload Me End If .MoveNext Wend End With End Sub
CODING :- HELP
CODE
Private Sub cmdOK_Click() Unload Me End Sub
CODING :- TIP
CODE
Option Explicit Dim Tips As New Collection Const TIP_FILE = "TIPOFDAY.TXT" Dim CurrentTip As Long Private Sub DoNextTip() CurrentTip = Int((Tips.count * Rnd) + 1) Tip.DisplayCurrentTip
End Sub Function LoadTips(sFile As String) As Boolean Dim NextTip As String Dim InFile As Integer InFile = FreeFile If sFile = "" Then LoadTips = False Exit Function End If If Dir(sFile) = "" Then LoadTips = False Exit Function End If Open sFile For Input As InFile While Not EOF(InFile) Line Input #InFile, NextTip Tips.Add NextTip Wend Close InFile DoNextTip LoadTips = True End Function Private Sub chkLoadTipsAtStartup_Click() SaveSetting App.EXEName, "Options", "Show Tips at Startup", chkLoadTipsAtStartup.Value End Sub Private Sub cmdNextTip_Click() DoNextTip End Sub Private Sub cmdOK_Click() Unload Me
End Sub Private Sub Form_Load() Dim ShowAtStartup As Long ShowAtStartup = GetSetting(App.EXEName, "Options", "Show Tips at Startup", 1) If ShowAtStartup = 0 Then Unload Me Exit Sub End If Me.chkLoadTipsAtStartup.Value = vbChecked Randomize If LoadTips(App.Path & "\" & TIP_FILE) = False Then lblTipText.Caption = "That the " & TIP_FILE & " file was not found? " & vbCrLf & vbCrLf & _ "Create a text file named " & TIP_FILE & " using NotePad with 1 tip per line. " & _ "Then place it in the same directory as the application. " End If End Sub Public Sub DisplayCurrentTip() If Tips.count > 0 Then lblTipText.Caption = Tips.item(CurrentTip) End If End Sub
CODE
Public con As New ADODB.Connection Public rs_login As New ADODB.Recordset Public rs_emp_table As New ADODB.Recordset Public rs_checkin As New ADODB.Recordset Public rs_check_out As New ADODB.Recordset Public rs_suite As New ADODB.Recordset
Public rs_deluxsingle As New ADODB.Recordset Public rs_deluxdouble As New ADODB.Recordset Public rs_executivedouble As New ADODB.Recordset Public rs_executivesingle As New ADODB.Recordset Public rs_standarddouble As New ADODB.Recordset Public rs_standardsingle As New ADODB.Recordset Public rs_payroll As New ADODB.Recordset Public rs_veg As New ADODB.Recordset Public rs_nveg As New ADODB.Recordset Public rs_reservation As New ADODB.Recordset Public rs_soft As New ADODB.Recordset Public rs_rorder As New ADODB.Recordset Public rs_rbill As New ADODB.Recordset Public rs_hard As New ADODB.Recordset Public rs_charges As New ADODB.Recordset Public rs_border As New ADODB.Recordset Public rs_bbill As New ADODB.Recordset Public rs_tbill As New ADODB.Recordset Sub Main() If con.State = adStateOpen Then con.Close con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Project\Database\Hotel.mdb;Persist Security Info=False" rs_login.Open "select * from login", con, adOpenStatic, adLockReadOnly rs_emp_table.Open "select * from emp_table order by empid", con, adOpenDynamic, adLockOptimistic rs_checkin.Open "select * from chechkin order by customer_code", con, adOpenDynamic, adLockOptimistic rs_check_out.Open "select * from check_out order by customer_code", con, adOpenDynamic, adLockOptimistic rs_suite.Open "select * from suite where status=0 ", con, adOpenDynamic, adLockOptimistic rs_deluxsingle.Open "select * from delux_single where status=0 ", con, adOpenDynamic, adLockOptimistic rs_deluxdouble.Open "select * from delux_double where status=0 ", con, adOpenDynamic, adLockOptimistic rs_executivedouble.Open "select * from executive_double where status=0", con, adOpenDynamic, adLockOptimistic rs_executivesingle.Open "select * from executive_single where status=0", con, adOpenDynamic, adLockOptimistic rs_standardsingle.Open "select * from standard_single where status=0", con, adOpenDynamic, adLockOptimistic rs_standarddouble.Open "select * from standard_double where status=0", con, adOpenDynamic, adLockOptimistic
rs_payroll.Open "select * from payroll", con, adOpenDynamic, adLockOptimistic rs_veg.Open "select * from r_veg order by veg", con, adOpenDynamic, adLockOptimistic rs_nveg.Open "select * from nonveg order by nonveg", con, adOpenDynamic, adLockOptimistic rs_reservation.Open "select * from reservation", con, adOpenDynamic, adLockOptimistic rs_soft.Open "select * from soft_drink", con, adOpenDynamic, adLockOptimistic rs_rorder.Open "select * from r_order", con, adOpenDynamic, adLockOptimistic rs_rbill.Open "select * from rbill", con, adOpenDynamic, adLockOptimistic rs_hard.Open "select * from hard_drink", con, adOpenDynamic, adLockOptimistic rs_charges.Open "select * from roomcharges", con, adOpenDynamic, adLockOptimistic rs_border.Open "select * from b_order", con, adOpenDynamic, adLockOptimistic rs_bbill.Open "select * from bbill", con, adOpenDynamic, adLockOptimistic rs_tbill.Open "select * from tbill ", con, adOpenDynamic, adLockOptimistic Splash.Show 'MDIForm1.Show 'Login.Show End Sub Public Sub char(KeyAscii As Integer) KeyAscii = Asc(UCase$(Chr$(KeyAscii))) Select Case KeyAscii Case Asc(" ") Case 65 To 90 Case 97 To 122 Case 32 Case 8 Case 127 Case Else MsgBox "PLEASE ENTER THE CHARECTER...", vbOKOnly + vbExclamation, "Invalid input" KeyAscii = 0 End Select End Sub Public Sub Num(KeyAscii As Integer) Select Case KeyAscii Case 8 Case 97 Case 110 Case 47 Case 13 Case 46 Case 48 To 57
Case Else MsgBox "PLEASE ENTER THE NUMERIC VALUES...", vbOKOnly + vbExclamation, "Invalid input" KeyAscii = 0 End Select End Sub
Output Spacification
SCREENSHOT
SCREENSHOT
SCREENSHOT
HOTEL MANAGEMENT SYSYTEM
137
SCREENSHOT
REPORT NAME:-REPORT1
THIS REPORT PRINTS THE CUSTOMERS BILL DETAIL WHO HAS CHECKED-OUT FROM THE HOTEL.
SCREENSHOT
HOTEL MANAGEMENT SYSYTEM
139
SCREENSHOT
SCREENSHOT
HOTEL MANAGEMENT SYSYTEM
141
REFERENCES
Visual Basic 6 Programming Black Book by Steven Holzner Mastering in Visual Basic