这是最相关的。
费用项目_PrepareEdit
If Forms("费用项目").Opened Then
If e.RecordGrid Is Nothing Then '如果不是在记录窗口输入数据
e.Cancel = True '则取消输入
Else
If e.IsFocusCell Then
If e.Col.name = "项目类别" AndAlso e.Row("收付") = 1 Then
Dim tb As New DropTreeBuilder
tb.SourceTable = DataTables("基础类别") '指定目录树表
tb.TreeCols = "{类别归属}" '指定用于生成目录树的列,用大括号括起来
tb.SourceCols = "类别名称" ' 字符型,指定数据来源列
tb.ReceiveCols = "项目类别" '指定数据接收列
tb.TreeFilter = "[级别] > 0 And SubString([类别归属],1,6) = '收费项目类别'"
tb.PathSeparator = "\" '指定路径分割符号
' e.Col.DropTree = tb.Build()
Tables("费用项目_TableMoney").Cols("项目类别").DropTree = tb.Build()
End If
End If
End If
End If
费用项目_DataColChanging
Select Case e.DataCol.Name
Case "流程顺序"
If e.DataRow("是否流程") And e.NewValue IsNot Nothing Then
Dim dr As DataRow
dr = e.DataTable.Find("流程顺序 = " & e.NewValue & "")
If dr IsNot Nothing Then
MessageBox.Show("此流程号已经存在!")
e.Cancel = True
End If
ElseIf e.DataRow("是否流程") = False And e.NewValue IsNot Nothing Then
If e.NewValue > 0 And e.NewValue <> 9999 Then
MessageBox.Show("非流程项目设定流程顺序有特殊要求,具体请参考使用说明书!","操作提示",MessageBoxButtons.OK,MessageBoxIcon.Error)
e.Cancel = True
End If
End If
Case "项目名称"
Dim dr As DataRow
dr = e.DataTable.Find("项目名称 = '" & e.NewValue & "'")
If dr IsNot Nothing Then
MessageBox.Show("已存在此项目,不能重复添加!","操作提示",MessageBoxButtons.OK,MessageBoxIcon.Error)
e.Cancel = True
End If
Case "代收费标准"
If e.DataRow("是否代收费") = False Or e.DataRow.IsNull("代收费方式") Then
MessageBox.Show("请先勾选是否代收费并选取代收费方式!","操作提示",MessageBoxButtons.OK,MessageBoxIcon.Error)
e.Cancel = True
Else
If e.DataRow("代收费方式") = "比例" And e.NewValue > 1 Then
MessageBox.Show("代收费方式为比例时标准不能大于1","操作提示",MessageBoxButtons.OK,MessageBoxIcon.Error)
End If
End If
Case "费用单价"
If e.DataRow("固定收费") Then
MessageBox.Show("固定收费,不可变更!","操作提示",MessageBoxButtons.OK,MessageBoxIcon.Error)
e.Cancel = True
End If
End Select
费用项目_DataColChanged
Select Case e.DataCol.Name
Case "是否流程"
If e.DataRow("是否流程") = False Then
e.DataRow("流程顺序") = Nothing
e.DataRow("年审审核") = False
e.DataRow("记录仪审核") = False
e.DataRow("保险审核") = False
End If
Case "年审审核","记录仪审核","保险审核"
If e.DataRow("是否流程") = False And e.DataRow(e.DataCol.Name) = True Then
MessageBox.Show("只有流程项目才能审核!")
e.DataRow(e.DataCol.Name) = False
End If
End Select