git-svn-id: https://192.168.0.254/svn/Proyectos.Acana_FactuGES/trunk@4 3f40d355-893c-4141-8e64-b1d9be72e7e7
168 lines
5.2 KiB
ObjectPascal
168 lines
5.2 KiB
ObjectPascal
{
|
|
===============================================================================
|
|
Copyright (©) 2002. 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: 26-01-2003
|
|
Versión actual: 1.0.1
|
|
Fecha versión actual: 28-05-2004
|
|
===============================================================================
|
|
Modificaciones:
|
|
|
|
Fecha Comentarios
|
|
---------------------------------------------------------------------------
|
|
28/05/2004 Se han adaptado los frames para que se autoconfiguren
|
|
===============================================================================
|
|
}
|
|
|
|
unit RdxFramePagos;
|
|
|
|
{$I ..\COMPILE.INC}
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Classes,
|
|
RdxFrame, RdxDBFrame, IBCustomDataSet, DB, Entidades;
|
|
|
|
type
|
|
TRdxFramePagos = class(TRdxDBFrame)
|
|
private
|
|
FTablaPagos : TIBDataSet;
|
|
procedure SetTablaPagos (Value : TIBDataSet);
|
|
|
|
protected
|
|
FCodigoPago : Variant;
|
|
procedure SetCodigoPago (Value : Variant); virtual;
|
|
procedure SetContenido (NuevoFrame : TRdxFrame); override;
|
|
function TratarCambios : integer; override;
|
|
procedure BuscarPago; virtual;
|
|
procedure CambiarModo(ModoAnterior, Modo : TRdxModo); override;
|
|
function CambiarEntidad(EntidadAnterior, Entidad : TRdxEntidad): Boolean; override;
|
|
public
|
|
property TablaPagos: TIBDataSet read FTablaPagos write SetTablaPagos;
|
|
property CodigoPago : Variant read FCodigoPago write SetCodigoPago;
|
|
|
|
constructor Create (AOwner : TComponent); override;
|
|
published
|
|
end;
|
|
|
|
|
|
implementation
|
|
|
|
{$R *.DFM}
|
|
|
|
uses
|
|
StrFunc, Mensajes, Literales, Configuracion
|
|
{$IFDEF RDX_D6}, Variants{$ENDIF};
|
|
|
|
{ TRdxFramePagos }
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// PRIVATE
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
procedure TRdxFramePagos.SetCodigoPago(Value: Variant);
|
|
begin
|
|
if not EsCadenaVacia(Value) then
|
|
begin
|
|
FCodigoPago := Value;
|
|
BuscarPago;
|
|
end
|
|
end;
|
|
|
|
procedure TRdxFramePagos.SetTablaPagos(Value: TIBDataSet);
|
|
begin
|
|
if (FTablaPagos <> Value) then
|
|
FTablaPagos := Value;
|
|
end;
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// PROTECTED
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
procedure TRdxFramePagos.SetContenido(NuevoFrame: TRdxFrame);
|
|
begin
|
|
if (FContenido <> NIL) then
|
|
if (Contenido.Name = NuevoFrame.ClassName) then
|
|
begin
|
|
NuevoFrame.Free;
|
|
exit;
|
|
end;
|
|
inherited;
|
|
if (TablaPagos <> NIL) then
|
|
begin
|
|
FCodigoPago := TablaPagos.FieldByName('CODIGO').Value;
|
|
if Contenido is TRdxFramePagos then
|
|
(Contenido as TRdxFramePagos).CodigoPago := FCodigoPago;
|
|
end;
|
|
end;
|
|
|
|
function TRdxFramePagos.TratarCambios : integer;
|
|
begin
|
|
if (TablaPagos.State in dsEditModes) then
|
|
begin
|
|
case VerMensajePregunta(msgGuardarCambios) of
|
|
IDCANCEL : Result := IDCANCEL;
|
|
IDYES : begin
|
|
if (RealizarOperacion)
|
|
then Result := IDOK
|
|
else Result := IDCANCEL;
|
|
end;
|
|
IDNO : begin
|
|
if (DescartarOperacion)
|
|
then Result := IDOK
|
|
else Result := IDCANCEL;
|
|
end;
|
|
end
|
|
end
|
|
else Result := IDOK;
|
|
end;
|
|
|
|
procedure TRdxFramePagos.BuscarPago;
|
|
begin
|
|
//
|
|
end;
|
|
|
|
procedure TRdxFramePagos.CambiarModo(ModoAnterior, Modo : TRdxModo);
|
|
begin
|
|
inherited;
|
|
if (FModo in [Normal, Seleccionar]) then
|
|
begin
|
|
TablaPagos.Close;
|
|
TablaPagos.Open;
|
|
end
|
|
else begin
|
|
{ Si estábamos en el modo Añadir y pasamos a cualquier otro modo SIEMPRE
|
|
es necesario buscar el codigo de pago que tiene el frame
|
|
en CodigoPago (al activar el modo Añadir NO se pisa este valor con
|
|
el código de pago nuevo), preguntamos si la tabla esta activa por si
|
|
se ha cerrado al realizar algun cambio en modificar y ejecutar TratarCambios}
|
|
if (not TablaPagos.Active) or (ModoAnterior = Anadir) then
|
|
BuscarPago;
|
|
end;
|
|
end;
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// PUBLIC
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
constructor TRdxFramePagos.Create(AOwner: TComponent);
|
|
begin
|
|
inherited Create(AOwner);
|
|
FCodigoPago := NULL;
|
|
FTablaPagos := NIL;
|
|
end;
|
|
|
|
function TRdxFramePagos.CambiarEntidad(EntidadAnterior, Entidad: TRdxEntidad): Boolean;
|
|
begin
|
|
inherited CambiarEntidad(EntidadAnterior, Entidad);
|
|
ConfigurarFrame(Self, Self.Entidad);
|
|
end;
|
|
|
|
end.
|