📄 main_qtgl_mdgl_gz.frm
字号:
Caption = "应付金额:"
ForeColor = &H00000000&
Height = 195
Index = 6
Left = 165
TabIndex = 40
Top = 285
Width = 945
End
End
Begin VB.Frame Frame1
Height = 585
Left = 30
TabIndex = 20
Top = 735
Width = 8055
Begin VB.Label labdjh
BackStyle = 0 'Transparent
ForeColor = &H000000FF&
Height = 225
Left = 5925
TabIndex = 25
Top = 240
Width = 1875
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "结帐单据号:"
Height = 270
Left = 4770
TabIndex = 24
Top = 255
Width = 1095
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
ForeColor = &H00FF0000&
Height = 225
Index = 6
Left = 645
TabIndex = 23
Top = 225
Width = 1005
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "状态:"
Height = 255
Index = 5
Left = 120
TabIndex = 22
Top = 240
Width = 555
End
End
Begin VB.Frame Frame6
Height = 585
Left = 30
TabIndex = 21
Top = 1185
Width = 8055
Begin VB.Label Label8
BackStyle = 0 'Transparent
Caption = "点单日期:"
Height = 225
Left = 4755
TabIndex = 31
Top = 255
Width = 915
End
Begin VB.Label labrq
BackStyle = 0 'Transparent
ForeColor = &H000000FF&
Height = 195
Left = 5685
TabIndex = 30
Top = 240
Width = 1665
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
Caption = "服务员姓名:"
Height = 225
Left = 2010
TabIndex = 29
Top = 255
Width = 1425
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "服务员编号:"
Height = 225
Left = 150
TabIndex = 28
Top = 255
Width = 1110
End
Begin VB.Label Labbh
BackStyle = 0 'Transparent
ForeColor = &H00FF0000&
Height = 210
Left = 1200
TabIndex = 27
Top = 240
Width = 735
End
Begin VB.Label Labxm
BackStyle = 0 'Transparent
ForeColor = &H00FF0000&
Height = 210
Left = 3075
TabIndex = 26
Top = 255
Width = 1275
End
End
Begin VB.Frame Frame4
Height = 1695
Left = 8205
TabIndex = 2
Top = 3000
Width = 2565
Begin VB.CommandButton Comfa
Caption = "优惠挂账"
Height = 375
Left = 240
TabIndex = 6
Top = 1200
Width = 1950
End
Begin VB.CommandButton Comagio
Caption = "打折挂账"
Height = 375
Left = 240
TabIndex = 5
Top = 705
Width = 1950
End
Begin VB.CommandButton Comnoagio
Caption = "不打折挂账"
Height = 375
Left = 270
TabIndex = 4
Top = 210
Width = 1950
End
End
Begin VB.Frame Frame5
Height = 660
Left = 8205
TabIndex = 3
Top = 4575
Width = 2565
Begin VB.CommandButton Comend
Caption = "退出挂账管理"
Height = 375
Left = 240
TabIndex = 7
Top = 180
Width = 1950
End
End
End
Attribute VB_Name = "main_qtgl_mdgl_gz"
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 rs2 As New ADODB.Recordset
Dim i As Integer '定义整型变量
Dim mystr, SQL1, SQL2, SQL3, SQL4, SQL5 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 'Connection 对象的 Execute 方法,执行指定的查询、SQL 语句、存储过程或特定提供者的文本等内容。'详细说明或实例参见《Visual Basic编程词典》基础知识部分,该部分有详细说明。
'吉林省明日科技有限公司愿为您提供最实用、最全面、最完整和最方便的编程技术和开发资源,同时为您提供最周到的技术支持和服务。
'技术支持及升级请访问www.cccxy.com www.mingrisoft.com 价值无限,服务无限
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
Next i
Sql = "select * from 点单临时表 where 房台编号='" + Trim(Label4(0).Caption) + "'"
Call FunAdo(Adodc1, Sql)
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("点单日期"))
sqlStr = "select 状态 as 状态1,sum(数量)as 数量1,sum(金额)as 金额合计 from 点单临时表 where 房台编号='" + Trim(Label4(0).Caption) + "'group by 状态"
Call FunAdo(Adodc2, sqlStr)
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 Form_Load()
Sql = "select * from 点单临时表"
sqlStr = "select * from 点单临时表"
Call FunAdo(Adodc1, Sql)
Call FunAdo(Adodc2, sqlStr)
End Sub
Private Sub Form_Unload(Cancel As Integer)
main_qtgl_mdgl.Enabled = True
End Sub
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn And Index = 0 Then Text1(1).SetFocus
If KeyCode = vbKeyReturn And Index = 1 Then Comok.SetFocus
If KeyCode = vbKeyUp And Index = 1 Then Text1(0).SetFocus
End Sub
Private Sub Comok_Click()
If Frame10.Caption = "挂账信息栏" Then
If MsgBox("确认不打折挂账吗?", vbYesNo) = vbYes Then '不打折挂账
rs1.Open "select * from 挂账表 order by 挂账时间", cnn, adOpenKeyset, adLockOptimistic
rs2.Open "select * from 日结账表 order by 结账单据号", cnn, adOpenKeyset, adLockOptimistic
If Text1(0).text <> "" And Text1(1).text <> "" Then
rs1.AddNew
rs1.Fields("单据号") = labdjh.Caption
rs1.Fields("挂账时间") = Now
rs1.Fields("挂账人") = Text1(0).text
rs1.Fields("经手人") = Labxm.Caption
rs1.Fields("挂账原因") = Text1(1).text
rs1.Fields("挂账金额") = Val(Labyfje.Caption)
rs1.Fields("是否结账") = "否"
rs1.Update
rs2.AddNew
rs2.Fields("结账单据号") = labdjh.Caption
rs2.Fields("房台编号") = Label4(0).Caption
rs2.Fields("日期") = Now
rs2.Fields("结款金额") = Val(Labyfje.Caption)
rs2.Fields("结款人") = Trim(Labxm.Caption)
rs2.Fields("结款方式") = "挂账"
rs2.Fields("结款说明") = Text1(1).text
rs2.Update
Else
MsgBox ("请输入挂账人或挂账原因.")
rs1.Close: rs2.Close '关闭数据集对象
Exit Sub
End If
rs1.Close: rs2.Close '关闭数据集对象
Call JZ '调用函数
MsgBox ("挂账完毕!")
Call main_qtgl_mdgl.list_change '调用函数
main_qtgl_mdgl.Enabled = True
Unload Me
End If
End If
If Frame10.Caption = "打折信息栏" Then
mystr = MsgBox("确认打折挂账吗?", vbYesNo)
If mystr = vbYes Then '打折挂账
rs1.Open "select * from 挂账表 order by 挂账时间", cnn, adOpenKeyset, adLockOptimistic
rs2.Open "select * from 日结账表 order by 结账单据号", cnn, adOpenKeyset, adLockOptimistic
If Text1(0).text <> "" And Text1(1).text <> "" Then
rs1.AddNew
rs1.Fields("单据号") = labdjh.Caption
rs1.Fields("挂账时间") = Now
rs1.Fields("挂账人") = Text1(0).text
rs1.Fields("经手人") = Labxm.Caption
rs1.Fields("挂账原因") = Text1(1).text
rs1.Fields("挂账金额") = Val(Labyfje.Caption) * (Left(List1.text, 1) / 10)
rs1.Fields("是否结账") = "否"
rs1.Update
rs2.AddNew
rs2.Fields("结账单据号") = labdjh.Caption
rs2.Fields("房台编号") = Label4(0).Caption
rs2.Fields("日期") = Now
rs2.Fields("结款金额") = Val(Labyfje.Caption) * (Left(List1.text, 1) / 10)
rs2.Fields("结款人") = Trim(Labxm.Caption)
rs2.Fields("结款方式") = "挂账"
rs2.Fields("结款说明") = "[打" & List1.text & "]挂账[" & Text1(1).text & "]"
rs2.Update
Else
MsgBox ("请输入挂账人或挂账原因.")
rs1.Close: rs2.Close '关闭数据集对象
Exit Sub
End If
rs1.Close: rs2.Close '关闭数据集对象
Call JZ '调用函数
MsgBox "您的挂账金额为" & Format(Val(Labyfje.Caption) * (Left(List1.text, 1) / 10), "0.00") & "元"
Call main_qtgl_mdgl.list_change '调用函数
main_qtgl_mdgl.Enabled = True
Unload Me
End If
End If
If Frame10.Caption = "优惠挂账" Then
mystr = MsgBox("确认优惠挂账吗?", vbYesNo)
If mystr = vbYes Then '优惠挂账
rs1.Open "select * from 挂账表 order by 挂账时间", cnn, adOpenKeyset, adLockOptimistic
rs2.Open "select * from 日结账表 order by 结账单据号", cnn, adOpenKeyset, adLockOptimistic
If Text1(0).text <> "" And Text1(1).text <> "" And Text1(2).text <> "" And Text1(3).text <> "" Then
rs1.AddNew
rs1.Fields("单据号") = labdjh.Caption
rs1.Fields("挂账时间") = Now
rs1.Fields("挂账人") = Text1(0).text
rs1.Fields("经手人") = Labxm.Caption
rs1.Fields("挂账原因") = Text1(1).text
rs1.Fields("挂账金额") = Val(Labyfje.Caption) - Val(Text1(2).text)
rs1.Fields("是否结账") = "否"
rs1.Update
rs2.AddNew
rs2.Fields("结账单据号") = labdjh.Caption
rs2.Fields("房台编号") = Label4(0).Caption
rs2.Fields("日期") = Now
rs2.Fields("结款金额") = Val(Labyfje.Caption) - Val(Text1(2).text)
rs2.Fields("结款人") = Trim(Labxm.Caption)
rs2.Fields("结款方式") = "挂账"
rs2.Fields("结款说明") = "[减免" & Val(Text1(2).text) & "元]挂账.挂账原因[" & Text1(1).text & "].减免原因[" & Text1(3).text & "]"
rs2.Update
Else
MsgBox ("请输入挂账人或挂账原因等.")
rs1.Close: rs2.Close '关闭数据集对象
Exit Sub
End If
rs1.Close: rs2.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 Comnoagio_Click() '不打折挂账窗口
Frame10.Visible = True
Frame10.Caption = "挂账信息栏"
Text1(0).SetFocus
Frame10.Height = 1740: Frame10.Left = 30: Frame10.Top = 3585
Comok.Top = 1125: Comok.Left = 645: Comcancel.Top = 1125
Comcancel.Left = 2265: List1.Top = 3000
Label9(2).Visible = False: Label9(3).Visible = False
Text1(2).Visible = False: Text1(3).Visible = False
End Sub
Private Sub Comagio_Click() '打折挂账窗口
Frame10.Visible = True
Frame10.Caption = "打折信息栏"
Text1(0).SetFocus
Frame10.Height = 4740: Frame10.Left = 3645: Frame10.Top = 30
Comok.Top = 4200: Comok.Left = 645: Comcancel.Top = 4200
Comcancel.Left = 2265: List1.Top = 1230: List1.Left = 195
Label9(2).Visible = False: Label9(3).Visible = False
Text1(2).Visible = False: Text1(3).Visible = False
End Sub
Private Sub Comfa_Click() '优惠挂账窗口
Frame10.Visible = True
Frame10.Caption = "优惠挂账"
Text1(0).SetFocus
Frame10.Height = 2565: Frame10.Left = 30: Frame10.Top = 2760
Comok.Top = 2025: Comok.Left = 645: Comcancel.Top = 2025
Comcancel.Left = 2265: List1.Top = 3000
Label9(2).Visible = True: Label9(3).Visible = True
Text1(2).Visible = True: Text1(3).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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -