Attribute VB_Name = "modEMCode"
Option Explicit
Public Function LongtoLoHi(tmpIndex As Long) As String
Dim intY As Integer
Dim tmpResult As String
Dim tmpString As String
tmpString = Hex(tmpIndex)
While Len(tmpString) < 8
tmpString = "0" & tmpString
Wend
tmpResult = Right(tmpString, 2) & Mid(tmpString, 5, 2) & Mid(tmpString, 3, 2) & Left(tmpString, 2)
LongtoLoHi = tmpResult
End Function
Public Function IntegertoLoHi(tmpIndex As Integer) As String
Dim intY As Integer
Dim tmpResult As String
Dim tmpString As String
tmpString = Hex(tmpIndex)
While Len(tmpString) < 4
tmpString = "0" & tmpString
Wend
tmpResult = Right(tmpString, 2) & Left(tmpString, 2)
IntegertoLoHi = tmpResult
End Function
Public Function Stdto8H10D(tmpCode As String) As String
End Function
Public Function Stdto6H8D(tmpCode As String) As String
End Function
Public Function Stdto2H4H(tmpCode As String) As String
End Function
Public Function Stdto4H4H(tmpCode As String) As String
End Function
Public Function Conv2H4Hto8H10D(tmpCode As String) As String '如號碼太大, 不能轉回真正的8H10D 編號, 必須檢查購貨的EM咭編號
Dim intX As Integer
Dim tmp2H As String
Dim tmp4H As String
Dim tmpResult As String
If Len(tmpCode) > 0 Then
While Len(tmpCode) < 8
tmpCode = "0" & tmpCode
Wend
tmp2H = Hex(Left(tmpCode, 3))
If Len(tmp2H) < 2 Then tmp2H = "0" & tmp2H
tmp4H = Hex(Right(tmpCode, 5))
While Len(tmp4H) < 4
tmp4H = "0" & tmp4H
Wend
tmpResult = CDec("&H" & "00" & tmp2H & tmp4H)
While Len(tmpResult) < 10
tmpResult = "0" & tmpResult
Wend
End If
Conv2H4Hto8H10D = tmpResult
End Function
Public Function Conv8H10Dto2H4H(tmpCode As String) As String
Dim intX As Integer
Dim tmpResult As String
Dim tmpString As String
Dim tmp2H As String
Dim tmp4H As String
tmpResult = Empty
If Len(tmpCode) > 0 Then
tmpString = Hex(cuLong(tmpCode))
While Len(tmpString) < 8
tmpString = "0" & tmpString
Wend
tmp2H = CDec("&H" & Mid(tmpString, 3, 2))
While Len(tmp2H) < 3
tmp2H = "0" & tmp2H
Wend
tmp4H = CDec("&H" & Right(tmpString, 4))
While Len(tmp4H) < 5
tmp4H = "0" & tmp4H
Wend
tmpResult = tmp2H & tmp4H
End If
Conv8H10Dto2H4H = tmpResult
End Function