Foxtable(狐表)用户栏目专家坐堂 → [求助]开一个帖请教问题~


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

主题:[求助]开一个帖请教问题~

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


加好友 发短信
等级:幼狐 帖子:184 积分:1148 威望:0 精华:0 注册:2014/6/10 20:24:00
[求助]开一个帖请教问题~  发帖心情 Post By:2014/7/13 10:40:00 [只看该作者]

当天装配表控制代码生成~ 然后我想昨天品种和昨天配比 显示该用户昨天的配比情况 前天品种和前天配比列显示 前天该用户的配比情况~ (从装配表里面读出来对应的历史配比记录)
其中自动生成装箱配比 代码如下(有点甜大哥帮忙解决的 自己有点小调整):
Tables("装配表").DataTable.DeleteFor(" [日期] = '" & e.Form.Controls("DateTimePicker1").Value & "'")
Tables("装配表").Filter=" [日期] = '" & e.Form.Controls("DateTimePicker1").Value & "'"
SystemReady = False
Dim n As Integer=0

Dim drs As List(Of DataRow) = DataTables("蔬菜采收表").Select("日期 = #" & e.Sender.Text & "#")
For Each dr As DataRow In DataTables("当天配送会员").Select("日期 = #" & e.Sender.Text & "#")
    '统计是否满足装箱总斤数
    n=0
    For Each cdr As DataRow In drs
        Dim ndr As DataRow = DataTables("装配表").addnew
        
        ndr("日期") = dr("日期")
        ndr("会员编号") = dr("会员编号")
        ndr("品种") = cdr("品种")
        ndr("装箱总斤数")=dr("装箱斤数")
        Dim fdr As DataRow = DataTables("蔬菜喜好表").Find("会员编号 = '" & dr("会员编号") & "' and 产品 = '" & cdr("品种") & "'")
        If fdr IsNot Nothing Then
            ndr("喜好") = fdr("喜好")
            If fdr("喜好") = "吃" Then
                ndr("配比") = 1
            ElseIf fdr("喜好") = "爱吃" Then
                ndr("配比") = 2
            Else
                ndr("配比") = 0
            End If
            '没有找到记录     '
        Else
            n=n+1
            If n<=5 Then
                ndr("喜好")="吃"
                ndr("配比") = 1
            Else
                ndr("喜好")="不吃"
                ndr("配比") = 0
            End If
        End If
    Next
Next
For Each dr As DataRow In DataTables("装配表").Select("日期 = #" & e.Sender.Text & "#")
    dr("小计") = DataTables("装配表").compute("sum(配比)", "日期 = #" & dr("日期") & "# and 会员编号 = '" & dr("会员编号") & "'")
    dr("装箱参考")=dr("配比")
Next

SystemReady = True

Dim t As Table = Forms("装配窗体").Controls("Table1").Table
Dim b As New GroupTableBuilder("统计表1", DataTables("装配表"))
b.Groups.AddDef("品种") '根据产品分组
b.Totals.AddDef("配比", AggregateEnum.Sum, "总数量") '对数量进行统计
b.Filter = "日期 = #" & e.Sender.Text & "#"
t.DataSource = b.BuildDataSource '生成统计表
t.DataTable.DataCols.Add("实际产量", Gettype(Integer))
For Each r As Row In t.Rows
    Dim fdr As DataRow = DataTables("蔬菜采收表").Find("日期 = #" & e.Sender.Text & "# And 品种 = '" & r("品种") & "'")
    If fdr IsNot Nothing Then
        r("实际产量") = fdr("实际产量")
    End If
Next

如果我要昨天品种和昨天配比 显示该用户昨天的配比情况 前天品种和前天配比列显示 前天该用户的配比情况  怎么在这个里面加代码读取实现呢?求大神指点下 不知道如何下手
图片点击可在新窗口打开查看此主题相关图片如下:33.png
图片点击可在新窗口打开查看
图片点击可在新窗口打开查看此主题相关图片如下:34.png
图片点击可在新窗口打开查看


 回到顶部
总数 27 1 2 3 下一页