⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 充值.frm

📁 浴馆管理软件(包括IC卡的操作、动态库的调用等内容)
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmcongzi 
   Caption         =   "充值"
   ClientHeight    =   4755
   ClientLeft      =   3345
   ClientTop       =   2130
   ClientWidth     =   5625
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   ScaleHeight     =   4755
   ScaleWidth      =   5625
   Begin VB.TextBox Text10 
      Height          =   270
      Left            =   120
      TabIndex        =   19
      Text            =   "Text10"
      Top             =   3600
      Visible         =   0   'False
      Width           =   1455
   End
   Begin VB.TextBox Text9 
      Height          =   270
      Left            =   120
      TabIndex        =   18
      Text            =   "000"
      Top             =   1800
      Visible         =   0   'False
      Width           =   855
   End
   Begin VB.TextBox Text8 
      Height          =   270
      Left            =   120
      TabIndex        =   17
      Text            =   "00"
      Top             =   1200
      Visible         =   0   'False
      Width           =   855
   End
   Begin VB.TextBox Text7 
      Height          =   270
      Left            =   120
      TabIndex        =   16
      Text            =   "0"
      Top             =   720
      Visible         =   0   'False
      Width           =   855
   End
   Begin VB.TextBox Text6 
      Height          =   375
      Left            =   1560
      TabIndex        =   15
      Top             =   3960
      Width           =   2175
   End
   Begin VB.CommandButton Command2 
      Caption         =   "读  卡"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   3960
      TabIndex        =   13
      Top             =   960
      Width           =   1455
   End
   Begin VB.TextBox Text5 
      Height          =   375
      Left            =   1560
      TabIndex        =   12
      Top             =   3240
      Width           =   2175
   End
   Begin VB.CommandButton Command1 
      Caption         =   " 充      值"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1575
      Left            =   4440
      TabIndex        =   10
      Top             =   2520
      Width           =   615
   End
   Begin VB.TextBox Text4 
      Height          =   375
      Left            =   1560
      TabIndex        =   8
      Top             =   2640
      Width           =   2175
   End
   Begin VB.TextBox Text3 
      Height          =   375
      Left            =   1560
      TabIndex        =   7
      Top             =   2040
      Width           =   2175
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   1560
      TabIndex        =   6
      Top             =   1440
      Width           =   2175
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   1560
      TabIndex        =   5
      Top             =   840
      Width           =   2175
   End
   Begin VB.Line Line5 
      X1              =   3840
      X2              =   5520
      Y1              =   1920
      Y2              =   1920
   End
   Begin VB.Line Line4 
      X1              =   3840
      X2              =   5520
      Y1              =   1800
      Y2              =   1800
   End
   Begin VB.Label Label8 
      Caption         =   "总额:"
      Height          =   375
      Left            =   840
      TabIndex        =   14
      Top             =   3960
      Width           =   615
   End
   Begin VB.Line Line3 
      X1              =   0
      X2              =   3840
      Y1              =   3120
      Y2              =   3120
   End
   Begin VB.Label Label7 
      Caption         =   "充值:"
      Height          =   255
      Left            =   840
      TabIndex        =   11
      Top             =   3360
      Width           =   615
   End
   Begin VB.Label Label6 
      BorderStyle     =   1  'Fixed Single
      Height          =   2415
      Left            =   4080
      TabIndex        =   9
      Top             =   2160
      Width           =   1335
   End
   Begin VB.Label Label5 
      Caption         =   "剩余金额:"
      Height          =   255
      Left            =   480
      TabIndex        =   4
      Top             =   2760
      Width           =   975
   End
   Begin VB.Label Label4 
      Caption         =   "卡号:"
      Height          =   375
      Left            =   840
      TabIndex        =   3
      Top             =   2160
      Width           =   615
   End
   Begin VB.Label Label3 
      Caption         =   "身份证号:"
      Height          =   255
      Left            =   480
      TabIndex        =   2
      Top             =   1560
      Width           =   975
   End
   Begin VB.Label Label2 
      Caption         =   "姓名:"
      Height          =   375
      Left            =   840
      TabIndex        =   1
      Top             =   960
      Width           =   615
   End
   Begin VB.Line Line2 
      X1              =   0
      X2              =   5400
      Y1              =   600
      Y2              =   600
   End
   Begin VB.Line Line1 
      X1              =   0
      X2              =   5400
      Y1              =   480
      Y2              =   480
   End
   Begin VB.Label Label1 
      Caption         =   "欢迎使用富美贵宾卡"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1200
      TabIndex        =   0
      Top             =   120
      Width           =   2895
   End
   Begin VB.Menu numcongzhi 
      Caption         =   "充值查询(&S)"
   End
End
Attribute VB_Name = "frmcongzi"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Command1_Click()

'错误检测
On Error GoTo lidierror
lidierror:
       MsgBox "没有检测到有关设备,请检查设备是否连接好。", vbInformation, "错误!"
       Exit Sub
       
       
   ' Dim zhong As Integer '定义重价前
    Dim chang As Integer '重价的长度
    Dim str2 As String
    
   ' Dim jin As String
    'Dim ll As String
    Dim lidicn As New ADODB.Connection
    Dim lidirs As New ADODB.Recordset
    lidicn.Open "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = 信息库.mdb;"
    
  Text6.Text = CStr(CInt(Text4.Text) + CInt(Text5.Text))
    chang = Len(Text6.Text)
   ' ll = Str(zhong)
    If chang = 1 Then
      Text10.Text = Text9.Text + Text6.Text
    ElseIf chang = 2 Then
     Text10.Text = Text8.Text + Text6.Text
    ElseIf chang = 3 Then
      Text10.Text = Text7.Text + Text6.Text
    ElseIf chang = 4 Then
     Text10.Text = Text6.Text
    End If
    str2 = Text3.Text + Text10.Text
    
    
    
    '打开连接
