📄 frmjz.frm
字号:
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public houseNum As String
Public sumM1 As Integer
Public sumM2 As Integer
Public zd As String '帐单号
Public zdNUM As Integer '帐单数
Public paihao As String '牌号
Public fl As String
Public fwy As String '服务员
Private Sub Combo1_Click()
Select Case Combo1.Text
Case "附加费率"
Text12.Enabled = True
Text12.Text = 0
Text13.Enabled = False
Text12.SetFocus
Case "指定金额"
Text13.Enabled = True
Text13.Text = 0
Text12.Enabled = False
Text13.SetFocus
Case Else
End Select
End Sub
Private Sub Combo2_Click()
Select Case Combo2.Text
Case "折扣率"
Text14.Enabled = True
Text14.Text = 0
Text15.Enabled = False
Text14.SetFocus
Case "指定金额"
Text15.Enabled = True
Text15.Text = 0
Text14.Enabled = False
Text15.SetFocus
Case Else
End Select
End Sub
Private Sub Combo3_Click()
Select Case Combo3.Text
Case "5元优惠券"
Text16.Text = 5
Case "10元优惠券"
Text16.Text = 10
Case "指定金额"
Text16.Text = 0
Text16.SetFocus
Case Else
End Select
End Sub
Private Sub Command1_Click()
Picture1.Visible = True
End Sub
Private Sub Command2_Click()
If paihao <> "" Then
If Left(paihao, 1) = 1 Then fl = "包厢号"
If Left(paihao, 1) = 0 Then fl = "桌号"
End If
Adodc1.RecordSource = "select * from " & fl & " where " & fl & " =" & paihao & ""
Adodc1.Refresh
If Option2.Value = True Then
Adodc1.Recordset.Fields("状态") = "空"
ElseIf Option1.Value = True Then
Adodc1.Recordset.Fields("状态") = "清洁"
Adodc1.RecordSource = "select * from 已结帐单"
Adodc1.Refresh
Adodc2.Recordset.MoveFirst
For i = 1 To Adodc2.Recordset.RecordCount
With Adodc1.Recordset
.AddNew
.Fields("牌号") = paihao
.Fields("项目") = Adodc2.Recordset.Fields("项目")
.Fields("数量") = Adodc2.Recordset.Fields("数量")
.Fields("单价") = Adodc2.Recordset.Fields("单价")
.Fields("总价") = Adodc2.Recordset.Fields("总价")
.Fields("付款方式") = Adodc2.Recordset.Fields("付款方式")
.Fields("消费开始时间") = Adodc2.Recordset.Fields("消费开始时间")
.Fields("消费结束时间") = Format(Date, "yyyy.mm.dd") & " " & Time
.Fields("帐单号") = Adodc2.Recordset.Fields("帐单号")
.Fields("服务员") = Adodc2.Recordset.Fields("服务员")
.Fields("姓名") = Text3.Text
.Fields("卡号") = Text5.Text
.Update
End With
Adodc2.Recordset.MoveNext
Next
End If
Adodc2.Recordset.MoveFirst
For i = 1 To Adodc2.Recordset.RecordCount
Adodc2.Recordset.Delete
Adodc2.Recordset.MoveNext
Next
Adodc2.Recordset.Update
'是否需要打印票据
If MsgBox("是否需要打印票据?", vbYesNo, "提示") = vbYes Then
Else
End If
End Sub
Private Sub Command3_Click()
Picture2.Visible = True
End Sub
Private Sub Command5_Click()
Text4.Text = Text19.Text
If Left(paihao, 1) = 1 Then
With Adodc2.Recordset
.AddNew
.Fields("牌号") = paihao
.Fields("项目") = "调整金额"
.Fields("数量") = 1
.Fields("单价") = Text19.Text
.Fields("总价") = Text19.Text
.Fields("付款方式") = DataCombo1.Text
.Fields("消费开始时间") = Format(Date, "0000.00.00") & " " & Time
.Fields("预付押金") = 0
.Fields("服务员") = fwy
.Fields("帐单号") = zd
.Update
End With
End If
End Sub
Private Sub Command6_Click()
Text12.Enabled = False
Text13.Enabled = False
Text14.Enabled = False
Text15.Enabled = False
Text16.Enabled = False
End Sub
Private Sub Command7_Click()
Picture1.Visible = False
End Sub
Private Sub Command8_Click()
Picture2.Visible = False
Adodc2.Recordset.MoveFirst
For i = 1 To Adodc2.Recordset.RecordCount
sumM1 = sumM1 + Adodc2.Recordset.Fields("总价")
Adodc2.Recordset.MoveNext
Next
Text4.Text = sumM1
End Sub
Private Sub Command9_Click()
Picture2.Visible = False
End Sub
Private Sub DataCombo1_Click(Area As Integer)
Text3.Enabled = False
Text5.Enabled = False
Select Case DataCombo1.Text
Case "金卡用户"
Text5.Enabled = True
Text5.SetFocus
Case "签单用户"
Text3.Enabled = True
Text3.SetFocus
Case "免费客人"
Text3.Enabled = True
Text3.SetFocus
Case Else
End Select
If DataCombo1.Text = "金卡用户" Then
End If
End Sub
Private Sub DataGrid2_DblClick()
If paihao = "" Then
MsgBox "请对具体牌号点单", vbOKOnly, "警告!"
Else
With Adodc2.Recordset
.AddNew
.Fields("牌号") = paihao
.Fields("项目") = Adodc3.Recordset.Fields("项目")
.Fields("数量") = 1
.Fields("单价") = Adodc3.Recordset.Fields("单价")
.Fields("总价") = .Fields("数量") * .Fields("单价")
.Fields("消费开始时间") = Format(Date, "yyyy.mm.dd") & " " & Time
.Fields("预付押金") = 0
.Fields("帐单号") = List1.ListIndex
.Fields("服务员") = fwy
.Update
End With
End If
End Sub
Private Sub Form_Activate()
Call MDIhide
Picture1.Left = DataGrid1.Left
Picture2.Left = DataGrid2.Left
End Sub
Private Sub Form_Load()
Adodc1.ConnectionString = conn1
Adodc2.ConnectionString = conn1
Adodc3.ConnectionString = conn1
Adodc1.RecordSource = "select * from 帐单号"
Adodc1.Refresh
zdNUM = Adodc1.Recordset.Fields("帐单号")
For i = 1 To zdNUM
List1.AddItem "帐单号|N" & Format(i, "00000")
Next
'初始化picture1窗口参数
With Combo1
.AddItem "无"
.AddItem "附加费率"
.AddItem "指定金额"
.ListIndex = 0
End With
With Combo2
.AddItem "无"
.AddItem "折扣率"
.AddItem "指定金额"
.ListIndex = 0
End With
With Combo3
.AddItem "无"
.AddItem "5元优惠券"
.AddItem "5元优惠券"
.AddItem "指定金额"
.ListIndex = 0
End With
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call MDIview
End Sub
Private Sub Image1_Click()
Adodc2.RecordSource = "select * from 点单 where 牌号='" & Trim(Text1.Text) & "'and 帐单号='" & zd & "'"
Adodc2.Refresh
fwy = Adodc2.Recordset.Fields("服务员")
End Sub
Private Sub List1_Click()
sumM1 = 0
sumM2 = 0
List2.Clear
paihao = ""
zd = List1.ListIndex
If List1.Text <> "" Then
Adodc2.RecordSource = "select * from 点单 where 帐单号='" & zd & "'"
Adodc2.Refresh
End If
Adodc1.RecordSource = "select distinct * from 点单 where 帐单号='" & zd & "'"
Adodc1.Refresh
For i = 1 To Adodc1.Recordset.RecordCount
houseNum = Adodc1.Recordset.Fields("牌号")
If Left(houseNum, 1) = "1" Then
List2.AddItem "包厢号 |" & houseNum
Else
List2.AddItem "桌号 |" & houseNum
End If
Adodc1.Recordset.MoveNext
Next
'Label1.Caption = "客户名称: " & List1.Text
'Label3.Caption = "入店时间: " & Adodc2.Recordset.Fields("消费开始时间")
'Label4.Caption = "付款方式: " & Adodc2.Recordset.Fields("付款方式")
For i = 1 To Adodc2.Recordset.RecordCount
sumM1 = sumM1 + Adodc2.Recordset.Fields("总价")
sumM2 = sumM2 + Adodc2.Recordset.Fields("预付押金")
Adodc2.Recordset.MoveNext
Next
Text4.Text = sumM1
Text9.Text = sumM1
Text6.Text = sumM2
End Sub
Private Sub List2_Click()
sumM1 = 0
sumM2 = 0
paihao = Right(List2.Text, 4)
Adodc2.RecordSource = "select * from 点单 where 牌号='" & paihao & "'and 帐单号='" & zd & "'"
Adodc2.Refresh
fwy = Adodc2.Recordset.Fields("服务员")
Text2.Text = List2.Text
Text10.Text = Adodc2.Recordset.Fields("消费开始时间")
Text11.Text = Format(Date, "yyyy.mm.dd") & " " & Time
'Label4.Caption = "付款方式: " & Adodc2.Recordset.Fields("付款方式")
For i = 1 To Adodc2.Recordset.RecordCount
sumM1 = sumM1 + Adodc2.Recordset.Fields("总价")
sumM2 = sumM2 + Adodc2.Recordset.Fields("预付押金")
Adodc2.Recordset.MoveNext
Next
Text4.Text = sumM1
Text9.Text = sumM1
Text6.Text = sumM2
Command1.Enabled = True
End Sub
Private Sub ListView1_BeforeLabelEdit(Cancel As Integer)
Adodc3.RecordSource = "select * from 费用 where 类别='" & ListView1.SelectedItem & "'"
Adodc3.Refresh
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Image1_Click
End Sub
Private Sub Text12_LostFocus()
Text17.Text = CInt(Text9.Text) * CInt(Text12.Text) / 100
End Sub
Private Sub Text13_Change()
Text17.Text = Text13.Text
End Sub
Private Sub Text14_LostFocus()
Text18.Text = CInt(Text9.Text) * CInt(Text14.Text) / 100
End Sub
Private Sub Text15_Change()
Text17.Text = Text15.Text
End Sub
Private Sub Text17_Change()
Text19.Text = Text19.Text + Text17.Text - Text18.Text
End Sub
Private Sub Text18_Change()
Text19.Text = Text19.Text + Text17.Text - Text18.Text
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Adodc1.RecordSource = "select * from 签单用户 where 姓名='" & Text3.Text & "'"
If Adodc1.Recordset.RecordCount = 0 Then
MsgBox "查无此用户,请与管理员联系!", vbOKOnly, "提示"
Else
Text7.Enabled = True
Text7.SetFocus
End If
End If
End Sub
Private Sub Text5_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Adodc1.RecordSource = "select * from 金卡用户 where 卡号='" & Text5.Text & "'"
If Adodc1.Recordset.RecordCount = 0 Then
MsgBox "查无此用户,请与管理员联系!", vbOKOnly, "提示"
Else
Text7.Enabled = True
Text7.SetFocus
End If
End If
End Sub
Private Sub Text7_KeyPress(KeyAscii As Integer)
Dim sumM, sumM1 As Integer
If KeyAscii = 13 Then
If Text7.Text <> Adodc1.Recordset.Fields("密码") Then
MsgBox "密码不正确!", vbOKOnly, "提示"
Else
Select Case DataCombo1.Text
Case "金卡用户"
sumM = Adodc1.Recordset.Fields("卡内金额")
sumM1 = sumM - CInt(Text4.Text)
If sumM1 < 0 Then
MsgBox "对不起,卡内余额不足,请再补交现金" & CInt(Text4.Text) - sumM & "元!", vbOKOnly, "提示"
Adodc1.Recordset.Fields("卡内余额") = 0
Else
Adodc1.Recordset.Fields("卡内余额") = sumM1
MsgBox "您的帐已划掉,卡内最新余额为" & sumM1 & "元!谢谢光临!", vbOKOnly, "提示"
End If
Case "签单用户"
sumM = Adodc1.Recordset.Fields("消费金额")
sumM1 = sumM + CInt(Text4.Text)
Adodc1.Recordset.Fields("消费金额") = sumM1
Adodc1.Recordset.Update
MsgBox "您的帐已划掉,帐户内累计金额为" & sumM1 & "元!谢谢光临!", vbOKOnly, "提示"
Case Else
End Select
For i = 1 To Adodc2.Recordset.RecordCount
Adodc2.Recordset.Delete
Adodc2.Recordset.MoveNext
Next
Adodc2.Recordset.Update
End If
End If
End Sub
Private Sub Text8_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If CInt(Text8.Text) < CInt(Text4.Text) - CInt(Text6.Text) Then MsgBox "sorry,您的金额不足,请检查是否输入错误!", vbOKOnly, "无法结帐提示!!"
If CInt(Text8.Text) > CInt(Text4.Text) - CInt(Text6.Text) Then MsgBox "收到现金{" & Text8.Text & "},找回 {" & CInt(Text8.Text) - CInt(Text4.Text) & "},不能结帐!!", vbOKOnly, "无法结帐提示!!"
If CInt(Text8.Text) > CInt(Text4.Text) - CInt(Text6.Text) Then
Command2.Enabled = True
Command2.SetFocus
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -