📄 hwbfdhs.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 = "HwBfdhs"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
Dim oHwBfdhs As Collection
Public Property Get Name() As String
Name = "HwBfdhs"
End Property
Private Sub Class_Initialize()
Set oHwBfdhs = New Collection
End Sub
Public Sub Add(oHwBfdh As HwBfdh, Optional Needsave As Integer = 1)
Dim mKey As Integer
Dim vHwBfdh As HwBfdh
For Each vHwBfdh In oHwBfdhs
If mKey < vHwBfdh.HwBfdhKey Then
mKey = vHwBfdh.HwBfdhKey
End If
Next
oHwBfdh.HwBfdhKey = mKey + 1
If Needsave = 1 Then
oHwBfdh.Save
End If
oHwBfdhs.Add Item:=oHwBfdh, Key:=CStr(mKey + 1)
End Sub
Public Sub Remove(Vindex, Optional Needdel As Integer = 1)
Dim oHwBfdh As HwBfdh
Set oHwBfdh = Item(Vindex)
If Needdel = 1 And oHwBfdh.HwBfdhId = 1 Then
oHwBfdh.Del
End If
oHwBfdhs.Remove (Vindex)
Set oHwBfdh = Nothing
End Sub
Public Property Get Count() As Integer
Count = oHwBfdhs.Count
End Property
Public Function Item(Vindex) As HwBfdh
Attribute Item.VB_UserMemId = 0
Set Item = oHwBfdhs.Item(Vindex)
End Function
Public Sub ClearAll()
Dim i, Vcount As Integer
Vcount = oHwBfdhs.Count
For i = 1 To Vcount
oHwBfdhs.Remove (1)
Next
End Sub
Public Sub Fillbydb(Optional vWhereStr As String = "")
Dim oHwBfdh As HwBfdh
Dim mRs As DbRs
Dim mKey As Integer
Dim mSqlStr As String
On Error GoTo Errorhandle
ClearAll
mSqlStr = "SELECT HwBfdHDOCNO,HwBfdHDAT,HwBfdh_CwQjCode=COALESCE((SELECT CWQJCODE FROM CWQJREC WHERE CWQJNO=HwBfdh_CwQjno),''),HwBfdh_CwQjno,"
mSqlStr = mSqlStr & "HwBfdH_HwBfRcCODE=COALESCE((SELECT HwBfRcCODE FROM HwBfRcREC WHERE HwBfRcNO=HwBfdH_HwBfRcNO),''),HwBfdH_HwBfRcNO,"
mSqlStr = mSqlStr & "HwBfdH_HwCkMc=COALESCE((SELECT HwCkMc FROM HwCkREC WHERE HwCkNO=HwBfdH_HwCkNO),''),HwBfdH_HwCkNO,"
mSqlStr = mSqlStr & "HwBfdHFORM,HwBfdHNO FROM HwBfdHREC"
If vWhereStr <> "" Then
mSqlStr = mSqlStr & " WHERE " & vWhereStr
End If
mSqlStr = mSqlStr & " ORDER BY HwBfdHDOCNO"
Set mRs = New DbRs
mRs.Fillbydb mSqlStr
mRs.MoveFirst
mKey = 1
Do Until mRs.EOF
Set oHwBfdh = New HwBfdh
oHwBfdh.HwBfdhKey = mKey
oHwBfdh.BatchLet mRs!HwBfdhDocno, mRs!HwBfdhDat, mRs!HwBfdh_CwQjCode, mRs!HwBfdh_CwqjNo, mRs!HwBfdh_HwBfRcCode, mRs!HwBfdh_HwBfRcno, mRs!HwBfdh_HwCkMc, mRs!HwBfdh_HwCkno, mRs!HwBfdhForm, mRs!HwBfdhNo
oHwBfdhs.Add Item:=oHwBfdh, 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 = oHwBfdhs.[_NewEnum]
End Function
Private Sub Class_Terminate()
ClearAll
Set oHwBfdhs = Nothing
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -