This repository has been archived on 2024-11-29. You can view files and clone it, but cannot push or open issues or pull requests.
Tecsitel_FactuGES/Frames/RdxFrameInstaladores.pas

197 lines
5.9 KiB
ObjectPascal
Raw Normal View History

{
===============================================================================
Copyright (<EFBFBD>) 2001. 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: 13-05-2002
Versi<EFBFBD>n actual: 1.0.0
Fecha versi<EFBFBD>n actual: 13-05-2002
===============================================================================
Modificaciones:
Fecha Comentarios
---------------------------------------------------------------------------
===============================================================================
}
unit RdxFrameInstaladores;
{$I ..\COMPILE.INC}
interface
uses
Consts, Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, IB, IBCustomDataSet, IBDataBase, DB, Mensajes, Tipos,
RdxFrame, RdxDBFrame;
type
TRdxFrameInstaladores = class(TRdxDBFrame)
private
FTablaInstaladores : TIBDataSet;
protected
FListaInstaladores : TStringList;
procedure SetTablaInstaladores (Value : TIBDataSet);
procedure SetListaInstaladores (Value : TStringList);
procedure SetCodigoInstalador (Value : Variant);
procedure SetFCodigoInstalador (Value : Variant);
function GetCodigoInstalador: Variant;
function GetFCodigoInstalador: Variant;
procedure SetContenido (NuevoFrame : TRdxFrame); override;
function TratarCambios : integer; override;
procedure BuscarInstalador; virtual; abstract;
procedure CambiarModo(ModoAnterior, Modo : TRdxModo); override;
public
property TablaInstaladores: TIBDataSet read FTablaInstaladores write SetTablaInstaladores;
property ListaInstaladores : TStringList read FListaInstaladores write SetListaInstaladores;
property CodigoInstalador : Variant read GetCodigoInstalador write SetCodigoInstalador;
property FCodigoInstalador : Variant read GetFCodigoInstalador write SetFCodigoInstalador;
constructor Create (AOwner : TComponent); override;
destructor Destroy; override;
published
property BaseDatos;
property Transaccion;
end;
implementation
{$R *.DFM}
uses
Literales{$IFDEF RDX_D6},Variants{$ENDIF};
{ TRdxFrameInstaladores }
constructor TRdxFrameInstaladores.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FListaInstaladores := TStringList.Create;
FTablaInstaladores := NIL;
end;
destructor TRdxFrameInstaladores.Destroy;
begin
FListaInstaladores.free;
FListaInstaladores := NIL;
inherited;
end;
function TRdxFrameInstaladores.TratarCambios : integer;
begin
if (TablaInstaladores.Modified = True) then
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
else Result := IDOK;
end;
procedure TRdxFrameInstaladores.SetContenido(NuevoFrame: TRdxFrame);
begin
if (Contenido <> NIL) then
if (Contenido.Name = NuevoFrame.ClassName) then
begin
NuevoFrame.Free;
exit;
end;
inherited;
if (TablaInstaladores <> NIL) then
begin
FCodigoInstalador := TablaInstaladores.FieldByName('CODIGO').Value;
if (Contenido is TRdxFrameInstaladores) then
(Contenido as TRdxFrameInstaladores).CodigoInstalador := FCodigoInstalador;
end;
end;
procedure TRdxFrameInstaladores.SetTablaInstaladores(Value: TIBDataSet);
begin
if (FTablaInstaladores <> Value) then
begin
FTablaInstaladores := Value;
end;
end;
procedure TRdxFrameInstaladores.CambiarModo(ModoAnterior, Modo : TRdxModo);
begin
inherited;
if (FModo in [Normal, Seleccionar]) then
begin
TablaInstaladores.Close;
TablaInstaladores.Open;
end
else begin
{ Si est<EFBFBD>bamos en el modo A<EFBFBD>adir y pasamos a cualquier otro modo SIEMPRE
es necesario buscar el codigo de articulo que tiene el frame
en CodigoArticulo (al activar el modo A<EFBFBD>adir NO se pisa este valor con
el c<EFBFBD>digo de articulo nuevo), preguntamos si la tabla esta activa por si
se ha cerrado al realizar algun cambio en modificar y ejecutar TratarCambios}
if (not TablaInstaladores.Active) or (ModoAnterior = Anadir) then
BuscarInstalador;
end;
end;
function TRdxFrameInstaladores.GetCodigoInstalador: Variant;
begin
Result := FCodigoInstalador;
end;
function TRdxFrameInstaladores.GetFCodigoInstalador: Variant;
begin
if (ListaInstaladores.Count = 0) then
Result := NULL
else
Result := ListaInstaladores.Strings[ListaInstaladores.Count-1];
end;
procedure TRdxFrameInstaladores.SetCodigoInstalador(Value: Variant);
begin
if (not VarIsNull(Value)) then
begin
FCodigoInstalador := Value;
BuscarInstalador;
end
end;
procedure TRdxFrameInstaladores.SetFCodigoInstalador(Value: Variant);
begin
FListaInstaladores.Clear;
if (not VarIsNull(Value)) then
FListaInstaladores.Add(Value);
end;
procedure TRdxFrameInstaladores.SetListaInstaladores(Value: TStringList);
begin
if (Value = Nil) or (Value.Count = 0) then
exit;
FListaInstaladores.Clear;
FListaInstaladores.Assign(Value);
end;
end.