Ver Mensaje Individual
  #2  
Antiguo 18-03-2008
Avatar de jcarteagaf
[jcarteagaf] jcarteagaf is offline
Miembro Premium
 
Registrado: abr 2006
Ubicación: La Paz, Bolivia
Posts: 651
Reputación: 19
jcarteagaf Va por buen camino
Sub totales

Me imagino que para calcular el Subtotal usas un TQRExpr.

Y que tal si colocas un TQRLabel y haces el calculo del total de manera manual (por eventos):

1. Creas una variable a nivel del reporte
Código Delphi [-]
 fTotal : Double;
2. Inicializas a cero la variable cada vez que se imprime la cabecera del Grupo:

Código Delphi [-]
procedure TqrExtracto.QRGroup1BeforePrint(Sender: TQRCustomBand;
  var PrintBand: Boolean);
begin
  fTotal := 0;
end;

3. Vas acumulando el valor deseado en la variable por cada linea de detalle impresa

Código Delphi [-]
procedure TqrExtracto.DetailBand1AfterPrint(Sender: TQRCustomBand;
  BandPrinted: Boolean);
begin
  fTotal := fTotal + TuTabla.TuCampo;
end;

4. En el evento OnBeforePrint del Pie de Pagina muestras el total acumulado

Código Delphi [-]
procedure TqrExtracto.PageFooterBand1BeforePrint(Sender: TQRCustomBand;
  var PrintBand: Boolean);
begin
  qrlabel1.Caption := FormatFloat(',0.00',fTotal);
end;

5. Como decimos por aca, listo el Pollo.

Espero que sirva.

Saludos.
Responder Con Cita