Foxtable(狐表)用户栏目专家坐堂 → 请教修改代码


  共有1528人关注过本帖树形打印复制链接

主题:请教修改代码

帅哥哟,离线,有人找我吗?
jamhuton
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:502 积分:3620 威望:0 精华:0 注册:2015/4/21 22:45:00
请教修改代码  发帖心情 Post By:2017/6/27 18:01:00 [显示全部帖子]

If e.DataRow("商家名称") = "商家名称" Then
    e.DataRow("金额") = DataTables("船运明细").Compute("sum(金额)","[商家名称]= '" & e.DataRow("商家名称") & "' And [月份]= '" & e.DataRow("月份") & "'And [业务类型]= '" & e.DataRow("业务类型") & "'" )
    e.DataRow("成本") = DataTables("船运明细").Compute("sum(成本)","[商家名称]= '" & e.DataRow("商家名称") & "' And [月份]= '" & e.DataRow("月份") & "'And [业务类型]= '" & e.DataRow("业务类型") & "'" )
    e.DataRow("业务量") = DataTables("船运明细").Compute("count(箱型)","[商家名称]= '" & e.DataRow("商家名称") & "' And [月份]= '" & e.DataRow("月份") & "'And [业务类型]= '" & e.DataRow("业务类型") & "'" )
Else
    e.DataRow("金额") = DataTables("入库").Compute("sum(合计)","[商家名称]= '" & e.DataRow("商家名称") & "' And [月份]= '" & e.DataRow("月份") & "'And [业务类型]= '" & e.DataRow("业务类型") & "'" )
    e.DataRow("成本") = DataTables("入库").Compute("sum(装卸成本)","[商家名称]= '" & e.DataRow("商家名称") & "' And [月份]= '" & e.DataRow("月份") & "'And [业务类型]= '" & e.DataRow("业务类型") & "'" )
    e.DataRow("业务量") = DataTables("入库").Compute("count(箱型)","[商家名称]= '" & e.DataRow("商家名称") & "' And [月份]= '" & e.DataRow("月份") & "'And [业务类型]= '" & e.DataRow("业务类型") & "'" )
Else
    e.DataRow("金额") = DataTables("出库").Compute("sum(合计)","[商家名称]= '" & e.DataRow("商家名称") & "' And [月份]= '" & e.DataRow("月份") & "'And [业务类型]= '" & e.DataRow("业务类型") & "'" )
    e.DataRow("成本") = DataTables("出库").Compute("sum(运输成本)","[商家名称]= '" & e.DataRow("商家名称") & "' And [月份]= '" & e.DataRow("月份") & "'And [业务类型]= '" & e.DataRow("业务类型") & "'" )
    e.DataRow("业务量") = DataTables("出库").Compute("count(箱型)","[商家名称]= '" & e.DataRow("商家名称") & "' And [月份]= '" & e.DataRow("月份") & "'And [业务类型]= '" & e.DataRow("业务类型") & "'" )
End If

老师好,Else如何修改?
放一个else可以执行,放了2个代码需要变化吗?

 回到顶部
帅哥哟,离线,有人找我吗?
jamhuton
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:502 积分:3620 威望:0 精华:0 注册:2015/4/21 22:45:00
  发帖心情 Post By:2017/6/28 9:45:00 [显示全部帖子]

If e.DataRow("业务类型") = "业务类型" Then
    e.DataRow("金额") = DataTables("船运明细").Compute("sum(金额)","[商家名称]= '" & e.DataRow("商家名称") & "' And [月份]= '" & e.DataRow("月份") & "'And [业务类型]= '" & e.DataRow("业务类型") & "'" )
    e.DataRow("成本") = DataTables("船运明细").Compute("sum(成本)","[商家名称]= '" & e.DataRow("商家名称") & "' And [月份]= '" & e.DataRow("月份") & "'And [业务类型]= '" & e.DataRow("业务类型") & "'" )
    e.DataRow("业务量") = DataTables("船运明细").Compute("count(箱型)","[商家名称]= '" & e.DataRow("商家名称") & "' And [月份]= '" & e.DataRow("月份") & "'And [业务类型]= '" & e.DataRow("业务类型") & "'" )
ElseIf e.DataRow("业务类型") = "业务类型" Then
    e.DataRow("金额") = DataTables("入库").Compute("sum(合计)","[商家名称]= '" & e.DataRow("商家名称") & "' And [月份]= '" & e.DataRow("月份") & "'And [业务类型]= '" & e.DataRow("业务类型") & "'" )
    e.DataRow("成本") = DataTables("入库").Compute("sum(装卸成本)","[商家名称]= '" & e.DataRow("商家名称") & "' And [月份]= '" & e.DataRow("月份") & "'And [业务类型]= '" & e.DataRow("业务类型") & "'" )
    e.DataRow("业务量") = DataTables("入库").Compute("count(箱型)","[商家名称]= '" & e.DataRow("商家名称") & "' And [月份]= '" & e.DataRow("月份") & "'And [业务类型]= '" & e.DataRow("业务类型") & "'" )
Else
    e.DataRow("金额") = DataTables("出库").Compute("sum(合计)","[商家名称]= '" & e.DataRow("商家名称") & "' And [月份]= '" & e.DataRow("月份") & "'And [业务类型]= '" & e.DataRow("业务类型") & "'" )
    e.DataRow("成本") = DataTables("出库").Compute("sum(运输成本)","[商家名称]= '" & e.DataRow("商家名称") & "' And [月份]= '" & e.DataRow("月份") & "'And [业务类型]= '" & e.DataRow("业务类型") & "'" )
    e.DataRow("业务量") = DataTables("出库").Compute("count(箱型)","[商家名称]= '" & e.DataRow("商家名称") & "' And [月份]= '" & e.DataRow("月份") & "'And [业务类型]= '" & e.DataRow("业务类型") & "'" )
End If

第三段代码执行了,前面的不执行。

 回到顶部
帅哥哟,离线,有人找我吗?
jamhuton
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:502 积分:3620 威望:0 精华:0 注册:2015/4/21 22:45:00
  发帖心情 Post By:2017/6/28 9:59:00 [显示全部帖子]


图片点击可在新窗口打开查看此主题相关图片如下:1.png
图片点击可在新窗口打开查看

从三个表格导入数据,前面的两个表格的数据没有导入。

 回到顶部
帅哥哟,离线,有人找我吗?
jamhuton
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:502 积分:3620 威望:0 精华:0 注册:2015/4/21 22:45:00
  发帖心情 Post By:2017/6/28 10:17:00 [显示全部帖子]

找到问题了。

 回到顶部