📄 form1.frm
字号:
Left = 6840
TabIndex = 7
Top = 360
Width = 615
End
Begin VB.Label Label4
Caption = "Label4"
ForeColor = &H000000FF&
Height = 255
Left = 2520
TabIndex = 6
Top = 360
Width = 735
End
Begin VB.Label Label3
Caption = "Label3"
ForeColor = &H000000FF&
Height = 255
Left = 960
TabIndex = 5
Top = 360
Width = 735
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "包厢总数: 在用包厢数:"
Height = 180
Left = 6000
TabIndex = 4
Top = 360
Width = 2520
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "包厢号: 单价:"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 180
Left = 120
TabIndex = 3
Top = 360
Width = 2235
End
End
End
End
Attribute VB_Name = "FrmLBJD"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public zdh As Integer
Private Sub XandZ()
Combo1.Clear
Select Case SSTab1.Caption
Case "包厢客人"
Label7.Caption = "包厢号"
Label8.Caption = "包厢类别"
Label12.Caption = "包厢费 可容人数"
Label1.Caption = "包厢号: 单价:"
Label2.Caption = "包厢总数: 在用包厢数:"
Adodc1.RecordSource = "select * from 类别设置 where 标识='BX'"
Case "散客"
Label7.Caption = "桌 号"
Label8.Caption = "桌 类 别"
Label12.Caption = "桌 费 可容人数"
Label1.Caption = "桌 号: 单价:"
Label2.Caption = "桌总数: 在用桌数:"
Adodc1.RecordSource = "select * from 类别设置 where 标识='ZL'"
End Select
Adodc1.Refresh
For i = 1 To Adodc1.Recordset.RecordCount
If Adodc1.Recordset.RecordCount <> 0 Then
If Not Adodc1.Recordset.EOF Then
Combo1.AddItem Adodc1.Recordset.Fields("名称")
Adodc1.Recordset.MoveNext
End If
End If
Next
Combo1.ListIndex = 0
End Sub
Private Sub Command1_Click()
Dim strPH As String
'将点单临时表中内容添加到点单表中,然后将临时点单表清空,以备下次肜
If List1.ListCount > 0 Then
Call addDD
MsgBox "欢迎光临!您预付押金为『 " & Text7.Text & " 』元!", vbOKOnly, "热情服务"
Text7.Text = 0
'更改包厢状态
For i = 1 To List1.ListCount
strPH = strPH & Mid(List1.list(i - 1), 6, 4)
Next
Call FTset(strPH)
List1.Clear
Else
MsgBox "你还没有选择牌号,请重新操作!", vbOKOnly, "警告"
End If
MsgBox "『" & Format(zdh, "000000") & "』" & " 帐单已被记录,系统将启用新帐单『" & Format(Val(zdh) + 1, "000000") & "』", vbOKOnly, "提示"
zdh = Format(Val(zdh) + 1, "000000")
Call addZD
End Sub
Private Sub Command2_Click()
Dim j
Dim ph As String
Select Case SSTab1.Caption
Case "包厢客人"
j = 1
Case "散客"
j = 2
End Select
For i = 1 To List1.ListCount
ph = Mid$(List1.list(i - 1), 6, 4)
ListView1.ListItems.Add , , ph, j
Next
List1.Clear
Call delTempTabel
End Sub
Private Sub Command3_Click()
Dim rs As New ADODB.Recordset
Set rs = New ADODB.Recordset
Dim j
Dim ph As String
If Len(List1.Text) > 0 Then
ph = Mid$(List1.Text, 6, 4)
rs.Open "select * from 点单临时表 where 牌号='" & ph & "'", conn1, adOpenKeyset, adLockPessimistic
If rs.RecordCount > 0 Then
rs.Delete
rs.Update
rs.Close
Else
MsgBox "没有找到记录,请重新选择!", vbOKOnly, "提示"
End If
Select Case SSTab1.Caption
Case "包厢客人"
j = 1
Case "散客"
j = 2
End Select
ListView1.ListItems.Add , , ph, j
List1.RemoveItem (List1.ListIndex)
Else
MsgBox "没有选择牌号,请重新选择!", vbOKOnly, "提示"
End If
End Sub
Private Sub Command4_Click()
Call delTempTabel
Unload Me
End Sub
Private Sub Form_Activate()
On Error Resume Next
Call MDIhide
'先建立帐单号
Adodc1.RecordSource = "select * from 帐单号"
Adodc1.Refresh
zdh = Val(Adodc1.Recordset.Fields("帐单号")) + 1
Call XandZ
Adodc1.RecordSource = "select * from 类别设置 where 标识='BK'"
Adodc1.Refresh
For i = 1 To Adodc1.Recordset.RecordCount
If Adodc1.Recordset.RecordCount <> 0 Then
If Not Adodc1.Recordset.EOF Then
Combo2.AddItem Adodc1.Recordset.Fields("名称")
Adodc1.Recordset.MoveNext
End If
End If
Next
Combo2.ListIndex = 0
Adodc1.RecordSource = "select * from 类别设置 where 标识='FK'"
Adodc1.Refresh
For i = 1 To Adodc1.Recordset.RecordCount
If Adodc1.Recordset.RecordCount <> 0 Then
If Not Adodc1.Recordset.EOF Then
Combo3.AddItem Adodc1.Recordset.Fields("名称")
Adodc1.Recordset.MoveNext
End If
End If
Next
Combo3.ListIndex = 0
Adodc1.RecordSource = "select * from 服务员 where 状态='空闲'"
Adodc1.Refresh
For i = 1 To Adodc1.Recordset.RecordCount
If Adodc1.Recordset.RecordCount <> 0 Then
If Not Adodc1.Recordset.EOF Then
Combo4.AddItem Adodc1.Recordset.Fields("编号")
Adodc1.Recordset.MoveNext
End If
End If
Next
Combo4.ListIndex = 0
Adodc1.RecordSource = "select * from 帐单号"
Adodc1.Refresh
zdh = Adodc1.Recordset.Fields("帐单号") + 1
End Sub
Private Sub Form_Load()
On Error Resume Next
Adodc1.ConnectionString = conn1
Adodc2.ConnectionString = conn1
Adodc1.RecordSource = "select * from 包厢号 where 状态='空'"
Adodc1.Refresh
Adodc2.RecordSource = "select * from 点单"
Adodc2.Refresh
'添加列表
Adodc1.Recordset.MoveFirst
Do While Adodc1.Recordset.EOF = False
Key = Trim(Adodc1.Recordset.Fields("包厢号"))
Set itmX = ListView1.ListItems.Add(, , Key, 1)
Adodc1.Recordset.MoveNext
Loop
Adodc1.RecordSource = "select * from 包厢号"
Adodc1.Refresh
Label5.Caption = Adodc1.Recordset.RecordCount
Adodc1.RecordSource = "select * from 包厢号 where 状态='有客'"
Adodc1.Refresh
Label6.Caption = Adodc1.Recordset.RecordCount
'初始标识
flag = False
Text5.Text = 0
Text4.Text = ""
Text3.Text = ""
Text1.Text = ""
Label3.Caption = ""
Label4.Caption = ""
tabflag = "包厢客人"
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call MDIview
End Sub
Private Sub List1_DblClick()
Command3_Click
End Sub
Private Sub ListView1_Click()
If ListView1.ListItems.Count > 0 Then
list = ListView1.SelectedItem
'查询信息
Select Case SSTab1.Caption
Case "包厢客人"
Adodc1.RecordSource = "select * from 包厢号 where 包厢号='" + list + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Label3.Caption = Adodc1.Recordset.Fields("包厢号")
Label4.Caption = Adodc1.Recordset.Fields("包厢费")
Text4.Text = Adodc1.Recordset.Fields("包厢人数")
End If
Case "散客"
Adodc1.RecordSource = "select * from 桌号 where 桌号='" + list + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Label3.Caption = Adodc1.Recordset.Fields("桌号")
Label4.Caption = Adodc1.Recordset.Fields("桌费")
Text4.Text = Adodc1.Recordset.Fields("桌人数")
End If
End Select
Combo1.Text = Adodc1.Recordset.Fields("类别")
Text3.Text = Label4.Caption
Text1.Text = Label3.Caption
Text5.SetFocus
Text5.Text = 0
Text5.SelStart = 0
Text5.SelLength = 1
End If
End Sub
Private Sub ListView1_DblClick()
Dim list As String
Text6.Text = Val(Text6.Text) + Val(Text5.Text)
Text5.Text = 0
'Text5.Enabled = False
list = ListView1.SelectedItem
Adodc1.RecordSource = "select * from 点单临时表"
Adodc1.Refresh
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("牌号") = list
Adodc1.Recordset.Fields("付款方式") = Combo3.Text
Adodc1.Recordset.Fields("数量") = 1
Adodc1.Recordset.Fields("单价") = Text3.Text
Adodc1.Recordset.Fields("总价") = Text3.Text
Adodc1.Recordset.Fields("预付押金") = 0
Adodc1.Recordset.Fields("服务员") = Combo4.Text
Adodc1.Recordset.Fields("帐单号") = Format(zdh, "000000")
Select Case SSTab1.Caption
Case "包厢客人"
Adodc1.Recordset.Fields("项目") = "包厢费"
List1.AddItem Format(list, bxhFat) & "|$" & Label4.Caption
Case "散客"
Adodc1.Recordset.Fields("项目") = "桌 费"
List1.AddItem Format(list, zhFat) & "|$" & Label4.Caption
End Select
Adodc1.Recordset.Update
ListView1.ListItems.Remove ListView1.SelectedItem.Index
End Sub
Private Sub SSTab1_Click(PreviousTab As Integer)
Dim j As Integer
Dim jcount As Integer
Dim ph As String
Label3.Caption = ""
Label4.Caption = ""
ListView1.ListItems.Clear
j = 0
Call XandZ
On Error Resume Next
Select Case SSTab1.Caption
Case "包厢客人"
Adodc1.RecordSource = "select * from 包厢号 where 状态='空'"
Adodc1.Refresh
'添加列表
Adodc1.Recordset.MoveFirst
Do While Adodc1.Recordset.EOF = False
Key = Trim(Adodc1.Recordset.Fields("包厢号"))
Set itmX = ListView1.ListItems.Add(, , Key, 1)
Adodc1.Recordset.MoveNext
Loop
Adodc1.RecordSource = "select * from 包厢号"
Adodc1.Refresh
Label5.Caption = Adodc1.Recordset.RecordCount
Adodc1.RecordSource = "select * from 包厢号 where 状态='有客'"
Case "散客"
Adodc1.RecordSource = "select * from 桌号 where 状态='空'"
Adodc1.Refresh
Label5.Caption = Adodc1.Recordset.RecordCount
'添加列表
Adodc1.Recordset.MoveFirst
Do While Adodc1.Recordset.EOF = False
Key = Trim(Adodc1.Recordset.Fields("桌号"))
Set itmX = ListView1.ListItems.Add(, , Key, 2)
Adodc1.Recordset.MoveNext
Loop
Adodc1.RecordSource = "select * from 桌号"
Adodc1.Refresh
Label5.Caption = Adodc1.Recordset.RecordCount
Adodc1.RecordSource = "select * from 桌号 where 状态='有客'"
End Select
Adodc1.Refresh
Label6.Caption = Adodc1.Recordset.RecordCount
For i = 1 To List1.ListCount
ph = Left$(Right$(List1.list(i - 1), 9), 4)
For j = 1 To CInt(Label5.Caption)
If ph = ListView1.ListItems.Item(j).Text Then ListView1.ListItems.Remove (j)
Next
Next
End Sub
Private Sub Text5_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Dim list As String
Text6.Text = 0
Text6.Text = Val(Text6.Text) + Val(Text5.Text)
Text7.Text = Val(Text7.Text) + Val(Text6.Text)
Text5.Text = 0
'Text5.Enabled = False
list = ListView1.SelectedItem
Adodc1.RecordSource = "select * from 点单临时表"
Adodc1.Refresh
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("牌号") = list
Adodc1.Recordset.Fields("付款方式") = Combo3.Text
Adodc1.Recordset.Fields("数量") = 1
Adodc1.Recordset.Fields("单价") = Text3.Text
Adodc1.Recordset.Fields("总价") = Text3.Text
Adodc1.Recordset.Fields("预付押金") = Val(Text6.Text)
Adodc1.Recordset.Fields("服务员") = Combo4.Text
Adodc1.Recordset.Fields("帐单号") = Format(zdh, "000000")
Select Case SSTab1.Caption
Case "包厢客人"
Adodc1.Recordset.Fields("项目") = "包厢费"
List1.AddItem Format(list, bxhFat) & "|$" & Label4.Caption
Case "散客"
Adodc1.Recordset.Fields("项目") = "桌 费"
List1.AddItem Format(list, zhFat) & "|$" & Label4.Caption
End Select
Adodc1.Recordset.Update
ListView1.ListItems.Remove ListView1.SelectedItem.Index
End If
End Sub
Private Sub Timer1_Timer()
Text2.Text = Date & " " & Time
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -