2007-06-25 15:19:31 +00:00
|
|
|
|
{
|
|
|
|
|
|
===============================================================================
|
|
|
|
|
|
Copyright (<EFBFBD>) 2003. Rodax Software.
|
|
|
|
|
|
===============================================================================
|
|
|
|
|
|
Los contenidos de este fichero son propiedad de Rodax Software titular del
|
|
|
|
|
|
copyright. Este fichero s<EFBFBD>lo podr<EFBFBD> ser copiado, distribuido y utilizado,
|
|
|
|
|
|
en su totalidad o en parte, con el permiso escrito de Rodax Software, o de
|
|
|
|
|
|
acuerdo con los t<EFBFBD>rminos y condiciones establecidas en el acuerdo/contrato
|
|
|
|
|
|
bajo el que se suministra.
|
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
|
Web: www.rodax-software.com
|
|
|
|
|
|
===============================================================================
|
|
|
|
|
|
Fecha primera versi<EFBFBD>n: 30-03-2003
|
|
|
|
|
|
Versi<EFBFBD>n actual: 1.0.3
|
|
|
|
|
|
Fecha versi<EFBFBD>n actual: 04-02-2005
|
|
|
|
|
|
===============================================================================
|
|
|
|
|
|
Modificaciones:
|
|
|
|
|
|
|
|
|
|
|
|
Fecha Comentarios
|
|
|
|
|
|
---------------------------------------------------------------------------
|
|
|
|
|
|
13-08-2003 Se ha cambiado el intervalo a intervalo de nombre en vez
|
|
|
|
|
|
de intervalo de c<EFBFBD>digos de cliente.
|
|
|
|
|
|
30-03-2004 Se ha eliminado el atributo SERIE (P8 MULTIEMPRESA)
|
|
|
|
|
|
04-02-2005 Se elimnina la separaci<EFBFBD>n entre el informe resumen facturas e historial
|
|
|
|
|
|
facturas quedando un <EFBFBD>nico informe desde el que acceder a ambos.
|
|
|
|
|
|
===============================================================================
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
unit InformeResumenFacturacionClientes;
|
|
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
|
|
|
Dialogs, InformeBase, FR_IBXDB, FR_Shape, FR_Class, DB, IBCustomDataSet,
|
|
|
|
|
|
IBQuery, FR_DSet, FR_DBSet, RdxEmpresaActiva;
|
|
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
TdmInformeResumenFacturacionClientes = class(TdmInformeBase)
|
|
|
|
|
|
dsFacturacionClientes: TfrDBDataSet;
|
|
|
|
|
|
TablaFacturacionClientes: TIBQuery;
|
|
|
|
|
|
private
|
|
|
|
|
|
FImporteMinimo: Variant;
|
|
|
|
|
|
FNombreIni: String;
|
|
|
|
|
|
FNombreFin: String;
|
|
|
|
|
|
FFechaFacFin: TDateTime;
|
|
|
|
|
|
FFechaFacIni: TDateTime;
|
|
|
|
|
|
protected
|
|
|
|
|
|
procedure RellenarCabecera(Band: TfrBand); override;
|
|
|
|
|
|
procedure PrepararConsultas; override;
|
|
|
|
|
|
public
|
|
|
|
|
|
constructor Create(AOwner: TComponent); override;
|
|
|
|
|
|
published
|
|
|
|
|
|
property ImporteMinimo : Variant read FImporteMinimo write FImporteMinimo;
|
|
|
|
|
|
property NombreIni : String read FNombreIni write FNombreIni;
|
|
|
|
|
|
property NombreFin : String read FNombreFin write FNombreFin;
|
|
|
|
|
|
property FechaFacIni : TDateTime read FFechaFacIni write FFechaFacIni;
|
|
|
|
|
|
property FechaFacFin : TDateTime read FFechaFacFin write FFechaFacFin;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
var
|
|
|
|
|
|
dmInformeResumenFacturacionClientes: TdmInformeResumenFacturacionClientes;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
|
|
{ TdmInformeResumenFacturacionClientes }
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
BaseDatos, StrFunc, TablaEmpresas;
|
|
|
|
|
|
|
|
|
|
|
|
constructor TdmInformeResumenFacturacionClientes.Create(AOwner: TComponent);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
FNombreInforme := 'ResumenFacturacionClientes.frf';
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TdmInformeResumenFacturacionClientes.PrepararConsultas;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
with TablaFacturacionClientes do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Database := FBaseDatos;
|
|
|
|
|
|
Transaction := FTransaccion;
|
|
|
|
|
|
SQL.Clear;
|
2009-03-10 15:26:19 +00:00
|
|
|
|
SQL.Add('select NOMBRE, (BASEIMPONIBLE - IMPORTEDESCUENTO) AS BASEIMPONIBLE, IMPORTEIVA, IMPORTETOTAL ');
|
2007-06-25 15:19:31 +00:00
|
|
|
|
SQL.Add('from FACTURASCLIENTE ');
|
|
|
|
|
|
SQL.Add('where CODIGOEMPRESA = :CODIGOEMPRESA');
|
|
|
|
|
|
SQL.Add('and upper(NOMBRE) between upper(:NOMBREINI) and upper(:NOMBREFIN) ');
|
|
|
|
|
|
SQL.Add('and FECHAFACTURA between :FECHAFACINI and :FECHAFACFIN ');
|
|
|
|
|
|
if not VarIsNull(FImporteMinimo) then
|
2009-03-10 15:26:19 +00:00
|
|
|
|
SQL.Add('and (BASEIMPONIBLE - IMPORTEDESCUENTO) >= :BASEIMPONIBLE ');
|
2007-06-25 15:19:31 +00:00
|
|
|
|
SQL.Add('order by NOMBRE');
|
|
|
|
|
|
ParamByName('CODIGOEMPRESA').AsInteger := EmpresaActiva.Codigo;
|
|
|
|
|
|
ParamByName('NOMBREINI').AsString := FNombreIni;
|
|
|
|
|
|
ParamByName('NOMBREFIN').AsString := FNombreFin;
|
|
|
|
|
|
ParamByName('FECHAFACINI').AsDateTime := FFechaFacIni;
|
|
|
|
|
|
ParamByName('FECHAFACFIN').AsDateTime := FFechaFacFin;
|
|
|
|
|
|
if not VarIsNull(FImporteMinimo) then
|
|
|
|
|
|
ParamByName('BASEIMPONIBLE').AsFloat := FImporteMinimo;
|
|
|
|
|
|
Prepare;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TdmInformeResumenFacturacionClientes.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(FFechaFacIni) + ' - ' + DateToStr(FFechaFacFin));
|
|
|
|
|
|
Memo.Add('Rango de clientes: ' + FNombreIni + ' - ' + FNombreFin);
|
|
|
|
|
|
if not VarIsNull(FImporteMinimo) then
|
|
|
|
|
|
Memo.Add('Importe de facturas m<>nimo: ' + FormatFloat('#,##0.00', FImporteMinimo) + ' <20>');
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end.
|