这么好的产品值得升级
项目事件
计划管理
表事件
会计科目_DataColChanged
If e.DataCol.Name = "科目代码" Then
If e.DataRow.IsNull("科目代码") Then
e.DataRow("是否末级科目") = Nothing
Else
If e.DataTable.Find("科目代码 like '" & e.DataRow("科目代码") & "%' and 科目代码 <> '" & e.DataRow("科目代码") & "'") Is Nothing Then
e.DataRow("是否末级科目") = "末级"
Else
e.DataRow("是否末级科目") = "非末级"
End If
End If
End If
窗口表事件
窗口与控件事件
窗口1_AfterLoad
Dim tr As WinForm.TreeView = e.Form.Controls("TreeView1")
Dim nd As WinForm.TreeNode
Dim dt As DataTable = DataTables("会计科目")
tr.StopRedraw()
tr.Nodes.Clear
tr.Nodes.Add("全部")
For Each dr As DataRow In dt.Select("","科目代码")
If dr.IsNull("科目代码") = False AndAlso dr("科目代码").Length = 4 Then
nd = tr.Nodes.Add(dr("科目代码"),dr("科目代码") & " " & dr("科目名称"))
Functions.Execute("AddChildren",nd,dt)
End If
Next
tr.ResumeRedraw()
窗口1_TreeView1_NodeMouseDoubleClick
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
If e.Node.Name = "全部" Then
Tables("会计科目").Filter = ""
Else
Tables("会计科目").Filter = "科目代码 Like '" & e.Node.Name & "%'"
End If
窗口2_AfterLoad
Dim tr As WinForm.TreeView = e.Form.Controls("TreeView1")
Dim rts() As String = {"全部","资产","负债","权益","成本","损益"}
Dim nd As WinForm.TreeNode
Dim dt As DataTable = DataTables("会计科目")
tr.StopRedraw()
tr.Nodes.Clear
For Each rt As String In rts
tr.Nodes.Add(rt)
Next
For Each dr As DataRow In dt.Select("", "科目代码")
If dr.IsNull("科目代码") = False AndAlso dr("科目代码").Length = 4 Then
Dim i As Integer = CInt(dr("科目代码").Substring(0,1))
nd = tr.Nodes(i).Nodes.Add(dr("科目代码"),dr("科目代码") & " " & dr("科目名称"))
Functions.Execute("AddChildren",nd,dt)
End If
Next
tr.ResumeRedraw()
窗口2_TreeView1_NodeMouseDoubleClick
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
If e.Node.Level = 0
If e.Node.Name = "全部" Then
Tables("会计科目").Filter = ""
Else
Tables("会计科目").Filter = "科目代码 Like '" & e.Node.Index & "%'"
End If
Else
Tables("会计科目").Filter = "科目代码 Like '" & e.Node.Name & "%'"
End If
窗口3_Button1_Click
Forms("窗口2").Close()
Forms("窗口1").Open()
窗口3_Button2_Click
Forms("窗口1").Close()
Forms("窗口2").Open()
自定义函数
AddChildren
Dim nd As WinForm.TreeNode = args(0)
Dim dt As DataTable = args(1)
For Each dr As DataRow In dt.Select("","科目代码") '按科目代码顺序添加
Dim km As String = dr("科目代码")
If km.StartsWith(nd.name) AndAlso km.Length = nd.Name.Length + 2 Then
Dim cd As Winform.TreeNode = nd.Nodes.Add(km,km & " " & dr("科目名称"))
Functions.Execute("AddChildren",cd,dt)
End If
Next
全局代码
菜单事件
[此贴子已经被作者于2022/7/6 14:00:45编辑过]