📄 frmktgl.frm
字号:
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 3
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmktgl.frx":7D42
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmktgl.frx":8594
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmktgl.frx":88AE
Key = ""
EndProperty
EndProperty
End
Begin TabDlg.SSTab SSTab1
Height = 5895
Left = 120
TabIndex = 0
Top = 120
Width = 6255
_ExtentX = 11033
_ExtentY = 10398
_Version = 393216
TabHeight = 520
TabCaption(0) = "空闲房间"
TabPicture(0) = "frmktgl.frx":9100
Tab(0).ControlEnabled= -1 'True
Tab(0).Control(0)= "Label1(0)"
Tab(0).Control(0).Enabled= 0 'False
Tab(0).Control(1)= "ListView1(0)"
Tab(0).Control(1).Enabled= 0 'False
Tab(0).ControlCount= 2
TabCaption(1) = "营业房间"
TabPicture(1) = "frmktgl.frx":911C
Tab(1).ControlEnabled= 0 'False
Tab(1).Control(0)= "Label1(1)"
Tab(1).Control(1)= "ListView1(1)"
Tab(1).ControlCount= 2
TabCaption(2) = "预定房间"
TabPicture(2) = "frmktgl.frx":9138
Tab(2).ControlEnabled= 0 'False
Tab(2).Control(0)= "ListView1(2)"
Tab(2).Control(1)= "Label1(2)"
Tab(2).ControlCount= 2
Begin MSComctlLib.ListView ListView1
Height = 4935
Index = 0
Left = 120
TabIndex = 1
Top = 360
Width = 6015
_ExtentX = 10610
_ExtentY = 8705
LabelWrap = -1 'True
HideSelection = -1 'True
OLEDragMode = 1
_Version = 393217
Icons = "ImageList1"
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
OLEDragMode = 1
NumItems = 0
End
Begin MSComctlLib.ListView ListView1
Height = 4935
Index = 1
Left = -74880
TabIndex = 2
Top = 360
Width = 6015
_ExtentX = 10610
_ExtentY = 8705
LabelWrap = -1 'True
HideSelection = -1 'True
OLEDragMode = 1
_Version = 393217
Icons = "ImageList1"
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
OLEDragMode = 1
NumItems = 0
End
Begin MSComctlLib.ListView ListView1
Height = 4935
Index = 2
Left = -74880
TabIndex = 3
Top = 360
Width = 6015
_ExtentX = 10610
_ExtentY = 8705
LabelWrap = -1 'True
HideSelection = -1 'True
OLEDragMode = 1
_Version = 393217
Icons = "ImageList1"
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
OLEDragMode = 1
NumItems = 0
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Label1"
Height = 180
Index = 2
Left = -74880
TabIndex = 6
Top = 5400
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Label1"
Height = 180
Index = 1
Left = -74880
TabIndex = 5
Top = 5400
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Label1"
Height = 180
Index = 0
Left = 120
TabIndex = 4
Top = 5400
Width = 540
End
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "总金额:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 6480
TabIndex = 14
Top = 5880
Width = 840
End
End
Attribute VB_Name = "frmktgl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim itmx As ListItem
Dim cmd As New ADODB.Command
Dim rs As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset
Dim rs3 As New ADODB.Recordset
Dim rs4 As New ADODB.Recordset
Dim rs5 As New ADODB.Recordset
Dim rs6 As New ADODB.Recordset
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Sub change() '给listview添加值
i = SSTab1.Tab
If rs1.State Then rs1.Close
rs1.Open "select * from 餐台 where 餐台状态='" & Left(SSTab1.Caption, 2) & "'", conn
rs1.Requery
ListView1(i).ListItems.Clear
If Not rs1.EOF And Not rs1.BOF Then
ListView1(i).ListItems.Clear
rs1.MoveFirst
Do While rs1.EOF = False
Key = "(" & Trim(rs1.Fields(0)) & ")" & Trim(rs1.Fields(1))
Set itmx = ListView1(i).ListItems.Add(, , Key, 3)
rs1.MoveNext
Loop
End If
Label1(i).Caption = Left(SSTab1.Caption, 2) & "总数: " & rs1.RecordCount & "个"
rs1.Close
End Sub
Private Sub Command1_Click()
If Label5(0).Caption = "" Or Label5(1).Caption = "" Then
a = MsgBox("请选择房间!", vbOKOnly + 48, "提示")
Else
If Label5(2).Caption = "营业" Or Label5(2).Caption = "预定" Then
a = MsgBox("Sorry,你选择的房间正在" & Label5(2).Caption & "", vbOKOnly + 48, "提示")
Else
cmd.ActiveConnection = conn
cmd.CommandText = "update 餐台 set 餐台状态='营业' where 餐台号='" & Label5(0).Caption & "'"
cmd.Execute
cth = Label5(0).Caption
Call change
frmktgl_ktfw.Show
End If
End If
End Sub
Private Sub Command2_Click()
rs.Open "select * from 餐台 where 餐台状态='空闲'", conn
If Not rs.EOF And Not rs.BOF Then
If Label5(2).Caption = "营业" Then
cth = Label5(0).Caption
rs2.Open "select * from 餐台 where 餐台号='" & cth & "'", conn, adOpenStatic
rs2.Requery
If Not rs2.EOF And Not rs2.BOF Then
frmktgl_ztfw.Label4.Caption = Trim(rs2.Fields(0))
frmktgl_ztfw.Label5.Caption = Trim(rs2.Fields(1))
frmktgl_ztfw.Label6.Caption = Trim(rs2.Fields(2))
End If
rs2.Close
frmktgl_ztfw.Show
Else
a = MsgBox("该餐台当前不在营业中!", vbOKOnly + 48, "提示")
End If
Else
a = MsgBox("已没有空闲房间", vbOKOnly + 48, "提示")
End If
rs.Close
End Sub
Private Sub Command3_Click()
rs.Open "select * from 餐台 where 餐台状态='营业'", conn
If Not rs.EOF And Not rs.BOF Then
If Label5(2).Caption = "营业" Then
cth = Label5(0).Caption
If rs6.State Then rs6.Close
rs6.Open "select * from 登记ls where 房台号='" & cth & "'", conn, adOpenStatic
rs6.Requery
Set frmktgl_jcfw.DataGrid1.DataSource = rs6
rs5.Open "select * from 餐台 where 餐台号='" & cth & "'", conn
frmktgl_jcfw.Label4.Caption = Trim(rs5.Fields(0))
frmktgl_jcfw.Label5.Caption = Trim(rs5.Fields(1))
frmktgl_jcfw.Label6.Caption = Trim(rs5.Fields(2))
rs5.Close
frmktgl_jcfw.Show
Else
a = MsgBox("该餐台当前不在营业中!", vbOKOnly + 48, "提示")
End If
Else
a = MsgBox("没有营业中的房间!", vbOKOnly + 48, "提示")
End If
rs.Close
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Form_Load()
SetWindowLong frmktgl_ktfw.hwnd, -8, frmktgl.hwnd
SetWindowLong frmktgl_ztfw.hwnd, -8, frmktgl.hwnd
SetWindowLong frmktgl_jcfw.hwnd, -8, frmktgl.hwnd
Call change
Set DataGrid1.DataSource = rs3
Set Text1.DataSource = rs4
End Sub
Private Sub Form_Unload(Cancel As Integer)
If rs.State Then rs.Close
If rs1.State Then rs1.Close
If rs3.State Then rs3.Close
If rs4.State Then rs4.Close
End Sub
Private Sub ListView1_Click(Index As Integer)
i = SSTab1.Tab
If ListView1(i).ListItems.Count > 0 Then
List = ListView1(i).SelectedItem
rs1.Open "select * from 餐台 where 餐台号='" + Right(Left(List, 4), 3) + "'", conn, adOpenStatic
If rs1.RecordCount > 0 Then
For a = 0 To 2
Label5(a).Caption = Trim(rs1.Fields(a)) '赋值给label5(a).caption
Next a
End If
rs1.Close
If rs3.State Then rs3.Close
rs3.Open "select * from 登记ls where 房台号='" & Label5(0).Caption & "'", conn, adOpenStatic
rs3.Requery
If rs4.State Then rs4.Close
rs4.Open "select sum(金额) as je from 登记ls where 房台号='" & Label5(0).Caption & "'", conn
rs4.Requery
End If
End Sub
Private Sub SSTab1_Click(PreviousTab As Integer)
Call change
For i = 0 To 2
Label5(i).Caption = ""
Next
If rs3.State Then rs3.Close
rs3.Open "select * from 登记ls where 房台号='" & Label5(0).Caption & "'", conn, adOpenStatic
rs3.Requery
If rs4.State Then rs4.Close
rs4.Open "select sum(金额) as je from 登记ls where 房台号='" & Label5(0).Caption & "'", conn, adOpenStatic
rs4.Requery
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -