-- 作者:飞过海洋
-- 发布时间:2017/11/27 11:16:00
--
老师:
我按您的指导加进去编 码了。结存金额已经成功了。可是自动生成起号代码我加进去后,没反应,是不是我写错了。请老师给改正一下
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 \'如果没有上一行,说明本行就是同产品的第一行
dr = e.DataTable.Find("[_SortKey] < " & mr("_SortKey") & " And [姓名] = \'" & mr("姓名") & "\'", "[_SortKey] Desc")
dr("售出_起号") = dr("售出_止号") + 1
mr("结存张数") = mr("上年结转_张数") + mr("领入_张数") - mr("售出_张数")- 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)("领入_张数") - drs(i)("售出_张数")- drs(i)("售出_废票")
drs(i)("结存金额") = drs(i-1)("结存金额") + drs(i)("售出_金额")
Next
End Select
此主题相关图片如下:e@z(gfl671ttf$o7)}(hg.png
此主题相关图片如下:@%}ed4}(0af56(wd21vwcl7.jpg
|