unit InformeFacturaProforma;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, InformeBase, FR_IBXDB, FR_Shape, FR_DSet, FR_DBSet, FR_Class,
  DB, IBCustomDataSet, IBQuery, RdxEmpresaActiva;

type
  TdmInformeFacturaProforma = class(TdmInformeBase)
    TablaCab: TfrDBDataSet;
    TablaDet: TfrDBDataSet;
    TablaFacturasProforma: TIBQuery;
    TablaDetallesFacturas: TIBQuery;
  private
    FCodigoFactura : Variant;
  protected
    procedure PrepararConsultas; override;
  public
    constructor Create(AOwner: TComponent); override;
  published
    property CodigoFactura : variant read FCodigoFactura write FCodigoFactura;
  end;

var
  dmInformeFacturaProforma: TdmInformeFacturaProforma;

implementation

{$R *.dfm}

{ TdmInformeFacturaProforma }

constructor TdmInformeFacturaProforma.Create(AOwner: TComponent);
begin
  inherited;
  FNombreInforme := 'InformeFacturaProforma.frf';
end;

procedure TdmInformeFacturaProforma.PrepararConsultas;
begin
  inherited;

  with TablaFacturasProforma do
  begin
    Database := FBaseDatos;
    Transaction := FTransaccion;
    SQL.Clear;
    SQL.Add('select * from FACTURASPROFORMA ');
    SQL.Add('where CODIGO = :CODIGO');
    ParamByName('CODIGO').AsString := FCodigoFactura;
    Prepare;
  end;

  with TablaDetallesFacturas do
  begin
    Database := FBaseDatos;
    Transaction := FTransaccion;
    SQL.Clear;
    SQL.Add('select * from DETALLESFACTURASPROFORMAART ');
    SQL.Add('where CODIGOFACTURA = :CODIGOFACTURA');
    ParamByName('CODIGOFACTURA').AsString := FCodigoFactura;
    Prepare;
  end;

  TablaCab.Open;
  TablaDet.Open;
end;

end.
