Este es la estructura del reporte.
Código Delphi
[-]
unit UQrDetDocVta;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Qrctrls, Db, QuickRpt, ExtCtrls;
type
TFQrDetDocVta = class(TForm)
QrDetDocVta: TQuickRep;
QRBand2: TQRBand;
QrBandDet: TQRBand;
QRlNombEmpresa: TQRLabel;
QRTitulo: TQRLabel;
QRShape2: TQRShape;
QRShape1: TQRShape;
QrTipDoc: TQRLabel;
QRPagina: TQRLabel;
QRFecha: TQRLabel;
QRBand1: TQRBand;
QRShape3: TQRShape;
QRHora: TQRLabel;
QRSysHora: TQRSysData;
QRLabel4: TQRLabel;
QRMaxMinimo: TQRLabel;
QrTotDoc: TQRLabel;
QrNombre: TQRLabel;
QRSysData1: TQRSysData;
QRSysData2: TQRSysData;
QrLabel1: TQRLabel;
QrFecDoc: TQRLabel;
QRLabel3: TQRLabel;
QRGDetMes: TQRGroup;
QRSubTotalMes: TQRBand;
QrProveed: TQRLabel;
qrNeto: TQRLabel;
QRShape6: TQRShape;
QRLabel2: TQRLabel;
QrNumDoc: TQRLabel;
QRLabel8: TQRLabel;
QrCantDoc: TQRLabel;
QrSubTitulo: TQRLabel;
QrCodigo: TQRLabel;
QRLabel7: TQRLabel;
QRLabel5: TQRLabel;
QrCostoDoc: TQRLabel;
QRLabel9: TQRLabel;
QrIva: TQRLabel;
QrLabel20: TQRLabel;
QrTotal: TQRLabel;
QRLabel13: TQRLabel;
procedure QrDetDocVtaBeforePrint(Sender: TCustomQuickRep;
var PrintReport: Boolean);
procedure QrBandDetBeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
procedure QrDetDocVtaStartPage(Sender: TCustomQuickRep);
procedure FormActivate(Sender: TObject);
procedure QRSubTotalMesBeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
private
public
end;
var
FQrDetDocVta: TFQrDetDocVta;
nPagina : Integer;
iTTotal : Extended;
implementation
uses UVarGlobales, ULibrerias, UDt1;
{$R *.DFM}
procedure TFQrDetDocVta.FormActivate(Sender: TObject);
begin
nPagina :=0;
end;
procedure TFQrDetDocVta.QrDetDocVtaStartPage(Sender: TCustomQuickRep);
begin
nPagina := nPagina + 1;
end;
procedure TFQrDetDocVta.QrDetDocVtaBeforePrint(Sender: TCustomQuickRep;
var PrintReport: Boolean);
begin
sMenuOpc := 'Informe Detallado de Ventas';
QRlNombEmpresa.Caption := sEmpresa;
QrTitulo.Caption := sMenuOpc;
QrSubTitulo.Caption := '(' + 'Desde: ' + sParam1 + ' Hasta: ' + sParam2 + ')';
QrDetDocVta.DataSet := SQL_String;
QRSysHora.Data := qrsTime;
end;
procedure TFQrDetDocVta.QrBandDetBeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
begin
QrFecDoc.Caption := SQL_String.FieldByName( 'FechaEmi' ).AsString;
QrTipDoc.Caption := SQL_String.FieldByName( 'TipoDoc' ).AsString;
QrNumDoc.Caption := SQL_String.FieldByName( 'Numero' ).AsString;
QrCodigo.Caption := SQL_String.FieldByName( 'Codigo' ).AsString;
QrNombre.Caption := SQL_String.FieldByName( 'Descrip' ).AsString;
QrCantDoc.Caption := SQL_String.FieldByName( 'Cantidad' ).AsString;
QrTotDoc.Caption := Picture(SQL_String.FieldByName( 'TotalLinDe' ).AsString);
itTotal := itTotal + StrToFloat(SQL_String.FieldByName( 'TotalLinDe' ).AsString);
end;
procedure TFQrDetDocVta.QRSubTotalMesBeforePrint(
Sender: TQRCustomBand; var PrintBand: Boolean); <------- Cuando entra aqui para subtotalizar por mes, se cae, y presenta el mensaje: "Operation not allowed on a unidirectional dataset".
begin
QrTotal.Caption := FloatToStr(itTotal);
itTotal := 0;
end;
end.
Gracias de antemano.
Saludos.
Jose Miguel B.