以下代码第二行计算不正确,drs(i)("E34") = 2倍 SU ,
Case "E30","E31","E16"
Dim dr As DataRow
Dim drs As List(of DataRow)
Dim Su As Single
dr = e.DataTable.Find("[_SortKey] < " & e.DataRow("_SortKey"), "[_SortKey] Desc") '找出上一行
If dr Is Nothing Then '如果没有找到上一行,说明本行就是第一行
e.DataRow("E34") = e.DataRow("E8") / e.DataRow("E30") / e.DataRow("E31") / e.DataRow("E16")
Dim Lng As Integer = Math.Ceiling(Su)
e.DataRow("E33") = DataTables("JF").DataRows(0)("E32").AddDays(Lng-1)
dr = e.DataRow
End If
Su = dr("E34")
drs = e.DataTable.Select("[_SortKey] >= " & dr("_SortKey"), "[_SortKey]")
For i As Integer = 1 To drs.Count - 1 '重算余下行的余额
Su = Su + drs(i)("E8") / (drs(i)("E30") * drs(i)("E31") * drs(i)("E16"))
drs(i)("E34") = Format(Su,"0.0")
Next