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

📄 form_ktk.frm

📁 射频卡收费系统 自主开发 可以用于任何商业收费场所
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   4920
      TabIndex        =   7
      Top             =   3480
      Width           =   300
   End
   Begin VB.Label Label8 
      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            =   3000
      TabIndex        =   6
      Top             =   360
      Width           =   1560
   End
   Begin VB.Label Label6 
      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
      ForeColor       =   &H00FF0000&
      Height          =   285
      Left            =   1920
      TabIndex        =   5
      Top             =   360
      Width           =   900
   End
   Begin VB.Label Label7 
      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
      ForeColor       =   &H000000FF&
      Height          =   285
      Left            =   120
      TabIndex        =   4
      Top             =   4560
      Width           =   4500
   End
End
Attribute VB_Name = "Form_ktk"
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
    
 

MSComm1.PortOpen = True
    
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""

Command2.SetFocus
    

End If

End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Form_Load()
MSComm1.CommPort = com_x '串口号,
MSComm1.Settings = "9600,N,8,1" '串口的属性
MSComm1.InputLen = 0 '接收缓冲区的大小
MSComm1.InputMode = comInputModeBinary '二进制接受方式
MSComm1.RThreshold = 7 '每7个字节响应消息
MSComm1.PortOpen = True '打开通信串口
    
  

  
  
 
With chzh_cn
    .ConnectionString = dblianjie
    .Open
End With



End Sub

Private Sub Form_Unload(Cancel As Integer)
    chzh_cn.Close
    Set kayue_cn = Nothing
     
   
   If (MSComm1.PortOpen) Then
        MSComm1.PortOpen = False
    End If
End Sub

Private Sub MSComm1_OnComm()
 Select Case MSComm1.CommEvent '串口事件
    Case comEvReceive '接收到数据
    Dim Buffer As Variant '存储数据的缓冲区
    Dim StringBuf(8) As String '数据数组
    
    Buffer = MSComm1.Input '清理接收缓冲区,此时,接收的字节数已经为0
    'Dim CardNumber As Long '卡号
    
    CardNumber = CDec(Buffer(3)) * 2 ^ 24 + (Buffer(4) * 2 ^ 16) + (Buffer(5) * 2 ^ 8) + Buffer(6) '单个字节数据左移
   '----------------------------------
    
   
    Set yue = New Recordset
    
    yue.CursorLocation = adUseClient
    yue.CursorType = adOpenDynamic
    
    yue.Open "select * from 卡资料 where 卡号='" & CStr(CardNumber) & "'", chzh_cn
   
    If yue.RecordCount > 0 Then
        If Trim(yue.Fields("卡状态")) = "正常" 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("身份证号"))
             Text7.Text = Format(yue.Fields("累计消费"), "0.00")
             
             Text3.Text = "0"
             Text3.SetFocus
        
              
         
             If (MSComm1.PortOpen) Then
                 MSComm1.PortOpen = False
             End If
             
        Else
            If (MSComm1.PortOpen) Then
                 MSComm1.PortOpen = False
             End If
            MsgBox "本卡已挂失!", vbExclamation, "读卡提示"
            MSComm1.PortOpen = True
            Text4.Text = ""
             Text5.Text = ""
             Text6.Text = ""
             Text7.Text = ""
            Text1.Text = ""
            Text2.Text = ""
            Text3.Text = ""
            
        
        
        
        End If
        
    Else
        If (MSComm1.PortOpen) Then
            MSComm1.PortOpen = False
        End If
       MsgBox "非本系统注册的卡!", vbExclamation, "读卡提示"
       MSComm1.PortOpen = True
       Text4.Text = ""
        Text5.Text = ""
        Text6.Text = ""
        Text7.Text = ""
       Text1.Text = ""
       Text2.Text = ""
       Text3.Text = ""
       
    End If
   
 End Select

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



⌨️ 快捷键说明

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