计算库存代码问题?我的报表采购_入库数量是表达式列,其数值需要通过“型号“*“采购_数量”计算”,现在代码不会自动计算,请专家帮我看看怎么改。
Select Case e.DataCol.Name
Case "试剂名称" , "领用_数量", "采购_入库数量"
Dim dr As DataRow
Dim mr As DataRow = e.DataRow
Dim drs As List(Of DataRow)
dr = e.DataTable.Find("[_SortKey] < " & mr("_SortKey") & " And [试剂名称] = '" & mr("试剂名称") & "'", "[_SortKey] Desc")
If dr Is Nothing Then '如果没有上一行,说明本行就是同产品的第一行
mr("库存") = mr("采购_入库数量") - mr("领用_数量")
dr = mr
End If
drs = e.DataTable.Select("[_SortKey] >= " & dr("_SortKey") & " And [试剂名称] = '" & dr("试剂名称") & "'")
For i As Integer = 1 To drs.Count - 1 '重算余下行的余额
drs(i)("库存") = drs(i - 1)("库存") + drs(i)("采购_入库数量") - drs(i)("领用_数量")
Next
End Select