This repository has been archived on 2024-11-29. You can view files and clone it, but cannot push or open issues or pull requests.
Tecsitel_FactuGES/Clientes/BuscarPresupuestoCliente.pas

204 lines
5.9 KiB
ObjectPascal
Raw Permalink Normal View History

{
===============================================================================
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: 01-11-2001
===============================================================================
Modificaciones:
Fecha Comentarios
---------------------------------------------------------------------------
01-11-2001 Se puede realizar b<EFBFBD>squedas por cliente final (c<EFBFBD>digo y
nombre).
===============================================================================
}
unit BuscarPresupuestoCliente;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
RdxBotones, ExtCtrls, StdCtrls, RdxCampos,
RdxPaneles, RdxBarras, RdxFramePresupuestos, RdxTitulos;
type
TfrBuscarPresupuestoCliente = class(TRdxFramePresupuestos)
brBuscar: TRdxBarraInferior;
bBuscar: TRdxBoton;
bCerrar: TRdxBoton;
pnlScroll: TRdxScrollPanel;
cBuscarProveedor: TRdxCabecera;
eCodigo: TLabel;
Label2: TLabel;
Label3: TLabel;
eNombre: TLabel;
Codigo: TRdxEdit;
CodigoCliente: TRdxEdit;
NIF: TRdxEdit;
Nombre: TRdxEdit;
eCodClienteFinal: TLabel;
CodClienteFinal: TRdxEdit;
eNombreClienteFinal: TLabel;
NombreClienteFinal: TRdxEdit;
procedure bCerrarClick(Sender: TObject);
procedure bBuscarClick(Sender: TObject);
private
procedure RecogerDatos;
protected
procedure BuscarPresupuesto; override;
function CloseFrame : boolean; override;
public
constructor Create(AOwner : TComponent); override;
end;
var
frBuscarPresupuestoCliente: TfrBuscarPresupuestoCliente;
implementation
{$R *.DFM}
uses
Tipos, Mensajes, StrFunc, DB, Configuracion, Literales;
var
Campos : String;
Valores : Variant;
Contador : Integer;
procedure TfrBuscarPresupuestoCliente.bCerrarClick(Sender: TObject);
begin
CloseFrame;
end;
procedure TfrBuscarPresupuestoCliente.bBuscarClick(Sender: TObject);
begin
RecogerDatos;
if Contador <> -1 then
BuscarPresupuesto
else
VerMensaje(msgNoParametros);
end;
procedure TfrBuscarPresupuestoCliente.BuscarPresupuesto;
var
Respuesta : integer;
Resultado : Boolean;
begin
if Contador <> -1 then begin
TablaPresupuestos.DisableControls;
if Contador = 0 then
Resultado := TablaPresupuestos.LocateNext(Campos, Valores[Contador], [loCaseInsensitive, loPartialKey])
else
Resultado := TablaPresupuestos.LocateNext(Campos, Valores, [loCaseInsensitive, loPartialKey]);
if (Resultado = false) then
begin
Respuesta := VerMensajePregunta(msgIrInicio);
case Respuesta of
IDYES: TablaPresupuestos.First;
end;
end;
TablaPresupuestos.EnableControls;
end;
end;
constructor TfrBuscarPresupuestoCliente.Create(AOwner: TComponent);
begin
if not (AOwner is TRdxFramePresupuestos) then
exit;
inherited Create(AOwner);
Entidad := entPresupuestoCliente;
ConfigurarFrame(Self, Self.Entidad);
Contador := -1;
Campos := '';
Valores := VarArrayOf([null, null, null, null]);
TablaPresupuestos := (AOwner as TRdxFramePresupuestos).TablaPresupuestos;
with TablaPresupuestos do begin
Codigo.MaxLength := FieldByName('CODIGO').Size;
CodigoCliente.MaxLength := FieldByName('CODIGOCLIENTE').Size;
NIF.MaxLength := FieldByName('NIFCIF').Size;
Nombre.MaxLength := FieldByName('NOMBRE').Size;
CodClienteFinal.MaxLength := FieldByName('CODIGOCLIENTEFINAL').Size;
NombreClienteFinal.MaxLength := FieldByName('NOMBRECLIENTEFINAL').Size;
end;
end;
procedure TfrBuscarPresupuestoCliente.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(CodigoCliente.Text) then
begin
Contador := Contador + 1;
if Contador > 0 then
Campos := Campos + ';';
Campos := Campos + 'CODIGOCLIENTE';
Valores[Contador] := Trim(CodigoCliente.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;
if not EsCadenaVacia(Nif.Text) then
begin
Contador := Contador + 1;
if Contador > 0 then
Campos := Campos + ';';
Campos := Campos + 'NIFCIF';
Valores[Contador] := Trim(Nif.Text);
end;
if not EsCadenaVacia(CodClienteFinal.Text) then
begin
Contador := Contador + 1;
if Contador > 0 then
Campos := Campos + ';';
Campos := Campos + 'CODIGOCLIENTEFINAL';
Valores[Contador] := Trim(CodClienteFinal.Text);
end;
if not EsCadenaVacia(NombreClienteFinal.Text) then
begin
Contador := Contador + 1;
if Contador > 0 then
Campos := Campos + ';';
Campos := Campos + 'NOMBRECLIENTEFINAL';
Valores[Contador] := Trim(NombreClienteFinal.Text);
end;
end;
function TfrBuscarPresupuestoCliente.CloseFrame: boolean;
begin
FCodigoPresupuesto := TablaPresupuestos.FieldByName('CODIGO').AsString;
Result := inherited CloseFrame;
end;
end.