-- 作者:jackshen888
-- 发布时间:2011/8/1 22:37:00
--
我现在的目的是这样的,
父 子 孙
销售订单的进度情况-----------从入库单提取(使用交叉统计)------------入库明细单提取入库总数
一对多关系 多对多关系
1、销售订单的订单总数,从销售订单明细中提取各明细的数量
代码
Dim t1,t2 As Table Dim i,n As Integer t1 =Tables("销售订单") n =t1.Cols("订单总数").Index
Dim jb As New SQLJoinTableBuilder("查询表1","销售订单") jb.AddCols("{销售订单}.*") jb.Addexp("订单总数","0.1-0.1") jb.build
t2 =Tables("查询表1") t2.StopRedraw t2.Cols("订单总数").Move(n) For Each r As Row In t2.Rows r("订单总数") = t1.Rows(i)("订单总数") i+=1 r("订单总数") = DataTables("销售订单明细").Compute("sum(数量)","订单号=\'" & r("订单号") & "\'") Next t2.MainTable = t2ResumeRedraw
2、计算入库单总数,从入库单明细提取
代码 Dim s1,s2 As Table Dim i,f As Integer s1 =Tables("入库单") f =s1.Cols("入库总数").Index
Dim cb As New SQLJoinTableBuilder("查询表2","入库单") jc.AddCols("{入库单}.*") jc.Addexp("入库总数","0.1-0.1") jc.build
s2 =Tables("查询表2") s2.StopRedraw s2.Cols("入库总数").Move(f) For Each r As Row In s2.Rows r("入库总数") = t1.Rows(i)("入库总数") i+=1 r("入库总数") = DataTables("入库单明细").Compute("sum(数量)","入库单号=\'" & r("入库单号") & "\'") Next s2.ResumeRedraw MainTable = s2
3、t2 (销售订单) 和 s2(入库单)进行交叉统计
CrossTableBuilder
这样能在一个命令窗口中写代码吗,,,怎么写,,,,我对这个不太明白,,,谢谢
[此贴子已经被作者于2011-8-1 22:38:47编辑过]
|