217 lines
6.3 KiB
ObjectPascal
217 lines
6.3 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.2
|
|||
|
|
Fecha versi<EFBFBD>n actual: 01-11-2001
|
|||
|
|
===============================================================================
|
|||
|
|
Modificaciones:
|
|||
|
|
|
|||
|
|
Fecha Comentarios
|
|||
|
|
---------------------------------------------------------------------------
|
|||
|
|
30-10-2001 A<EFBFBD>adir la opci<EFBFBD>n de buscar por c<EFBFBD>digo de presupuesto o
|
|||
|
|
de albar<EFBFBD>n.
|
|||
|
|
01-11-2001 Se puede realizar b<EFBFBD>squedas por cliente final (c<EFBFBD>digo y
|
|||
|
|
nombre).
|
|||
|
|
===============================================================================
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
unit BuscarFacturaCliente;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
|||
|
|
RdxFrameFacturasCliente, RdxBotones, ExtCtrls, StdCtrls, RdxCampos, RdxTitulos,
|
|||
|
|
RdxPaneles, RdxBarras;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrBuscarFacturaCliente = class(TRdxFrameFacturasCliente)
|
|||
|
|
brBuscar: TRdxBarraInferior;
|
|||
|
|
bBuscar: TRdxBoton;
|
|||
|
|
bCerrar: TRdxBoton;
|
|||
|
|
pnlScroll: TRdxScrollPanel;
|
|||
|
|
cBuscarCliente: TRdxCabecera;
|
|||
|
|
Codigo: TRdxEdit;
|
|||
|
|
eNIF: TLabel;
|
|||
|
|
NIF: TRdxEdit;
|
|||
|
|
eNombre: TLabel;
|
|||
|
|
Nombre: TRdxEdit;
|
|||
|
|
eCodigoProveedor: TLabel;
|
|||
|
|
CodigoCliente: TRdxEdit;
|
|||
|
|
eCodigo: TLabel;
|
|||
|
|
eCodPreAlb: TLabel;
|
|||
|
|
CodPreAlb: TRdxEdit;
|
|||
|
|
eCodClienteFinal: TLabel;
|
|||
|
|
CodClienteFinal: TRdxEdit;
|
|||
|
|
eNombreClienteFinal: TLabel;
|
|||
|
|
NombreClienteFinal: TRdxEdit;
|
|||
|
|
procedure bCerrarClick(Sender: TObject);
|
|||
|
|
procedure bBuscarClick(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
procedure RecogerDatos;
|
|||
|
|
protected
|
|||
|
|
procedure BuscarFactura; override;
|
|||
|
|
function CloseFrame : boolean; override;
|
|||
|
|
public
|
|||
|
|
constructor Create(AOwner : TComponent); override;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frBuscarFacturaCliente: TfrBuscarFacturaCliente;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
{$R *.DFM}
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Tipos, StrFunc, Mensajes, DB, Configuracion, Literales;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
Campos : String;
|
|||
|
|
Valores : Variant;
|
|||
|
|
Contador : Integer;
|
|||
|
|
|
|||
|
|
procedure TfrBuscarFacturaCliente.bCerrarClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
CloseFrame;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfrBuscarFacturaCliente.CloseFrame: boolean;
|
|||
|
|
begin
|
|||
|
|
FCodigoFactura := TablaFacturas.FieldByName('CODIGO').AsString;
|
|||
|
|
Result := inherited CloseFrame;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
constructor TfrBuscarFacturaCliente.Create(AOwner: TComponent);
|
|||
|
|
begin
|
|||
|
|
if not (AOwner is TRdxFrameFacturasCliente) then
|
|||
|
|
exit;
|
|||
|
|
inherited Create(AOwner);
|
|||
|
|
Entidad := entFacturaCliente;
|
|||
|
|
ConfigurarFrame(Self, Self.Entidad);
|
|||
|
|
|
|||
|
|
Contador := -1;
|
|||
|
|
Campos := '';
|
|||
|
|
Valores := VarArrayOf([null, null, null, null]);
|
|||
|
|
|
|||
|
|
TablaFacturas := (AOwner as TRdxFrameFacturasCliente).TablaFacturas;
|
|||
|
|
with TablaFacturas do begin
|
|||
|
|
Codigo.MaxLength := FieldByName('CODIGO').Size;
|
|||
|
|
CodPreAlb.MaxLength := FieldByName('CODIGOPRESUPUESTOALBARAN').Size;
|
|||
|
|
Nombre.MaxLength := FieldByName('NOMBRE').Size;
|
|||
|
|
CodigoCliente.MaxLength := FieldByName('CODIGOCLIENTE').Size;
|
|||
|
|
NIF.MaxLength := FieldByName('NIFCIF').Size;
|
|||
|
|
CodClienteFinal.MaxLength := FieldByName('CODIGOCLIENTEFINAL').Size;
|
|||
|
|
NombreClienteFinal.MaxLength := FieldByName('NOMBRECLIENTEFINAL').Size;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrBuscarFacturaCliente.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(CodPreAlb.Text) then
|
|||
|
|
begin
|
|||
|
|
Contador := Contador + 1;
|
|||
|
|
Campos := Campos + 'CODIGOPRESUPUESTOALBARAN';
|
|||
|
|
Valores[Contador] := Trim(CodPreAlb.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;
|
|||
|
|
|
|||
|
|
procedure TfrBuscarFacturaCliente.bBuscarClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
RecogerDatos;
|
|||
|
|
if Contador <> -1 then
|
|||
|
|
BuscarFactura
|
|||
|
|
else
|
|||
|
|
VerMensaje(msgNoParametros);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrBuscarFacturaCliente.BuscarFactura;
|
|||
|
|
var
|
|||
|
|
Respuesta : integer;
|
|||
|
|
Resultado : Boolean;
|
|||
|
|
begin
|
|||
|
|
if Contador <> -1 then begin
|
|||
|
|
TablaFacturas.DisableControls;
|
|||
|
|
|
|||
|
|
if Contador = 0 then
|
|||
|
|
Resultado := TablaFacturas.LocateNext(Campos, Valores[Contador], [loCaseInsensitive, loPartialKey])
|
|||
|
|
else
|
|||
|
|
Resultado := TablaFacturas.LocateNext(Campos, Valores, [loCaseInsensitive, loPartialKey]);
|
|||
|
|
if (Resultado = false) then
|
|||
|
|
begin
|
|||
|
|
Respuesta := VerMensajePregunta(msgIrInicio);
|
|||
|
|
case Respuesta of
|
|||
|
|
IDYES: TablaFacturas.First;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
TablaFacturas.EnableControls;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|