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

📄 fieldobject.cls

📁 用友U8财务软件VB源程序, 本版本为2002年版本
💻 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 = "FieldObject"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
'--------------------------------
'时间:2001.11.12
'版权:北京用友软件股份有限公司
'设计:章景峰
'编码:章景峰
'说明:U8资金管理---实体对象
'--------------------------------
Option Explicit

Private m_iID               As Long
Private m_sName             As String
Private m_sCaption          As String
Private m_iEntityID         As Long
Private m_iFieldOption      As FieldOptionEnum
Private m_sHelpContextID    As String
Private m_bPersistent       As Boolean
Private m_oParent           As Fields
Private m_Value             As Variant
Private m_iReferenceType    As Byte
Private m_iRefFldSqc        As Long
Private m_iQryFldSqc        As Long
Private m_bIsUsed           As Boolean
Private m_sTaskID           As String
Private m_iEditProp         As EditPropertyEnum
Private m_iDataType         As DataTypeEnum
Private m_iLength           As Byte
Private m_iDecimals         As Byte
Private m_bAllowNull        As Boolean
Private m_DefaultValue      As Variant
Private m_sSourceField      As String
Private m_iRow              As Long
Private m_iStartCol         As Long
Private m_iEndCol           As Long
Private m_iInputCol         As Long
Private m_dblLeft           As Double
Private m_dblWidth          As Double
Private m_dblInputLeft      As Double
Private m_dblInputWidth     As Double
Private m_dblTop            As Double
Private m_dblHeight         As Double
Private m_iMin              As Variant
Private m_iMax              As Variant

Public Property Let SourceField(ByVal vData As String)
'当给属性赋值时在参数左边使用。
'Syntax: X.SourceField = 5
    m_sSourceField = vData
End Property

Public Property Get SourceField() As String
'当检索属性值时在参数右边使用。
'Syntax: Debug.Print X.SourceField
    SourceField = m_sSourceField
End Property

Public Property Let ReferenceType(ByVal vData As Byte)
'当给属性赋值时在参数左边使用。
'Syntax: X.ReferenceType = 5
    m_iReferenceType = vData
End Property

Public Property Get ReferenceType() As Byte
'当检索属性值时在参数右边使用。
'Syntax: Debug.Print X.ReferenceType
    ReferenceType = m_iReferenceType
End Property

Public Property Let Persistent(ByVal vData As Boolean)
'当给属性赋值时在参数左边使用。
'Syntax: X.Persistent = 5
    m_bPersistent = vData
End Property

Public Property Get Persistent() As Boolean
'当检索属性值时在参数右边使用。
'Syntax: Debug.Print X.Persistent
    Persistent = m_bPersistent
End Property

Public Property Set Parent(ByVal vData As Fields)
'当把对象赋值给属性时在 Set 语句左边使用。
'Syntax: Set x.Parent = Form1
    Set m_oParent = vData
End Property

Public Property Get Parent() As Fields
'当检索属性值时在参数右边使用。
'Syntax: Debug.Print X.Parent
    Set Parent = m_oParent
End Property

Public Property Let Value(ByVal vData As Variant)
'当给属性赋值时在参数左边使用。
'Syntax: X.Value = 5
    Dim iStrLength  As Byte
    
    '----去除字符串两边的空字符
    vData = Trim(vData)
    
    '----空值
    If IsNull(vData) Then
        m_Value = vData
        Exit Property
    End If
    
    '----空串
    If vData = "" Then
        m_Value = Null
        Exit Property
    End If
    
    Select Case Me.DataType
        Case esoString, esoID
            iStrLength = LenEx(vData)
            If iStrLength > Me.Length Then
                Err.Raise vbObjectError + 3001, Me.Name, Me.Caption & "输入超长,请重新输入!"
            End If
            
            vData = CStr(vData)
            
        Case esoBoolean
            
            vData = CBool(vData)
            
        Case esoDate
            If Not IsDate(vData) Then
                Err.Raise vbObjectError + 3002, Me.Name, Me.Caption & "输入有误,请重新输入!"
            End If
            
            If IsDate(vData) And vData = "0:00:00" Then
                Value = "1899-12-30"
            Else
                vData = CDate(vData)
            End If
            
        Case esoLong
            If Not IsNumeric(vData) Then
                Err.Raise vbObjectError + 3003, Me.Name, Me.Caption & "输入有误,请重新输入!"
            End If
            
            vData = CLng(vData)
            
            If Not IsNull(Me.Max) Then
                If vData > Me.Max Then
                    Err.Raise vbObjectError + 3004, Me.Name, Me.Caption & "输入超出最大值,请重新输入!"
                End If
            End If
            
            If Not IsNull(Me.Min) Then
                If vData < Me.Min Then
                    Err.Raise vbObjectError + 3005, Me.Name, Me.Caption & "输入低于最小值,请重新输入!"
                End If
            End If
        
        Case esoCurrency
            If Not IsNumeric(vData) Then
                Err.Raise vbObjectError + 3003, Me.Name, Me.Caption & "输入有误,请重新输入!"
            End If
            
            vData = Format(vData, "#0." & String(Me.Decimals, "#"))
            vData = CCur(vData)
            
            If Not IsNull(Me.Max) Then
                If vData > Me.Max Then
                    Err.Raise vbObjectError + 3004, Me.Name, Me.Caption & "输入超出最大值,请重新输入!"
                End If
            End If
            
            If Not IsNull(Me.Min) Then
                If vData < Me.Min Then
                    Err.Raise vbObjectError + 3005, Me.Name, Me.Caption & "输入低于最小值,请重新输入!"
                End If
            End If
        
        Case esoDouble
            If Not IsNumeric(vData) Then
                Err.Raise vbObjectError + 3003, Me.Name, Me.Caption & "输入有误,请重新输入!"
            End If
            
            vData = Format(vData, "#0." & String(Me.Decimals, "#"))
            vData = CDbl(vData)
            
            If Not IsNull(Me.Max) Then
                If vData > Me.Max Then
                    Err.Raise vbObjectError + 3004, Me.Name, Me.Caption & "输入超出最大值,请重新输入!"
                End If
            End If
            
            If Not IsNull(Me.Min) Then
                If vData < Me.Min Then
                    Err.Raise vbObjectError + 3005, Me.Name, Me.Caption & "输入低于最小值,请重新输入!"
                End If
            End If
    End Select
    
    m_Value = vData
