老师,我在窗口中增加了TopicBar类型窗口,想统计日、周、月付款笔数和金额,以下代码没有提示错误,但统出来的数据不正确,全部为0.请老师指导,谢谢!!
Dim Page As WinForm.TopicPage
Dim cnt1 As Integer = DataTables("资金计划付款明细表").Compute("Count(_Identify)" , "rq = #" & Date.Today & "#")
Dim cnt4 As Integer = DataTables("资金计划付款明细表").Compute("sum(支付金额)" , "rq = #" & Date.Today & "#")
Page = e.Form.Controls("TopicBar1").Pages.Add("即时信息","即时信息")
Page.Links.Add("今日付款笔数","今日付款笔数(" & cnt1 & ")" )
Page.Links.Add("今日付款金额","今日付款金额(" & cnt4 & ")" )
Dim y As Integer = Date.Today.Year
Dim w As Integer = Date.Today.DayOfWeek '算出今天是星期几
Dim dt1 As Date = Date.Today.AddDays(-w) '获取本周的第一天
Dim dt2 As Date = Date.Today.AddDays(6 - w) '获取本周的最后一天
Dim Filter1 As String
Filter1 = "rq >= #" & dt1 & "# And rq <= #" & dt2 & "#"
Dim cnt2 As Integer = DataTables("资金计划付款明细表").Compute("Count(_Identify)" , "rq >= #" & dt1 & "# And rq <= #" & dt2 & "#")
Dim cnt3 As Integer = DataTables("资金计划付款明细表").Compute("sum(支付金额)" , "rq >= #" & dt1 & "# And rq <= #" & dt2 & "#")
Page.Links.Add("本周付款笔数","本周付款笔数(" & cnt2 & ")" )
Page.Links.Add("本周付款金额","本周付款金额(" & cnt3 & ")" )
Dim m As Integer = Date.Today.Month
Dim dt3 As New Date(y, m, 1)
Dim dt4 As New Date(y, m, Date.DaysInMonth(y, m)) '获取本月的最后一天
Dim Filter2 As String
Filter2 = "rq >= #" & dt3 & "# And rq <= #" & dt4 & "#"
Dim cnt5 As Integer = DataTables("资金计划付款明细表").Compute("Count(_Identify)" , "rq >= #" & dt3 & "# And rq <= #" & dt4 & "#")
Dim cnt6 As Integer = DataTables("资金计划付款明细表").Compute("sum(支付金额)" , "rq >= #" & dt3 & "# And rq <= #" & dt4 & "#")
Page.Links.Add("本月付款笔数","本月付款笔数(" & cnt5 & ")" )
Page.Links.Add("本月付款金额","本月付款金额(" & cnt6 & ")" )