2007-10-08 08:05:23 +00:00
|
|
|
unit uViewFiltroBase;
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
2008-08-27 16:48:20 +00:00
|
|
|
Dialogs, StdCtrls, Buttons, cxRadioGroup, TBXDkPanels, TB2ExtItems, TBXExtItems,
|
2008-05-14 14:38:09 +00:00
|
|
|
TBX, TB2Item, TB2Dock, TB2Toolbar, ActnList, ImgList, PngImageList,
|
2008-08-27 16:48:20 +00:00
|
|
|
cxGraphics, dxLayoutLookAndFeels, dxLayoutControl, cxDropDownEdit, cxMaskEdit,
|
2009-07-09 14:31:58 +00:00
|
|
|
cxCalendar, cxContainer, cxEdit, cxTextEdit, cxControls, uViewBase;
|
2007-10-08 08:05:23 +00:00
|
|
|
|
|
|
|
|
type
|
2009-07-09 14:31:58 +00:00
|
|
|
IViewFiltroBase = interface(IViewBase)
|
2007-10-08 08:05:23 +00:00
|
|
|
['{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;
|
|
|
|
|
end;
|
|
|
|
|
|
2009-07-09 14:31:58 +00:00
|
|
|
TfrViewFiltroBase = class(TfrViewBase, IViewFiltroBase)
|
2007-10-08 08:05:23 +00:00
|
|
|
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;
|
2008-06-09 17:08:55 +00:00
|
|
|
dxLayoutControl1Item4: TdxLayoutItem;
|
|
|
|
|
eLista: TcxComboBox;
|
2014-02-18 22:41:52 +00:00
|
|
|
dxLayoutControl1Item5: TdxLayoutItem;
|
|
|
|
|
eLista2: TcxComboBox;
|
2007-10-08 08:05:23 +00:00
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
procedure LimpiarCampos; virtual;
|
|
|
|
|
function ValidarCampos: Boolean; virtual;
|
|
|
|
|
|
|
|
|
|
public
|
2009-07-09 14:31:58 +00:00
|
|
|
function GetModified: Boolean;
|
2007-10-08 08:05:23 +00:00
|
|
|
property OnFiltrosChange: TNotifyEvent read GetFiltrosChange write SetFiltrosChange;
|
|
|
|
|
property VerFiltros: Boolean read GetVerFiltros write SetVerFiltros;
|
|
|
|
|
property Texto: String read GetTexto write SetTexto;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
uses uDialogUtils;
|
|
|
|
|
|
|
|
|
|
{ TfrViewFiltroBase }
|
|
|
|
|
|
|
|
|
|
function TfrViewFiltroBase.GetFiltrosChange: TNotifyEvent;
|
|
|
|
|
begin
|
|
|
|
|
Result := FOnFiltrosChange;
|
|
|
|
|
end;
|
|
|
|
|
|
2009-07-09 14:31:58 +00:00
|
|
|
function TfrViewFiltroBase.GetModified: Boolean;
|
|
|
|
|
begin
|
|
|
|
|
Result := False;
|
|
|
|
|
end;
|
|
|
|
|
|
2007-10-08 08:05:23 +00:00
|
|
|
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;
|
|
|
|
|
edtFechaIniFiltro.Clear;
|
|
|
|
|
edtFechaFinFiltro.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;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrViewFiltroBase.actQuitarFiltroExecute(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
LimpiarCampos;
|
|
|
|
|
if Assigned(FOnFiltrosChange) then
|
|
|
|
|
FOnFiltrosChange(Sender);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TfrViewFiltroBase.GetTexto: String;
|
|
|
|
|
begin
|
|
|
|
|
Result := txtFiltroTodo.Text;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrViewFiltroBase.SetTexto(const Value: String);
|
|
|
|
|
begin
|
|
|
|
|
txtFiltroTodo.Text := Value;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end.
|