📄 frminout.frm
字号:
EndProperty
Height = 255
Left = 8280
TabIndex = 4
Top = 5400
Width = 1455
End
Begin VB.Label CheckinDate
Alignment = 2 'Center
BackColor = &H0000FF00&
BorderStyle = 1 'Fixed Single
Caption = "CheckinDate"
BeginProperty Font
Name = "Arial"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 6720
TabIndex = 3
Top = 5400
Width = 1455
End
Begin VB.Label RoomNo
Alignment = 2 'Center
BackColor = &H0000FFFF&
BorderStyle = 1 'Fixed Single
Caption = "RoomNo"
BeginProperty Font
Name = "Arial"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 255
Left = 5160
TabIndex = 2
Top = 5760
Width = 1455
End
Begin VB.Label GuestNo
Alignment = 2 'Center
BackColor = &H0080FF80&
BorderStyle = 1 'Fixed Single
Caption = "GuestNo"
BeginProperty Font
Name = "Arial"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 5160
TabIndex = 1
Top = 5400
Width = 1455
End
Begin VB.Label RTNo
Alignment = 2 'Center
BackColor = &H00C0FFC0&
BorderStyle = 1 'Fixed Single
Caption = "RTNo"
BeginProperty Font
Name = "Arial"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 3600
TabIndex = 0
Top = 5400
Width = 1455
End
End
Attribute VB_Name = "frmCheckout"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim lenght_of_stay As Integer
Dim amount_payable As Integer
Dim total_payable As Integer
Public c As Integer
Public o As Integer
Dim ar As Integer
Dim tp As Integer
Dim Change As Integer
Public dept As String
Dim datenow As String
Dim TransType As String
Dim nad As String
Dim Status As String
Public strLOS As String
Public strRATE As String
Private Sub fillt()
On Error GoTo HELL
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 '(, , 1)
lvtran.ListItems(i).SubItems(1) = rs(1).Value
lvtran.ListItems(i).SubItems(2) = rs(2).Value
lvtran.ListItems(i).SubItems(3) = rs(3).Value
'===========
check_RStemp
rstemp.Open "select rate from room where room_no = " & rs(3), Cnn
lvtran.ListItems(i).SubItems(4) = rstemp(0)
strRATE = rstemp(0)
'===========
check_RStemp
lenght_of_stay = DateValue(Format(Now, "Short Date")) - rs(1).Value
If lenght_of_stay = 0 Then
lenght_of_stay = 1
End If
lvtran.ListItems(i).SubItems(5) = lenght_of_stay
strLOS = lenght_of_stay
amount_payable = lenght_of_stay * lvtran.ListItems(i).SubItems(4)
'===========
lvtran.ListItems(i).SubItems(6) = amount_payable 'rs(5).Value
lvtran.ListItems(i).SubItems(7) = rs(5).Value
total_payable = amount_payable + lvtran.ListItems(i).SubItems(7)
lvtran.ListItems(i).SubItems(8) = total_payable
RTNo.Caption = rs(0)
GuestNo.Caption = rs(2)
CheckinDate.Caption = rs(1)
CheckoutDate.Caption = Date
TotalPayable.Caption = total_payable
Label3.Caption = amount_payable
Label4.Caption = rs(5).Value
i = i + 1
rs.MoveNext
HELL:
Wend
End Sub
Private Sub cmbsearch_Click()
If cmbsearch.ListIndex = 0 Then
Combo1.Clear
RoomNo.Caption = ""
Toolbar1.Buttons(6).Enabled = False
Command1.Enabled = False
check_RS1
rs1.Open "select * from room_transaction", Cnn
While Not rs1.EOF
Combo1.AddItem (rs1(2))
rs1.MoveNext
Wend
'=====
ElseIf cmbsearch.ListIndex = 1 Then
Combo1.Clear
RoomNo.Caption = ""
Toolbar1.Buttons(6).Enabled = False
Command1.Enabled = False
check_RS1
rs1.Open "select * from room_transaction", Cnn
While Not rs1.EOF
Combo1.AddItem (rs1(3))
rs1.MoveNext
Wend
'=====
ElseIf cmbsearch.ListIndex = 2 Then
Combo1.Clear
RoomNo.Caption = ""
Toolbar1.Buttons(6).Enabled = False
Command1.Enabled = False
check_RS1
rs1.Open "select * from room_transaction", Cnn
While Not rs1.EOF
Combo1.AddItem (rs1(0))
rs1.MoveNext
Wend
End If
End Sub
Private Sub Combo1_Click()
If cmbsearch.Text = "Guest ID" Then
check_RS
rs.Open "Select * from room_transaction where room_transaction.guest_id = " & Combo1, Cnn
lblORNo = datenow & rs(0) & Label12
RoomNo = rs(3)
Toolbar1.Buttons(6).Enabled = True
Command1.Enabled = True
GuestNo = rs(2)
fillt
'==========
ElseIf cmbsearch.Text = "Room No." Then
check_RS
rs.Open "Select * from room_transaction where room_transaction.room_no = " & Combo1, Cnn
lblORNo = datenow & rs(0) & Label12
RoomNo = rs(3)
Toolbar1.Buttons(6).Enabled = True
Command1.Enabled = True
fillt
'==========
ElseIf cmbsearch.Text = "Room Trans. No." Then
check_RS
rs.Open "Select * from room_transaction where room_transaction.room_trans_no = " & Combo1, Cnn
lblORNo = datenow & rs(0) & Label12
RoomNo = rs(3)
GuestNo = rs(2)
Toolbar1.Buttons(6).Enabled = True
Command1.Enabled = True
fillt
End If
End Sub
Private Sub Command1_Click()
GenerateBILL CInt(RTNo.Caption)
End Sub
Public Sub GenerateBILL(rtn As Integer)
check_RS
rs.Open "exec bill " & rtn, Cnn ', adOpenDynamic, adLockOptimistic
With rptBilling
Set .DataSource = rs
With .Sections("Section4").Controls
For i = 1 To .Count
If TypeOf .Item(i) Is RptLabel Then
If .Item(i).Name = "lblGID" Then
.Item(i).Caption = GuestNo.Caption
ElseIf .Item(i).Name = "lblRN" Then
.Item(i).Caption = RoomNo.Caption
ElseIf .Item(i).Name = "lblT" Then
.Item(i).Caption = RTNo.Caption
ElseIf .Item(i).Name = "lblRTNO" Then
.Item(i).Caption = lblORNo.Caption
ElseIf .Item(i).Name = "lbld" Then
.Item(i).Caption = CheckoutDate.Caption
ElseIf .Item(i).Name = "lblRate" Then
.Item(i).Caption = strRATE
ElseIf .Item(i).Name = "lblLOS" Then
.Item(i).Caption = strLOS
End If
End If
Next i
End With
With .Sections("Section5").Controls
For i = 1 To .Count
If TypeOf .Item(i) Is RptLabel Then
'If .Item(i).Name = "lblGID" Then
' .Item(i).Caption = GuestNo.Caption
'ElseIf .Item(i).Name = "lblRN" Then
' .Item(i).Caption = RoomNo.Caption
If .Item(i).Name = "lblTOT" Then
.Item(i).Caption = FormatNumber(TotalPayable)
ElseIf .Item(i).Name = "lblC" Then
.Item(i).Caption = Label4.Caption
ElseIf .Item(i).Name = "lblA" Then
.Item(i).Caption = Label3.Caption
End If
End If
Next i
End With
' Unload frmMonthEntry
' .Refresh
.Show vbModal
End With
rs.Close
End Sub
Private Sub Form_Load()
TransType = "Room"
datenow = Format(Date, "mmdd")
Status = "VACANT"
check_RS
rs.Open "Select * from room_transaction " & Combo1, Cnn
fillt
'============
check_RS
rs.Open "select * from transaction_type", Cnn
While Not rs.EOF
If TransType = rs!Description Then
Label12.Caption = rs!trans_code
rs.MoveLast
rs.MoveNext
Else
rs.MoveNext
End If
Wend
'===========
CheckoutDate = Date
Toolbar1.Buttons(6).Enabled = False
Command1.Enabled = False
dept = "Room"
nad = "checkout"
End Sub
Private Function V() As Boolean
check_RS1
rs1.Open "select * from room_reservation", Cnn
Dim strMessage As String
If txtAR.Text = "" Then
' txtAR.SetFocus
strMessage = "Balance must be paid..."
Else
V = True
End If
If Not V Then
MsgBox strMessage, vbOKOnly
End If
End Function
Private Sub txtsearch_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 txtAR_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 Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.key
'=======
Case "Show All"
Combo1 = ""
cmbsearch = ""
Combo1.Clear
If Combo1.Text = "" Then
Toolbar1.Buttons(6).Enabled = False
End If
check_RS
rs.Open "select * from room_transaction order by room_trans_no asc", Cnn
Toolbar1.Buttons(6).Enabled = False
fillt
Exit Sub
'End If
'=======
Case "Cancel"
Unload Me
'=======
Case "Checkout"
If nad = "checkout" Then
Cnn.Execute "update archive set checkout_date = '" & CheckoutDate & "', total = '" & TotalPayable & "' where room_trans_no = " & RTNo
check_RStemp
rstemp.Open "select * from payment", Cnn
Cnn.Execute "INSERT INTO payment (OR_no, trans_code, trans_no, date_paid, total) VALUES (" & _
lblORNo.Caption & ", '" & Label12.Caption & _
"', '" & RTNo.Caption & "', '" & CheckoutDate.Caption & "', '" & TotalPayable.Caption & "')" '
'=======
Cnn.Execute "delete from room_transaction where room_trans_no = " & RTNo
'=======
Cnn.Execute "update room set status = '" & Status & "' where room_no = " & RoomNo
'rs.Requery 1
Command1_Click
Unload Me
End If
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -