以下是引用i52117在2009-12-28 12:36:00的发言:
........................即考验开发软件又锻炼编程人员。
呵呵~ 言之有理!
另外: 既然六爷愿意考虑,说明有戏啦~ 在老六开戏之前我提供个临时解决方法:
用系统自带的统计的例子里的订单表测试吧~ ::::::::::
tables("订单").Redraw = False
if DataTables("订单").datacols.contains("fz") = false
DataTables("订单").DataCols.Add("fz", GetType(String), 16)
end if
if DataTables("订单").datacols.contains("月") = false
DataTables("订单").DataCols.Add("月", GetType(double), 5)
end if
for i as integer = 0 to tables("订单").count-1
Dim dr As Row = Tables("订单").Rows(i)
dr("月") = right(left(dr("日期"),7),2).trim("-") ’这个刚修正了~ 日期列的字符数字有问题似的???
dr("fz") = dr("产品") & " " & dr("月")
next
Dim yjdm As List(Of String)
yjdm = DataTables("订单").GetUniqueValues("", "产品")
Dim yf As List(Of String)
yf = DataTables("订单").GetUniqueValues("", "月")
Dim cfs As Integer
For Each yj As String In yjdm
For Each y As String In yf
Dim cyf As List(Of String)
cyf = DataTables("订单").GetUniqueValues("[产品]= '" & yj & "' and [月]= '" & y & "' ", "产品")
cfs = cyf.count
if cfs <> 0
Dim r As Row = Tables("订单").Rows.AddNew(cfs)
r("fz") = yj & " " & y & " " & "a"
r("产品") = "本月合计"
r("数量") = Tables("订单").Compute("Sum(数量)", "产品 = '" & yj & "' and 月 = '" & y & "' ")
' r("金额") = Tables("订单").Compute("Sum(金额)", "产品 = '" & yj & "' and 月 = '" & y & "' ")
'注意:这个金额是表达式列,老是提示错误,还没有解决,请老师们指教!~ 下同:::
Dim r1 As Row = Tables("订单").Rows.AddNew(cfs)
r1("fz") = yj & " " & y & " " & "b"
r1("产品") = "本月累计"
r1("数量") = Tables("订单").Compute("Sum(数量)", "产品 = '" & yj & "' and 月 <= '" & y & "' ")
' r1("金额") = Tables("订单").Compute("Sum(金额)", "产品 = '" & yj & "' and 月 <= '" & y & "' ")
end if
next
next
Tables("订单").Cols("产品").Width = 80
Tables("订单").sort = "fz"
tables("订单").Redraw = true
[此贴子已经被作者于2009-12-28 13:03:27编辑过]