在 crystal 报告中执行此操作的最佳方法是什么?

what's the best approach to do this in crystal report?

在 crystal 报告中执行此操作的最佳方法是什么?我得到了 3 tables Main table,Sub table 作为 Main,另一个是项目 table 作为 Sub 的 Sub.. 它就像这个..

MainTable - stored the main accounts.

idKey       Accnt           Amount
------------------------------------
01          Construction     1000.00
02          Maintenance       500.00


SubTable - this table where sub account for the main table stored.
         - the idkey from this table and main table is equal.

idKey    idSub   SubAccnt               Amount
-----------------------------------------
01          01   WatchTower             800.00
01          02   Level 9 Wall           200.00
02          03   Monthly Maintenance    500.00

itemTable - this table where the items of the sub table stored.
          - the idsub of this table and the SubTable is equal.

idSub       Items        Cost
-----------------------------------
01          Cement       100.00
01          Steel        100.00
01          Labor        400.00
02          Rocks        100.00
02          Labor        100.00
03          Labor        500.00

现在我希望报告看起来像这样..

如何做到这一点?我需要一个子报告吗?如何 ?并使用 crystal 报告和 VB.NET..很高兴得到任何帮助..提前发送 :)

这个查询可能会帮助你

  Select MT.Accnt,ST.SubAccnt, ST.amount,sum(IT.cost) from MainTable MT
    inner join SubTable ST on ST.idKey=MT.idKey       
    inner join itemTable IT on IT.idSub=ST.idSub
    Group By MT.Accnt,ST.SubAccnt, ST.amount

子报表不是必需的,对于余额,您可以在查询中获取,也可以在报表中获取

为 MT.Accnt 添加组并为相同的添加总计。