以下是引用鲁吉在2017/8/2 15:28:00的发言:也就是说当前行的”本年累计增加“=上一行(月)的”本年累计增加“+当前行的”本月增加“
这种效果没能实现
参考流水账的设计
http://www.foxtable.com/webhelp/scr/1572.htm
Select Case e.DataCol.name
Case "年", "月", "上年结转","本月增加","本月减少"
If e.DataRow.IsNull("年") Then
e.DataRow("本月结余") = Nothing
Else
If e.DataRow("月") = "1" Then
Dim fdr = e.DataTable.find("年 = '" & e.DataRow("年") - 1 & "' and 月 = '12'")
If fdr IsNot Nothing Then
e.DataRow("上年结转") = fdr("本月结余")
End If
Else
Dim fdr = e.DataTable.find("年 = '" & e.DataRow("年") & "' and 月 = '1'")
If fdr IsNot Nothing Then
e.DataRow("上年结转") = fdr("上年结转")
End If
End If
Dim sum1 As Double = e.DataTable.Compute("sum(本月增加)", "年 = '" & e.DataRow("年") & "'")
Dim sum2 As Double = e.DataTable.Compute("sum(本月减少)", "年 = '" & e.DataRow("年") & "'")
e.DataRow("本年累计增加") = sum1
e.DataRow("本年累计减少") = sum2
e.DataRow("本月结余") = sum1 + e.DataRow("上年结转") - sum2
End If
End Select