📄 xsfhdhs.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 = "XsFhdhs"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
Dim oXsFhdhs As Collection
Public Property Get Name() As String
Name = "XsFhdhs"
End Property
Private Sub Class_Initialize()
Set oXsFhdhs = New Collection
End Sub
Public Sub Add(oXsFhdh As XsFhdh, Optional Needsave As Integer = 1)
Dim mKey As Integer
Dim vXsFhdh As XsFhdh
For Each vXsFhdh In oXsFhdhs
If mKey < vXsFhdh.XsFhdhKey Then
mKey = vXsFhdh.XsFhdhKey
End If
Next
oXsFhdh.XsFhdhKey = mKey + 1
If Needsave = 1 Then
oXsFhdh.Save
End If
oXsFhdhs.Add Item:=oXsFhdh, Key:=CStr(mKey + 1)
End Sub
Public Sub Remove(Vindex, Optional Needdel As Integer = 1)
Dim oXsFhdh As XsFhdh
Set oXsFhdh = Item(Vindex)
If Needdel = 1 And oXsFhdh.XsFhdhId = 1 Then
oXsFhdh.Del
End If
oXsFhdhs.Remove (Vindex)
Set oXsFhdh = Nothing
End Sub
Public Property Get Count() As Integer
Count = oXsFhdhs.Count
End Property
Public Function Item(Vindex) As XsFhdh
Attribute Item.VB_UserMemId = 0
Set Item = oXsFhdhs.Item(Vindex)
End Function
Public Sub ClearAll()
Dim i, Vcount As Integer
Vcount = oXsFhdhs.Count
For i = 1 To Vcount
oXsFhdhs.Remove (1)
Next
End Sub
Public Sub Fillbydb(Optional vWhereStr As String = "")
Dim oXsFhdh As XsFhdh
Dim mRs As DbRs
Dim mKey As Integer
Dim mSqlStr As String
On Error GoTo Errorhandle
ClearAll
mSqlStr = "SELECT XsFhDHTYPE,XsFhdHDOCNO,XsFhdHDAT,XsFhdH_KHCODE=COALESCE((SELECT KHCODE FROM KHREC WHERE KHNO=XsFhDH_KHNO),''),XsFhdH_KHNO,"
mSqlStr = mSqlStr & "XsFhdh_CwQjCode=COALESCE((SELECT CWQJCODE FROM CWQJREC WHERE CWQJNO=XsFhdh_CwQjno),''),XsFhdh_CwQjno,"
mSqlStr = mSqlStr & "XsFhdh_CwBzCode=COALESCE((SELECT CWBZCODE FROM CWBZREC WHERE CWBZNO=XsFhdh_CwBzno),''),XsFhdh_CwBzno,XsFhDHFORM,"
mSqlStr = mSqlStr & "XsFhdHNO FROM XsFhdHREC"
If vWhereStr <> "" Then
mSqlStr = mSqlStr & " WHERE " & vWhereStr
End If
mSqlStr = mSqlStr & " ORDER BY XsFhdHDOCNO"
Set mRs = New DbRs
mRs.Fillbydb mSqlStr
mRs.MoveFirst
mKey = 1
Do Until mRs.EOF
Set oXsFhdh = New XsFhdh
oXsFhdh.XsFhdhKey = mKey
oXsFhdh.BatchLet mRs!XsFhdhType, mRs!XsFhdhDocno, mRs!XsFhdhDat, mRs!XsFhdh_CwQjCode, mRs!XsFhdh_CwqjNo, mRs!XsFhdh_KhCode, mRs!XsFhdh_Khno, mRs!XsFhdh_CwBzCode, mRs!XsFhdh_CwBzno, mRs!XsFhdhForm, mRs!XsFhdhNo
oXsFhdhs.Add Item:=oXsFhdh, Key:=CStr(mKey)
mRs.MoveNext
mKey = mKey + 1
Loop
Set mRs = Nothing
Exit Sub
Errorhandle:
Set mRs = Nothing
Err.Raise vbObjectError + 1, , Err.Description
End Sub
Public Function NewEnum() As IUnknown
Attribute NewEnum.VB_UserMemId = -4
Attribute NewEnum.VB_MemberFlags = "40"
Set NewEnum = oXsFhdhs.[_NewEnum]
End Function
Private Sub Class_Terminate()
ClearAll
Set oXsFhdhs = Nothing
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -