📄 form_khtk.frm
字号:
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 1560
TabIndex = 11
Top = 1800
Width = 1200
End
Begin VB.Label Label10
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "姓名"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 2160
TabIndex = 10
Top = 1320
Width = 600
End
Begin VB.Label Label11
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "性别"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 4800
TabIndex = 9
Top = 1320
Width = 600
End
End
Attribute VB_Name = "Form_khtk"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim CardNumber As Double
Dim chzh_cn As New Connection
Dim yue As Recordset
Dim r_chzhjl As Recordset
Private Sub Command1_Click()
If Trim(Text1) <> "" And Trim(Text2) <> "" And Trim(Text3) <> "" Then
If CDbl(Text2.Text) <> 0 Then
If CDbl(Text3.Text) <= CDbl(Text2.Text) Then
If CDbl(Text3.Text) > 0 Then
Set yue = New Recordset
yue.CursorLocation = adUseClient
yue.CursorType = adOpenDynamic
yue.LockType = adLockOptimistic
yue.Open "select * from 卡资料 where 卡编号='" & Trim(Text1.Text) & "'", chzh_cn
yue.Fields("卡余额") = yue.Fields("卡余额") - CDbl(Text3.Text)
yue.Update
yue.Close
Set r_chzhjl = New Recordset
r_chzhjl.CursorLocation = adUseClient
r_chzhjl.CursorType = adOpenDynamic
r_chzhjl.LockType = adLockOptimistic
r_chzhjl.Open "select top 1 * from 卡退款记录 ", chzh_cn
r_chzhjl.AddNew
r_chzhjl.Fields("卡编号") = Trim(Text1.Text)
r_chzhjl.Fields("退款金额") = CDbl(Text3.Text)
r_chzhjl.Fields("日期") = Date
r_chzhjl.Fields("时间") = Date + Time
r_chzhjl.Fields("操作人") = yonghuming
If Time < #6:00:00 AM# Then
r_chzhjl.Fields("出帐日期") = Date - 1
Else
r_chzhjl.Fields("出帐日期") = Date
End If
r_chzhjl.Update
' '=======================打印
' setprinter "batai"
'
' Dim xx As Integer
'
' xx = 10
' Printer.Font.Underline = False
' Printer.ScaleMode = vbPoints
'
' Printer.Font.Name = "宋体"
'
'
' Printer.Font.Size = 16
' Printer.CurrentX = xx
' Printer.Print "爱情麻辣烫卡退款记录"
' Printer.Font.Size = 13
'
'
' Printer.CurrentX = xx
' Printer.CurrentY = Printer.CurrentY + 10
' Printer.Font.Size = 12
' Printer.CurrentX = xx
' Printer.Print "收银员:" & yonghuming
' Printer.CurrentX = xx
' Printer.Print "退款时间:" & Format(r_chzhjl.Fields("时间"), "yy-mm-dd hh:mm:ss")
'
' Printer.CurrentY = Printer.CurrentY + 10
'
' Printer.CurrentX = xx
' Printer.Print "-----------------------------"
'
' Printer.Font.Size = 13
' Printer.CurrentX = xx
' Printer.Print "卡编号:" & Trim(Text1.Text)
' Printer.CurrentY = Printer.CurrentY + 5
'
' Printer.CurrentX = xx
' Printer.Print "退款金额:" & Format(Text3.Text, "0.00")
'
' Printer.CurrentY = Printer.CurrentY + 5
'
' Printer.CurrentX = xx
' Printer.Print "卡余额:" & Format(CDbl(Text2.Text) - CDbl(Text3.Text), "0.00")
'
' Printer.CurrentY = Printer.CurrentY + 15
'
' Printer.CurrentX = xx
' Printer.Print "应退现金:" & Format(CDbl(Text3.Text), "0.00")
'
' Printer.Print
' Printer.Print
' Printer.Print "."
' Printer.EndDoc
'
' '=======================打印
'
'----------------------
MsgBox "退款成功!", vbInformation, "提示"
Else
MsgBox "退款额不能小于零!", vbExclamation, "提示"
End If
Else
MsgBox "退款额不能大于卡余额!", vbExclamation, "提示"
End If
Else
MsgBox "卡余额等于零,不能退款!", vbExclamation, "提示"
End If
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Command2.SetFocus
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
Set yue = New Recordset
yue.CursorLocation = adUseClient
yue.CursorType = adOpenDynamic
yue.Open "select * from 卡资料 where 卡编号='" & Trim(Text7.Text) & "'", chzh_cn
If yue.RecordCount > 0 Then
Text1.Text = Trim(yue.Fields("卡编号"))
Text2.Text = Format(yue.Fields("卡余额"), "0.00")
Text4.Text = Trim(yue.Fields("姓名"))
Text5.Text = Trim(yue.Fields("性别"))
Text6.Text = Trim(yue.Fields("身份证号"))
Text3.Text = "0"
Text3.SetFocus
Else
MsgBox "没有此卡编号,请查证!", vbExclamation, "读卡提示"
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End If
End Sub
Private Sub Form_Load()
With chzh_cn
.ConnectionString = dblianjie
.Open
End With
End Sub
Private Sub Form_Unload(Cancel As Integer)
chzh_cn.Close
Set kayue_cn = Nothing
End Sub
Private Sub Text3_GotFocus()
Text3.SelStart = 0
Text3.SelLength = Len(Text3)
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If Not (Chr(KeyAscii) Like "[0-9]" Or Chr(KeyAscii) = "." Or KeyAscii = vbKeyBack Or KeyAscii = 13) Then
KeyAscii = 0
End If
If KeyAscii = 13 And Text3.Text <> "" Then
Command1.SetFocus
End If
End Sub
Private Sub Text7_GotFocus()
Text7.SelStart = 0
Text7.SelLength = Len(Text7)
End Sub
Private Sub Text7_KeyPress(KeyAscii As Integer)
If Not (Chr(KeyAscii) Like "[0-9]" Or KeyAscii = vbKeyBack Or KeyAscii = 13) Then
KeyAscii = 0
End If
If KeyAscii = 13 And Text7.Text <> "" Then
Command3.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -