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

📄 hwpddhs.cls

📁 制造业产供销与往来系统源码,包括进销存及全部控件!
💻 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 = "HwPddhs"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
Dim oHwPddhs As Collection

Public Property Get Name() As String
   Name = "HwPddhs"
End Property

Private Sub Class_Initialize()
   Set oHwPddhs = New Collection
End Sub

Public Sub Add(oHwPddh As HwPddh, Optional Needsave As Integer = 1)
   Dim mKey As Integer
   Dim vHwPddh As HwPddh
   For Each vHwPddh In oHwPddhs
      If mKey < vHwPddh.HwPddhKey Then
         mKey = vHwPddh.HwPddhKey
      End If
   Next
   oHwPddh.HwPddhKey = mKey + 1
   If Needsave = 1 Then
      oHwPddh.Save
   End If
   oHwPddhs.Add Item:=oHwPddh, Key:=CStr(mKey + 1)
End Sub

Public Sub Remove(Vindex, Optional Needdel As Integer = 1)
 
   Dim oHwPddh As HwPddh
   Set oHwPddh = Item(Vindex)
   If Needdel = 1 And oHwPddh.HwPddhId = 1 Then
      oHwPddh.Del
   End If
   oHwPddhs.Remove (Vindex)
   Set oHwPddh = Nothing
   
End Sub

Public Property Get Count() As Integer
   Count = oHwPddhs.Count
End Property

Public Function Item(Vindex) As HwPddh
Attribute Item.VB_UserMemId = 0
   Set Item = oHwPddhs.Item(Vindex)
End Function

Public Sub ClearAll()
   Dim i, Vcount As Integer
   Vcount = oHwPddhs.Count
   For i = 1 To Vcount
      oHwPddhs.Remove (1)
   Next
End Sub

Public Sub Fillbydb(Optional vWhereStr As String = "")
   Dim oHwPddh As HwPddh
   Dim mRs As DbRs
   Dim mKey As Integer
   Dim mSqlStr As String
On Error GoTo Errorhandle

   ClearAll
   
   mSqlStr = "SELECT HwPddHDOCNO,HwPddHDAT,HwPddh_CwQjCode=COALESCE((SELECT CWQJCODE FROM CWQJREC WHERE CWQJNO=HwPddh_CwQjno),''),HwPddh_CwQjno,"
   mSqlStr = mSqlStr & "HwPddH_HwPdRcCODE=COALESCE((SELECT HwPdRcCODE FROM HwPdRcREC WHERE HwPdRcNO=HwPddH_HwPdRcNO),''),HwPddH_HwPdRcNO,"
   mSqlStr = mSqlStr & "HwPddH_HwCkMc=COALESCE((SELECT HwCkMc FROM HwCkREC WHERE HwCkNO=HwPddH_HwCkNO),''),HwPddH_HwCkNO,"
   mSqlStr = mSqlStr & "HwPddHFORM,HwPddHNO FROM HwPddHREC"
   
   If vWhereStr <> "" Then
      mSqlStr = mSqlStr & " WHERE " & vWhereStr
   End If
   
   mSqlStr = mSqlStr & " ORDER BY HwPddHDOCNO"
   
   Set mRs = New DbRs
   mRs.Fillbydb mSqlStr
   
   mRs.MoveFirst
   
   mKey = 1
   Do Until mRs.EOF
      Set oHwPddh = New HwPddh
      oHwPddh.HwPddhKey = mKey
      oHwPddh.BatchLet mRs!HwPddhDocno, mRs!HwPddhDat, mRs!HwPddh_CwQjCode, mRs!HwPddh_CwqjNo, mRs!HwPddh_HwPdRcCode, mRs!HwPddh_HwPdRcno, mRs!HwPddh_HwCkMc, mRs!HwPddh_HwCkno, mRs!HwPddhForm, mRs!HwPddhNo
      oHwPddhs.Add Item:=oHwPddh, 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 = oHwPddhs.[_NewEnum]
End Function

Private Sub Class_Terminate()
   ClearAll
   Set oHwPddhs = Nothing
End Sub



⌨️ 快捷键说明

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