Data Bands
The running total (cumulative sum) represents sum of all data on the databand from the beginning of report or from the beginning of the band until the record which is currently displayed. In Pantheon we use running total for example for displaying stock quantity and value. It can be displayed in every row or only at the end.
Example of using running total is on report '18A - Record on Retail Sale and Purchase of Goods' that is in the program menu 'Goods | Invoice Issued Report | Commercial Records'.
var
nNabavaNeto, nSalePrice: Double;
...
procedure DetailOnBeforePrint(Sender: TfrxComponent);
begin
if (<Line#> <> 1) or (<qReportIzpis."acKey"> <> '0000000000000') then
begin
nNabavaNeto := nNabavaNeto + <qReportIzpis."NabavaNeto">;
nSalePrice := nSalePrice + <qReportIzpis."anSalePrice">;
end;
end;
...
begin
nNabavaNeto := 0;
nSalePrice := 0;
end.
Let's analize this example.
At the top of the code are declared variables "nNabavaNeto" and "nSalePrice". They hold values in the period, defined by report criteria (without initial balance). Then on "OnBeforePrint" event values of purchase, receiving of goods and goods sales are added. Finally variables are displayed in the report summary.