以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  求助:某列改变后,期待能够执行该列值进行对比查找数据。  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=53697)

--  作者:李孝春
--  发布时间:2014/7/13 22:26:00
--  求助:某列改变后,期待能够执行该列值进行对比查找数据。
求助:某列改变后,期待能够执行该列值进行对比查找数据。

纠正如下代码  当年月日列发生变动后  下面的数据全部对应为当前年月日值下面的数据

Select Case e.DataCol.Name
    Case "年月日"
        e.DataRow("应收")=  Format(DataTables("消费明细").Compute("sum(累计消费)","消费时间 >= #" & Date.Today & " 00:00:00#  and 消费时间<= #" & Date.Today & " 23:59:59#"),"f")
        e.DataRow("人数")= DataTables("消费信息").Compute("sum(就餐人数)","就餐时间 >= #" & Date.Today & " 00:00:00#  and 就餐时间<= #" & Date.Today & " 23:59:59#")
        e.DataRow("实收")= Format(DataTables("结账登记").Compute("sum(消费金额)","结账时间 >= #" & Date.Today & " 00:00:00#  and 结账时间<= #" & Date.Today & " 23:59:59#"),"f")
       
End Select

--  作者:有点甜
--  发布时间:2014/7/13 22:29:00
--  

 你的年月日列是什么东西?

 

 参考 http://www.foxtable.com/help/topics/2720.htm

 


--  作者:李孝春
--  发布时间:2014/7/13 22:30:00
--  回复:(有点甜) 你的年月日列是什么东西?&n...
有点甜老师 

年月日为时期列 当这个日期选择某天时候  下面的这些代码对应为当前年月日列的值下面的时间段进行筛选数据

Select Case e.DataCol.Name
    Case "年月日"
        e.DataRow("应收")=  Format(DataTables("消费明细").Compute("sum(累计消费)","消费时间 >= #" & Date.Today & " 00:00:00#  and 消费时间<= #" & Date.Today & " 23:59:59#"),"f")
        e.DataRow("人数")= DataTables("消费信息").Compute("sum(就餐人数)","就餐时间 >= #" & Date.Today & " 00:00:00#  and 就餐时间<= #" & Date.Today & " 23:59:59#")
        e.DataRow("实收")= Format(DataTables("结账登记").Compute("sum(消费金额)","结账时间 >= #" & Date.Today & " 00:00:00#  and 结账时间<= #" & Date.Today & " 23:59:59#"),"f")
       
End Select

--  作者:有点甜
--  发布时间:2014/7/13 22:34:00
--  

Select Case e.DataCol.Name
    Case "年月日"
        If e.DataRow.Isnull("年月日") Then
            e.DataRow("应收")= Nothing
            e.DataRow("人数")= Nothing
            e.DataRow("实收")= Nothing
        Else
            Dim d As Date = e.NewValue
            e.DataRow("应收")=  Format(DataTables("消费明细").Compute("sum(累计消费)","消费时间 >= #" & d & "#  and 消费时间< #" & d.AddDays(1) & "#"),"f")
            e.DataRow("人数")= DataTables("消费信息").Compute("sum(就餐人数)","就餐时间 >= #" & d & "#  and 就餐时间< #" & d.AddDays(1) & "#")
            e.DataRow("实收")= Format(DataTables("结账登记").Compute("sum(消费金额)","结账时间 >= #" & d & "#  and 结账时间<= #" & d.AddDays(1) & "#"),"f")
        End If
End Select

 


--  作者:李孝春
--  发布时间:2014/7/13 22:39:00
--  回复:(有点甜)Select Case e.DataCol.Name &n...
谢谢有点甜老师 又学习到一小知识