git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES/trunk@4 b68bf8ae-e977-074f-a058-3cfd71dd8f45
169 lines
4.7 KiB
ObjectPascal
169 lines
4.7 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: 13-05-2002
|
|
Versión actual: 1.0.0
|
|
Fecha versión actual: 13-05-2002
|
|
===============================================================================
|
|
Modificaciones:
|
|
|
|
Fecha Comentarios
|
|
---------------------------------------------------------------------------
|
|
===============================================================================
|
|
}
|
|
|
|
unit BuscarInstalador;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
|
ExtCtrls, IBQuery, StdCtrls, DB, RdxBotones, RdxBarras, RdxComboBox,
|
|
RdxCampos, RdxTitulos, RdxPaneles, Tipos, Mensajes,
|
|
RdxFrame, RdxDBFrame, RdxFrameInstaladores;
|
|
|
|
type
|
|
TfrBuscarInstalador = class(TRdxFrameInstaladores)
|
|
brDoble: TRdxBarraInferior;
|
|
bBuscar: TRdxBoton;
|
|
bCerrar: TRdxBoton;
|
|
pnlPanel: TRdxPanel;
|
|
cDatos: TRdxCabecera;
|
|
eCodigo: TLabel;
|
|
eTelefono: TLabel;
|
|
eNombre: TLabel;
|
|
Codigo: TRdxEdit;
|
|
Nombre: TRdxEdit;
|
|
Telefono: TRdxEdit;
|
|
procedure bCerrarClick(Sender: TObject);
|
|
procedure bBuscarClick(Sender: TObject);
|
|
procedure RecogerDatos;
|
|
protected
|
|
procedure BuscarInstalador; override;
|
|
function CloseFrame : boolean; override;
|
|
public
|
|
constructor Create (AOwner : TComponent); override;
|
|
published
|
|
property TablaInstaladores;
|
|
property CodigoInstalador;
|
|
end;
|
|
|
|
var
|
|
frBuscarInstalador: TfrBuscarInstalador;
|
|
|
|
implementation
|
|
|
|
{$R *.DFM}
|
|
|
|
uses
|
|
BaseDatos, Instaladores, Configuracion, Literales;
|
|
|
|
var
|
|
Campos : String;
|
|
Valores : Variant;
|
|
Contador : Integer;
|
|
|
|
constructor TfrBuscarInstalador.Create (AOwner : TComponent);
|
|
begin
|
|
if not (AOwner is TRdxFrameInstaladores) then
|
|
exit;
|
|
inherited Create(AOwner);
|
|
Entidad := entInstalador;
|
|
ConfigurarFrame(Self, Self.Entidad);
|
|
|
|
Contador := -1;
|
|
Campos := '';
|
|
Valores := VarArrayOf([null, null, null]);
|
|
|
|
TablaInstaladores := (AOwner as TRdxFrameInstaladores).TablaInstaladores;
|
|
with TablaInstaladores do begin
|
|
Codigo.MaxLength := FieldByName('CODIGO').Size;
|
|
Nombre.MaxLength := FieldByName('NOMBRE').Size;
|
|
end;
|
|
if TablaInstaladores.FieldByName('CODIGO').AsString='' then;
|
|
end;
|
|
|
|
procedure TfrBuscarInstalador.bCerrarClick(Sender: TObject);
|
|
begin
|
|
CloseFrame;
|
|
end;
|
|
|
|
procedure TfrBuscarInstalador.RecogerDatos;
|
|
begin
|
|
Campos := '';
|
|
Contador := -1;
|
|
|
|
if Length(Trim(Codigo.Text)) > 0 then
|
|
begin
|
|
Contador := Contador + 1;
|
|
Campos := Campos + 'CODIGO';
|
|
Valores[Contador] := Trim(Codigo.Text);
|
|
end;
|
|
|
|
if Length(Trim(Nombre.Text)) > 0 then
|
|
begin
|
|
Contador := Contador + 1;
|
|
if Contador > 0 then
|
|
Campos := Campos + ';';
|
|
Campos := Campos + 'NOMBRE';
|
|
Valores[Contador] := Trim(Nombre.Text);
|
|
end;
|
|
|
|
if Length(Trim(Telefono.Text)) > 0 then
|
|
begin
|
|
Contador := Contador + 1;
|
|
if Contador > 0 then
|
|
Campos := Campos + ';';
|
|
Campos := Campos + 'TELEFONO1';
|
|
Valores[Contador] := Trim(Telefono.Text);
|
|
end;
|
|
end;
|
|
|
|
procedure TfrBuscarInstalador.bBuscarClick(Sender: TObject);
|
|
begin
|
|
RecogerDatos;
|
|
if Contador <> -1 then
|
|
BuscarInstalador
|
|
else
|
|
VerMensaje(msgNoParametros);
|
|
end;
|
|
|
|
procedure TfrBuscarInstalador.BuscarInstalador;
|
|
var
|
|
Respuesta : integer;
|
|
Resultado : Boolean;
|
|
begin
|
|
if Contador <> -1 then begin
|
|
TablaInstaladores.DisableControls;
|
|
|
|
if Contador = 0
|
|
then Resultado := TablaInstaladores.LocateNext(Campos, Valores[Contador], [loCaseInsensitive, loPartialKey])
|
|
else Resultado := TablaInstaladores.LocateNext(Campos, Valores, [loCaseInsensitive, loPartialKey]);
|
|
if (Resultado = false) then
|
|
begin
|
|
Respuesta := VerMensajePregunta(msgIrInicio);
|
|
case Respuesta of
|
|
IDYES: TablaInstaladores.First;
|
|
end;
|
|
end;
|
|
TablaInstaladores.EnableControls;
|
|
end;
|
|
end;
|
|
|
|
function TfrBuscarInstalador.CloseFrame: boolean;
|
|
begin
|
|
FCodigoInstalador := TablaInstaladores.FieldByName('CODIGO').AsString;
|
|
Result := inherited CloseFrame;
|
|
end;
|
|
|
|
end.
|