소스 검색

* Small refactoring, moving processaggregates to where it belongs

git-svn-id: trunk@37667 -
michael 7 년 전
부모
커밋
9b219e5a6e
1개의 변경된 파일22개의 추가작업 그리고 15개의 파일을 삭제
  1. 22 15
      packages/fcl-report/src/fpreport.pp

+ 22 - 15
packages/fcl-report/src/fpreport.pp

@@ -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;