Pfunction TCdsTemp.AGregarCampos(const CdSet: TClientDataSet; eNumCampo,
EnuDisplays: array of const): TClientDataSet;
Var
xpara : Integer;
begin
Result := CdSet;
with Result do
begin
AggregatesActive := False;
For xpara := low( eNumCampo ) to High( eNumCampo ) do
begin
if Aggregates.Find(Format( '%s', EnuDisplays[xpara]) ) = nil
then
with Aggregates.Add do
begin
Expression := Format( 'Sum(%s)', eNumCampo[xpara] );
AggregateName := Format( '%s', EnuDisplays[xpara]);
Active := True;
end;
end;
AggregatesActive := true;
end;
end;
AGregarCampos( CdSet, [ 'DTotal' ,'Adt' , 'Receber','Simples' ,'IssVAlor','Comissao','Compra_1','lbruto','compras','areceber' ],
[ 'DDTotal' ,'DAdt','DReceber','DSimples','dIssVAlor','dComissao','dCompra_1','dlbruto','dcompras','dareceber' ] );