Dim kai As Integer
kai = MCS_InitComm(0, 115200)
If (kai <> 0) Then
    MsgBox "没有检测到IC卡读写器。", vbInformation, "错误!"
    MCS_LED (2)
    Exit Sub
End If

        '打开卡
Dim ka  As Integer
Dim str0 As String
str0 = String(4, Str(0))
ka = SLE4442_OpenCard(str0)
If (ka <> 0) Then
  MsgBox "读写器中没有卡,请检查卡是否插好。", vbInformation, "错误!"
     MCS_LED (2)
   Exit Sub
Else
       MCS_LED (1)
End If

'校验密码
     Dim yanmima  As Integer
    Dim ps(3) As Integer
    ps(0) = &H86
    ps(1) = &H86
    ps(2) = &H86
    yanmima = SLE4442_VerifyPWD(ps(0), ps(1), ps(2))
    If (yanmima <> 0) Then
       MsgBox "密码错误,您用了非法卡!", vbInformation, "警告!"
       Exit Sub
    End If

 '写卡
    Dim xie2 As Integer
    Dim xie As Integer
   ' Dim str1 As String
    'str1 = Text1.Text
    xie2 = SLE4442_WriteChar(111, 7, str2)
    xie = SLE4442_WriteChar(32, 7, str2)
     If (xie <> 0) Then
         MsgBox "数据写入失败!", vbInformation, "提示!"
         Exit Sub
     End If
        MsgBox "充值成功,数据已成功写入!", vbInformation, "提示!"
      

  '关闭连接和关闭卡
Dim guan As Integer
guan = SLE4442_CloseCard()
MCS_LED (2)
guan = MCS_ExitComm()

'写入数据库
lidirs.Open "select * from 卡表 " + " where IC号 like" + "'" + Text3.Text + "'", lidicn, adOpenKeyset, adLockOptimistic

lidirs!余额 = CInt(Text6.Text)
lidirs.Update
lidirs.Close

lidirs.Open " 充值表", lidicn, adOpenKeyset, adLockOptimistic
lidirs.AddNew
lidirs!卡号 = Text3.Text
lidirs!姓名 = Text1.Text
lidirs!充值时间 = Str(Date)
lidirs!充值金额 = CInt(Text5.Text)
lidirs.Update
lidirs.Close

MsgBox "充值成功!", vbInformation, "提示!"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""

End Sub

Private Sub Command2_Click()
On Error GoTo lidierror
lidierror:
       MsgBox "没有检测到有关设备,请检查设备是否连接好。", vbInformation, "错误!"
       Exit Sub
    '打开连接
Dim kai As Integer
kai = MCS_InitComm(0, 115200)
If (kai <> 0) Then
    MsgBox "没有检测到IC卡读写器。", vbInformation, "错误!"
    MCS_LED (2)
    Exit Sub
End If

        '打开卡
Dim ka  As Integer
Dim str0 As String
str0 = String(4, Str(0))

ka = SLE4442_OpenCard(str0)
If (ka <> 0) Then
  MsgBox "读写器中没有卡,请检查卡是否插好。", vbInformation, "错误!"
     MCS_LED (2)
   Exit Sub
'Else
'MCS_LED (1)
End If
    
    '读卡
    'Dim i, iStart, iLen As Integer
    Dim du As Integer
    Dim str1 As String '读卡好
    str1 = String(3, Chr(0))
    du = SLE4442_ReadChar(32, 3, str1)
    If (du <> 0) Then
       MsgBox "数据读取失败!", vbInformation, "提示"
       Exit Sub
    Else
       Text3.Text = str1
    End If
    
    str1 = String(4, Chr(0)) '读金额
     du = SLE4442_ReadChar(35, 4, str1)
    If (du <> 0) Then
       MsgBox "数据读取失败!", vbInformation, "提示"
       Exit Sub
    Else
       Text4.Text = str1
    End If
    
    Dim lidicn As New ADODB.Connection
    Dim lidirs As New ADODB.Recordset
    lidicn.Open "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = 信息库.mdb;"
    lidirs.Open "select * from 卡表 " + " where IC号 like" + "'" + Text3.Text + "'", lidicn
    If (lidirs.BOF Or lidirs.EOF) Then
          MsgBox "没有您要查询的结果,你使用了非法卡!", vbInformation, "提示!"
          Exit Sub
    Else
          Text1.Text = lidirs!姓名
          Text2.Text = lidirs!身份证号码
    End If
    
    '关闭连接和关闭卡
Dim guan As Integer
guan = SLE4442_CloseCard()
MCS_LED (2)
guan = MCS_ExitComm()
End Sub

Private Sub jieguashi_Click()
  
End Sub

Private Sub numcongzhi_Click()
 frmfindcongzhi.show
End Sub

Private Sub Text5_Change()
'Int(Text4.Text) + CInt(Text5.Text)

End Sub

Private Sub Text5_KeyPress(KeyAscii As Integer)
If KeyAscii < 48 Or KeyAscii > 57 Then
   MsgBox "请输入数字", vbInformation, "提示"
   KeyAscii = 0
   
End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -