git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES/trunk@4 b68bf8ae-e977-074f-a058-3cfd71dd8f45
159 lines
4.8 KiB
ObjectPascal
159 lines
4.8 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: 01-10-2001
|
|
Versión actual: 1.0.1
|
|
Fecha versión actual: 07-04-2002
|
|
===============================================================================
|
|
Modificaciones:
|
|
|
|
Fecha Comentarios
|
|
---------------------------------------------------------------------------
|
|
07-04-2002 Se ha adaptado el frame para transaccion unica.
|
|
===============================================================================
|
|
}
|
|
|
|
unit RdxFramePoblaciones;
|
|
|
|
{$I ..\COMPILE.INC}
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
|
IBDatabase, IBCustomDataSet, Tipos, DB, RdxFrame, RdxDBFrame;
|
|
|
|
type
|
|
TRdxFramePoblaciones = class(TRdxDBFrame)
|
|
private
|
|
FCodigoProvincia : Variant;
|
|
FCodigoPoblacion : Variant;
|
|
FTablaPoblaciones : TIBDataSet;
|
|
protected
|
|
procedure SetTablaPoblaciones (Value : TIBDataSet);
|
|
procedure SetCodigoProvincia (Value : Variant); virtual;
|
|
procedure SetCodigoPoblacion (Value : Variant); virtual;
|
|
procedure SetContenido (NuevoFrame : TRdxFrame); override;
|
|
procedure BuscarPoblacion; virtual;
|
|
procedure CambiarModo(ModoAnterior, Modo : TRdxModo); override;
|
|
public
|
|
property TablaPoblaciones: TIBDataSet read FTablaPoblaciones write SetTablaPoblaciones;
|
|
property CodigoProvincia : Variant read FCodigoProvincia write SetCodigoProvincia;
|
|
property CodigoPoblacion : Variant read FCodigoPoblacion write SetCodigoPoblacion;
|
|
constructor Create (AOwner : TComponent); override;
|
|
published
|
|
property BaseDatos;
|
|
property Transaccion;
|
|
end;
|
|
|
|
implementation
|
|
|
|
{$R *.DFM}
|
|
|
|
uses
|
|
IB, Mensajes
|
|
{$IFDEF RDX_D6}, Variants{$ENDIF};
|
|
|
|
{ TfrPoblaciones }
|
|
|
|
constructor TRdxFramePoblaciones.Create(AOwner: TComponent);
|
|
begin
|
|
inherited Create(AOwner);
|
|
FCodigoProvincia := NULL;
|
|
FCodigoPoblacion := NULL;
|
|
FTablaPoblaciones := NIL;
|
|
end;
|
|
|
|
procedure TRdxFramePoblaciones.BuscarPoblacion;
|
|
begin
|
|
if Transaccion = NIL then
|
|
exit;
|
|
try
|
|
TablaPoblaciones.Close;
|
|
// Buscar la fila a tratar si es necesario
|
|
if not VarIsNull(FCodigoProvincia) then
|
|
TablaPoblaciones.Params.ByName('CODIGOPROVINCIA').AsString := FCodigoProvincia;
|
|
TablaPoblaciones.Prepare;
|
|
TablaPoblaciones.Open;
|
|
except
|
|
on E : EIBError do begin
|
|
VerMensaje(E.Message);
|
|
end;
|
|
on E : EDatabaseError do begin
|
|
VerMensaje(E.Message);
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
procedure TRdxFramePoblaciones.SetCodigoProvincia(Value: Variant);
|
|
begin
|
|
if (not VarIsNull(FCodigoProvincia)) and (FCodigoProvincia = Value) then
|
|
exit;
|
|
|
|
if (not VarIsNull(Value)) then
|
|
begin
|
|
if (TratarCambios = IDCANCEL) then
|
|
exit;
|
|
FCodigoProvincia := Value;
|
|
BuscarPoblacion;
|
|
end
|
|
end;
|
|
|
|
procedure TRdxFramePoblaciones.SetCodigoPoblacion(Value: Variant);
|
|
begin
|
|
if (not VarIsNull(FCodigoPoblacion)) and (FCodigoPoblacion = Value) then
|
|
exit;
|
|
|
|
if (not VarIsNull(Value)) then
|
|
FCodigoPoblacion := Value;
|
|
end;
|
|
|
|
procedure TRdxFramePoblaciones.SetContenido(NuevoFrame: TRdxFrame);
|
|
begin
|
|
if (Contenido <> NIL) then
|
|
if (Contenido.Name = NuevoFrame.ClassName) then
|
|
begin
|
|
NuevoFrame.Free;
|
|
exit;
|
|
end;
|
|
inherited;
|
|
if TablaPoblaciones <> NIL then
|
|
begin
|
|
FCodigoProvincia := TablaPoblaciones.FieldByName('CODIGOPROVINCIA').Value;
|
|
FCodigoPoblacion := TablaPoblaciones.FieldByName('CODIGOPOBLACION').Value;
|
|
if Contenido is TRdxFramePoblaciones then begin
|
|
(Contenido as TRdxFramePoblaciones).CodigoProvincia := FCodigoProvincia;
|
|
(Contenido as TRdxFramePoblaciones).CodigoPoblacion := FCodigoPoblacion;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
procedure TRdxFramePoblaciones.CambiarModo(ModoAnterior, Modo : TRdxModo);
|
|
begin
|
|
inherited;
|
|
if not (FModo in [Normal, Seleccionar]) then
|
|
BuscarPoblacion
|
|
else begin
|
|
TablaPoblaciones.Close;
|
|
TablaPoblaciones.Open;
|
|
end;
|
|
end;
|
|
|
|
procedure TRdxFramePoblaciones.SetTablaPoblaciones(Value: TIBDataSet);
|
|
begin
|
|
if (FTablaPoblaciones <> Value) then
|
|
FTablaPoblaciones := Value;
|
|
end;
|
|
|
|
end.
|
|
|