This repository has been archived on 2024-12-02. You can view files and clone it, but cannot push or open issues or pull requests.
FactuGES/Informes/InformeLibro.pas
2007-06-26 08:08:27 +00:00

144 lines
3.7 KiB
ObjectPascal

unit InformeLibro;
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
TdmInformeLibro = class(TdmInformeBase)
TablaCab: TfrDBDataSet;
TablaDet: TfrDBDataSet;
TablaLibros: TIBQuery;
TablaDetallesLibros: TIBQuery;
private
FTipoLibro : Variant;
FFechaInicio : TDateTime;
FFechaFin : TDateTime;
protected
procedure RellenarCabecera(Band: TfrBand); override;
procedure PrepararConsultas; override;
public
constructor Create(AOwner: TComponent); override;
published
property TipoLibro : variant read FTipoLibro write FTipoLibro;
property FechaInicio : TDateTime read FFechaInicio write FFechaInicio;
property FechaFin : TDateTime read FFechaFin write FFechaFin;
end;
var
dmInformeLibro: TdmInformeLibro;
implementation
{$R *.dfm}
uses
StrFunc, BaseDatos, TablaEmpresas;
{ TdmInformeBase1 }
constructor TdmInformeLibro.Create(AOwner: TComponent);
begin
inherited;
FNombreInforme := 'InformeLibro.frf';
end;
procedure TdmInformeLibro.PrepararConsultas;
begin
inherited;
with TablaLibros do
begin
Database := FBaseDatos;
Transaction := FTransaccion;
SQL.Clear;
SQL.Add('select * from LIBROS ');
SQL.Add('where CODIGOEMPRESA = :CODIGOEMPRESA');
SQL.Add('and TIPO = :TIPO');
ParamByName('CODIGOEMPRESA').AsInteger := EmpresaActiva.Codigo;
ParamByName('TIPO').AsString := FTipoLibro;
Prepare;
end;
with TablaDetallesLibros do
begin
Database := FBaseDatos;
Transaction := FTransaccion;
SQL.Clear;
SQL.Add('select * from DETALLESLIBROS ');
SQL.Add('where CODIGOEMPRESA = :CODIGOEMPRESA ');
SQL.Add('and TIPOLIBRO = :TIPOLIBRO ');
SQL.Add('and FECHAENTRADA between :FECHAINI and :FECHAFIN ');
ParamByName('CODIGOEMPRESA').AsInteger := EmpresaActiva.Codigo;
ParamByName('TIPOLIBRO').AsString := FTipoLibro;
ParamByName('FECHAINI').AsDate := FFechaInicio;
ParamByName('FECHAFIN').AsDate := FFechaFin;
Prepare;
end;
end;
procedure TdmInformeLibro.RellenarCabecera(Band: TfrBand);
var
iCont : Integer;
Objeto : TfrView;
begin
inherited;
with Band do
begin
for iCont := 0 to Objects.Count - 1 do
begin
Objeto := Objects[iCont];
if ((Objeto is TfrMemoView) and (Objeto.Name = 'CabParametros')) then
begin
with (Objeto as TfrMemoView) do
begin
Memo.Clear;
Memo.Add('Empresa: ' + EmpresaActiva.NombreComercial);
Memo.Add('Rango de fechas: ' + DateToStr(FechaInicio) + ' - ' + DateToStr(FechaFin));
end;
end;
end;
end;
{
inherited;
with Band do
begin
for iCont := 0 to Objects.Count - 1 do
begin
Objeto := Objects[iCont];
if ((Objeto is TfrMemoView) and (Objeto.Name = 'FechaInicio')) then
begin
with (Objeto as TfrMemoView) do
begin
begin
Font.Name := 'Tahoma';
Font.Size := 10;
Alignment := frtaLeft;
Memo.Clear;
Memo.Add(FechaInicio);
end
end;
end;
if ((Objeto is TfrMemoView) and (Objeto.Name = 'FechaFin')) then
begin
with (Objeto as TfrMemoView) do
begin
begin
Font.Name := 'Tahoma';
Font.Size := 10;
Alignment := frtaLeft;
Memo.Clear;
Memo.Add(FechaFin);
end
end;
end;
end;
end;
}
end;
end.