git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES/trunk@4 b68bf8ae-e977-074f-a058-3cfd71dd8f45
264 lines
7.4 KiB
ObjectPascal
264 lines
7.4 KiB
ObjectPascal
{
|
|
===============================================================================
|
|
Copyright (©) 2001. Rodax Software.
|
|
===============================================================================
|
|
Los contenidos de este fichero son propiedad de Rodax Software titular del
|
|
copyright. Este fichero sólo podrá ser copiado, distribuido y utilizado,
|
|
en su totalidad o en parte, con el permiso escrito de Rodax Software, o de
|
|
acuerdo con los términos y condiciones establecidas en el acuerdo/contrato
|
|
bajo el que se suministra.
|
|
-----------------------------------------------------------------------------
|
|
Web: www.rodax-software.com
|
|
===============================================================================
|
|
Fecha primera versión: 02-08-2002
|
|
Versión actual: 1.0.3
|
|
Fecha versión actual: 28-06-2004
|
|
===============================================================================
|
|
Modificaciones:
|
|
|
|
Fecha Comentarios
|
|
---------------------------------------------------------------------------
|
|
08-03-2003 Se han puesto componentes con calendario.
|
|
|
|
15-03-2003 p260. Poder realizar el informe eligiendo un cliente concreto.
|
|
|
|
28-06-2004 p272. Adaptación a multiempresa.
|
|
===============================================================================
|
|
}
|
|
|
|
unit ListadoFacturasCli;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
|
ListadoBase, ExtCtrls, StdCtrls, RdxTitulos, RdxPaneles, cxControls, Tipos,
|
|
cxContainer, cxEdit, cxTextEdit, cxMaskEdit, cxDropDownEdit, cxCalendar,
|
|
RdxCampos, RdxRadioButton, cxButtonEdit;
|
|
|
|
type
|
|
TfrListadoFacturasCli = class(TfrListadoBase)
|
|
Label1: TLabel;
|
|
FechaIni: TcxDateEdit;
|
|
Label2: TLabel;
|
|
FechaFin: TcxDateEdit;
|
|
Bevel1: TBevel;
|
|
rbCodigo: TRdxRadioButton;
|
|
eCodigoIni: TLabel;
|
|
NombreCliente: TRdxEdit;
|
|
rbTodos: TRdxRadioButton;
|
|
eInfoCriterios: TLabel;
|
|
CodCli: TcxButtonEdit;
|
|
procedure FechaIniPropertiesValidate(Sender: TObject;
|
|
var DisplayValue: Variant; var ErrorText: TCaption;
|
|
var Error: Boolean);
|
|
procedure FechaFinPropertiesValidate(Sender: TObject;
|
|
var DisplayValue: Variant; var ErrorText: TCaption;
|
|
var Error: Boolean);
|
|
procedure rbTodosClick(Sender: TObject);
|
|
procedure rbCodigoClick(Sender: TObject);
|
|
procedure CodCliPropertiesButtonClick(Sender: TObject;
|
|
AButtonIndex: Integer);
|
|
procedure CodCliPropertiesValidate(Sender: TObject;
|
|
var DisplayValue: Variant; var ErrorText: TCaption;
|
|
var Error: Boolean);
|
|
procedure RdxFrameShow(Sender: TObject);
|
|
private
|
|
FFechaIni: Variant;
|
|
FFechaFin: Variant;
|
|
FCodigoCliente: Variant;
|
|
procedure ActivarCliente;
|
|
procedure DesactivarCliente;
|
|
procedure SetCodigoCliente(const Value: Variant);
|
|
procedure RefrescarInforme; override;
|
|
protected
|
|
procedure FreeContenido; override;
|
|
procedure VerModal; override;
|
|
public
|
|
property CodigoCliente : Variant read FCodigoCliente write SetCodigoCliente;
|
|
constructor Create (AOwner : TComponent); override;
|
|
end;
|
|
|
|
var
|
|
frListadoFacturasCli: TfrListadoFacturasCli;
|
|
|
|
implementation
|
|
|
|
{$R *.DFM}
|
|
|
|
{ TfrListadoFacturasCli }
|
|
|
|
uses
|
|
Configuracion, Literales, InformeListadoFacturasCli, DateFunc, TablaClientes,
|
|
Clientes, StrFunc;
|
|
|
|
constructor TfrListadoFacturasCli.Create(AOwner: TComponent);
|
|
begin
|
|
inherited;
|
|
ConfigurarFrame(Self, Self.Entidad);
|
|
|
|
FFechaIni := DarDiaInicioMesDat;
|
|
FFechaFin := DarDiaFinalMesDat;
|
|
FechaIni.Date := FFechaIni;
|
|
FechaFin.Date := FFechaFin;
|
|
FCodigoCliente := NULL;
|
|
|
|
FInforme := TdmInformeListadoFacturasCli.Create(Self);
|
|
FInforme.Preview := FVistaPrevia.Preview;
|
|
RefrescarInforme;
|
|
end;
|
|
|
|
procedure TfrListadoFacturasCli.FechaIniPropertiesValidate(
|
|
Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption;
|
|
var Error: Boolean);
|
|
begin
|
|
if (StrToDate(DisplayValue) > FechaFin.Date) then
|
|
begin
|
|
ErrorText := msgFechaIniMayor;
|
|
Error := True;
|
|
Exit;
|
|
end;
|
|
FFechaIni := StrToDate(DisplayValue);
|
|
RefrescarInforme;
|
|
end;
|
|
|
|
procedure TfrListadoFacturasCli.FechaFinPropertiesValidate(
|
|
Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption;
|
|
var Error: Boolean);
|
|
begin
|
|
if (StrToDate(DisplayValue) < FechaIni.Date) then
|
|
begin
|
|
ErrorText := msgFechaIniMayor;
|
|
Error := True;
|
|
Exit;
|
|
end;
|
|
FFechaFin := StrToDate(DisplayValue);
|
|
RefrescarInforme;
|
|
end;
|
|
|
|
procedure TfrListadoFacturasCli.RefrescarInforme;
|
|
begin
|
|
with (FInforme as TdmInformeListadoFacturasCli) do
|
|
begin
|
|
FechaIni := FFechaIni;
|
|
FechaFin := FFechaFin;
|
|
if rbTodos.Checked then
|
|
Tipo := tiTodo
|
|
else begin
|
|
Tipo := tiPorCliente;
|
|
if FCodigoCliente = Null then
|
|
Exit;
|
|
CodigoCliente := FCodigoCliente;
|
|
NombreCliente := Self.NombreCliente.Text;
|
|
end;
|
|
Previsualizar;
|
|
end;
|
|
end;
|
|
|
|
procedure TfrListadoFacturasCli.ActivarCliente;
|
|
begin
|
|
CodCli.Enabled := True;
|
|
CodCli.SetFocus;
|
|
NombreCliente.Enabled := True;
|
|
end;
|
|
|
|
procedure TfrListadoFacturasCli.DesactivarCliente;
|
|
begin
|
|
CodCli.Enabled := False;
|
|
NombreCliente.Enabled := False;
|
|
end;
|
|
|
|
procedure TfrListadoFacturasCli.SetCodigoCliente(const Value: Variant);
|
|
var
|
|
DatosCliente : TDatosCliente;
|
|
begin
|
|
if Value = Null then
|
|
Exit;
|
|
|
|
if FCodigoCliente <> Value then
|
|
begin
|
|
FCodigoCliente := Value;
|
|
DatosCliente := TDatosCliente.Create;
|
|
try
|
|
DatosCliente.Codigo := FCodigoCliente;
|
|
dmTablaClientes.DarDatosCliente(DatosCliente);
|
|
CodCli.Text := FCodigoCliente;
|
|
NombreCliente.Text := DatosCliente.Nombre;
|
|
finally
|
|
DatosCliente.Free;
|
|
end;
|
|
RefrescarInforme;
|
|
end;
|
|
end;
|
|
|
|
procedure TfrListadoFacturasCli.rbTodosClick(Sender: TObject);
|
|
begin
|
|
DesactivarCliente;
|
|
RefrescarInforme;
|
|
end;
|
|
|
|
procedure TfrListadoFacturasCli.rbCodigoClick(Sender: TObject);
|
|
begin
|
|
ActivarCliente;
|
|
RefrescarInforme;
|
|
end;
|
|
|
|
procedure TfrListadoFacturasCli.CodCliPropertiesButtonClick(
|
|
Sender: TObject; AButtonIndex: Integer);
|
|
begin
|
|
ModoModal := Seleccionar;
|
|
ContenidoModal := TfrClientes.Create(Self);
|
|
end;
|
|
|
|
procedure TfrListadoFacturasCli.CodCliPropertiesValidate(
|
|
Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption;
|
|
var Error: Boolean);
|
|
begin
|
|
if EsCadenaVacia (DisplayValue) then
|
|
begin
|
|
Error := True;
|
|
ErrorText := msgCliFaltaCodigo;
|
|
Exit;
|
|
end;
|
|
|
|
if (dmTablaClientes.ValidarCodigo(DisplayValue)) then
|
|
begin
|
|
DisplayValue := dmTablaClientes.FormatearCodigo(DisplayValue);
|
|
if (not dmTablaClientes.ExisteCodigo(DisplayValue)) then
|
|
begin
|
|
Error := True;
|
|
ErrorText := Format(msgCliCodCliNoExiste, [DisplayValue]);
|
|
Exit;
|
|
end;
|
|
end
|
|
else begin
|
|
Error := True;
|
|
ErrorText := Format(msgCliCodCliIncorrecto, [DisplayValue]);
|
|
Exit;
|
|
end;
|
|
|
|
CodigoCliente := DisplayValue;
|
|
end;
|
|
|
|
procedure TfrListadoFacturasCli.VerModal;
|
|
begin
|
|
if (ContenidoModal is TfrClientes) then
|
|
(ContenidoModal as TfrClientes).CodigoCliente := FCodigoCliente;
|
|
inherited;
|
|
end;
|
|
|
|
procedure TfrListadoFacturasCli.FreeContenido;
|
|
begin
|
|
if (ContenidoModal is TfrClientes) then
|
|
CodigoCliente := (ContenidoModal as TfrClientes).CodigoCliente;
|
|
inherited;
|
|
end;
|
|
|
|
procedure TfrListadoFacturasCli.RdxFrameShow(Sender: TObject);
|
|
begin
|
|
DesactivarCliente;
|
|
FechaIni.SetFocus;
|
|
end;
|
|
|
|
end.
|
|
|