As my homework is programming a "General Ledger System", my groupmate and I want to make it to be a web base, we are programming by VB2003 ~ ADO.NET conecting with SQL server 2000.

We want to generate the financial reprot using the crystal report, we just can generate the Trial balance as it have not much calculation. But the following reports are too much calculation, and we don't know how to make the value(from SQL server 2000) calculation in crystal report.

SUCH AS:
In Trading and Profit and Loss Account the value of Cost of goods sold means Opening inventory add Purchases and subtract Closing inventory.
How can we calculate the value of Cost of goods sold?