📄 tm0a.cls
字号:
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "timecard"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
Private mvarcardpwd As Long '局部复制
Private mvarhotelcode As Long '局部复制
Private mvarcardno As Long '局部复制
Private mvartmdatetime As Date '局部复制
Private mvarreadtimeable As Boolean '局部复制
Public Property Let readtimeable(ByVal vData As Boolean)
mvarreadtimeable = vData
End Property
Public Property Get readtimeable() As Boolean
readtimeable = mvarreadtimeable
End Property
Public Property Let tmdatetime(ByVal vData As Date)
mvartmdatetime = vData
End Property
Public Property Get tmdatetime() As Date
tmdatetime = mvartmdatetime
End Property
Public Function tread() As Boolean
Dim ptemp As String
Dim temp As String
Dim n As Long
Dim i As Integer
Dim card1 As New tmreadtype
Set card1 = New tmreadtype
With card1
.treadtype
temp = .romid
i = CLng("&H" + Mid(temp, 15, 2))
If i <> 4 Then
Err.Raise 60094, , GetError(94)
tread = False
Exit Function
End If
End With
temp = ""
ptemp = ""
ptemp = tm94.readtm94()
If (ptemp = "") Or (Len(ptemp) <> 22) Then
tread = False
Err.Raise 60012, "tm94.readtm94", GetError(12)
Else
tread = True
temp = Mid(ptemp, 1, 8)
n = CLng("&H" + temp)
tmdatetime = DateAdd("s", n, "1970/1/1")
temp = Mid(ptemp, 9, 4)
hotelcode = CLng("&H" + temp)
temp = Mid(ptemp, 13, 4)
cardpwd = (65535 - CLng("&H" + temp))
temp = Mid(ptemp, 17, 4)
cardno = CLng("&H" + temp)
temp = Mid(ptemp, 21, 2)
n = CLng("&H" + temp)
Select Case n
Case 0
readtimeable = False
Case 170
readtimeable = True
Case Else
Err.Raise 60012, "tm94.readtm94", GetError(12)
End Select
End If
End Function
Public Function twrite() As Boolean
Dim ptemp As String
Dim temp As String
Dim ntemp As String
Dim i As Integer
Dim card1 As New tmreadtype
Set card1 = New tmreadtype
With card1
.treadtype
temp = .romid
i = CLng("&H" + Mid(temp, 15, 2))
If i <> 4 Then
Err.Raise 60094, , GetError(94)
twrite = False
Exit Function
End If
End With
ptemp = ""
temp = Hex(hotelcode)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = Hex((65535 - cardpwd))
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
temp = Hex(cardno)
While Len(temp) < 4
temp = "0" + temp
Wend
ptemp = ptemp + temp
If readtimeable Then
ptemp = ptemp + "AA"
Else
ptemp = ptemp + "00"
End If
ntemp = Hex(DateDiff("s", "1970/1/1", tmdatetime))
While Len(ntemp) < 8
ntemp = "0" + ntemp
Wend
temp = ""
For i = 3 To 0 Step -1
temp = temp + Mid(ntemp, 2 * i + 1, 2)
Next i
ptemp = ptemp + temp
twrite = tm94.writetm94(ptemp)
End Function
Public Property Let cardno(ByVal vData As Long)
If vData > 65535 Or vData < 0 Then
Err.Raise 60012, "timecard.cardno", GetError(12)
Exit Property
End If
mvarcardno = vData
End Property
Public Property Get cardno() As Long
cardno = mvarcardno
End Property
Public Property Let hotelcode(ByVal vData As Long)
If vData > 65535 Or vData < 0 Then
Err.Raise 60012, "timecard.hotelcode", GetError(12)
Exit Property
End If
mvarhotelcode = vData
End Property
Public Property Get hotelcode() As Long
hotelcode = mvarhotelcode
End Property
Public Property Let cardpwd(ByVal vData As Long)
If vData > 65534 Or vData < 1 Then
Err.Raise 60012, "timecard.cardpwd", GetError(12)
Exit Property
End If
mvarcardpwd = vData
End Property
Public Property Get cardpwd() As Long
cardpwd = mvarcardpwd
End Property
Public Function CardInfo() As String
Dim Info As String
If readtimeable Then
Info = "读取时间,时间是=" & tmdatetime
Else
Info = "设置时间,时间是=" & tmdatetime
End If
CardInfo = Info
End Function
Private Sub Class_Initialize()
ReDim state_buffer(15360)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -