www.pudn.com > netserver.zip > frmEndPlay.frm
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Begin VB.Form frmEndPlay
BorderStyle = 1 'Fixed Single
Caption = "结帐"
ClientHeight = 6330
ClientLeft = 2535
ClientTop = 330
ClientWidth = 6690
Icon = "frmEndPlay.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6330
ScaleWidth = 6690
Begin MSComDlg.CommonDialog ComDialog1
Left = 3120
Top = 2880
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.CommandButton Command4
Caption = "打印帐单"
Height = 375
Left = 3480
TabIndex = 3
Top = 2640
Width = 1335
End
Begin RichTextLib.RichTextBox RTBox
Height = 3135
Left = 0
TabIndex = 24
Top = 3120
Width = 6615
_ExtentX = 11668
_ExtentY = 5530
_Version = 393217
Enabled = -1 'True
ReadOnly = -1 'True
ScrollBars = 3
TextRTF = $"frmEndPlay.frx":030A
End
Begin VB.CommandButton Command2
Caption = "<<详细资料"
Height = 375
Left = 5040
TabIndex = 4
Top = 2640
Width = 1335
End
Begin VB.CheckBox Check1
Caption = "使用储金卡"
Height = 300
Left = 240
TabIndex = 0
Top = 1440
Width = 1215
End
Begin VB.TextBox txtYiShou
Alignment = 1 'Right Justify
Height = 270
Left = 1440
Locked = -1 'True
TabIndex = 14
Top = 840
Width = 1455
End
Begin VB.ListBox List2
Height = 1950
ItemData = "frmEndPlay.frx":03A7
Left = 3480
List = "frmEndPlay.frx":03A9
Style = 1 'Checkbox
TabIndex = 13
Top = 480
Width = 3135
End
Begin VB.Frame Frame2
Caption = "Frame2"
Height = 975
Left = 120
TabIndex = 8
Top = 1560
Width = 3015
Begin VB.TextBox txtKaMiMa
Enabled = 0 'False
Height = 270
IMEMode = 3 'DISABLE
Left = 1080
PasswordChar = "*"
TabIndex = 10
Top = 600
Width = 1815
End
Begin VB.TextBox txtKaHaoMa
Enabled = 0 'False
Height = 270
Left = 1080
TabIndex = 9
Top = 240
Width = 1815
End
Begin VB.Label Label25
Caption = "密码:"
Enabled = 0 'False
Height = 255
Left = 120
TabIndex = 12
Top = 600
Width = 735
End
Begin VB.Label Label24
Caption = "卡号:"
Enabled = 0 'False
Height = 255
Left = 120
TabIndex = 11
Top = 240
Width = 975
End
End
Begin VB.ComboBox comYouHui
Height = 300
ItemData = "frmEndPlay.frx":03AB
Left = 1440
List = "frmEndPlay.frx":03BB
TabIndex = 7
Text = "无"
Top = 480
Width = 1455
End
Begin VB.TextBox txtShiShou
Alignment = 1 'Right Justify
Height = 270
Left = 1440
TabIndex = 6
Top = 1200
Width = 1455
End
Begin VB.TextBox txtYingShou
Alignment = 1 'Right Justify
Height = 270
Left = 1440
Locked = -1 'True
TabIndex = 5
Top = 120
Width = 1455
End
Begin VB.CommandButton Command3
Caption = "结帐并关机"
Height = 375
Left = 1920
TabIndex = 2
Top = 2640
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "结帐"
Height = 375
Left = 360
TabIndex = 1
Top = 2640
Width = 1335
End
Begin VB.Label Label13
Caption = "元"
Height = 255
Left = 3000
TabIndex = 23
Top = 840
Width = 255
End
Begin VB.Label Label12
Caption = "已收金额:"
Height = 255
Left = 120
TabIndex = 22
Top = 840
Width = 1215
End
Begin VB.Label Label19
Caption = "其他一起结帐的机器:"
Height = 375
Left = 3480
TabIndex = 21
Top = 120
Width = 1815
End
Begin VB.Label Label11
Caption = "元"
Height = 375
Left = 3000
TabIndex = 20
Top = 1200
Width = 375
End
Begin VB.Label Label10
Caption = "%"
Height = 255
Left = 3000
TabIndex = 19
Top = 480
Width = 375
End
Begin VB.Label Label9
Caption = "元"
Height = 255
Left = 3000
TabIndex = 18
Top = 240
Width = 375
End
Begin VB.Label Label8
Caption = "打折优惠:"
Height = 255
Left = 120
TabIndex = 17
Top = 525
Width = 975
End
Begin VB.Label Label7
Caption = "实收金额:"
Height = 375
Left = 120
TabIndex = 16
Top = 1200
Width = 1095
End
Begin VB.Label Label6
Caption = "应收金额:"
Height = 255
Left = 120
TabIndex = 15
Top = 240
Width = 1095
End
End
Attribute VB_Name = "frmEndPlay"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim selShiShou As Integer
Private Sub Command2_Click()
If Command2.Caption = "详细资料>>" Then
Command2.Caption = "<<详细资料"
RTBox.Visible = True
Me.Height = 6705
Else
Command2.Caption = "详细资料>>"
RTBox.Visible = False
Me.Height = 3480
End If
End Sub
Private Sub Command4_Click()
'打印帐单
On Error Resume Next
With ComDialog1
.CancelError = True
.Flags = cdlPDReturnDC + cdlPDNoPageNums + &H100000
RTBox.SelLength = 0
.ShowPrinter
If Err <> mscomdlg.cdlCancel Then
RTBox.SelPrint .hdc
End If
End With
End Sub
Private Sub comYouHui_Change()
comYouHui_Click
End Sub
Private Sub comYouHui_Click()
If Val(comYouHui.Text) > 0 Then
txtShiShou.Text = Round((Val(txtYingShou.Text) * Val(comYouHui.Text) / 100 - Val(txtYiShou.Text)) * 2) / 2
Else
txtShiShou.Text = Round((Val(txtYingShou.Text) - Val(txtYiShou.Text)) * 2) / 2
End If
End Sub
Private Sub comYouHui_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) Like "[!0-9.]" And (Not KeyAscii = 8) Then KeyAscii = 0
End Sub
Private Sub Check1_Click()
If Check1.Value = 1 Then
Label24.Enabled = True
Label25.Enabled = True
txtKaHaoMa.Enabled = True
txtKaMiMa.Enabled = True
Else
Label24.Enabled = False
Label25.Enabled = False
txtKaHaoMa.Enabled = False
txtKaMiMa.Enabled = False
End If
End Sub
Private Sub Command1_Click()
'结帐
On Error Resume Next
If Check1.Value = 1 Then '如果使用储金卡
Dim bYanKa As Boolean
With frmMain.Data6.Recordset
.MoveFirst
For i = 1 To .RecordCount
If .Fields("卡号") = txtKaHaoMa.Text And .Fields("密码") = txtKaMiMa.Text Then
bYanKa = True
Exit For
End If
.MoveNext
Next i
If bYanKa = False Then
MsgBox "储金卡卡号或密码错误,请确认后再次结帐!", vbCritical, "警告"
Exit Sub
End If
Dim shishou As Double
shishou = Round(Val(txtShiShou.Text) * .Fields("总金额") * 2 / frmMain.Data1.Recordset.Fields("单位费用") / .Fields("总机时")) / 2
If .Fields("金额").Value < shishou Then
MsgBox "储金卡金额不足,请确认后再结帐!" + vbCrLf + "当前卡金额:" & .Fields("金额"), vbExclamation, "警告"
Exit Sub
Else
.Edit
.Fields("金额").Value = .Fields("金额").Value - shishou
.Fields("已用机时").Value = Round(.Fields("已用机时").Value + shishou * .Fields("总机时") / .Fields("总金额"), 2)
.Fields("上机次数") = .Fields("上机次数") + 1
.Update
frmMain.Data9.Recordset.Edit
frmMain.Data9.Recordset.MoveFirst
For i = 1 To frmMain.Data9.Recordset.RecordCount
If frmMain.Data9.Recordset.Fields("编号") = .Fields("客户编号") Then
frmMain.Data9.Recordset.Edit
frmMain.Data9.Recordset.Fields("消费额") = frmMain.Data9.Recordset.Fields("消费额") + shishou
frmMain.Data9.Recordset.Fields("消费次数") = frmMain.Data9.Recordset.Fields("消费次数") + 1
frmMain.Data9.Recordset.Fields("最后一次时间") = Now
frmMain.Data9.Recordset.Update
End If
frmMain.Data9.Recordset.MoveNext
Next i
txtKaHaoMa = ""
txtKaMiMa = ""
Check1.Value = 0
End If
End With
End If
frmMain.ClearJF
comYouHui.Text = Round(Val(txtShiShou.Text) / Val(txtYingShou.Text), 4) * 100
For i = 0 To List2.ListCount - 1
If List2.Selected(i) Then
frmMain.Data1.Recordset.MoveFirst
frmMain.Data1.Recordset.Move List2.ItemData(i)
SelectComputer = frmMain.Data1.Recordset.AbsolutePosition + 1
frmMain.ClearJF
End If
Next i
'For i = 0 To frmMain.Winsock1.Count - 1
'If frmMain.Data1.Recordset.Fields("IP") = frmMain.Winsock1(i).RemoteHostIP Then
' frmMain.Winsock1(i).SendData "_comm" + Chr(0) + "stop"
' DoEvents
' Exit For
'End If
'Next i
Unload Me
frmMain.Timer2_Timer
End Sub
Private Sub Command3_Click()
'结帐并关机
On Error Resume Next
Command1_Click
For i = 0 To Winsock1.Count - 1
If frmMain.Data1.Recordset.Fields("IP") = frmMain.Winsock1(i).RemoteHostIP Then
frmMain.Winsock1(i).SendData "_comm" + Chr(0) + "shutdown" + Chr(0) + "OK$"
DoEvents
Exit For
End If
Next i
End Sub
Private Sub Form_Load()
On Error Resume Next
With frmMain.Data1.Recordset '
txtYingShou.Text = frmMain.CountJF
txtYiShou.Text = .Fields("已收款")
txtShiShou.Text = txtYingShou.Text
.MoveFirst
For i = 1 To .RecordCount
If .AbsolutePosition <> SelectComputer - 1 Then
If .Fields("状态").Value = "Y" Or .Fields("状态").Value = "P" Then
List2.AddItem .Fields("名称")
List2.ItemData(List2.NewIndex) = .AbsolutePosition
' Else
' List1.AddItem .Fields("名称")
' List1.ItemData(List1.NewIndex) = .AbsolutePosition
End If
End If
.MoveNext
Next i
.MoveFirst
.Move SelectComputer - 1
End With
Command2_Click
Me.Top = frmMain.Top + 1500
LoadRtBox
End Sub
Private Sub Form_Unload(Cancel As Integer)
selShiShou = 0
End Sub
Private Sub List2_Click()
With frmMain.Data1.Recordset
Dim old As Long, Zjine As Double
Zjine = 0
RTBox.Text = ""
LoadRtBox
Zjine = Zjine + frmMain.CountJF
For k = 0 To List2.ListCount - 1
If List2.Selected(k) = True Then
old = .AbsolutePosition
.MoveFirst
.Move List2.ItemData(k)
Zjine = Zjine + frmMain.CountJF
'RTBox.SelStart = selShiShou
RTBox.SelStart = selShiShou
RTBox.SelLength = Len(RTBox.Text) - selShiShou
RTBox.SelText = "━━━━━━━━━━━━━━━━━━━" & vbCrLf
selShiShou = RTBox.SelStart
LoadRtBox
.MoveFirst
.Move old
End If
Next k
Zjine = Round(Zjine * 2) / 2
txtYingShou.Text = Zjine
comYouHui_Click
End With
End Sub
Sub LoadRtBox()
'
On Error Resume Next
With frmMain.Data1.Recordset
RTBox.SelText = .Fields("名称") & "上机详细状况" & vbCrLf
RTBox.SelText = "上机人姓名:" & .Fields("客户姓名") & vbCrLf
RTBox.SelText = "上机人证件(" & .Fields("客户证件") & "):" & .Fields("证件号码") & vbCrLf
RTBox.SelText = "开始时间:" & Format(.Fields("开始时间"), "yyyy年mm月dd日hh:nn") & vbCrLf
RTBox.SelText = "结束时间:" & Format(Now, "yyyy年mm月dd日hh:nn") & vbCrLf
mm = DateDiff("n", .Fields("开始时间"), Now)
Zje = .Fields("单位费用").Value * mm / 60
'金额
If Zje <= frmMain.Data7.Recordset.Fields("最低消费额") Then Zje = frmMain.Data7.Recordset.Fields("最低消费额")
If frmMain.Data7.Recordset.Fields("取整金额") = 0.5 Then
Zje = Round(Zje * 2) / 2
Else
Zje = Round(Zje)
End If
RTBox.SelText = "所用时间:" & mm \ 60 & "小时" & mm Mod 60 & "分钟" & vbCrLf '
RTBox.SelText = "上机金额:" & Format(Zje, "¥###0.00元") & vbCrLf
ss = RTBox.SelStart
Shangpin = 0
'其他花费
frmMain.Data2.Recordset.MoveFirst
For i = 1 To frmMain.Data2.Recordset.RecordCount
If frmMain.Data2.Recordset.Fields("机号").Value = .Fields("机号").Value Then
frmMain.Data3.Recordset.MoveFirst
For j = 1 To frmMain.Data3.Recordset.RecordCount
If frmMain.Data3.Recordset.Fields("商品编号").Value = frmMain.Data2.Recordset.Fields("商品编号").Value Then Exit For
frmMain.Data3.Recordset.MoveNext
Next j
Shangpin = Shangpin + frmMain.Data2.Recordset.Fields("数量").Value * frmMain.Data3.Recordset.Fields("零售价格")
RTBox.SelText = " " & frmMain.Data3.Recordset.Fields("商品名称") & ":" & Format(frmMain.Data3.Recordset.Fields("零售价格"), "###0.00元") _
& "*" & "" & frmMain.Data2.Recordset.Fields("数量").Value _
& "=" & Format(frmMain.Data2.Recordset.Fields("数量").Value * frmMain.Data3.Recordset.Fields("零售价格"), "###0.00元") & vbCrLf
End If
frmMain.Data2.Recordset.MoveNext
Next i
' If Shangpin > 0 Then ListView1.ListItems(Index).SubItems(6) = Format(Shangpin, "###,###0.00元")
RTBox.SelStart = ss
RTBox.SelText = "其他花费:" & Format(Shangpin, "¥###0.00元") & vbCrLf
RTBox.SelStart = Len(RTBox.Text)
RTBox.SelText = "───────────────────" & vbCrLf
Zje = Zje + Shangpin
RTBox.SelText = "以上金额合计:" & Format(Zje, "¥###0.00元") & vbCrLf
selShiShou = RTBox.SelStart
RTBox.SelText = "━━━━━━━━━━━━━━━━━━━" & vbCrLf
RTBox.SelText = "实 收 金 额 :" & Format(Val(txtShiShou.Text), "¥###0.00元") & vbCrLf
End With
End Sub
Private Sub txtShiShou_Change()
If selShiShou <> 0 Then
RTBox.SelStart = selShiShou
RTBox.SelLength = Len(RTBox.Text) - selShiShou
RTBox.SelText = "━━━━━━━━━━━━━━━━━━━" & vbCrLf
RTBox.SelText = "实 收 金 额 :" & Format(Val(txtShiShou.Text), "¥###0.00元") & vbCrLf
End If
End Sub
Private Sub txtShiShou_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) Like "[!0-9.]" And (Not KeyAscii = 8) Then KeyAscii = 0
End Sub