📄 form2.frm
字号:
Top = 840
Width = 6495
Begin VB.Label Label13
BackColor = &H8000000A&
Caption = "HOTEL JENNYS RESIDENCY"
BeginProperty Font
Name = "Georgia"
Size = 20.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 495
Left = 120
TabIndex = 55
Top = 120
Width = 6255
End
End
Begin VB.Frame Frame1
Height = 855
Left = -72240
TabIndex = 49
Top = 5400
Width = 6375
Begin VB.TextBox Text8
Height = 285
Left = 840
TabIndex = 51
Top = 360
Width = 3135
End
Begin VB.CommandButton Command3
Caption = "Search"
Height = 375
Left = 4080
TabIndex = 52
Top = 360
Width = 1215
End
Begin VB.Label Label12
Caption = "Name"
Height = 255
Left = 240
TabIndex = 53
Top = 360
Width = 495
End
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = "D:\ashik\HMS\hotel2.mdb"
DefaultCursorType= 0 'DefaultCursor
DefaultType = 2 'UseODBC
Exclusive = 0 'False
Height = 345
Left = -72360
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "room"
Top = 1080
Visible = 0 'False
Width = 1140
End
Begin VB.Label Label46
BeginProperty Font
Name = "Times New Roman"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 6240
TabIndex = 113
Top = 1920
Width = 1935
End
Begin VB.Label Label45
BeginProperty Font
Name = "Times New Roman"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2400
TabIndex = 112
Top = 1920
Width = 2295
End
Begin VB.Label Label43
Caption = "Check Out Details"
BeginProperty Font
Name = "Book Antiqua"
Size = 14.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 375
Left = -70320
TabIndex = 108
Top = 600
Width = 2655
End
Begin VB.Label Label37
Caption = "Room Status"
BeginProperty Font
Name = "Book Antiqua"
Size = 14.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 375
Left = -74520
TabIndex = 96
Top = 720
Width = 1695
End
Begin VB.Label Label1
Caption = "Checkin Information"
BeginProperty Font
Name = "Book Antiqua"
Size = 14.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 375
Left = -70200
TabIndex = 48
Top = 720
Width = 2895
End
End
Begin VB.Menu file
Caption = "File"
Begin VB.Menu logoff
Caption = "&Log off"
Shortcut = ^L
End
Begin VB.Menu sep1
Caption = "-"
Index = 2
End
Begin VB.Menu exit
Caption = "E&xit"
Shortcut = ^X
End
End
Begin VB.Menu util
Caption = "utilities"
Begin VB.Menu rmst
Caption = "&Room status"
End
Begin VB.Menu rep
Caption = "&View Reports"
End
Begin VB.Menu stat
Caption = "&Statistics"
End
Begin VB.Menu seperater
Caption = "-"
Index = 0
End
Begin VB.Menu dbms
Caption = "&Database Manager"
End
End
Begin VB.Menu hlp
Caption = "Help"
Begin VB.Menu hlphms
Caption = "Help on HMS"
End
Begin VB.Menu about
Caption = "About Us"
Shortcut = {F1}
End
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim db As Database
Dim rs As Recordset
Dim db1 As Database
Dim rs1 As Recordset
Dim db2 As Database
Dim rs2 As Recordset
Dim val1 As Integer
Dim val2 As Integer
Dim val3 As Integer
Dim val As Integer
Private Sub Command1_Click()
If Text2.Text = "" Then
MsgBox "Please enter name", vbInformation, "HMS"
Text2.SetFocus
Else
If Text3.Text = "" Then
MsgBox "Please enter age", vbInformation, "HMS"
Text3.SetFocus
Else
If Text4.Text = "" Then
MsgBox "Please enter address", vbInformation, "HMS"
Text4.SetFocus
Else
If Text5.Text = "" Then
MsgBox "please enter city", vbInformation, "HMS"
Text5.SetFocus
Else
If Text6.Text = "" Then
MsgBox "please enter pin", vbInformation, "HMS"
Text6.SetFocus
Else
If Text7.Text = "" Then
MsgBox "please enter phone", vbInformation, "HMS"
Text7.SetFocus
Else
If Combo1.Text = "" Then
MsgBox "please enter sex", vbInformation, "HMS"
Combo1.SetFocus
Else
If Combo2.Text = "" Then
MsgBox "please enter roomno", vbInformation, "HMS"
Combo2.SetFocus
Else
rs.AddNew
rs.Fields(0) = Text1.Text
rs.Fields(1) = Text9.Text
rs.Fields(2) = Text2.Text
rs.Fields(3) = Combo1.Text
rs.Fields(4) = Text3.Text
rs.Fields(5) = Text4.Text
rs.Fields(6) = Text5.Text
rs.Fields(7) = Text6.Text
rs.Fields(8) = Text7.Text
rs.Fields(9) = Combo2.Text
rs.Update
Data1.Recordset.MoveFirst
Do Until Data1.Recordset.EOF
If Data1.Recordset.Fields(0) = Combo2.Text Then
Data1.Recordset.Edit
Data1.Recordset.Fields(1) = True
Data1.Recordset.Update
MsgBox ("Data added. Room alloted for visitor") + Combo2.Text, vbInformation, "HMS"
Exit Sub
Else
Data1.Recordset.MoveNext
End If
Loop
End If
End If
End If
End If
End If
End If
End If
End If
End Sub
Private Sub Command10_Click()
rs1.MoveFirst
Do Until rs1.EOF
If rs1.Fields(1) = Text15.Text And rs1.Fields(5) = True Then
Call rescheck
Exit Sub
Else
If (rs1.Fields(1) = Text15.Text) And rs1.Fields(5) = False Then
Text11.Text = rs1.Fields(1)
Text12.Text = rs1.Fields(2)
Text13.Text = rs1.Fields(3)
Text14.Text = rs1.Fields(4)
Check1.Value = 0
'Check1.Value = rs1.Fields(5)
Exit Sub
Else
rs1.MoveNext
End If
End If
Loop
MsgBox "No data found.Try again..", vbInformation, "HMS"
End Sub
Private Sub Command11_Click()
rs2.AddNew
rs2.Fields(0) = Text16.Text
rs2.Fields(1) = Text17.Text
rs2.Fields(2) = Text18.Text
rs2.Fields(3) = Text21.Text
rs2.Fields(4) = Text19.Text
rs2.Fields(5) = Text20.Text
rs2.Fields(6) = DateValue(Format(Now, "Short Date")) - rs.Fields(0)
rs2.Fields(7) = Text25.Text
rs2.Update
Call chkoutroom
rs.MoveFirst
Do Until rs.EOF
If rs.Fields(2) = Text16.Text Then
rs.Delete
Exit Sub
Else
rs.MoveNext
End If
Loop
MsgBox "Guest Checked out sucessfuly...", vbInformation, "HMS"
End Sub
Private Sub Command12_Click()
Form2.PrintForm
End Sub
Private Sub Command13_Click()
rs.MoveFirst
If Option1.Value = True Then
Call optionsearch
Else
Do Until rs.EOF
If rs.Fields(2) = Text26.Text Then
Text16.Text = rs.Fields(2)
Text17.Text = rs.Fields(5)
Text18.Text = rs.Fields(8)
Text21.Text = rs.Fields(9)
Text19.Text = rs.Fields(0)
val = DateValue(Format(Now, "Short Date")) - rs.Fields(0)
Text28.Text = DateValue(Format(Now, "Short Date")) - rs.Fields(0)
Text22.Text = val * 300
Text23.Text = (10 / 100) * Text22.Text
Text24.Text = (20 / 100) * Text23.Text
val1 = Int(Text22.Text)
val2 = Int(Text23.Text)
val3 = Int(Text24.Text)
Text25.Text = val1 + val2 + val3
Text16.Enabled = True
Text17.Enabled = True
Text18.Enabled = True
Text19.Enabled = True
Text21.Enabled = True
Text22.Enabled = True
Text23.Enabled = True
Text24.Enabled = True
Text25.Enabled = True
Command11.Enabled = True
Command12.Enabled = True
Command21.Enabled = True
Exit Sub
Else
rs.MoveNext
End If
Loop
MsgBox "no datas found.", vbInformation, "HMS"
Text26.Text = ""
Text26.SetFocus
End If
End Sub
Private Sub Command14_Click()
If rs.BOF Or rs.EOF = True Then
MsgBox " END OF FILE", vbOKOnly, "HMS"
Else
rs.Delete
End If
End Sub
Private Sub Command15_Click()
If rs.BOF = True Then
MsgBox "beginning of record", vbOKOnly, "HMS"
Else
rs.MoveFirst
Text1.Text = rs.Fields(0)
Text2.Text = rs.Fields(2)
Combo1.Text = rs.Fields(3)
Text3.Text = rs.Fields(4)
Text4.Text = rs.Fields(5)
Text5.Text = rs.Fields(6)
Text6.Text = rs.Fields(7)
Text7.Text = rs.Fields(8)
Combo2.Text = rs.Fields(9)
End If
End Sub
Private Sub Command16_Click()
If rs.EOF <> True Then
rs.MoveNext
If rs.EOF = True Then
rs.MoveLast
MsgBox "End of record", vbInformation, "HMS"
Else
'rs.MoveNext
Text1.Text = rs.Fields(0)
Text2.Text = rs.Fields(2)
Combo1.Text = rs.Fields(3)
Text3.Text = rs.Fields(4)
Text4.Text = rs.Fields(5)
Text5.Text = rs.Fields(6)
Text6.Text = rs.Fields(7)
Text7.Text = rs.Fields(8)
Combo2.Text = rs.Fields(9)
End If
End If
End Sub
Private Sub Command17_Click()
If rs.BOF <> True Then
rs.MovePrevious
If rs.BOF = True Then
rs.MoveFirst
MsgBox "begining of record", vbInformation, "HMS"
Else
'rs.MovePrevious
Text1.Text = rs.Fields(0)
Text2.Text = rs.Fields(2)
Combo1.Text = rs.Fields(3)
Text3.Text = rs.Fields(4)
Text4.Text = rs.Fields(5)
Text5.Text = rs.Fields(6)
Text6.Text = rs.Fields(7)
Text7.Text = rs.Fields(8)
Combo2.Text = rs.Fields(9)
End If
End If
End Sub
Private Sub Command18_Click()
If rs.EOF = True Then
MsgBox ("End of record")
Else
rs.MoveLast
Text1.Text = rs.Fields(0)
Text2.Text = rs.Fields(2)
Combo1.Text = rs.Fields(3)
Text3.Text = rs.Fields(4)
Text4.Text = rs.Fields(5)
Text5.Text = rs.Fields(6)
Text6.Text = rs.Fields(7)
Text7.Text = rs.Fields(8)
Combo2.Text = rs.Fields(9)
End If
End Sub
Private Sub Command19_Click()
rs1.Edit
rs1.Fields(1) = Text11.Text
rs1.Fields(2) = Text12.Text
rs1.Fields(3) = Text13.Text
rs1.Fields(4) = Text14.Text
rs1.Fields(5) = Check1.Value
rs1.Update
Command5.Enabled = True
Command6.Enabled = True
Command7.Enabled = True
MsgBox "Reservation for Guest is updated", vbInformation, "HMS"
Command19.Enabled = False
End Sub
Private Sub Command2_Click()
NameQuery = InputBox("Enter A Name To Search For", "Name Query")
rs.MoveFirst
Do Until rs.EOF
If rs.Fields("name") = NameQuery Then
Text1.Text = rs.Fields(0)
Text9.Text = rs.Fields(1)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -