180 lines
5.2 KiB
ObjectPascal
180 lines
5.2 KiB
ObjectPascal
|
|
{
|
|||
|
|
===============================================================================
|
|||
|
|
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: 01-10-2001
|
|||
|
|
Versi<EFBFBD>n actual: 1.0.1
|
|||
|
|
Fecha versi<EFBFBD>n actual: 04-10-2004
|
|||
|
|
===============================================================================
|
|||
|
|
Modificaciones:
|
|||
|
|
|
|||
|
|
Fecha Comentarios
|
|||
|
|
---------------------------------------------------------------------------
|
|||
|
|
04-10-2004 Se a<EFBFBD>ade unidad cambiarEntidad para que pueda cambiar de color
|
|||
|
|
dependiendo del modulo desde el que se la llama
|
|||
|
|
|
|||
|
|
===============================================================================
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
unit BuscarAlbaranInstalador;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
|||
|
|
RdxFrameAlbaranes, RdxBotones, ExtCtrls, StdCtrls, RdxCampos,
|
|||
|
|
RdxTitulos, RdxPaneles, RdxBarras, Tipos;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrBuscarAlbaranInstalador = class(TRdxFrameAlbaranes)
|
|||
|
|
brBuscar: TRdxBarraInferior;
|
|||
|
|
bBuscar: TRdxBoton;
|
|||
|
|
bCerrar: TRdxBoton;
|
|||
|
|
pnlScroll: TRdxScrollPanel;
|
|||
|
|
cBuscarCliente: TRdxCabecera;
|
|||
|
|
eCodigoPedido: TLabel;
|
|||
|
|
Codigo: TRdxEdit;
|
|||
|
|
eNombre: TLabel;
|
|||
|
|
Nombre: TRdxEdit;
|
|||
|
|
eCodigoInstalador: TLabel;
|
|||
|
|
CodigoInstalador: TRdxEdit;
|
|||
|
|
procedure bBuscarClick(Sender: TObject);
|
|||
|
|
procedure bCerrarClick(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
procedure RecogerDatos;
|
|||
|
|
protected
|
|||
|
|
procedure BuscarAlbaran; override;
|
|||
|
|
function CloseFrame : boolean; override;
|
|||
|
|
function CambiarEntidad (EntidadAnterior, Entidad : TRdxEntidad): Boolean; override;
|
|||
|
|
public
|
|||
|
|
constructor Create(AOwner : TComponent); override;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frBuscarAlbaranInstalador: TfrBuscarAlbaranInstalador;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
{$R *.DFM}
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Mensajes, StrFunc, Configuracion, DB, Literales;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
Campos : String;
|
|||
|
|
Valores : Variant;
|
|||
|
|
Contador : Integer;
|
|||
|
|
|
|||
|
|
procedure TfrBuscarAlbaranInstalador.bBuscarClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
RecogerDatos;
|
|||
|
|
if Contador <> -1 then
|
|||
|
|
BuscarAlbaran
|
|||
|
|
else
|
|||
|
|
VerMensaje(msgNoParametros);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrBuscarAlbaranInstalador.bCerrarClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
CloseFrame;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrBuscarAlbaranInstalador.BuscarAlbaran;
|
|||
|
|
var
|
|||
|
|
Respuesta : integer;
|
|||
|
|
Resultado : Boolean;
|
|||
|
|
begin
|
|||
|
|
if Contador <> -1 then begin
|
|||
|
|
TablaAlbaranes.DisableControls;
|
|||
|
|
|
|||
|
|
if Contador = 0 then
|
|||
|
|
Resultado := TablaAlbaranes.LocateNext(Campos, Valores[Contador], [loCaseInsensitive, loPartialKey])
|
|||
|
|
else
|
|||
|
|
Resultado := TablaAlbaranes.LocateNext(Campos, Valores, [loCaseInsensitive, loPartialKey]);
|
|||
|
|
if (Resultado = false) then
|
|||
|
|
begin
|
|||
|
|
Respuesta := VerMensajePregunta(msgIrInicio);
|
|||
|
|
case Respuesta of
|
|||
|
|
IDYES: TablaAlbaranes.First;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
TablaAlbaranes.EnableControls;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfrBuscarAlbaranInstalador.CambiarEntidad(EntidadAnterior,
|
|||
|
|
Entidad: TRdxEntidad): Boolean;
|
|||
|
|
begin
|
|||
|
|
if not inherited CambiarEntidad(EntidadAnterior, Entidad) then
|
|||
|
|
Exit;
|
|||
|
|
|
|||
|
|
ConfigurarFrame(Self, Self.Entidad);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfrBuscarAlbaranInstalador.CloseFrame: boolean;
|
|||
|
|
begin
|
|||
|
|
FCodigoAlbaran := TablaAlbaranes.FieldByName('CODIGO').AsString;
|
|||
|
|
Result := inherited CloseFrame;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
constructor TfrBuscarAlbaranInstalador.Create(AOwner: TComponent);
|
|||
|
|
begin
|
|||
|
|
if not (AOwner is TRdxFrameAlbaranes) then
|
|||
|
|
exit;
|
|||
|
|
inherited Create(AOwner);
|
|||
|
|
Entidad := entAlbaranCliente;
|
|||
|
|
ConfigurarFrame(Self, Self.Entidad);
|
|||
|
|
|
|||
|
|
Contador := -1;
|
|||
|
|
Campos := '';
|
|||
|
|
Valores := VarArrayOf([null, null, null, null]);
|
|||
|
|
|
|||
|
|
TablaAlbaranes := (AOwner as TRdxFrameAlbaranes).TablaAlbaranes;
|
|||
|
|
with TablaAlbaranes do begin
|
|||
|
|
Codigo.MaxLength := FieldByName('CODIGO').Size;
|
|||
|
|
Nombre.MaxLength := FieldByName('NOMBRE').Size;
|
|||
|
|
CodigoInstalador.MaxLength := FieldByName('CODIGOINSTALADOR').Size;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrBuscarAlbaranInstalador.RecogerDatos;
|
|||
|
|
begin
|
|||
|
|
Campos := '';
|
|||
|
|
Contador := -1;
|
|||
|
|
|
|||
|
|
if not EsCadenaVacia(Codigo.Text) then
|
|||
|
|
begin
|
|||
|
|
Contador := Contador + 1;
|
|||
|
|
Campos := Campos + 'CODIGO';
|
|||
|
|
Valores[Contador] := Trim(Codigo.Text);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if not EsCadenaVacia(CodigoInstalador.Text) then
|
|||
|
|
begin
|
|||
|
|
Contador := Contador + 1;
|
|||
|
|
if Contador > 0 then
|
|||
|
|
Campos := Campos + ';';
|
|||
|
|
Campos := Campos + 'CODIGOINSTALADOR';
|
|||
|
|
Valores[Contador] := Trim(CodigoInstalador.Text);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if not EsCadenaVacia(Nombre.Text) then
|
|||
|
|
begin
|
|||
|
|
Contador := Contador + 1;
|
|||
|
|
if Contador > 0 then
|
|||
|
|
Campos := Campos + ';';
|
|||
|
|
Campos := Campos + 'NOMBRE';
|
|||
|
|
Valores[Contador] := Trim(Nombre.Text);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|