📄 单据项目编辑.frm
字号:
_StockProps = 253
ForeColor = 0
BackColor = 16777215
Appearance = 1
Property = 1
End
Begin VB.CheckBox chkUsed
Caption = "已使用"
Enabled = 0 'False
Height = 315
Left = 2520
TabIndex = 16
Top = 480
Value = 1 'Checked
Visible = 0 'False
Width = 2295
End
Begin VB.Label lblLength
AutoSize = -1 'True
Caption = "项目长度"
Height = 195
Left = 120
TabIndex = 21
Top = 1200
Visible = 0 'False
Width = 720
End
Begin VB.Label lblDataType
AutoSize = -1 'True
Caption = "数据类型"
Height = 195
Left = 120
TabIndex = 20
Top = 840
Width = 720
End
Begin VB.Label lblCaption
AutoSize = -1 'True
Caption = "项目标题"
Height = 195
Left = 120
TabIndex = 19
Top = 480
Width = 720
End
Begin VB.Label lblName
AutoSize = -1 'True
Caption = "项目名称"
Height = 195
Left = 120
TabIndex = 18
Top = 120
Width = 720
End
End
End
Attribute VB_Name = "frmVchItem"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'--------------------------------
'时间:2001.11.12
'版权:北京用友软件股份有限公司
'设计:章景峰
'编码:章景峰
'说明:U8资金管理---单据项目编辑
'--------------------------------
Option Explicit
Public AddOrEdit As Long
Private Sub CmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim i As Long
Dim CellFormat As F1CellFormat
Dim CellFormat2 As F1CellFormat
Dim oFO As U8FDEso.FieldObject
If Trim(Me.txtCaption.Text) = "" Then
MsgBox "项目标题不能为空!", vbInformation, App.ProductName
Exit Sub
Else
For i = 1 To frmVchDefine.EO.Fields.count
Set oFO = frmVchDefine.EO.Fields.Item(i)
If oFO.EditProp <> U8FDEso.esoNotVisible And oFO.Name <> Me.cboName.Text And oFO.Caption = Trim(Me.txtCaption.Text) Then
MsgBox "项目标题不能重复!", vbInformation, App.ProductName
Exit Sub
End If
Next
End If
If Trim(Me.txtRow.Text) = "" Or Trim(Me.txtStartCol.Text) = "" Or Trim(Me.txtInputCol.Text) = "" Or Trim(Me.txtEndCol.Text) = "" Then
MsgBox "行列值不能为空!", vbInformation, App.ProductName
Exit Sub
End If
If Me.txtRow.Text <= 0 Or Me.txtRow.Text > frmVchDefine.objF1Book.MaxRow Then
MsgBox "输入行应大于0小于等于当前最大行数!", vbInformation, App.ProductName
Exit Sub
End If
If Me.txtStartCol.Text <= 0 Or Me.txtStartCol.Text > frmVchDefine.objF1Book.MaxCol Or Me.txtInputCol.Text <= 0 Or Me.txtInputCol.Text > frmVchDefine.objF1Book.MaxCol Or Me.txtEndCol.Text <= 0 Or Me.txtEndCol.Text > frmVchDefine.objF1Book.MaxCol Then
MsgBox "各列应大于0小于等于当前最大列数!", vbInformation, App.ProductName
Exit Sub
End If
If Me.txtInputCol.Text > Me.txtEndCol.Text Or (Me.cboDataType.ListIndex <> 4 And Me.txtInputCol.Text <= Me.txtStartCol.Text) Or (Me.cboDataType.ListIndex = 4 And Me.txtInputCol.Text < Me.txtStartCol.Text) Or Me.txtStartCol.Text >= Me.txtEndCol.Text Or Me.txtStartCol.Text <= 0 Then
MsgBox "输入列应大于开始列小于等于结束列!", vbInformation, App.ProductName
Exit Sub
End If
If Me.AddOrEdit = 2 Then
For i = Me.txtStartCol.Text To Me.txtEndCol.Text
If Not frmVchDefine.FieldObjectRC(Me.txtRow.Text, i) Is Nothing Then
MsgBox "第" & Me.txtRow.Text & "行,第" & i & "列已有项目,重新选择行列", vbInformation, App.ProductName
Exit Sub
End If
Next
Else
For i = Me.txtStartCol.Text To Me.txtEndCol.Text
If Not frmVchDefine.FieldObjectRC(Me.txtRow.Text, i) Is Nothing Then
If Not frmVchDefine.FieldObjectRC(Me.txtRow.Text, Me.txtStartCol.Text) Is Nothing Then
If frmVchDefine.FieldObjectRC(Me.txtRow.Text, i).Name <> frmVchDefine.FieldObjectRC(Me.txtRow.Text, Me.txtStartCol.Text).Name Then
MsgBox "第" & Me.txtRow.Text & "行,第" & i & "列已有项目,重新选择行列", vbInformation, App.ProductName
Exit Sub
End If
End If
End If
Next
End If
For i = 1 To frmVchDefine.EO.Fields.count
Set oFO = frmVchDefine.EO.Fields.Item(i)
With oFO
If .Name = Me.cboName.Text Then
frmVchDefine.objF1Book.SetSelection Me.txtRow.Text, Me.txtStartCol.Text + 1, Me.txtRow.Text, Me.txtEndCol.Text
Set CellFormat = frmVchDefine.objF1Book.GetCellFormat
If .row <> Me.txtRow.Text Then
If .row <> 0 Then frmVchDefine.objF1Book.ClearRange .row, .StartCol, .row, .EndCol, F1ClearAll
frmVchDefine.objF1Book.SetSelection Me.txtRow.Text, Me.txtStartCol.Text + 1, Me.txtRow.Text, Me.txtEndCol.Text
frmVchDefine.objF1Book.SetCellFormat CellFormat
ElseIf .StartCol <> Me.txtStartCol.Text Then
If .row <> 0 Then frmVchDefine.objF1Book.ClearRange .row, .StartCol, .row, .EndCol, F1ClearAll
frmVchDefine.objF1Book.SetSelection Me.txtRow.Text, Me.txtStartCol.Text + 1, Me.txtRow.Text, Me.txtEndCol.Text
frmVchDefine.objF1Book.SetCellFormat CellFormat
If .EndCol <> Me.txtEndCol.Text Then
frmVchDefine.objF1Book.SetSelection .row, .StartCol + 1, .row, .EndCol
Set CellFormat2 = frmVchDefine.objF1Book.GetCellFormat
CellFormat2.MergeCells = False
frmVchDefine.objF1Book.SetCellFormat CellFormat2
frmVchDefine.objF1Book.ClearRange .row, .StartCol + 1, .row, .EndCol, F1ClearAll
frmVchDefine.objF1Book.SetSelection Me.txtRow.Text, Me.txtStartCol.Text + 1, Me.txtRow.Text, Me.txtEndCol.Text
frmVchDefine.objF1Book.SetCellFormat CellFormat
End If
ElseIf .EndCol <> Me.txtEndCol.Text Then
frmVchDefine.objF1Book.SetSelection .row, .StartCol + 1, .row, .EndCol
Set CellFormat2 = frmVchDefine.objF1Book.GetCellFormat
CellFormat2.MergeCells = False
frmVchDefine.objF1Book.SetCellFormat CellFormat2
If .row <> 0 Then frmVchDefine.objF1Book.ClearRange .row, .StartCol + 1, .row, .EndCol, F1ClearAll
frmVchDefine.objF1Book.SetSelection Me.txtRow.Text, Me.txtStartCol.Text + 1, Me.txtRow.Text, Me.txtEndCol.Text
frmVchDefine.objF1Book.SetCellFormat CellFormat
End If
Exit For
End If
End With
Next
If frmVchDefine.objF1Book.TextRC(Me.txtRow.Text, Me.txtStartCol.Text) <> Me.txtCaption.Text Then frmVchDefine.objF1Book.TextRC(Me.txtRow.Text, Me.txtStartCol.Text) = Me.txtCaption.Text
If cboDataType.ListIndex <> 4 Then
frmVchDefine.objF1Book.TextRC(Me.txtRow.Text, Me.txtStartCol.Text + 1) = "[数据]"
End If
frmVchDefine.objF1Book.SetSelection Me.txtRow.Text, Me.txtStartCol.Text + 1, Me.txtRow.Text, Me.txtEndCol.Text
Set CellFormat = frmVchDefine.objF1Book.GetCellFormat
CellFormat.MergeCells = True
frmVchDefine.objF1Book.SetCellFormat CellFormat
'编辑时,如果原来的StartCol-EndCol是合并的就合并,否则不处理
For i = 1 To frmVchDefine.EO.Fields.count
Set oFO = frmVchDefine.EO.Fields.Item(i)
With oFO
If .Name = Me.cboName.Text Then
.AllowNull = CBool(Me.chkAllowNull.Value)
.Caption = Me.txtCaption.Text
.DefaultValue = Me.txtDefault.Text
.Decimals = Me.txtFrac.Text
.EndCol = Me.txtEndCol.Text
.InputCol = Me.txtInputCol.Text
.IsUsed = True
.Max = Me.txtMax.Text
.Min = Me.txtMin.Text
'.ReferenceType = CBool(Me.chkReference.Value)
.row = Me.txtRow.Text
.length = Me.txtLength.Text
.StartCol = Me.txtStartCol.Text
Exit For
End If
End With
Next
Unload Me
End Sub
Private Sub cboName_Click()
Dim oFO As U8FDEso.FieldObject
Dim i As Integer
' For Each oFO In frmVchDefine.EO.Fields
For i = 1 To frmVchDefine.EO.Fields.count
Set oFO = frmVchDefine.EO.Fields.Item(i)
With oFO
If .Name = cboName.Text Then
Me.txtCaption = .Caption
Select Case .DataType
Case 1, 2
Me.cboDataType.ListIndex = .DataType - 1
Case 3, 4, 5, 6
Me.cboDataType.ListIndex = 2
Case 7, 8
Me.cboDataType.ListIndex = .DataType - 4
End Select
Me.txtLength = .length
If mID(Me.cboDataType.Text, 1, 1) = 2 Or mID(Me.cboDataType.Text, 1, 1) = 3 Then
Me.txtLength.Locked = True
Else
Me.txtLength.Locked = False
End If
If AddOrEdit = 1 Then
Me.txtRow = .row
' Me.txtRow.Locked = True
Me.txtInputCol = .InputCol
Me.txtStartCol = .StartCol
' Me.txtStartCol.Locked = True
Me.txtEndCol = .EndCol
End If
' Me.txtMax = .Max
' Me.txtMin = .Min
If Not IsNull(.DefaultValue) Then Me.txtDefault = .DefaultValue
Me.txtFrac = .Decimals
Me.chkAllowNull.Value = Abs(CInt(.AllowNull))
Me.chkReference.Value = Abs(CBool(.ReferenceType))
If oFO.FieldOption <> U8FDEso.esoUserDefined Then
Me.chkAllowNull.Enabled = False
Else
Me.chkAllowNull.Enabled = True
End If
Me.chkUsed.Value = Abs(CInt(.IsUsed))
End If
End With
Next
End Sub
Private Sub Form_Load()
Dim oFO As U8FDEso.FieldObject
Dim i As Integer
Me.top = (Screen.Height - Me.Height) / 2
Me.left = (Screen.width - Me.width) / 2
cboDataType.ListIndex = 0
If AddOrEdit = 2 Then
' For Each oFO In frmVchDefine.EO.Fields
For i = 1 To frmVchDefine.EO.Fields.count
Set oFO = frmVchDefine.EO.Fields.Item(i)
With oFO
If .EditProp <> U8FDEso.esoNotVisible And Not .IsUsed Then
cboName.AddItem oFO.Name
Me.txtRow = frmVchDefine.lDownRow
' Me.txtRow.Locked = True
Me.txtStartCol = frmVchDefine.lDownCol
' Me.txtStartCol.Locked = True
If oFO.FieldOption <> U8FDEso.esoUserDefined Then
Me.chkAllowNull.Enabled = False
Else
Me.chkAllowNull.Enabled = True
End If
End If
End With
Next
ElseIf AddOrEdit = 1 Then
' For Each oFO In frmVchDefine.EO.Fields
For i = 1 To frmVchDefine.EO.Fields.count
Set oFO = frmVchDefine.EO.Fields.Item(i)
With oFO
If .EditProp <> U8FDEso.esoNotVisible And .row = frmVchDefine.lDownRow And .StartCol <= frmVchDefine.lDownCol And .EndCol >= frmVchDefine.lDownCol Then
cboName.AddItem oFO.Name
Me.txtCaption = .Caption
Me.txtLength = .length
Me.txtRow = .row
'Me.txtRow.Locked = True
Me.txtInputCol = .InputCol
Me.txtStartCol = .StartCol
'Me.txtStartCol.Locked = True
Me.txtEndCol = .EndCol
If Not IsNull(.Max) Then Me.txtMax = .Max
If Not IsNull(.Min) Then Me.txtMin = .Min
If Not IsNull(.DefaultValue) Then Me.txtDefault = .DefaultValue
Me.txtFrac = .Decimals
Me.chkAllowNull.Value = Abs(CInt(.AllowNull))
Me.chkReference.Value = Abs(CBool(.ReferenceType))
If oFO.FieldOption <> U8FDEso.esoUserDefined Then
Me.chkAllowNull.Enabled = False
Else
Me.chkAllowNull.Enabled = True
End If
Me.chkUsed.Value = Abs(CInt(.IsUsed))
Exit For
End If
End With
Next
End If
If cboName.ListCount > 0 Then cboName.ListIndex = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -