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

📄 arivrs.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 = "Arivrs"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
Dim OArivrs As Collection

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

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

Public Sub Add(oArivr As Arivr, Optional Needsave As Integer = 1)
   Dim mKey As Integer
   Dim vArivr As Arivr
   For Each vArivr In OArivrs
      If mKey < vArivr.ArivrKey Then
         mKey = vArivr.ArivrKey
      End If
   Next
   oArivr.ArivrKey = mKey + 1
   If Needsave = 1 Then
      oArivr.Save
   End If
   OArivrs.Add Item:=oArivr, Key:=CStr(mKey + 1)
End Sub

Public Sub Remove(Vindex)
 
   Dim oArivr As Arivr
   Set oArivr = Item(Vindex)
   OArivrs.Remove (Vindex)
   Set oArivr = Nothing
   
End Sub

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

Public Function Item(Vindex) As Arivr
Attribute Item.VB_UserMemId = 0
   Set Item = OArivrs.Item(Vindex)
End Function

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

Public Sub Fillbydb(vArivd As Arivd)
   Dim oArivr As Arivr
   Dim mRs As DbRs
   Dim mKey As Integer
   Dim mSqlStr As String
On Error GoTo Errorhandle

   ClearAll
   
   mSqlStr = "SELECT Arivr_ArIVDNO,Arivr_XsArNO,ArivrQTY,ArivrNO FROM ArivrREC WHERE Arivr_ArIVDNO=" & CStr(vArivd.ArivdNo)
   
   Set mRs = New DbRs
   mRs.Fillbydb mSqlStr
   
   mRs.MoveFirst
   
   mKey = 1
   Do Until mRs.EOF
      Set oArivr = New Arivr
      Set oArivr.Arivd = vArivd
      oArivr.ArivrKey = mKey
      oArivr.BatchLet mRs!Arivr_Arivdno, mRs!Arivr_XsArno, mRs!ArivrQty, mRs!ArivrNo
      OArivrs.Add Item:=oArivr, 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 = OArivrs.[_NewEnum]
End Function

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

Public Sub Save()
   Dim mNotSaved As Collection
   Dim mArivr As Arivr
On Error GoTo Errorhandle
   
   Set mNotSaved = New Collection
   
   For Each mArivr In OArivrs
      If mArivr.ArivrId = -1 Then
         mNotSaved.Add mArivr
      End If
      mArivr.Save
   Next
   
   Set mNotSaved = Nothing
   
Exit Sub
Errorhandle:
   For Each mArivr In mNotSaved
      mArivr.ArivrId = -1
   Next
   Set mNotSaved = Nothing
   Err.Raise vbObjectError + 1, , Err.Description
End Sub





⌨️ 快捷键说明

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