End Property

Public Property Set Value(ByVal vData As Object)
'当把对象赋值给属性时在 Set 语句左边使用。
'Syntax: Set x.Value = Form1
    Set m_Value = vData
End Property

Public Property Get Value() As Variant
Attribute Value.VB_UserMemId = 0
'当检索属性值时在参数右边使用。
'Syntax: Debug.Print X.Value
    If IsObject(m_Value) Then
        Set Value = m_Value
    ElseIf IsDate(m_Value) And m_Value = "0:00:00" Then
        Value = "1899-12-30"
    Else
        Value = m_Value
    End If
End Property

Public Property Let DefaultValue(ByVal vData As Variant)
'当给属性赋值时在参数左边使用。
'Syntax: X.DefaultValue = 5
    m_DefaultValue = vData
End Property

Public Property Set DefaultValue(ByVal vData As Object)
'当把对象赋值给属性时在 Set 语句左边使用。
'Syntax: Set x.DefaultValue = Form1
    Set m_DefaultValue = vData
End Property

Public Property Get DefaultValue() As Variant
'当检索属性值时在参数右边使用。
'Syntax: Debug.Print X.DefaultValue
    If IsObject(m_DefaultValue) Then
        Set DefaultValue = m_DefaultValue
    Else
        DefaultValue = m_DefaultValue
    End If
End Property

Public Property Let AllowNull(ByVal vData As Boolean)
'当给属性赋值时在参数左边使用。
'Syntax: X.AllowNull = 5
    m_bAllowNull = vData
End Property

Public Property Get AllowNull() As Boolean
'当检索属性值时在参数右边使用。
'Syntax: Debug.Print X.AllowNull
    AllowNull = m_bAllowNull
End Property

Public Property Let Length(ByVal vData As Byte)
'当给属性赋值时在参数左边使用。
'Syntax: X.Length = 5
    m_iLength = vData
End Property

Public Property Get Length() As Byte
'当检索属性值时在参数右边使用。
'Syntax: Debug.Print X.Length
    Length = m_iLength
End Property

Public Property Let DataType(ByVal vData As DataTypeEnum)
'当给属性赋值时在参数左边使用。
'Syntax: X.DataType = 5
    m_iDataType = vData
End Property

Public Property Get DataType() As DataTypeEnum
'当检索属性值时在参数右边使用。
'Syntax: Debug.Print X.DataType
    DataType = m_iDataType
End Property

Public Property Let Caption(ByVal vData As String)
'当给属性赋值时在参数左边使用。
'Syntax: X.Caption = 5
    m_sCaption = vData
End Property

Public Property Get Caption() As String
'当检索属性值时在参数右边使用。
'Syntax: Debug.Print X.Caption
    Caption = m_sCaption
End Property

Public Property Let Name(ByVal vData As String)
'当给属性赋值时在参数左边使用。
'Syntax: X.Name = 5
    m_sName = vData
End Property

Public Property Get Name() As String
'当检索属性值时在参数右边使用。
'Syntax: Debug.Print X.Name
    Name = m_sName
End Property

Public Property Get ID() As Long
    ID = m_iID
End Property

Public Property Let ID(ByVal vData As Long)
    m_iID = vData
End Property

Public Property Get EntityID() As Long
    EntityID = m_iEntityID
End Property

Public Property Let EntityID(ByVal vData As Long)
    m_iEntityID = vData
End Property

Public Property Get FieldOption() As FieldOptionEnum
    FieldOption = m_iFieldOption
End Property

Public Property Let FieldOption(ByVal vData As FieldOptionEnum)
    m_iFieldOption = vData
End Property

