* Small refactoring, moving processaggregates to where it belongs

git-svn-id: trunk@37667 -
This commit is contained in:
michael 2017-12-03 11:23:46 +00:00
parent 4467ff81a6
commit 9b219e5a6e

View File

@ -934,6 +934,7 @@ type
procedure ResolveDataName;
procedure SetData(const AValue: TFPReportData);
protected
procedure ProcessAggregates(const AData: TFPReportData); virtual;
Procedure SaveDataToNames; override;
Procedure RestoreDataFromNames; override;
function GetData: TFPReportData; override;
@ -2551,6 +2552,7 @@ begin
Result := EncodeDate(lY, lM, lD) + EncodeTime(lH, lMi, lS, 0);
end;
{ TFPReportElementEditor }
procedure TFPReportElementEditor.SetElement(AValue: TFPReportElement);
@ -7030,23 +7032,14 @@ procedure TFPCustomReport.ProcessAggregates(const APageIdx: integer; const AData
var
b: integer;
c: integer;
i: integer;
m: TFPReportCustomMemo;
P : TFPReportCustomPage;
begin
Writeln('TFPCustomReport.ProcessAggregates');
for b := 0 to Pages[APageIdx].BandCount-1 do
begin
if Pages[APageIdx].Bands[b] is TFPReportCustomBandWithData then
begin
if TFPReportCustomBandWithData(Pages[APageIdx].Bands[b]).Data <> AData then
Continue; // band is from a different data-loop
end;
for c := 0 to Pages[APageIdx].Bands[b].ChildCount-1 do
if Pages[APageIdx].Bands[b].Child[c] is TFPReportCustomMemo then
TFPReportCustomMemo(Pages[APageIdx].Bands[b].Child[c]).UpdateAggregates;
end; { bands }
P:=Pages[APageIdx];
for I := 0 to P.BandCount-1 do
if P.Bands[I] is TFPReportCustomBandWithData then
TFPReportCustomBandWithData(P.Bands[I]).ProcessAggregates(AData);
end;
procedure TFPCustomReport.ClearReferenceList;
@ -8128,6 +8121,20 @@ begin
FData.FreeNotification(Self);
end;
procedure TFPReportCustomBandWithData.ProcessAggregates(const AData: TFPReportData);
Var
I : Integer;
begin
if AData<>Data then
exit;
for I := 0 to ChildCount-1 do
if Child[I] is TFPReportCustomMemo then
TFPReportCustomMemo(Child[I]).UpdateAggregates;
end;
procedure TFPReportCustomBandWithData.SaveDataToNames;
begin
inherited SaveDataToNames;