git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES/trunk@4 b68bf8ae-e977-074f-a058-3cfd71dd8f45
213 lines
6.0 KiB
ObjectPascal
213 lines
6.0 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.2
|
|
Fecha versión actual: 04-10-2004
|
|
===============================================================================
|
|
Modificaciones:
|
|
|
|
Fecha Comentarios
|
|
---------------------------------------------------------------------------
|
|
27-11-2001 Cambio de la cabecera dependiendo de la entidad en la que nos
|
|
encontremos, almacen u obra (CambiarEntidad).
|
|
|
|
04-10-2004 Cambio CambiarEntidad para que soporte otro color.
|
|
===============================================================================
|
|
}
|
|
|
|
unit BuscarAlmacen;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
|
ExtCtrls, IBQuery, StdCtrls, DB, RdxBotones, RdxBarras, RdxComboBox,
|
|
RdxCampos, RdxTitulos, RdxPaneles, Tipos, Mensajes,
|
|
RdxFrame, RdxDBFrame, RdxFrameAlmacenes;
|
|
|
|
|
|
type
|
|
TfrBuscarAlmacen = class(TRdxFrameAlmacenes)
|
|
brBuscar: TRdxBarraInferior;
|
|
bBuscar: TRdxBoton;
|
|
bCerrar: TRdxBoton;
|
|
pnlPanel: TRdxPanel;
|
|
cAlmacen: TRdxCabecera;
|
|
eCodigo: TLabel;
|
|
eNombre: TLabel;
|
|
eCodigoCliente: TLabel;
|
|
eNifCif: TLabel;
|
|
eNombreCliente: TLabel;
|
|
Codigo: TRdxEdit;
|
|
NombreCliente: TRdxEdit;
|
|
CodigoCliente: TRdxEdit;
|
|
Nombre: TRdxEdit;
|
|
Nif: TRdxEdit;
|
|
procedure bCerrarClick(Sender: TObject);
|
|
procedure bBuscarClick(Sender: TObject);
|
|
procedure RecogerDatos;
|
|
protected
|
|
function CambiarEntidad (EntidadAnterior, Entidad : TRdxEntidad): Boolean; override;
|
|
procedure BuscarAlmacen; override;
|
|
function CloseFrame: boolean; override;
|
|
public
|
|
constructor Create (AOwner : TComponent); override;
|
|
published
|
|
property TablaAlmacenes;
|
|
property CodigoAlmacen;
|
|
end;
|
|
|
|
|
|
var
|
|
frBuscarAlmacen: TfrBuscarAlmacen;
|
|
|
|
implementation
|
|
|
|
{$R *.DFM}
|
|
|
|
uses
|
|
BaseDatos, Almacenes, Configuracion, Literales;
|
|
|
|
var
|
|
Campos : String;
|
|
Valores : Variant;
|
|
Contador : Integer;
|
|
|
|
constructor TfrBuscarAlmacen.Create (AOwner : TComponent);
|
|
begin
|
|
if not (AOwner is TRdxFrameAlmacenes) then
|
|
exit;
|
|
inherited Create(AOwner);
|
|
Entidad := entAlmacen;
|
|
ConfigurarFrame(Self, Self.Entidad);
|
|
|
|
Contador := -1;
|
|
Campos := '';
|
|
Valores := VarArrayOf([null, null, null, null, null]);
|
|
|
|
TablaAlmacenes := (AOwner as TRdxFrameAlmacenes).TablaAlmacenes;
|
|
with TablaAlmacenes do begin
|
|
Codigo.MaxLength := FieldByName('ALMACENES.CODIGO').Size;
|
|
Nombre.MaxLength := FieldByName('ALMACENES.NOMBRE').Size;
|
|
CodigoCliente.MaxLength := FieldByName('CLIENTES.CODIGO').Size;
|
|
NombreCliente.MaxLength := FieldByName('CLIENTES.NOMBRE').Size;
|
|
Nif.MaxLength := FieldByName('NIFCIF').Size;
|
|
end;
|
|
|
|
end;
|
|
|
|
procedure TfrBuscarAlmacen.bCerrarClick(Sender: TObject);
|
|
begin
|
|
inherited;
|
|
CloseFrame;
|
|
end;
|
|
|
|
procedure TfrBuscarAlmacen.RecogerDatos;
|
|
begin
|
|
Campos := '';
|
|
Contador := -1;
|
|
|
|
if Length(Trim(Codigo.Text)) > 0 then
|
|
begin
|
|
Contador := Contador + 1;
|
|
Campos := Campos + 'ALMACENES.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 + 'ALMACENES.NOMBRE';
|
|
Valores[Contador] := Trim(Nombre.Text);
|
|
end;
|
|
|
|
if Length(Trim(CodigoCliente.Text)) > 0 then
|
|
begin
|
|
Contador := Contador + 1;
|
|
if Contador > 0 then
|
|
Campos := Campos + ';';
|
|
Campos := Campos + 'CLIENTES.CODIGO';
|
|
Valores[Contador] := Trim(CodigoCliente.Text);
|
|
end;
|
|
|
|
if Length(Trim(NombreCliente.Text)) > 0 then
|
|
begin
|
|
Contador := Contador + 1;
|
|
if Contador > 0 then
|
|
Campos := Campos + ';';
|
|
Campos := Campos + 'CLIENTES.NOMBRE';
|
|
Valores[Contador] := Trim(NombreCliente.Text);
|
|
end;
|
|
|
|
if Length(Trim(Nif.Text)) > 0 then
|
|
begin
|
|
Contador := Contador + 1;
|
|
if Contador > 0 then
|
|
Campos := Campos + ';';
|
|
Campos := Campos + 'NIFCIF';
|
|
Valores[Contador] := Trim(Nif.Text);
|
|
end;
|
|
end;
|
|
|
|
procedure TfrBuscarAlmacen.bBuscarClick(Sender: TObject);
|
|
begin
|
|
RecogerDatos;
|
|
if Contador <> -1 then
|
|
BuscarAlmacen
|
|
else
|
|
VerMensaje(msgNoParametros);
|
|
end;
|
|
|
|
procedure TfrBuscarAlmacen.BuscarAlmacen;
|
|
var
|
|
Respuesta : integer;
|
|
Resultado : Boolean;
|
|
begin
|
|
if Contador <> -1 then begin
|
|
TablaAlmacenes.DisableControls;
|
|
|
|
if Contador = 0
|
|
then Resultado := TablaAlmacenes.LocateNext(Campos, Valores[Contador], [loCaseInsensitive, loPartialKey])
|
|
else Resultado := TablaAlmacenes.LocateNext(Campos, Valores, [loCaseInsensitive, loPartialKey]);
|
|
if (Resultado = false) then
|
|
begin
|
|
Respuesta := VerMensajePregunta(msgIrInicio);
|
|
case Respuesta of
|
|
IDYES: TablaAlmacenes.First;
|
|
end;
|
|
end;
|
|
TablaAlmacenes.EnableControls;
|
|
end;
|
|
end;
|
|
|
|
function TfrBuscarAlmacen.CloseFrame: boolean;
|
|
begin
|
|
FCodigoAlmacen := TablaAlmacenes.FieldByName('ALMACENES.CODIGO').AsString;
|
|
Result := inherited CloseFrame;
|
|
end;
|
|
|
|
function TfrBuscarAlmacen.CambiarEntidad(EntidadAnterior, Entidad: TRdxEntidad): Boolean;
|
|
begin
|
|
if not inherited CambiarEntidad(EntidadAnterior, Entidad) then
|
|
Exit;
|
|
|
|
ConfigurarFrame(Self, Self.Entidad);
|
|
|
|
if Entidad = entAlmacenObra then
|
|
cAlmacen.Caption := 'Búsqueda de obra';
|
|
end;
|
|
|
|
end.
|