以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 高于流水账增加条件的表达式问题 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=159022) |
-- 作者:papa -- 发布时间:2020/12/10 21:37:00 -- 高于流水账增加条件的表达式问题 请问老师如何在高效流水账计算中增加产品和库存组织条件进行计算,用 [产品] and [库存组织] 只能计算一次,在增加产品计算发生错误 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 [产品] and [库存组织] = \'" & mr("产品") & "\'", "[_SortKey] Desc") \'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 [产品] and [库存组织] = \'" & dr("产品") & "\'", "[_SortKey]") \'drs = e.DataTable.Select("[_SortKey] >= " & dr("_SortKey") & " And [产品] = \'" & dr("产品") & "\'", "[_SortKey]") For i As Integer = 1 To drs.Count - 1 drs(i)("库存") = drs(i-1)("库存") + drs(i)("入库") - drs(i)("出库") Next If e.DataCol.Name = "产品" AndAlso e.OldValue IsNot Nothing AndAlso e.OldValue <> e.NewValue Then dr = e.DataTable.Find("[_SortKey] < " & mr("_SortKey") & " And [产品] and [库存组织] = \'" & e.OldValue & "\'", "[_SortKey] Desc") \'dr = e.DataTable.Find("[_SortKey] < " & mr("_SortKey") & " And [产品] = \'" & e.OldValue & "\'", "[_SortKey] Desc") If dr Is Nothing Then dr = e.DataTable.Find("[产品] = \'" & e.OldValue & "\'", "[_SortKey]") If dr IsNot Nothing Then dr("库存") = dr("入库") - dr("出库") End If End If If dr IsNot Nothing Then drs = e.DataTable.Select("[_SortKey] >= " & dr("_SortKey") & " And [产品] and [库存组织] = \'" & dr("产品") & "\'", "[_SortKey]") \'drs = e.DataTable.Select("[_SortKey] >= " & dr("_SortKey") & " And [产品] = \'" & dr("产品") & "\'", "[_SortKey]") For i As Integer = 1 To drs.Count - 1 drs(i)("库存") = drs(i-1)("库存") + drs(i)("入库") - drs(i)("出库") Next End If End If End Select
[此贴子已经被作者于2020/12/10 22:06:42编辑过]
|
-- 作者:papa -- 发布时间:2020/12/10 21:51:00 -- 附件 |
-- 作者:有点蓝 -- 发布时间:2020/12/10 22:26:00 -- dr = e.DataTable.Find("[_SortKey] < " & mr("_SortKey") & " And [产品] = \'" & mr("产品") & "\' and [库存组织]=\'" & mr("库存组织") & "\'", "[_SortKey] Desc") |