Foxtable(狐表)用户栏目专家坐堂 → [求助]非常非常麻烦的报表怎么实现?狐爸帮帮忙 (将表修改后)


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

主题:[求助]非常非常麻烦的报表怎么实现?狐爸帮帮忙 (将表修改后)

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


加好友 发短信
等级:婴狐 帖子:89 积分:535 威望:0 精华:0 注册:2013/2/23 20:06:00
  发帖心情 Post By:2013/2/27 21:21:00 [显示全部帖子]

你在命令窗口执行下面的代码:

 

Dim dt1 As Date = #1/1/2013#
Dim dt2 As Date = #12/31/2013#
Dim dt As DataTable = DataTables("产品录入")
Dim filter As String = "日期 >= #" & dt1 & "# And 日期 <= #" & dt2 & "#"
Dim dtb As New DataTableBuilder("统计")
dtb.AddDef("姓名", Gettype(String), 32)
dtb.AddDef("完整_经手人1", Gettype(Integer))
dtb.AddDef("完整_经手人2", Gettype(Integer))
dtb.AddDef("水果_经手人1", Gettype(Integer))
dtb.AddDef("水果_经手人2", Gettype(Integer))
dtb.AddDef("零食_经手人1", Gettype(Integer))
dtb.AddDef("零食_经手人2", Gettype(Integer))
dtb.AddDef("时间_经手人1", Gettype(Integer))
dtb.AddDef("时间_经手人2", Gettype(Integer))
dtb.AddDef("个人利润_经手人1", Gettype(Integer))
dtb.AddDef("个人利润_经手人2", Gettype(Integer))
dtb.Build()
Dim lst1 As List(of String) = DataTables("产品录入").GetUniqueValues("","经手人一")
Dim lst2 As List(of String) = DataTables("产品录入").GetUniqueValues("","经手人二")
For Each nm As String In lst2
    If Lst1.Contains(nm) = False Then
        lst1.add(nm)
    End If
Next
For Each nm As String In lst1
    Dim r As Row = Tables("统计").AddNew()
    r("姓名") = nm
    r("完整_经手人1") = DataTables("产品录入").Compute("Count([_Identify])","经手人一 = '" & nm & "'")
    r("完整_经手人2") = DataTables("产品录入").Compute("Count([_Identify])","经手人二 = '" & nm & "'")
    r("零食_经手人1") = DataTables("产品录入").Compute("Count([_Identify])","经手人一 = '" & nm & "' And 类型 = '零食'")
    r("零食_经手人2") = DataTables("产品录入").Compute("Count([_Identify])","经手人二 = '" & nm & "' And 类型 = '零食'")
    r("水果_经手人1") = r("完整_经手人1") - r("零食_经手人1")
    r("水果_经手人2") = r("完整_经手人2") - r("零食_经手人2")
    r("个人利润_经手人1") = DataTables("产品录入").Compute("Sum(利润)","经手人一 = '" & nm & "'")
    r("个人利润_经手人2") = DataTables("产品录入").Compute("Sum(利润)","经手人二 = '" & nm & "'")
Next


 回到顶部