📄
字号:
Height = 285
Left = 960
TabIndex = 42
Top = 3900
Width = 1455
End
Begin VB.TextBox Text11
Appearance = 0 'Flat
BackColor = &H80000003&
Height = 285
Left = 960
TabIndex = 41
Top = 3420
Width = 1455
End
Begin VB.TextBox Text10
Appearance = 0 'Flat
BackColor = &H80000003&
Height = 285
Left = 960
TabIndex = 40
Top = 2880
Width = 1455
End
Begin VB.TextBox Text9
Appearance = 0 'Flat
BackColor = &H80000003&
Height = 285
Left = 960
TabIndex = 39
Top = 2400
Width = 1455
End
Begin VB.TextBox Text8
Appearance = 0 'Flat
BackColor = &H80000003&
Height = 285
Left = 960
TabIndex = 38
Top = 1920
Width = 1455
End
Begin VB.TextBox Text7
Appearance = 0 'Flat
BackColor = &H80000003&
Height = 285
Left = 960
TabIndex = 37
Top = 1440
Width = 1455
End
Begin VB.TextBox Text6
Appearance = 0 'Flat
BackColor = &H80000003&
Height = 285
Left = 960
TabIndex = 36
Top = 1020
Width = 1455
End
Begin VB.TextBox Text5
Appearance = 0 'Flat
BackColor = &H80000003&
Height = 285
Left = 960
TabIndex = 35
Top = 660
Width = 1455
End
Begin VB.TextBox Text4
Appearance = 0 'Flat
BackColor = &H80000003&
Height = 285
Left = 960
TabIndex = 34
Top = 240
Width = 1455
End
Begin VB.Label Label18
AutoSize = -1 'True
Caption = "会员卡号:"
Height = 195
Left = 120
TabIndex = 33
Top = 5400
Width = 900
End
Begin VB.Label Label17
AutoSize = -1 'True
Caption = "应收金额:"
Height = 195
Left = 120
TabIndex = 32
Top = 4920
Width = 900
End
Begin VB.Label Label16
AutoSize = -1 'True
Caption = "折 扣:"
Height = 195
Left = 120
TabIndex = 31
Top = 4440
Width = 900
End
Begin VB.Label Label15
AutoSize = -1 'True
Caption = "服务收费:"
Height = 195
Left = 120
TabIndex = 30
Top = 3960
Width = 900
End
Begin VB.Label Label14
AutoSize = -1 'True
Caption = "最低消费:"
Height = 195
Left = 120
TabIndex = 29
Top = 3480
Width = 900
End
Begin VB.Label Label13
AutoSize = -1 'True
Caption = "特殊消费:"
Height = 195
Left = 120
TabIndex = 28
Top = 3000
Width = 900
End
Begin VB.Label Label12
AutoSize = -1 'True
Caption = "酒菜消费:"
Height = 195
Left = 120
TabIndex = 27
Top = 2520
Width = 900
End
Begin VB.Label Label11
AutoSize = -1 'True
Caption = "开台时间:"
Height = 195
Left = 120
TabIndex = 26
Top = 2040
Width = 900
End
Begin VB.Label Label10
AutoSize = -1 'True
Caption = "消费类型:"
Height = 195
Left = 120
TabIndex = 25
Top = 1560
Width = 900
End
Begin VB.Label Label9
AutoSize = -1 'True
Caption = "帐单编号:"
Height = 195
Left = 120
TabIndex = 24
Top = 1080
Width = 900
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "顾 客:"
Height = 195
Left = 120
TabIndex = 23
Top = 720
Width = 900
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "台 号:"
Height = 195
Left = 120
TabIndex = 22
Top = 360
Width = 900
End
End
End
Attribute VB_Name = "JZ"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim myRecord As ADODB.Recordset
Private Sub Command1_Click()
On Error Resume Next
Dim tempNum As Integer
Dim tempCount As Integer
'要确保每种支付方式只能在listview中出现一次
'一次消费可以同时采用多种消费方式
'注意支付的时候,不能超过总额
tempCount = ListView1.ListItems.Count
If tempCount > 0 Then
For tempNum = 1 To tempCount
If ListView1.ListItems(tempCount).Text = Combo3.Text Then
MsgBox "已经采用改种支付方式了,可以删除重新支付!"
Exit Sub
End If
Next
End If
With ListView1
.ListItems.Add , , Combo3.Text, 1, 1
.ListItems(.ListItems.Count).SubItems(1) = Text3.Text
End With
End Sub
Private Sub Command2_Click()
Dim tempSql As String
Dim TotalNum As Single
'向帐单记录表中增加相应数据
'可以根据需要写入更多的信息
'本程序只写入一些最基本的信息
tempSql = "insert into 帐单记录 (帐单编号,结帐时间,房台编号,顾客姓名,消费方式名称,应收金额,"
tempSql = tempSql & "实收金额,折扣率,挂帐金额,免单金额,信用卡支付,支票支付,现金支付,会员卡支付,会员卡号,结帐员工号)"
tempSql = tempSql & " values ('"
tempSql = tempSql & Text6.Text + "','" '帐单编号
tempSql = tempSql & CStr(Now) + "','" '结帐时间
tempSql = tempSql & Text4.Text + "','" '房台编号
tempSql = tempSql & Text5.Text + "','" '顾客姓名
tempSql = tempSql & Text7.Text + "'," '消费方式
tempSql = tempSql & Text1.Text + "," '应收金额
tempSql = tempSql & Text2.Text + "," '实收金额
tempSql = tempSql & Combo1.Text + "," '折扣率
'tempSql = tempSql + Combo1.Text + ")" '折扣率
tempSql = tempSql & GetPayValue("挂帐") & "," '挂帐金额
TotalNum = TotalNum + GetPayValue("挂帐")
tempSql = tempSql & GetPayValue("免单") & "," '免单金额
TotalNum = TotalNum + GetPayValue("免单")
tempSql = tempSql & GetPayValue("信用卡") & "," '信用卡支付金额
TotalNum = TotalNum + GetPayValue("信用卡")
tempSql = tempSql & GetPayValue("支票") & "," '支票支付
TotalNum = TotalNum + GetPayValue("支票")
tempSql = tempSql & GetPayValue("现金") & "," '现金支付
TotalNum = TotalNum + GetPayValue("现金")
tempSql = tempSql & GetPayValue("会员卡") & ",'" '会员卡支付
TotalNum = TotalNum + GetPayValue("会员卡")
tempSql = tempSql & Text15.Text & "','" '会员卡号
tempSql = tempSql & Admin + "')" '结帐员工号
Debug.Print tempSql
If TotalNum <> CSng(Text2.Text) Then
MsgBox "借款数额不对!总额为:" & Text2.Text & "实际支付为:" & TotalNum
Exit Sub
End If
dbConn.Execute tempSql
'修改房台状态
tempSql = "update 房台状态信息 set "
tempSql = tempSql & " 房台状态=0"
tempSql = tempSql & " where 房台编号='" + Text4.Text + "'"
'
dbConn.Execute tempSql
'修改会员卡记录
If Text15.Text <> "" Then
tempSql = "update 会员表 set 卡余额=卡余额-" & GetPayValue("会员卡") & ",卡消费金额=卡消费金额+"
tempSql = tempSql + GetPayValue("会员卡")
dbConn.Execute tempSql
End If
'同时删除每日点单的记录
'在删除之前要将此次消费明细写入到点单记录表中,读者自己完成
tempSql = "delete 每日点单 where 房台编号='" & Text4.Text & "'"
dbConn.Execute tempSql
End Sub
Private Sub Command3_Click()
With ListView1
ListView1.ListItems.Remove .SelectedItem.Index
End With
End Sub
Private Sub Command5_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim tempSql As String
tempSql = "select * from 付款方式"
dbRecord.Open tempSql, dbConn, adOpenStatic, adLockReadOnly
Do While Not dbRecord.EOF
Combo3.AddItem dbRecord("方式名称").Value
dbRecord.MoveNext
Loop
dbRecord.Close
'设定默认选项为第1项
Combo3.ListIndex = 0
Text4.Text = FTZD.Text1.Text '从房台帐单窗体获得台号
Text5.Text = FTZD.Text7.Text
Text6.Text = FTZD.Text5.Text
'Text7.Text
Text8.Text = FTZD.Text4.Text '开台时间
'Text9.Text
'Text10.Text
'Text11.Text
'Text12.Text
'Text13.Text
Text15.Text = FTZD.Text9.Text
'初始化消费明细
'从每日点单表中获取当前台号的数据
tempSql = "select 酒菜名称,数量,单价,数量*单价 as 合计 from 每日点单 where 房台编号='" & Text4.Text & "'"
Set myRecord = New ADODB.Recordset
myRecord.CursorLocation = adUseClient
myRecord.Open tempSql, dbConn, adOpenStatic, adLockReadOnly
Set DataGrid1.DataSource = myRecord
'统计总共消费金额
'可以通过Sum函数来实现
tempSql = "select sum(数量*单价) as 总价 from 每日点单 where 房台编号='" & Text4.Text & "'"
dbRecord.Open tempSql, dbConn, adOpenStatic, adLockReadOnly
Text1.Text = dbRecord(0)
dbRecord.Close '关闭RecordSet
'计算实收金额
Text2.Text = CSng(Text1.Text) * CSng(Combo1.Text)
With ListView1
.ColumnHeaders.Add , , "付费方式"
.ColumnHeaders.Add , , "金额"
End With
End Sub
Function GetPayValue(PayWay As String) As Single
Dim tempNum As Integer
Dim tempCount As Integer
Dim tempValue As Single
With ListView1
tempCount = .ListItems.Count '如果没有任何一种支付方式,则退出
If tempCount = 0 Then
MsgBox "还没有支付完毕!"
Exit Function
End If
For tempNum = 1 To .ListItems.Count
If .ListItems(tempNum).Text = PayWay Then
tempValue = .ListItems(tempNum).SubItems(1)
End If
Next
End With
If tempValue <> 0 Then
GetPayValue = tempValue
Else
GetPayValue = 0
End If
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -