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

📄 发卡.frm

📁 浴馆管理软件(包括IC卡的操作、动态库的调用等内容)
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmfaka 
   Caption         =   "发卡"
   ClientHeight    =   4575
   ClientLeft      =   3345
   ClientTop       =   1470
   ClientWidth     =   5640
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   ScaleHeight     =   4575
   ScaleWidth      =   5640
   Begin VB.TextBox Text6 
      Height          =   375
      Left            =   1560
      TabIndex        =   14
      Top             =   2520
      Width           =   2175
   End
   Begin VB.TextBox Text5 
      Height          =   375
      Left            =   1560
      TabIndex        =   12
      Top             =   1320
      Width           =   2175
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   1560
      TabIndex        =   4
      Top             =   720
      Width           =   2175
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   1560
      TabIndex        =   3
      Top             =   1920
      Width           =   2175
   End
   Begin VB.TextBox Text3 
      Height          =   375
      Left            =   1560
      TabIndex        =   2
      Top             =   3120
      Width           =   1335
   End
   Begin VB.TextBox Text4 
      Height          =   375
      Left            =   1560
      TabIndex        =   1
      Top             =   3720
      Width           =   1335
   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          =   1455
      Left            =   4560
      TabIndex        =   0
      Top             =   1080
      Width           =   615
   End
   Begin VB.Line Line3 
      X1              =   0
      X2              =   5640
      Y1              =   3000
      Y2              =   3000
   End
   Begin VB.Label Label10 
      Caption         =   "(四位,不够前面加0.如800元表示为0800.)"
      Height          =   495
      Left            =   3000
      TabIndex        =   16
      Top             =   3720
      Width           =   2535
   End
   Begin VB.Label Label9 
      Caption         =   "(三位,不够前面加0.如:86号表示为086.)"
      Height          =   495
      Left            =   3000
      TabIndex        =   15
      Top             =   3120
      Width           =   2535
   End
   Begin VB.Label Label8 
      Caption         =   "发卡时间:"
      Height          =   375
      Left            =   240
      TabIndex        =   13
      Top             =   2520
      Width           =   1095
   End
   Begin VB.Label Label7 
      Caption         =   "电话:"
      Height          =   375
      Left            =   600
      TabIndex        =   11
      Top             =   1440
      Width           =   735
   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            =   1440
      TabIndex        =   10
      Top             =   0
      Width           =   2895
   End
   Begin VB.Line Line1 
      X1              =   0
      X2              =   5640
      Y1              =   480
      Y2              =   480
   End
   Begin VB.Line Line2 
      X1              =   0
      X2              =   5640
      Y1              =   600
      Y2              =   600
   End
   Begin VB.Label Label2 
      Caption         =   "姓名:"
      Height          =   255
      Left            =   600
      TabIndex        =   9
      Top             =   840
      Width           =   735
   End
   Begin VB.Label Label3 
      Caption         =   "身份证号:"
      Height          =   255
      Left            =   240
      TabIndex        =   8
      Top             =   2040
      Width           =   975
   End
   Begin VB.Label Label4 
      Caption         =   "卡号:"
      Height          =   255
      Left            =   600
      TabIndex        =   7
      Top             =   3240
      Width           =   735
   End
   Begin VB.Label Label5 
      Caption         =   "金额:"
      Height          =   255
      Left            =   600
      TabIndex        =   6
      Top             =   3840
      Width           =   735
   End
   Begin VB.Label Label6 
      BorderStyle     =   1  'Fixed Single
      Height          =   2175
      Left            =   4320
      TabIndex        =   5
      Top             =   720
      Width           =   1095
   End
End
Attribute VB_Name = "frmfaka"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False


Private Sub Command1_Click()


       
If (Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text5.Text = "" Or Text6.Text = "") Then
   MsgBox "您输入的信息不全,请核对。", vbInformation, "提示!"
   Exit Sub
End If

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
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 xie As Integer
    Dim str1 As String
    str1 = Text3.Text
    
    Dim str2 As String
    str2 = Text4.Text
    
    'Dim str0 As String
    str0 = str1 + str2
    
    xie = SLE4442_WriteChar(32, 7, str0)
     If (xie <> 0) Then
         MsgBox "数据写入失败!", vbInformation, "提示!"
         Exit Sub
     End If
        xie = SLE4442_WriteChar(111, 7, str0)
        MsgBox "贵宾卡发行成功!", vbInformation, "提示!"

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

'把信息写入数据库
Dim lidicn As New ADODB.Connection
lidicn.Open "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = 信息库.mdb;"
Dim lidirs As New ADODB.Recordset
lidirs.Open " 卡表", lidicn, adOpenKeyset, adLockOptimistic
lidirs.AddNew
lidirs!IC号 = Text3.Text
lidirs!姓名 = Text1.Text
lidirs!电话 = Text5.Text
lidirs!身份证号码 = Text2.Text
lidirs!发卡时间 = Str(Date)
lidirs!余额 = CInt(Text4.Text)
lidirs!消费额 = 0
lidirs!是否挂失 = "No"
lidirs.Update
lidirs.Close


End Sub

Private Sub Form_Load()
Text6.Text = Str(Date)
'Dim lidicn As New ADODB.Connection
'Dim lidirs As New ADODB.Recordset
'lidicn.Open "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = 信息库.mdb;"

End Sub

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

Private Sub Text3_LostFocus()

'校验是否有重复的卡号
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 (Not lidirs.BOF) And (Not lidirs.EOF) Then
   MsgBox "卡号重复,请换别的卡号!", vbInformation, "提示!"
   lidirs.Close
   Text3.Text = ""
   Exit Sub
End If

If Len(Text3.Text) <> 3 Then
    MsgBox "您输入的字段长度不对!", vbInformation, "错误!"
    Exit Sub
     Text3.Text = ""
End If
   
End Sub

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

Private Sub Text4_LostFocus()
If Len(Text4.Text) <> 4 Then
    MsgBox "您输入的字段长度不对!", vbInformation, "错误!"
    Exit Sub
    Text4.Text = ""
End If
End Sub


⌨️ 快捷键说明

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