AfterLoad事件代码如下:
Dim drs As List(of DataRow)=DataTables("kjkm").Select("科目对应 IS NOT null","[_Identify]")
Dim fil1 As String,fil2 As String,fil3 As String
For Each dr As DataRow In drs
'kgs.Add(dr("科目编码"),dr("科目对应"))
If dr("科目编码") Like "2211-*" Then
fil1=fil1 & "末级会计科目 LIKE '%" & dr("科目编码") & "%'|"
ElseIf dr("科目编码") Like "5301-01-*" Then
fil2=fil2 & "末级会计科目 LIKE '%" & dr("科目编码") & "%'|"
ElseIf dr("科目编码") Like "5601-01-02-*" Then
fil3=fil3 & "末级会计科目 LIKE '%" & dr("科目编码") & "%'|"
End If
Next
fil1=fil1.trimend("|").Replace("|"," or ")
fil2=fil2.trimend("|").Replace("|"," or ")
fil3=fil3.trimend("|").Replace("|"," or ")
'Dim fil4 As String="(" & fil1 & ")" & " " And (末级会计科目 LIKE '%5601-01-02-01%' OR 末级科目编号 LIKE '%5301-01-%')" '2211中工资?五险一金及工会经费和教育经费这些科目对应的,且是计提的凭证,自动取2211的贷方数
'Dim fil5 As String="(" & fil2 & ")" & " and 末级会计科目 NOT LIKE '%6607%'" '5301中已经科目对应的,且不是结转研发费的凭证,自动取5301的借方数
'Dim fil6 As String="(" & fil3 & ")" & " and 末级会计科目 NOT LIKE '%5601-01-01-07%'" '5601-01-02中已经科目对应,且不是结转的凭证,自动取5601的借方数
'fil4=fil4 & " or 末级会计科目 LIKE '%2211-02-%' And (末级会计科目 LIKE '%5601-01-02-01%' OR 末级科目编号 LIKE '%5301-01-%')" '2211福利费虽没有对应,但是计提福利费的凭证,根据科目名称中的关键词自动取5601的借方
'fil4=fil4 & " Or (末级会计科目 LIKE '%2211-03-05%'" & _
'" Or 末级会计科目 LIKE '%2211-04%' or 末级会计科目 LIKE '%2211-06%'" & _
'" Or 末级会计科目 LIKE '%2211-07%' or 末级会计科目 LIKE '%2211-10%')" & _
'" and (末级会计科目 NOT LIKE '%5601-01-%' and 末级会计科目 NOT LIKE '%5301-01-%')" '2211中除福利费外其他没有对应的,且不是计提间接费和计提研发费的凭证,需要手动重分类
'fil5=fil5 & " or 末级会计科目 LIKE '%5301-01-14-99%' and 末级会计科目 NOT LIKE '%6607%'" '5301中其他中的其他没有对应的,且不是结转研发费的凭证,需要手动重分类
'fil6=fil6 & " or (末级会计科目 LIKE '%5601-01-02-19%' or 末级会计科目 LIKE '%5601-01-02-21%'" & _
'" Or 末级会计科目 LIKE '%5601-01-02-26%')" & _
'" And 末级会计科目 NOT LIKE '%5601-01-01-07%'" '间接费中没有对应的科目,且不是结转间接费的凭证,根据摘要中的关键词自动重分类部分科目,没有关键词的需要手动重分类
Dim fil4 As String="(末级会计科目 Like '%2211-03-05%'" & _
" Or 末级会计科目 LIKE '%2211-04%' or 末级会计科目 LIKE '%2211-06%'" & _
" Or 末级会计科目 LIKE '%2211-07%' or 末级会计科目 LIKE '%2211-10%')" & _
" and (末级会计科目 NOT LIKE '%5601-01-%' and 末级会计科目 NOT LIKE '%5301-01-%')" '2211中除福利费外其他没有对应的,且不是计提间接费和计提研发费的凭证,需要手动重分类
Dim fil5 As String="末级会计科目 Like '%5301-01-14-99%' and 末级会计科目 NOT LIKE '%6607%'" '5301中其他中的其他没有对应的,且不是结转研发费的凭证,需要手动重分类
Dim fil6 As String="(末级会计科目 Like '%5601-01-02-19%' or 末级会计科目 LIKE '%5601-01-02-21%'" & _
" Or 末级会计科目 LIKE '%5601-01-02-26%')" & _
" And 末级会计科目 NOT LIKE '%5601-01-01-07%'" '间接费中没有对应的科目,且不是结转间接费的凭证,根据摘要中的关键词自动重分类部分科目,没有关键词的需要手动重分类
Dim fil As String=fil4 & " or " & fil5 & " or " & fil6
Dim zts As String=DataTables("ZTMX").GetComboListString("账套编码","管理单位编号='1001001'","[_Identify]")
zts=zts.Replace("|","','")
zts="('" & zts & "')"
DataTables("Drsj_pzdjb").StopRedraw
DataTables("Drsj_xsz").StopRedraw
DataTables("Drsj_pzdjb").FillLoadTime.Out=60
DataTables("Drsj_xsz").FillLoadTime.Out=60
DataTables("Drsj_pzdjb").LoadFilter="账套编码 IN " & zts & " AND " & fil
DataTables("Drsj_pzdjb").LoadOrder="[_Identify]"
DataTables("Drsj_pzdjb").load(False)
Application.DoEvents
DataTables("Drsj_pzdjb").LoadChildren("Drsj_xsz")
Application.DoEvents
DataTables("Drsj_xsz").ResumeRedraw
Application.DoEvents
DataTables("Drsj_pzdjb").ResumeRedraw
Application.DoEvents
Dim czb As Table=Tables("间接费重分类_jjfcfl")
'Dim czb As Table=Tables("Drsj_xsz")
Dim dczb As DataTable=DataTables("Drsj_xsz")
MainTable=czb
Dim fil7 As String=fil1.Replace("末级会计科目 LIKE '%","'").replace("%'","'").replace(" or ",",")
Dim fil8 As String=fil2.Replace("末级会计科目 LIKE '%","'").replace("%'","'").replace(" or ",",")
Dim fil9 As String=fil3.Replace("末级会计科目 LIKE '%","'").replace("%'","'").replace(" or ",",")
fil7=fil7 & ",'2211-02-01','2211-02-02','2211-03-05','211-04','2211-06','2211-07','2211-10'"
fil8=fil8 & ",'5301-01-14-99'"
fil9=fil9 & ",'5601-01-02-19','5601-01-02-21','5601-01-02-26'"
Dim fil0 As String="(" & fil7 & "," & fil8 & "," & fil9 & ")"
czb.Filter="重分类科目编号 Is NULL And 末级科目编号 In " & fil0
Dim grid As C1FlexGrid.C1FlexGrid = czb.Grid
grid.BackColor = Color.Transparent
grid.Styles.EmptyArea.BackColor = Color.Transparent
czb.SetColVisibleWidth("账套简称|86|日期|73|凭证字号|61|摘要|265|末级科目编号|98|借方本位币|90|贷方本位币|90|重分类科目编号|98|重分类方式|60|重分类科目名称|98|重分类凭证金额|98")
'czb.Cols("预算年度").TextAlign = TextAlignEnum.Center
''czb.Cols("截止日期").TextAlign = TextAlignEnum.Center
Dczb.DataCols("借方本位币").SetFormat("#,##0.00")
Dczb.DataCols("贷方本位币").SetFormat("#,##0.00")
Dczb.DataCols("重分类凭证金额").SetFormat("#,##0.00")
czb.Cols("日期").AllowEdit=False
czb.Cols("凭证字号").AllowEdit=False
czb.Cols("摘要").AllowEdit=False
czb.Cols("末级科目编号").AllowEdit=False
czb.Cols("借方本位币").AllowEdit=False
czb.Cols("贷方本位币").AllowEdit=False
'czb.Cols("预算金额").AllowEdit=True
czb.EnterKeyActionDown=True
''czb.OpenLoadTree("账套简称")
'czb.Cols("预算金额").GrandTotal = True '指定要合计的列
''czb.Cols("金额").GrandTotal = True
'czb.GrandTotal = True '显示合计模式
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
trv.BuildTree(dczb, "账套简称")
trv.StopRedraw
For Each nd As WinForm.TreeNode In trv.AllNodes
If nd.Level=0 Then
nd.text=nd.text & "(" & dczb.Compute("count(账套简称)","[账套简称] = '" & nd.text & "' AND 重分类科目编号 Is NULL And 末级科目编号 In " & fil0) & "条)"
End If
Next
trv.Nodes.Insert("市政分公司所有","市政分公司所有(" & dczb.Compute("count(账套简称)","重分类科目编号 Is NULL And 末级科目编号 In " & fil0) & "条)",0)
trv.ResumeRedraw
czb.Filter = "(重分类科目编号 Is NULL or 重分类方式='手动') And 末级科目编号 In " & fil0