151 lines
4.5 KiB
ObjectPascal
151 lines
4.5 KiB
ObjectPascal
|
|
{
|
|||
|
|
===============================================================================
|
|||
|
|
Copyright (<EFBFBD>) 2002. 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: 19-04-2004
|
|||
|
|
Versi<EFBFBD>n actual: 1.0.0
|
|||
|
|
Fecha versi<EFBFBD>n actual: 19-04-2004
|
|||
|
|
===============================================================================
|
|||
|
|
Modificaciones:
|
|||
|
|
|
|||
|
|
Fecha Comentarios
|
|||
|
|
---------------------------------------------------------------------------
|
|||
|
|
===============================================================================
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
unit RdxFrameEmpresas;
|
|||
|
|
|
|||
|
|
{$I ..\COMPILE.INC}
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Consts, Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
|||
|
|
RdxFrame, RdxDBFrame, IBCustomDataSet, IBDataBase, Tipos, IB, DB;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TRdxFrameEmpresas = class(TRdxDBFrame)
|
|||
|
|
private
|
|||
|
|
FTablaEmpresas : TIBDataSet;
|
|||
|
|
protected
|
|||
|
|
FCodigoEmpresa : Variant;
|
|||
|
|
procedure SetTablaEmpresas (Value : TIBDataSet);
|
|||
|
|
procedure SetCodigoEmpresa (Value : Variant); virtual;
|
|||
|
|
procedure SetContenido (NuevoFrame : TRdxFrame); override;
|
|||
|
|
function TratarCambios : integer; override;
|
|||
|
|
procedure BuscarEmpresa; virtual;
|
|||
|
|
procedure CambiarModo(ModoAnterior, Modo : TRdxModo); override;
|
|||
|
|
public
|
|||
|
|
property TablaEmpresas: TIBDataSet read FTablaEmpresas write SetTablaEmpresas;
|
|||
|
|
property CodigoEmpresa : Variant read FCodigoEmpresa write SetCodigoEmpresa;
|
|||
|
|
constructor Create (AOwner : TComponent); override;
|
|||
|
|
published
|
|||
|
|
property BaseDatos;
|
|||
|
|
property Transaccion;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
{$R *.DFM}
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Mensajes, StrFunc, Literales
|
|||
|
|
{$IFDEF RDX_D6}, Variants{$ENDIF};
|
|||
|
|
|
|||
|
|
{ TRdxFrameClientes }
|
|||
|
|
|
|||
|
|
constructor TRdxFrameEmpresas.Create(AOwner: TComponent);
|
|||
|
|
begin
|
|||
|
|
inherited Create(AOwner);
|
|||
|
|
FCodigoEmpresa := NULL;
|
|||
|
|
FTablaEmpresas := NIL;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TRdxFrameEmpresas.TratarCambios : integer;
|
|||
|
|
begin
|
|||
|
|
if (TablaEmpresas.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 TRdxFrameEmpresas.SetCodigoEmpresa(Value: Variant);
|
|||
|
|
begin
|
|||
|
|
if not EsCadenaVacia(Value) then
|
|||
|
|
begin
|
|||
|
|
FCodigoEmpresa := Value;
|
|||
|
|
BuscarEmpresa;
|
|||
|
|
end
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TRdxFrameEmpresas.SetContenido(NuevoFrame: TRdxFrame);
|
|||
|
|
begin
|
|||
|
|
if (FContenido <> NIL) then
|
|||
|
|
if (Contenido.Name = NuevoFrame.ClassName) then
|
|||
|
|
begin
|
|||
|
|
NuevoFrame.Free;
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
inherited;
|
|||
|
|
if (TablaEmpresas <> NIL) then
|
|||
|
|
begin
|
|||
|
|
FCodigoEmpresa := TablaEmpresas.FieldByName('CODIGO').Value;
|
|||
|
|
if Contenido is TRdxFrameEmpresas then
|
|||
|
|
(Contenido as TRdxFrameEmpresas).CodigoEmpresa := FCodigoEmpresa;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TRdxFrameEmpresas.CambiarModo(ModoAnterior, Modo : TRdxModo);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
if (FModo in [Normal, Seleccionar]) then
|
|||
|
|
begin
|
|||
|
|
TablaEmpresas.Close;
|
|||
|
|
TablaEmpresas.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 almac<EFBFBD>n que tiene el frame
|
|||
|
|
en CodigoEmpresa (al activar el modo A<EFBFBD>adir NO se pisa este valor con
|
|||
|
|
el c<EFBFBD>digo de almac<EFBFBD>n nuevo), preguntamos si la tabla esta activa por si
|
|||
|
|
se ha cerrado al realizar algun cambio en modificar y ejecutar TratarCambios}
|
|||
|
|
if (not TablaEmpresas.Active) or (ModoAnterior = Anadir) then
|
|||
|
|
BuscarEmpresa;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TRdxFrameEmpresas.SetTablaEmpresas(Value: TIBDataSet);
|
|||
|
|
begin
|
|||
|
|
if (FTablaEmpresas <> Value) then
|
|||
|
|
FTablaEmpresas := Value;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TRdxFrameEmpresas.BuscarEmpresa;
|
|||
|
|
begin
|
|||
|
|
//
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|