📄 frrmguestroom.frm
字号:
Dim x As Integer
lvroom.ListItems.Clear
While Not rs.EOF
Set lst = lvroom.ListItems.Add(, , rs(0), , 1)
For x = 1 To 2
lst.SubItems(x) = rs(x)
If rs.Fields(3) = "OCCUPIED" Then lst.SubItems(1) = "OCCUPIED"
Next x
rs.MoveNext
Wend
End Sub
Private Sub Label12_Click()
Unload Me
End Sub
Private Sub l_DblClick()
check_RS
rs.Open "select * from guest order by guest_id asc", Cnn
While Not rs.EOF
If l.SelectedItem.Text = rs!guest_id Then
lblGC.Caption = rs!guest_id
txtLN.Text = rs!last_name
txtFN.Text = rs!first_name
txtMI.Text = rs!MI
txtAddress.Text = rs!Address
txtAge.Text = rs!Age
txtSex.Text = rs!Sex
txtNationality.Text = rs!Nationality
txtTelNo.Text = rs!tel_no
txtCompany.Text = rs!Company
rs.MoveLast
rs.MoveNext
Else
rs.MoveNext
End If
Wend
Call Lock_Text
Frame3.Visible = False
Command4.Visible = True
End Sub
Private Sub Clear_Text()
lblGC.Caption = G
txtLN.Text = ""
txtFN.Text = ""
txtMI.Text = ""
txtAddress.Text = ""
txtAge.Text = ""
txtSex.Text = ""
txtNationality.Text = ""
txtTelNo.Text = ""
txtCompany.Text = ""
End Sub
Private Sub Unlock_Text()
txtLN.Locked = False
txtFN.Locked = False
txtMI.Locked = False
txtAddress.Locked = False
txtAge.Locked = False
txtSex.Locked = False
txtNationality.Locked = False
txtTelNo.Locked = False
txtCompany.Locked = False
End Sub
Private Sub Lock_Text()
txtLN.Locked = True
txtFN.Locked = True
txtMI.Locked = True
txtAddress.Locked = True
txtAge.Locked = True
txtSex.Locked = True
txtNationality.Locked = True
txtTelNo.Locked = True
txtCompany.Locked = True
End Sub
Private Sub lvroom_Click()
check_RS
rs.Open "select * from room order by room_no asc", Cnn
While Not rs.EOF
If lvroom.SelectedItem.ListSubItems(1) = "OCCUPIED" Then
MsgBox "This room is already occupied!", vbInformation, "HMS"
Exit Sub
End If
If lvroom.SelectedItem.Text = rs!room_no Then
lblroomno.Caption = rs!room_no
lblRoomRate.Caption = rs!Rate
rs.MoveLast
rs.MoveNext
Else
rs.MoveNext
End If
Wend
End Sub
Private Sub Option1_Click()
Guest = "new"
Frame3.Visible = False
Command4.Visible = False
Call Clear_Text
Call Unlock_Text
End Sub
Private Sub Option2_Click()
Guest = "old"
Frame3.Visible = True
End Sub
Private Sub txtsearch_Change()
rsFILTER
End Sub
Private Sub Timer1_Timer()
If eks >= frmLogin.width Then
eks = 0
meyn.Refresh
End If
If sw1 = 0 Then
If seed >= 255 Then
sw1 = 1
Else
seed = seed + 10
End If
ElseIf sw1 = 1 Then
If seed <= 65 Then
sw1 = 0
Else
seed = seed - 10
End If
End If
'Label20.ForeColor = seed
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.key
Case "Cancel"
Unload Me
'=======
Case "Save"
If ValidData Then
Frame1.Visible = False
End If
'=======
End Select
End Sub
Private Sub Toolbar2_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.key
Case "Save"
T = 1
If ValidDataT Then
check_RStemp
rstemp.Open "select * from archive", Cnn
'================
While rstemp.RecordCount > 0
check_RStemp
T = T + 1
rstemp.Open "select * from archive where room_trans_no = " & T, Cnn
Wend
lblTransCode = T
Label12 = datenow & T
Label23 = "Transaction No." & T
'================
If Status = "OCCUPIED" Then
Cnn.Execute "update room set status = '" & Status & "' where room_no = " & lblroomno
End If
'check_RS1
'rs1.Open "select * from room_transaction_details", Cnn
'Cnn.Execute "insert into room_transaction_details (room_trans_no,room_no,lenght_of_stay) values (" & T & ", '" & lblRoomNo.Caption & _
'"', '" & txtEndDate.Text & "')"
'================
check_RS2
rs2.Open "select * from room_transaction", Cnn
Cnn.Execute "insert into room_transaction (room_trans_no,room_trans_date,guest_id,room_no,lenght_of_stay,total_charges) values (" & T & ", '" & datelbl.Caption & _
"', '" & lblGC.Caption & "', '" & lblroomno.Caption & "', '" & txtEndDate.Text & "', '" & lblCharges.Caption & "')"
'================
check_RS1
rs1.Open "select * from archive", Cnn
Cnn.Execute "INSERT INTO archive (room_trans_no, guest_id, room_no, checkin_date) VALUES (" & T & ", '" & lblGC.Caption & _
"', '" & lblroomno.Caption & "', '" & datelbl.Caption & "')" '
'================
filll
TotalAmount = TotalAmount + Val(lblRoomRate.Caption)
fillt
rs1.Requery 1
Command1.Enabled = False
Command3.Enabled = True
lblroomno = ""
lblRoomRate = ""
If MsgBox("Add another? ", vbYesNo, "?") = vbNo Then
'================
If Guest = "old" Then
'check_RStemp
'rstemp.Open "select * from guest", Cnn
'Cnn.Execute "INSERT INTO guest (guest_id, last_name, first_name, mi, address, age, sex, nationality, tel_no, company) VALUES (" & lblGC.Caption & ", '" & txtLN.Text & _
'"', '" & txtFN.Text & "', '" & txtMI.Text & "', '" & txtAddress.Text & "', '" & txtAge.Text & "', '" & txtSex.Text & "', '" & txtNationality.Text & "', '" & txtTelNo.Text & _
'"', '" & txtCompany.Text & "')" '
'check_RS2
'rs2.Open "select * from room_transaction", Cnn
'Cnn.Execute "insert into room_transaction (room_trans_no,room_trans_date,guest_id,total_charges) values (" & T & ", '" & datelbl.Caption & _
'"', '" & lblGuestCode.Caption & "', '" & lblCharges.Caption & "')"
'=================
'check_RS1
'rs1.Open "select * from payment_deposit", Cnn
'Cnn.Execute "INSERT INTO payment_deposit (OR_no, trans_code, trans_no, date_paid, total) VALUES (" & Label12.Caption & ", '" & Label18.Caption & _
'"', '" & T & "', '" & datelbl.Caption & "', '" & lblTotal.Caption & "')" '
'=================
'Cnn.Execute "update archive set total = " & lblTotal.Caption & " where room_trans_no = " & T
rs1.Requery 1
Unload Me
ElseIf Guest = "new" Then
check_RStemp
rstemp.Open "select * from guest", Cnn
Cnn.Execute "INSERT INTO guest (guest_id, last_name, first_name, mi, address, age, sex, nationality, tel_no, company) VALUES (" & lblGC.Caption & ", '" & txtLN.Text & _
"', '" & txtFN.Text & "', '" & txtMI.Text & "', '" & txtAddress.Text & "', '" & txtAge.Text & "', '" & txtSex.Text & "', '" & txtNationality.Text & "', '" & txtTelNo.Text & _
"', '" & txtCompany.Text & "')" '
'===============
'check_RS2
'rs2.Open "select * from room_transaction", Cnn
'Cnn.Execute "insert into room_transaction (room_trans_no,room_trans_date,guest_id,total_charges) values (" & T & ", '" & datelbl.Caption & _
'"', '" & lblGC.Caption & "', '" & lblCharges.Caption & "')"
'=================
'check_RS1
'rs1.Open "select * from payment", Cnn
'Cnn.Execute "INSERT INTO payment (OR_no, trans_code, trans_no, date_paid, total) VALUES (" & Label12.Caption & ", '" & Label18.Caption & _
'"', '" & T & "', '" & datelbl.Caption & "', '" & lblTotal.Caption & "')" '
'=================
'Cnn.Execute "update archive set total = " & lblTotal.Caption & " where room_trans_no = " & T
rs1.Requery 1
Unload Me
End If
End If
End If
End Select
End Sub
Private Sub txtLN_KeyPress(KeyAscii As Integer)
If Not (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or KeyAscii <= vbKeyBack Then
Exit Sub
Else
KeyAscii = 0
End If
End Sub
Private Sub txtFN_KeyPress(KeyAscii As Integer)
If Not (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or KeyAscii <= vbKeyBack Then
Exit Sub
Else
KeyAscii = 0
End If
End Sub
Private Sub txtMI_KeyPress(KeyAscii As Integer)
If Not (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or KeyAscii <= vbKeyBack Then
Exit Sub
Else
KeyAscii = 0
End If
End Sub
Private Sub txtSex_GotFocus() '(KeyAscii As Integer)
Combo2.Visible = True
If Not (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or KeyAscii <= vbKeyBack Then
Exit Sub
Else
KeyAscii = 0
End If
End Sub
Private Sub txtAge_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or KeyAscii <= vbKeyBack Then
Exit Sub
Else
KeyAscii = 0
End If
End Sub
Private Sub txtNationality_KeyPress(KeyAscii As Integer)
If Not (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or KeyAscii <= vbKeyBack Then
Exit Sub
Else
KeyAscii = 0
End If
End Sub
Private Sub txtTelNo_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or KeyAscii <= vbKeyBack Then
Exit Sub
Else
KeyAscii = 0
End If
End Sub
Private Sub txtDeposit_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or KeyAscii <= vbKeyBack Then
Exit Sub
Else
KeyAscii = 0
End If
End Sub
Private Sub fillt()
check_RS
rs.Open "select * from room_transaction where room_transaction.guest_id = " & lblGC, Cnn
lvtran.ListItems.Clear
lvtran.Refresh
Dim i As Integer
i = 1
While Not rs.EOF
lvtran.Refresh
lvtran.ListItems.Add
lvtran.ListItems(i).Text = rs(0).Value
lvtran.ListItems(i).SubItems(1) = rs(1).Value
lvtran.ListItems(i).SubItems(2) = rs(2).Value
lvtran.ListItems(i).SubItems(3) = rs(3).Value
Label14 = FormatNumber(TotalAmount)
lblTotal = (TotalAmount)
i = i + 1
rs.MoveNext
Wend
End Sub
Public Sub rsFILTER()
Dim sby, oby, Dasc As String
If cmbsearch.ListIndex = -1 Then cmbsearch.ListIndex = 0
If cmbOrder.ListIndex = -1 Then cmbOrder.ListIndex = 0
If cmbsort.ListIndex = -1 Then cmbsort.ListIndex = 0
Select Case cmbsearch.ListIndex
Case 0
sby = "guest_id"
Case 1
sby = "last_name"
Case 2
sby = "first_name"
Case 3
sby = "mi"
Case 4
sby = "address"
Case 5
sby = "age"
Case 6
sby = "sex"
Case 7
sby = "nationality"
Case 8
sby = "company"
End Select
'=============
Select Case cmbOrder.ListIndex
Case 0
oby = "guest_id"
Case 1
oby = "last_name"
Case 2
oby = "first_name"
Case 3
oby = "mi"
Case 4
oby = "address"
Case 5
oby = "age"
Case 6
oby = "sex"
Case 7
oby = "nationality"
Case 8
oby = "company"
End Select
'===========
Select Case cmbsort.ListIndex
Case 0
Dasc = " asc"
Case 1
Dasc = " desc"
End Select
check_RS
If cmbsearch.ListIndex = 1 Or cmbsearch.ListIndex = 9 Then
rs.Open "select * from guest where " & sby & " like '" & txtsearch & "%' order by " & _
oby & Dasc, Cnn
Else
If Not IsNumeric(txtsearch) Or txtsearch = "" Then
check_RS
rs.Open "Select * from guest where last_name like '%' order by " & oby & Dasc, Cnn
fillg
Exit Sub
End If
If Not IsNumeric(txtsearch) Or txtsearch = "" Then
check_RS
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -