以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]复制 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=148426) |
-- 作者:江南小镇 -- 发布时间:2020/4/7 21:00:00 -- [求助]复制 老师,下面代码怎样控制不重复复制。 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 dr2 As DataRow = DataTables("收支表").Find("单据编号 = \'" & e.DataRow("入库单编号明细") & "\'") \'找到指定返回的行 If dr2 Is Nothing Then Dim dr3 As DataRow = DataTables("收支表").AddNew For i As Integer = 0 To nma.Length - 1 dr3(nmb(i)) = e.DataRow(nma(i)) Next dr3("来源") = "采购" End If Else DataTables("收支表").deletefor("ID = \'" & e.DataRow("_Identify") & "\'") End If End If
|
-- 作者:有点蓝 -- 发布时间:2020/4/7 21:45:00 -- 代码有什么问题?查不到才会新增呀 |
-- 作者:江南小镇 -- 发布时间:2020/4/8 8:50:00 -- 老师好 |
-- 作者:有点蓝 -- 发布时间:2020/4/8 9:08:00 -- https://www.baidu.com/baidu?word=access+导入对象 |
-- 作者:江南小镇 -- 发布时间:2020/4/10 8:55:00 -- 老师,下面两组代码不能单独应用。 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 dr2 As DataRow = DataTables("收支表").Find("单据编号 = \'" & e.DataRow("出库单编号明细") & "\'") \'找到指定返回的行 If dr2 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 = "已开票" If e.DataRow("已开票") = True Then Dim nma() As String = {"_Identify","出库单编号", "出库_税率","开票日期" ,"发票名称","发票号码","出库_税金","出库_税金" } \'A表数据来源列 Dim nmb() As String = {"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("来源") = "支出" \'入库表就改为"采购",其他表改为"其它" dr("单位") = "份" dr("数量") = "1" dr("客户ID") = "S001" dr("客户") = "园区国税" dr("项目名称") = "增值税" End If Else DataTables("收支表").deletefor("ID = \'" & e.DataRow("_Identify") & "\'") End If End If
|
-- 作者:有点蓝 -- 发布时间:2020/4/10 9:11:00 -- 有什么问题? |
-- 作者:江南小镇 -- 发布时间:2020/4/10 9:15:00 -- 两组代码中第一组代码不复制,屏蔽第二组代码第一组就可以复制。 |
-- 作者:有点蓝 -- 发布时间:2020/4/10 9:20:00 -- 第一组 Else DataTables("收支表").deletefor("ID = \'" & e.DataRow("_Identify") & "\'") 改为 Elseif e.DataRow("已开票") = false DataTables("收支表").deletefor("ID = \'" & e.DataRow("_Identify") & "\'") 第二组改为 Elseif e.DataRow("审核") = false DataTables("收支表").deletefor("ID = \'" & e.DataRow("_Identify") & "\'") |
-- 作者:江南小镇 -- 发布时间:2020/4/10 10:22:00 -- 谢谢老师 |