📄 consume.frm
字号:
DataSource = "Adodc1"
Height = 330
Left = 360
TabIndex = 3
Top = 4680
Width = 1455
_ExtentX = 2566
_ExtentY = 582
_Version = 393216
ListField = "入住单号"
Text = ""
End
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 615
Left = 0
TabIndex = 11
Top = 0
Width = 9135
_ExtentX = 16113
_ExtentY = 1085
ButtonWidth = 1138
ButtonHeight = 926
Appearance = 1
ImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 10
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "首记录"
Key = "first"
ImageIndex = 1
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "上记录"
Key = "before"
ImageIndex = 2
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "下记录"
Key = "next"
ImageIndex = 3
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "尾记录"
Key = "last"
ImageIndex = 4
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "新增"
Key = "new"
ImageIndex = 5
EndProperty
BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "修改"
Key = "modify"
ImageIndex = 6
EndProperty
BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "删除"
Key = "delete"
ImageIndex = 7
EndProperty
BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
Enabled = 0 'False
Caption = "保存"
Key = "save"
ImageIndex = 8
EndProperty
BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
Enabled = 0 'False
Caption = "取消"
Key = "cancel"
ImageIndex = 9
EndProperty
BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "退出"
Key = "exit"
ImageIndex = 10
EndProperty
EndProperty
Begin MSComctlLib.ImageList ImageList1
Left = 7440
Top = 0
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 10
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Consume.frx":002A
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Consume.frx":013C
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Consume.frx":024E
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Consume.frx":0360
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Consume.frx":0472
Key = ""
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Consume.frx":0584
Key = ""
EndProperty
BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Consume.frx":0696
Key = ""
EndProperty
BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Consume.frx":07A8
Key = ""
EndProperty
BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Consume.frx":08BA
Key = ""
EndProperty
BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Consume.frx":09CC
Key = ""
EndProperty
EndProperty
End
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "消费内容"
Height = 180
Left = 720
TabIndex = 15
Top = 5160
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "入住单号"
Height = 180
Left = 720
TabIndex = 14
Top = 4440
Width = 720
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "消费金额"
Height = 180
Left = 2640
TabIndex = 13
Top = 5160
Width = 720
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "消费时间"
Height = 180
Left = 4800
TabIndex = 12
Top = 5160
Width = 720
End
End
Attribute VB_Name = "Consume"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub LoadData()
Dim str As String, str1 As String, flag%, mark%
Dim yuding As Boolean, pers As Boolean, atime As Boolean, dou As Boolean
If Len(Trim(Text1.Text)) = 0 Then '无入住单号
If Len(Trim(Text2.Text)) = 0 Then '无消费内容
flag = 0
Else '匹配消费内容
flag = 1: str1 = Text2.Text: mark = 2
End If
Else '匹配入住单号
flag = 1: str = Text1.Text: mark = 1
If Len(Trim(Text2.Text)) <> 0 Then '匹配入住单号和消费内容
flag = 2: str1 = Text2.Text: mark = 2
End If
End If
'根据查询条件重新填充DataGrid
If flag = 0 Then
OpenTable Adodc1, "select * from 消费单 "
ElseIf flag = 1 And mark = 1 Then
OpenTable Adodc1, "select * from 消费单 " + "where " + " 入住单号 " + " like '" + str + "%'"
ElseIf flag = 1 And mark = 2 Then
OpenTable Adodc1, "select * from 消费单 " + "where " + " 消费内容 " + " like '" + str1 + "%'"
ElseIf flag = 2 And mark = 2 Then
OpenTable Adodc1, "select * from 消费单 " + "where " + " 入住单号 " + " like '" + str + "%'" + " and " + " 消费内容 " + " like '" + str1 + "%'"
End If
End Sub
Private Sub Money_KeyPress(KeyAscii As Integer)
If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 8 Then
KeyAscii = 0
End If
End Sub
Private Sub Search_Click()
LoadData
End Sub
Private Sub SelectId_Click()
Reside.SelectId.Visible = True
Reside.Toolbar1.Buttons("new").Enabled = False
Reside.Toolbar1.Buttons("modify").Enabled = False
Reside.Toolbar1.Buttons("delete").Enabled = False
Reside.Show
End Sub
Private Sub Form_Load()
Content.AddItem ("加收房费")
Content.AddItem ("加收水电费")
Content.AddItem ("视频点播费")
Content.AddItem ("宽带上网费")
Content.AddItem ("商品使用费")
Content.AddItem ("其他费用")
LoadData
SetTextBoxState (False)
End Sub
Private Sub SetToolBarState(ByVal State As Boolean)
'设置Button的是否能够单击
Toolbar1.Buttons("first").Enabled = State
Toolbar1.Buttons("before").Enabled = State
Toolbar1.Buttons("next").Enabled = State
Toolbar1.Buttons("last").Enabled = State
Toolbar1.Buttons("new").Enabled = State
Toolbar1.Buttons("modify").Enabled = State
Toolbar1.Buttons("delete").Enabled = State
Toolbar1.Buttons("save").Enabled = Not State
Toolbar1.Buttons("cancel").Enabled = Not State
SelectId.Enabled = Not State
End Sub
Private Sub SetTextBoxState(ByVal State As Boolean)
InId.Enabled = State
Content.Enabled = State
Money.Enabled = State
End Sub
Private Sub Clear()
InId.Text = ""
Content.Text = ""
Money.Text = "0"
Ctime.Text = Date
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
If StrComp(Button.Key, "first") = 0 Then
If Not Adodc1.Recordset.BOF And Not Adodc1.Recordset.EOF Then Adodc1.Recordset.MoveFirst
ElseIf StrComp(Button.Key, "before") = 0 Then
If Not Adodc1.Recordset.BOF And Not Adodc1.Recordset.EOF Then
Adodc1.Recordset.MovePrevious
If Adodc1.Recordset.BOF Then Adodc1.Recordset.MoveFirst
End If
ElseIf StrComp(Button.Key, "next") = 0 Then
If Not Adodc1.Recordset.BOF And Not Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then Adodc1.Recordset.MoveLast
End If
ElseIf StrComp(Button.Key, "last") = 0 Then
If Not Adodc1.Recordset.BOF And Not Adodc1.Recordset.EOF Then Adodc1.Recordset.MoveLast
ElseIf StrComp(Button.Key, "new") = 0 Then
Adodc1.Recordset.AddNew
SetTextBoxState (True)
SetToolBarState (False)
Clear
ElseIf StrComp(Button.Key, "modify") = 0 Then
SetTextBoxState (True)
SetToolBarState (False)
ElseIf StrComp(Button.Key, "delete") = 0 Then
If Not Adodc1.Recordset.BOF And Not Adodc1.Recordset.EOF Then
If MsgBox("确定要删除吗?", vbYesNo, "提示") = vbYes Then
Adodc1.Recordset.Delete
Adodc1.Recordset.Update
End If
Else
MsgBox "无记录!", 64, "提示"
End If
ElseIf StrComp(Button.Key, "save") = 0 Then
If InId = "" Then
MsgBox "入住单号不能为空", , "提示"
ElseIf Content = "" Then MsgBox "消费内容不能为空", , "提示"
ElseIf Money <= 0 Then MsgBox "消费金额错误", , "提示"
Else
SetTextBoxState (False)
SetToolBarState (True)
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Update
End If
ElseIf StrComp(Button.Key, "cancel") = 0 Then
SetTextBoxState (False)
SetToolBarState (True)
Form_Load
ElseIf StrComp(Button.Key, "exit") = 0 Then
LoadData
Unload Me
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -