AlonsoYSal_FactuGES2/Source/GUIBase/uViewFiltroBase.pas
roberto d2aa26662f Version 2.2.3:
- a partir de ahora se añade en los asientos de caja y banco la referencia de la factura de proveedor y su nombre, además de la referencia de la factura de proveedor en FactuGES
- se añade columna de procedencia en presupuestos, facturas de cliente.
- se añade la posibilidad de filtrar por dos campos a la vez en clientes, presupuestos y facturas

git-svn-id: https://192.168.0.254/svn/Proyectos.AlonsoYSal_FactuGES2/trunk@28 40301925-124e-1c4e-b97d-170ad7a8785b
2022-03-31 09:03:49 +00:00

209 lines
6.1 KiB
ObjectPascal

unit uViewFiltroBase;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxMaskEdit, cxDropDownEdit, cxCalendar, dxLayoutControl,
cxContainer, cxEdit, cxTextEdit, dxLayoutLookAndFeels, cxControls,
StdCtrls, Buttons, cxRadioGroup, TBXDkPanels, TB2ExtItems, TBXExtItems,
TBX, TB2Item, TB2Dock, TB2Toolbar, ActnList, ImgList, PngImageList,
uViewBase;
type
IViewFiltroBase = interface(IViewBase)
['{0D0EA630-BF93-4BA1-93C2-FD5A5B0CBEED}']
function GetFiltrosChange: TNotifyEvent;
procedure SetFiltrosChange(const Value: TNotifyEvent);
property OnFiltrosChange: TNotifyEvent read GetFiltrosChange write SetFiltrosChange;
function GetVerFiltros: Boolean;
procedure SetVerFiltros(const Value: Boolean);
property VerFiltros: Boolean read GetVerFiltros write SetVerFiltros;
function GetTexto: String;
procedure SetTexto(const Value: String);
property Texto: String read GetTexto write SetTexto;
function GetTexto2: String;
procedure SetTexto2(const Value: String);
property Texto2: String read GetTexto2 write SetTexto2;
end;
TfrViewFiltroBase = class(TfrViewBase, IViewFiltroBase)
dxLayoutControl1Group_Root: TdxLayoutGroup;
dxLayoutControl1: TdxLayoutControl;
dxLayoutLookAndFeelList1: TdxLayoutLookAndFeelList;
dxLayoutControl1Item1: TdxLayoutItem;
txtFiltroTodo: TcxTextEdit;
dxLayoutControl1Item2: TdxLayoutItem;
edtFechaIniFiltro: TcxDateEdit;
dxLayoutControl1Item3: TdxLayoutItem;
edtFechaFinFiltro: TcxDateEdit;
dxLayoutControl1Group1: TdxLayoutGroup;
TBXDockablePanel1: TTBXDockablePanel;
ActionList1: TActionList;
actQuitarFiltro: TAction;
PngImageList: TPngImageList;
tbxBotones: TTBXToolbar;
TBXItem2: TTBXItem;
TBXAlignmentPanel1: TTBXAlignmentPanel;
dxLayoutControl1Item4: TdxLayoutItem;
edtFecha2FinFiltro: TcxDateEdit;
dxLayoutControl1Item5: TdxLayoutItem;
edtFecha2IniFiltro: TcxDateEdit;
dxLayoutControl1Group4: TdxLayoutGroup;
dxLayoutControl1Item6: TdxLayoutItem;
edtFecha3IniFiltro: TcxDateEdit;
dxLayoutControl1Item7: TdxLayoutItem;
edtFecha3FinFiltro: TcxDateEdit;
dxLayoutControl1Group2: TdxLayoutGroup;
dxLayoutControl1Item8: TdxLayoutItem;
txtFiltroTodo2: TcxTextEdit;
dxLayoutControl1Group3: TdxLayoutGroup;
procedure OnCamposFiltroChange(Sender: TObject);
procedure actQuitarFiltroExecute(Sender: TObject);
private
FOnFiltrosChange: TNotifyEvent;
function GetFiltrosChange: TNotifyEvent;
procedure SetFiltrosChange(const Value: TNotifyEvent);
function GetVerFiltros: Boolean;
procedure SetVerFiltros(const Value: Boolean);
function GetTexto: String;
procedure SetTexto(const Value: String);
function GetTexto2: String;
procedure SetTexto2(const Value: String);
protected
procedure LimpiarCampos; virtual;
function ValidarCampos: Boolean; virtual;
function GetModified: Boolean; override;
public
property OnFiltrosChange: TNotifyEvent read GetFiltrosChange write SetFiltrosChange;
property VerFiltros: Boolean read GetVerFiltros write SetVerFiltros;
property Texto: String read GetTexto write SetTexto;
property Texto2: String read GetTexto2 write SetTexto2;
end;
implementation
{$R *.dfm}
uses uDialogUtils;
{ TfrViewFiltroBase }
function TfrViewFiltroBase.GetFiltrosChange: TNotifyEvent;
begin
Result := FOnFiltrosChange;
end;
function TfrViewFiltroBase.GetModified: Boolean;
begin
Result := False;
end;
procedure TfrViewFiltroBase.SetFiltrosChange(const Value: TNotifyEvent);
begin
FOnFiltrosChange := Value;
end;
function TfrViewFiltroBase.GetVerFiltros: Boolean;
begin
Result := Self.Visible;
end;
procedure TfrViewFiltroBase.SetVerFiltros(const Value: Boolean);
begin
Self.Visible := Value;
if not Self.Visible then
actQuitarFiltro.Execute;
end;
procedure TfrViewFiltroBase.LimpiarCampos;
begin
txtFiltroTodo.Clear;
txtFiltroTodo2.Clear;
edtFechaIniFiltro.Clear;
edtFechaFinFiltro.Clear;
edtFecha2IniFiltro.Clear;
edtFecha2FinFiltro.Clear;
edtFecha3IniFiltro.Clear;
edtFecha3FinFiltro.Clear;
end;
procedure TfrViewFiltroBase.OnCamposFiltroChange(Sender: TObject);
begin
if ValidarCampos then
if Assigned(FOnFiltrosChange) then
FOnFiltrosChange(Sender);
end;
function TfrViewFiltroBase.ValidarCampos: Boolean;
begin
Result := True;
if not VarIsNull(edtFechaIniFiltro.EditValue) and not VarIsNull(edtFechaFinFiltro.EditValue) then
begin
if (edtFechaIniFiltro.EditValue > edtFechaFinFiltro.EditValue) then
begin
ShowWarningMessage('La fecha de inicio debe ser anterior a la fecha final');
edtFechaIniFiltro.SetFocus;
Result := False;
end
end;
if not VarIsNull(edtFecha2IniFiltro.EditValue) and not VarIsNull(edtFecha2FinFiltro.EditValue) then
begin
if (edtFecha2IniFiltro.EditValue > edtFecha2FinFiltro.EditValue) then
begin
ShowWarningMessage('La fecha de inicio debe ser anterior a la fecha final');
edtFechaIniFiltro.SetFocus;
Result := False;
end
end;
if not VarIsNull(edtFecha3IniFiltro.EditValue) and not VarIsNull(edtFecha3FinFiltro.EditValue) then
begin
if (edtFecha3IniFiltro.EditValue > edtFecha3FinFiltro.EditValue) then
begin
ShowWarningMessage('La fecha de inicio debe ser anterior a la fecha final');
edtFechaIniFiltro.SetFocus;
Result := False;
end
end;
end;
procedure TfrViewFiltroBase.actQuitarFiltroExecute(Sender: TObject);
begin
LimpiarCampos;
if Assigned(FOnFiltrosChange) then
FOnFiltrosChange(Sender);
end;
function TfrViewFiltroBase.GetTexto: String;
begin
Result := txtFiltroTodo.Text;
end;
function TfrViewFiltroBase.GetTexto2: String;
begin
Result := txtFiltroTodo2.Text;
end;
procedure TfrViewFiltroBase.SetTexto(const Value: String);
begin
txtFiltroTodo.Text := Value;
end;
procedure TfrViewFiltroBase.SetTexto2(const Value: String);
begin
txtFiltroTodo2.Text := Value;
end;
end.