e.Table.Filter = ""
e.Table.Sort = "到账时间 Desc"
Dim sum As Double
For i As Integer = 0 To e.Table.Rows.Count - 1
If e.Table.Rows(i)("到账时间").Year = e.Table.Rows(0)("到账时间").Year Then
sum = sum + e.Table.Rows(i)("回款金额")
Else
Exit For
End If
Next
e.Form.Controls("bnhk").Value = sum
Dim sum1 As Double
For i1 As Integer = 0 To e.Table.Rows.Count - 1
If e.Table.Rows(i1)("到账时间").Year = e.Table.Rows(0)("到账时间").Year And e.Table.Rows(i1)("到账时间").Month = e.Table.Rows(0)("到账时间").Month Then
sum1 = sum1 + e.Table.Rows(i1)("回款金额")
Else
Exit For
End If
Next
e.Form.Controls("byhk").Value = sum1
Dim sum2 As Double
For i2 As Integer = 0 To e.Table.Rows.Count - 1
If e.Table.Rows(i2)("到账时间").Year = e.Table.Rows(0)("到账时间").Year And e.Table.Rows(i2)("到账时间").Month = e.Table.Rows(0)("到账时间").Month And e.Table.Rows(i2)("到账时间").Day = e.Table.Rows(0)("到账时间").Day Then
sum2 = sum2 + e.Table.Rows(i2)("回款金额")
Else
Exit For
End If
Next
e.Form.Controls("brhk").Value = sum2
[此贴子已经被作者于2013-3-3 18:31:54编辑过]