老师,下面两组代码可以合并吗?
If e.DataCol.Name = "审核"
If e.DataRow("审核") = True Then
Dim nma() As String = {"_Identify","出库单编号" , "出库日期","客户ID","客户","商品ID","商品名称","规格","出库_数量","出库_售价","出库_单位","出库_价税合计","出库单编号明细"} 'A表数据来源列
Dim nmb() As String = {"ID" ,"单据编号" , "日期","客户ID","客户","商品ID","项目名称","规格","数量","单价","单位","收入","出库单编号明细" } 'B表数据接收列
e.DataRow.save
Dim dr1 As DataRow = DataTables("收支表").Find("出库单编号明细 = '" & e.DataRow("出库单编号明细") & "'") '找到指定返回的行
If dr1 Is Nothing Then
Dim dr As DataRow = DataTables("收支表").AddNew
For i As Integer = 0 To nma.Length - 1
dr(nmb(i)) = e.DataRow(nma(i))
Next
dr("来源") = "销售" '入库表就改为"采购",其他表改为"其它"
End If
Else
DataTables("收支表").deletefor("ID = '" & e.DataRow("_Identify") & "'")
End If
End If
If e.DataCol.Name = "已开piao"
If e.DataRow("已开piao") = True Then
Dim nma() As String = {"_Identify","出库单编号", "出库_税率","开piao日期" ,"fa piao号码","出库_税金","出库_税金" } 'A表数据来源列
Dim nmb() As String = {"ID" ,"单据编号","规格", "日期","fa piao号码","单价","支出" } 'B表数据接收列
e.DataRow.save
Dim dr1 As DataRow = DataTables("收支表").Find("fa piao号码 = '" & e.DataRow("fa piao号码") & "'") '找到指定返回的行
If dr1 Is Nothing Then
Dim dr As DataRow = DataTables("收支表").AddNew
For i As Integer = 0 To nma.Length - 1
dr(nmb(i)) = e.DataRow(nma(i))
Next
dr("来源") = "支出" '入库表就改为"采购",其他表改为"其它"
dr("单位") = "份"
dr("数量") = "1"
dr("客户ID") = "S001"
dr("客户") = "园区国税"
dr("项目名称") = "增值税"
End If
Else
DataTables("收支表").deletefor("ID = '" & e.DataRow("_Identify") & "'")
End If
End If
老师,有点搞不清思路,"审核"列是通过按钮触发该事件"已开piao"列是fa piao号码列触发的。如果已开是否的话不把"税金"列填充到收支表中。
[此贴子已经被作者于2017/5/27 22:30:45编辑过]