📄 frmmoneycard.frm
字号:
VERSION 5.00
Object = "{A964BDA3-3E93-11CF-9A0F-9E6261DACD1C}#2.0#0"; "resize32.ocx"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{0B81E4A9-BE4E-4AEF-9272-33AB5B51C6FC}#1.0#0"; "XPControls.ocx"
Begin VB.Form frmMoneyCard
BackColor = &H80000018&
Caption = "代金卡管理"
ClientHeight = 9000
ClientLeft = 60
ClientTop = 450
ClientWidth = 12975
Icon = "frmMoneyCard.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MDIChild = -1 'True
ScaleHeight = 9000
ScaleMode = 0 'User
ScaleWidth = 12540
Begin ResizeLibCtl.ReSize ReSize1
Left = 6030
Top = 4290
_Version = 131072
_ExtentX = 741
_ExtentY = 741
_StockProps = 0
Enabled = -1 'True
FormMinWidth = 0
FormMinHeight = 0
FormDesignHeight= 9000
FormDesignWidth = 12975
End
Begin VB.Frame Frame3
BackColor = &H80000018&
Caption = "消费记录"
Height = 8625
Left = 6120
TabIndex = 16
Top = 210
Width = 6675
Begin MSComctlLib.ListView lvwConsumeInfo
Height = 8175
Left = 150
TabIndex = 8
Top = 270
Width = 6375
_ExtentX = 11245
_ExtentY = 14420
View = 3
LabelEdit = 1
MultiSelect = -1 'True
LabelWrap = -1 'True
HideSelection = 0 'False
FullRowSelect = -1 'True
GridLines = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 5
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Text = "日期"
Object.Width = 3246
EndProperty
BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 1
Text = "存入"
Object.Width = 1482
EndProperty
BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 2
Text = "支出"
Object.Width = 1482
EndProperty
BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 3
Text = "备注"
Object.Width = 1835
EndProperty
BeginProperty ColumnHeader(5) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 4
Text = "操作员"
Object.Width = 1658
EndProperty
End
End
Begin VB.Frame Frame4
BackColor = &H80000018&
Caption = "代金卡查询"
Height = 5985
Left = 210
TabIndex = 11
Top = 240
Width = 5775
Begin MSComctlLib.ListView lvwMoneyCard
Height = 4815
Left = 150
TabIndex = 1
Top = 960
Width = 5445
_ExtentX = 9604
_ExtentY = 8493
View = 3
LabelEdit = 1
LabelWrap = -1 'True
HideSelection = 0 'False
FullRowSelect = -1 'True
GridLines = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 4
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Text = "卡号"
Object.Width = 2540
EndProperty
BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 1
Text = "余额(元)"
Object.Width = 1482
EndProperty
BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 2
Text = "发放日期"
Object.Width = 2540
EndProperty
BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 3
Text = "有效期至"
Object.Width = 1834
EndProperty
End
Begin VB.CommandButton cmdQuery
BackColor = &H80000018&
Height = 315
Left = 2670
Picture = "frmMoneyCard.frx":1982
Style = 1 'Graphical
TabIndex = 13
Top = 540
Width = 525
End
Begin VB.TextBox txtMoneyCard
Height = 285
Left = 420
TabIndex = 0
Top = 570
Width = 2205
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "请输入卡号:"
Height = 255
Left = 420
TabIndex = 12
Top = 270
Width = 1245
End
End
Begin VB.Frame Frame1
BackColor = &H80000018&
Caption = "代金卡操作"
Height = 2445
Left = 210
TabIndex = 10
Top = 6390
Width = 5775
Begin MSComCtl2.DTPicker dtpStopTime
Height = 285
Left = 2310
TabIndex = 4
Top = 1140
Width = 1395
_ExtentX = 2461
_ExtentY = 503
_Version = 393216
Format = 23855105
CurrentDate = 38337
End
Begin VB.TextBox txtCardID
Height = 285
Left = 2310
TabIndex = 2
Top = 360
Width = 1365
End
Begin VB.Frame Frame2
BackColor = &H80000018&
Caption = "操作"
Height = 855
Left = 270
TabIndex = 15
Top = 1470
Width = 5205
Begin XPControls.XPCommandButton cmdSendCard
Height = 375
Left = 120
TabIndex = 5
Top = 330
Width = 1035
_ExtentX = 1826
_ExtentY = 661
Caption = "发卡"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin XPControls.XPCommandButton cmdAppendMoney
Height = 375
Left = 1425
TabIndex = 6
Top = 330
Width = 1035
_ExtentX = 1826
_ExtentY = 661
Caption = "充值"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin XPControls.XPCommandButton XPCommandButton3
Cancel = -1 'True
Height = 375
Left = 4050
TabIndex = 9
Top = 330
Width = 1035
_ExtentX = 1826
_ExtentY = 661
Caption = "退出"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin XPControls.XPCommandButton cmdCancelCard
Height = 375
Left = 2745
TabIndex = 7
Top = 330
Width = 1035
_ExtentX = 1826
_ExtentY = 661
Caption = "注销"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
End
Begin VB.TextBox txtMoney
Alignment = 2 'Center
ForeColor = &H000000FF&
Height = 285
Left = 2310
TabIndex = 3
Top = 750
Width = 1365
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "有效期至:"
Height = 225
Left = 150
TabIndex = 18
Top = 1140
Width = 1935
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "请输入卡号或刷卡:"
Height = 255
Left = 150
TabIndex = 17
Top = 360
Width = 1935
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "请输入要充值的金额(元):"
Height = 195
Left = 150
TabIndex = 14
Top = 750
Width = 2325
End
End
End
Attribute VB_Name = "frmMoneyCard"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cmdAppendMoney_Click()
On Error GoTo ErrMsg
Dim Status
Dim strSQL As String
Dim rstemp As ADODB.Recordset
Dim itmCard As ListItem
Dim strCardID As String
Dim curMoney As Currency
Dim dtmStopTime As Date
Me.MousePointer = vbHourglass
'是否有输入
strCardID = Trim(txtCardID.Text)
'卡号是否为空
If strCardID = "" Then
MsgBox "请输入要充值的卡号!", vbInformation, "提示"
txtCardID.SetFocus
GoTo ExitLab
End If
'卡号是否存在
strSQL = "select Count(*) from SET_MONEYCARD" _
& " where CardID='" & strCardID & "'"
Set rstemp = New ADODB.Recordset
rstemp.Open strSQL, GCon, adOpenForwardOnly, adLockReadOnly
If rstemp(0) < 1 Then
MsgBox "您输入的卡号不存在。如果是第一次使用,请单击“发卡”按钮!", _
vbInformation, "提示"
txtCardID.SetFocus
GoTo ExitLab
End If
rstemp.Close
'充值金额
curMoney = CCur(Val(txtMoney.Text))
'有效期
dtmStopTime = dtpStopTime.Value
'是否有效
If dtmStopTime <= Date Then
MsgBox "您输入的有效期不合理,请核对后重新输入!", vbExclamation, "提示"
dtpStopTime.SetFocus
GoTo ExitLab
End If
'提示操作
If MsgBox("您将对卡号“" & strCardID & "”充值 “" & CStr(curMoney) & "” 元" _
& vbCrLf & "有效期至:" & CStr(dtmStopTime) _
& vbCrLf & "确实要继续吗?", _
vbQuestion + vbYesNo + vbDefaultButton1, "提示") = vbNo Then
txtCardID.SetFocus
GoTo ExitLab
End If
'在事务中进行充值操作
GCon.BeginTrans
On Error GoTo RollBack
'更新总表
strSQL = "update SET_MONEYCARD set" _
& " CardBalance=CardBalance+" & curMoney _
& ",StopTime='" & dtmStopTime & "'" _
& " where CardID='" & strCardID & "'"
GCon.Execute strSQL
'在消费表中添加一条记录
If CardConsume(strCardID, True, curMoney, Now) = False Then GoTo RollBack
'提交事务
GCon.CommitTrans
'提示
MsgBox "充值成功!", vbInformation, "提示"
txtCardID.Text = ""
txtMoney.Text = ""
'跳转焦点
txtCardID.SetFocus
'刷新
' CmdQuery_Click
GoTo ExitLab
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -