Foxtable(狐表)用户栏目专家坐堂 → [求助]号码段分组统计


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

主题:[求助]号码段分组统计

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


加好友 发短信 一级勋章
等级:MVP荣誉狐 帖子:5154 积分:31434 威望:0 精华:8 注册:2008/9/8 12:27:00
  发帖心情 Post By:2011/8/2 8:59:00 [显示全部帖子]

放在项目 maintablechanged 事件中:(你自己优化吧)

 


DataTables("表B").datarows.clear()
Dim n As Integer
For i As Integer = 0 To Tables("表A").count-1
    If i = 0
        Tables("表B").addnew()
        Tables("表B").Rows(n)("起号") = Tables("表A").Rows(i)("起号")
        Tables("表B").Rows(n)("序号") = n+1
        n = n + 1
    Else
        If i = Tables("表A").count-1
            Tables("表B").addnew()
            Tables("表B").Rows(n-1)("止号") = Tables("表A").Rows(i)("止号")
            Tables("表B").Rows(n-1)("全部单证张数") = Tables("表A").Compute("Sum(张数)","起号 >= '" & _
            Tables("表B").Rows(n-1)("起号") & "' and 起号 <= '" & Tables("表A").Rows(i)("起号") & "' ")
            Tables("表B").Rows(n-1)("售单张数") = Tables("表A").Compute("Sum(张数)","单证状态 = '售单' and 起号 >= '" & _
            Tables("表B").Rows(n-1)("起号") & "' and 起号 <= '" & Tables("表A").Rows(i)("起号") & "' ")
            Tables("表B").Rows(n-1)("退废单张数") = Tables("表A").Compute("Sum(张数)","(单证状态 = '退单' or 单证状态 = '废单') and 起号 >= '" & _
            Tables("表B").Rows(n-1)("起号") & "' and 起号 < '" & Tables("表A").Rows(i)("起号") & "' ")
            Tables("表B").Rows(n-1)("售单金额") = Tables("表A").Compute("Sum(保费)","单证状态 = '售单' and 起号 >= '" & _
            Tables("表B").Rows(n-1)("起号") & "' and 起号 <= '" & Tables("表A").Rows(i)("起号") & "' ")
            Tables("表B").Rows(n)("序号") = "合计"
            Tables("表B").Rows(n)("全部单证张数") =  Tables("表B").Compute("Sum(全部单证张数)")
            Tables("表B").Rows(n)("售单张数") =  Tables("表B").Compute("Sum(售单张数)")
            Tables("表B").Rows(n)("退废单张数") =  Tables("表B").Compute("Sum(退废单张数)")
            Tables("表B").Rows(n)("售单金额") =  Tables("表B").Compute("Sum(售单金额)")
        Else
            If val(Tables("表A").Rows(i)("起号")) - val(Tables("表A").Rows(i-1)("止号")) > 1
                Tables("表B").addnew()
                Tables("表B").Rows(n-1)("止号") = Tables("表A").Rows(i-1)("止号")
                Tables("表B").Rows(n)("起号") = Tables("表A").Rows(i)("起号")
                Tables("表B").Rows(n-1)("全部单证张数") = Tables("表A").Compute("Sum(张数)","起号 >= '" & _
                Tables("表B").Rows(n-1)("起号") & "' and 起号 < '" & Tables("表B").Rows(n)("起号") & "' ")
                Tables("表B").Rows(n-1)("售单张数") = Tables("表A").Compute("Sum(张数)","单证状态 = '售单' and 起号 >= '" & _
                Tables("表B").Rows(n-1)("起号") & "' and 起号 < '" & Tables("表B").Rows(n)("起号") & "' ")
                Tables("表B").Rows(n-1)("退废单张数") = Tables("表A").Compute("Sum(张数)","(单证状态 = '退单' or 单证状态 = '废单') and 起号 >= '" & _
                Tables("表B").Rows(n-1)("起号") & "' and 起号 < '" & Tables("表B").Rows(n)("起号") & "' ")
                Tables("表B").Rows(n-1)("售单金额") = Tables("表A").Compute("Sum(保费)","单证状态 = '售单' and 起号 >= '" & _
                Tables("表B").Rows(n-1)("起号") & "' and 起号 < '" & Tables("表B").Rows(n)("起号") & "' ")
                Tables("表B").Rows(n)("序号") = n+1
                n = n + 1
            End If
        End If
    End If
Next


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


加好友 发短信 一级勋章
等级:MVP荣誉狐 帖子:5154 积分:31434 威望:0 精华:8 注册:2008/9/8 12:27:00
  发帖心情 Post By:2011/8/2 17:35:00 [显示全部帖子]

以下是引用hzcaqjf在2011-8-2 16:26:00的发言:

"hhbb"您好!

s="起号 Like '" & dr("起号").Substring(0,1) & "*'"

这段代码的意思不大明白,能否说明一下?

起号 包含 起号的第一个字符


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


加好友 发短信 一级勋章
等级:MVP荣誉狐 帖子:5154 积分:31434 威望:0 精华:8 注册:2008/9/8 12:27:00
  发帖心情 Post By:2011/8/6 22:41:00 [显示全部帖子]

楼主出来看看,是你的问题还是原来的起止号就是允许这样的呢???如果是允许的,你想怎样来分组更符合你的要求呢???

 回到顶部