📄 main_qtgl_mdgl_md.frm
字号:
Height = 225
Index = 2
Left = 3405
TabIndex = 10
Top = 255
Width = 1200
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
ForeColor = &H00FF0000&
Height = 225
Index = 3
Left = 3090
TabIndex = 9
Top = 525
Width = 1215
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
ForeColor = &H00FF0000&
Height = 225
Index = 4
Left = 5550
TabIndex = 8
Top = 255
Width = 915
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
ForeColor = &H00FF0000&
Height = 225
Index = 5
Left = 5700
TabIndex = 7
Top = 510
Width = 1995
End
End
Begin VB.Frame Frame3
Height = 660
Left = 8145
TabIndex = 1
Top = 2460
Width = 2790
Begin VB.Label Labyfje
BackStyle = 0 'Transparent
Height = 210
Left = 1170
TabIndex = 46
Top = 285
Width = 1620
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "应付金额:"
ForeColor = &H00000000&
Height = 195
Index = 6
Left = 165
TabIndex = 39
Top = 285
Width = 945
End
End
Begin VB.Frame Frame1
Height = 585
Left = 30
TabIndex = 19
Top = 735
Width = 8055
Begin VB.Label labdjh
BackStyle = 0 'Transparent
ForeColor = &H000000FF&
Height = 225
Left = 5925
TabIndex = 24
Top = 240
Width = 1875
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "结帐单据号:"
Height = 270
Left = 4770
TabIndex = 23
Top = 255
Width = 1095
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
ForeColor = &H00FF0000&
Height = 225
Index = 6
Left = 645
TabIndex = 22
Top = 225
Width = 1005
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "状态:"
Height = 255
Index = 5
Left = 120
TabIndex = 21
Top = 240
Width = 555
End
End
Begin VB.Frame Frame6
Height = 585
Left = 30
TabIndex = 20
Top = 1185
Width = 8055
Begin VB.Label Label8
BackStyle = 0 'Transparent
Caption = "点单日期:"
Height = 225
Left = 4755
TabIndex = 30
Top = 255
Width = 915
End
Begin VB.Label labrq
BackStyle = 0 'Transparent
ForeColor = &H000000FF&
Height = 195
Left = 5685
TabIndex = 29
Top = 240
Width = 1665
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
Caption = "服务员姓名:"
Height = 225
Left = 2010
TabIndex = 28
Top = 255
Width = 1425
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "服务员编号:"
Height = 225
Left = 150
TabIndex = 27
Top = 255
Width = 1110
End
Begin VB.Label Labbh
BackStyle = 0 'Transparent
ForeColor = &H00FF0000&
Height = 210
Left = 1200
TabIndex = 26
Top = 240
Width = 735
End
Begin VB.Label Labxm
BackStyle = 0 'Transparent
ForeColor = &H00FF0000&
Height = 210
Left = 3075
TabIndex = 25
Top = 255
Width = 1275
End
End
Begin VB.Frame Frame4
Height = 1290
Left = 8145
TabIndex = 2
Top = 3090
Width = 2790
Begin VB.CommandButton Comagio
Caption = "打折结帐"
Height = 375
Left = 150
TabIndex = 5
Top = 765
Width = 2430
End
Begin VB.CommandButton Comnoagio
Caption = "不打折结帐"
Height = 375
Left = 150
TabIndex = 4
Top = 240
Width = 2430
End
End
Begin VB.Frame Frame5
Height = 660
Left = 8145
TabIndex = 3
Top = 4260
Width = 2790
Begin VB.CommandButton Comend
Caption = "退出结帐管理"
Height = 375
Left = 165
TabIndex = 6
Top = 180
Width = 2430
End
End
End
Attribute VB_Name = "main_qtgl_mdgl_md"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim newcnn As New Connection '定义数据库连接
Dim rs1 As New ADODB.Recordset '定义数据集对象
Dim i As Integer '定义整型变量
Dim mystr, SQL1, SQL2, SQL3, SQL4 As String '定义字符串变量
Public Sub JZ() '定义结帐函数
newcnn.Open "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=CYGLXT"
SQL1 = "update 点单临时表 set 结帐日期='" + Trim(rq.text) + "',是否结帐='是' where 单据号='" + Trim(labdjh.Caption) + "'"
newcnn.Execute SQL1
SQL2 = "insert 日点单信息表(房台编号,房台类别,商品编号,商品名称,单位,数量,单价,金额,点单日期,结帐日期,服务员编号,服务员姓名,状态,单据号,是否结帐,备注) select 房台编号,房台类别,商品编号,商品名称,单位,数量,单价,金额,点单日期,结帐日期,服务员编号,服务员姓名,状态,单据号,是否结帐,备注 from 点单临时表 where 单据号='" + Trim(labdjh.Caption) + "'"
newcnn.Execute SQL2
SQL3 = "delete 点单临时表 where 是否结帐='是'and 单据号='" + Trim(labdjh.Caption) + "'"
newcnn.Execute SQL3
SQL4 = "update 房间台号信息表 set 状态='空闲' where 编号='" + Label4(0).Caption + "'"
newcnn.Execute SQL4
newcnn.Close
End Sub
Private Sub Form_Activate()
For i = 1 To 9
List1.AddItem (i) & "折"
Next i
rq.text = Now '设置时间
For i = 0 To 6
Label4(i).Caption = main_qtgl_mdgl.Label4(i).Caption '赋值给label4(i).caption
Next i
Adodc1.RecordSource = "select * from 点单临时表 where 房台编号='" + Trim(Label4(0).Caption) + "'"
Adodc1.Refresh '查询点单信息
If Adodc1.Recordset.RecordCount > 0 Then
Labbh.Caption = Trim(Adodc1.Recordset.Fields("服务员编号"))
Labxm.Caption = Trim(Adodc1.Recordset.Fields("服务员姓名"))
labdjh.Caption = Trim(Adodc1.Recordset.Fields("单据号"))
labrq.Caption = Trim(Adodc1.Recordset.Fields("点单日期"))
Adodc2.RecordSource = "select 状态 as 状态1,sum(数量)as 数量1,sum(金额)as 金额合计 from 点单临时表 where 点单临时表.房台编号='" + Trim(Label4(0).Caption) + "'group by 状态"
Adodc2.Refresh
If Adodc2.Recordset.RecordCount > 1 Then
Label2(0).Caption = Adodc2.Recordset.Fields(1)
Label2(1).Caption = Format(Adodc2.Recordset.Fields(2), "0.00")
If Adodc2.Recordset.EOF = False Then Adodc2.Recordset.MoveNext
Label2(2).Caption = Adodc2.Recordset.Fields(1)
Label2(3).Caption = Format(Adodc2.Recordset.Fields(2), "0.00")
Else
If Trim(Adodc2.Recordset.Fields("状态1")) = "点单" Then
Label2(0).Caption = Adodc2.Recordset.Fields(1)
Label2(1).Caption = Format(Adodc2.Recordset.Fields(2), "0.00")
Label2(2).Caption = "0"
Label2(3).Caption = "0.00"
Else
Label2(0).Caption = "0"
Label2(1).Caption = "0.00"
Label2(2).Caption = Adodc2.Recordset.Fields(1)
Label2(3).Caption = Format(Adodc2.Recordset.Fields(2), "0.00")
End If
End If
Label2(4).Caption = Val(Label2(0).Caption) + Val(Label2(2).Caption)
Label2(5).Caption = Format(Val(Label2(1).Caption) + Val(Label2(3).Caption), "0.00")
Labyfje.Caption = Format(Val(Label4(4).Caption) + Val(Label2(1).Caption), "0.00")
Else
MsgBox ("对不起,此客人未消费,请重新选择!")
main_qtgl_mdgl.Enabled = True
Unload Me
End If
Me.Caption = Me.Caption & " " & frm_main.St1.Panels(3).text
End Sub
Private Sub Comok_Click() '打折结帐
If Frame10.Visible = True Then
mystr = MsgBox("确认打折结帐吗?", vbYesNo)
If mystr = vbYes Then
rs1.Open "select * from 日结帐表 order by 结帐单据号", cnn, adOpenKeyset, adLockOptimistic
rs1.AddNew
rs1.Fields("结帐单据号") = labdjh.Caption
rs1.Fields("房台编号") = Label4(0).Caption
rs1.Fields("日期") = Now
rs1.Fields("结款金额") = Val(Labyfje.Caption) * (Left(List1.text, 1) / 10)
rs1.Fields("结款人") = Trim(Labxm.Caption)
rs1.Fields("结款方式") = "现金"
rs1.Fields("结款说明") = "打[" & List1.text & "]现金结款"
rs1.Update
rs1.Close
Call JZ '调用函数
MsgBox "您的结帐金额为" & Format(Val(Labyfje.Caption) * (Left(List1.text, 1) / 10), "0.00") & "元人民币"
MsgBox ("结帐完毕!")
Call main_qtgl_mdgl.list_change '调用函数
main_qtgl_mdgl.Enabled = True
Unload Me
End If
End If
End Sub
Private Sub Comnoagio_Click() '不打折结帐
If Frame10.Visible = False Then
mystr = MsgBox("确认不打折结帐吗?", vbYesNo)
If mystr = vbYes Then
rs1.Open "select * from 日结帐表 order by 结帐单据号", cnn, adOpenKeyset, adLockOptimistic
rs1.AddNew
rs1.Fields("结帐单据号") = labdjh.Caption
rs1.Fields("房台编号") = Label4(0).Caption
rs1.Fields("日期") = Now
rs1.Fields("结款金额") = Val(Labyfje.Caption)
rs1.Fields("结款人") = Trim(Labxm.Caption)
rs1.Fields("结款方式") = "现金"
rs1.Fields("结款说明") = "现金结款" & Val(Labyfje.Caption) & "元"
rs1.Update
rs1.Close
Call JZ '调用函数
MsgBox ("结帐完毕!")
Call main_qtgl_mdgl.list_change '调用函数
main_qtgl_mdgl.Enabled = True
Unload Me
End If
End If
End Sub
Private Sub Comagio_Click() '打折结帐
Frame10.Visible = True
End Sub
Private Sub Comcancel_Click() '取消
Frame10.Visible = False
End Sub
Private Sub comend_Click()
main_qtgl_mdgl.Enabled = True
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
main_qtgl_mdgl.Enabled = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -