Foxtable(狐表)用户栏目专家坐堂 → 怎么加上时间区分


  共有3073人关注过本帖平板打印复制链接

主题:怎么加上时间区分

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


加好友 发短信
等级:童狐 帖子:203 积分:1368 威望:0 精华:0 注册:2017/12/4 15:36:00
怎么加上时间区分  发帖心情 Post By:2018/1/31 16:37:00 [只看该作者]

Dim g As New CrossTableBuilder("统计表1", DataTables("随件卡"))
g.HGroups.AddDef("客户名称")
g.HGroups.AddDef("产品种类")
g.HGroups.AddDef("产品名称")
g.HGroups.AddDef("产品代码")
g.HGroups.AddDef("工序代码")
g.VGroups.AddDef("加工时间", "{0}月")
g.Totals.AddDef("加工结果_合格", "产量")
g.Totals.AddDef("加工数量")
Dim dt As DataTable = g.Build(True)
Dim dict As new Dictionary(of String ,String)
For Each c As DataCol In dt.DataCols
    If c.name.Contains("_") Then
        dict.Add(c.Caption,c.Name)
    End If
Next

Dim yf() As String = {"","一","二","三","四","五","六","七","八","九","十","十一","十二"}
For Each dr As DataRow In dt.DataRows
    Dim filter As String = "1=1"
    If dr.Isnull("客户名称") Then
        filter &= " and 客户名称 is null"
    Else
        filter &= " and 客户名称 = '" & dr("客户名称") & "'"
    End If
    If dr.Isnull("产品种类") Then
        filter &= " and 产品种类 is null"
    Else
        filter &= " and 产品种类 = '" & dr("产品种类") & "'"
    End If
    If dr.Isnull("产品代码") Then
        filter &= " and 产品代码 is null"
    Else
        filter &= " and 产品代码 = '" & dr("产品代码") & "'"
    End If
    If dr.Isnull("工序代码") Then
        filter &= " and 工序代码 is null"
    Else
        filter &= " and 工序代码 = '" & dr("工序代码") & "'"
    End If
    If dr.Isnull("产品名称") Then
        filter &= " and 产品名称 is null"
    Else
        filter &= " and 产品名称 = '" & dr("产品名称") & "'"
    End If
    Dim ndr As DataRow = DataTables("产品表").Find(filter)
    If ndr Is Nothing Then
        ndr = DataTables("产品表").AddNew()
        ndr("客户名称") = dr("客户名称")
    End If
    For Each c As String In dict.Keys
        Dim str() As String = c.Split("_")
        If str(0) = "空" Then Continue For
        Dim yue As String = yf(val(str(0).trim("月"))) & "月分_"
        If str(1) = "产量" Then
            ndr(yue & str(1)) = dr(dict(c))
        Else
            ndr(yue & "合格率") = dr(dict(str(0) & "_产量")) / dr(dict(c))
        End If
    Next
Next


如果想按每个月的25号刀下个月25号为一个月份区间  这段代码应该怎么修改呢    密码1

 回到顶部
总数 11 1 2 下一页