Public Property Get HelpContextID() As String
    HelpContextID = m_sHelpContextID
End Property

Public Property Let HelpContextID(ByVal vData As String)
    m_sHelpContextID = vData
End Property

Public Property Get IsUsed() As Boolean
    IsUsed = m_bIsUsed
End Property

Public Property Let IsUsed(ByVal vData As Boolean)
    m_bIsUsed = vData
End Property

Public Property Get TaskID() As String
    TaskID = m_sTaskID
End Property

Public Property Let TaskID(ByVal vData As String)
    m_sTaskID = vData
End Property

Public Property Get EditProp() As EditPropertyEnum
    EditProp = m_iEditProp
End Property

Public Property Let EditProp(ByVal vData As EditPropertyEnum)
    m_iEditProp = vData
End Property

Public Property Get Decimals() As Byte
    Decimals = m_iDecimals
End Property

Public Property Let Decimals(ByVal vData As Byte)
    m_iDecimals = vData
End Property

Public Property Get Row() As Long
    Row = m_iRow
End Property

Public Property Let Row(ByVal vData As Long)
    m_iRow = vData
End Property

Public Property Get StartCol() As Long
    StartCol = m_iStartCol
End Property

Public Property Let StartCol(ByVal vData As Long)
    m_iStartCol = vData
End Property

Public Property Get EndCol() As Long
    EndCol = m_iEndCol
End Property

Public Property Let EndCol(ByVal vData As Long)
    m_iEndCol = vData
End Property

Public Property Get InputCol() As Long
    InputCol = m_iInputCol
End Property

Public Property Let InputCol(ByVal vData As Long)
    m_iInputCol = vData
End Property

Public Property Get RefFldSqc() As Long
    RefFldSqc = m_iRefFldSqc
End Property

Public Property Let RefFldSqc(ByVal vData As Long)
    m_iRefFldSqc = vData
End Property

Public Property Get Max() As Variant
    Max = m_iMax
End Property

Public Property Let Max(ByVal vData As Variant)
    m_iMax = vData
End Property

Public Property Get Min() As Variant
    Min = m_iMin
End Property

Public Property Let Min(ByVal vData As Variant)
    m_iMin = vData
End Property

Public Function Clone(Optional Mode As CloneModeEnum = 0) As FieldObject
    Dim oFO As New FieldObject
    
    With oFO
        .AllowNull = Me.AllowNull
        .TaskID = Me.TaskID
        .Caption = Me.Caption
        .DataType = Me.DataType
        .DefaultValue = Me.DefaultValue
        .Decimals = Me.Decimals
        .EditProp = Me.EditProp
        .EndCol = Me.EndCol
        .EntityID = Me.EntityID
        .FieldOption = Me.FieldOption
        .HelpContextID = Me.HelpContextID
        .ID = Me.ID
        .InputCol = Me.InputCol
        .IsUsed = Me.IsUsed
        .Max = Me.Max
        .Min = Me.Min
        .Name = Me.Name
        Set .Parent = Me.Parent
        .Persistent = Me.Persistent
        .QryFldSqc = Me.QryFldSqc
        .RefFldSqc = Me.RefFldSqc
        .ReferenceType = Me.ReferenceType
        .Row = Me.Row
        .Length = Me.Length
        .SourceField = Me.SourceField
        .StartCol = Me.StartCol
        .Left = Me.Left
        .Width = Me.Width
        .InputLeft = Me.InputLeft
        .InputWidth = Me.InputWidth
        .Top = Me.Top
        .Height = Me.Height
        
        If Mode = esoStructureOnly Then
            '----设置值为默认值,其余与原来的域对象完全一致
            .Value = Me.DefaultValue
        Else
            .Value = Me.Value
        End If
    End With
    
    Set Clone = oFO
End Function

Public Property Get QryFldSqc() As Long
    QryFldSqc = m_iQryFldSqc
End Property

Public Property Let QryFldSqc(ByVal vData As Long)
    m_iQryFldSqc = vData
End Property

Public Property Get Left() As Double
    Left = m_dblLeft
End Property

Public Property Let Left(ByVal vData As Double)
    m_dblLeft = vData
End Property

Public Property Get Width() As Double
    Width = m_dblWidth
End Property

Public Property Let Width(ByVal vData As Double)
    m_dblWidth = vData
End Property

Public Property Get InputLeft() As Double
    InputLeft = m_dblInputLeft
End Property

Public Property Let InputLeft(ByVal vData As Double)
    m_dblInputLeft = vData
End Property

Public Property Get InputWidth() As Double
    InputWidth = m_dblInputWidth
End Property

Public Property Let InputWidth(ByVal vData As Double)
    m_dblInputWidth = vData
End Property

Public Property Get Top() As Double
    Top = m_dblTop
End Property

Public Property Let Top(ByVal vData As Double)
    m_dblTop = vData
End Property

Public Property Get Height() As Double
    Height = m_dblHeight
End Property

Public Property Let Height(ByVal vData As Double)
    m_dblHeight = vData
End Property

⌨️ 快捷键说明

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