git-svn-id: https://192.168.0.254/svn/Proyectos.Varela_PuntosVenta/trunk@2 1c943782-d109-9647-9548-93b3ac332352
115 lines
3.1 KiB
ObjectPascal
115 lines
3.1 KiB
ObjectPascal
unit uViewFiltrosStock;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
Dialogs, dxLayoutControl, cxControls, uViewControlGrid,
|
|
cxGraphics, cxContainer, cxEdit, cxTextEdit, cxMaskEdit, cxDropDownEdit,
|
|
cxStyles, cxCustomData, cxFilter, cxData, cxDataStorage, DB, cxDBData,
|
|
cxGridLevel, cxClasses, cxGridCustomView, cxGridCustomTableView,
|
|
cxGridTableView, cxGridDBTableView, cxGrid, cxCheckComboBox, StdCtrls,
|
|
Mask, JvExMask, JvToolEdit, JvCombobox;
|
|
|
|
type
|
|
IViewFiltrosStock = interface
|
|
['{ABC745C3-64F0-44E4-AF4B-118AE5060150}']
|
|
procedure SetFocusedView (const Value : TcxGridDBTableView);
|
|
function GetFocusedView : TcxGridDBTableView;
|
|
property FocusedView : TcxGridDBTableView read GetFocusedView write SetFocusedView;
|
|
procedure Refresh;
|
|
end;
|
|
|
|
TfrViewFiltrosStock = class(TFrame, IViewFiltrosStock)
|
|
dxLayoutControl1Group_Root: TdxLayoutGroup;
|
|
dxLayoutControl1: TdxLayoutControl;
|
|
cbColeccion: TcxComboBox;
|
|
dxLayoutControl1Item1: TdxLayoutItem;
|
|
dxLayoutControl1Item3: TdxLayoutItem;
|
|
ccbCentro: TJvCheckedComboBox;
|
|
private
|
|
FFocusedView : TcxGridDBTableView;
|
|
function GetFilterValueList(AColumnIndex: Integer): TStringList;
|
|
protected
|
|
procedure RellenarFiltros;
|
|
procedure SetFocusedView (const Value : TcxGridDBTableView);
|
|
function GetFocusedView : TcxGridDBTableView;
|
|
public
|
|
CentroColumnIndex : Integer;
|
|
ColeccionColumnIndex : Integer;
|
|
property FocusedView : TcxGridDBTableView read GetFocusedView write SetFocusedView;
|
|
procedure Refresh;
|
|
end;
|
|
|
|
|
|
implementation
|
|
|
|
{$R *.dfm}
|
|
|
|
{ TfrViewFiltrosStock }
|
|
|
|
function TfrViewFiltrosStock.GetFilterValueList(AColumnIndex: Integer): TStringList;
|
|
var
|
|
AValueList : TcxDataFilterValueList;
|
|
i : Integer;
|
|
begin
|
|
Result := TStringList.Create;
|
|
|
|
if AColumnIndex < 0 then
|
|
Exit;
|
|
|
|
AValueList := TcxDataFilterValueList.Create(FFocusedView.DataController.Filter);
|
|
try
|
|
AValueList.Load(AColumnIndex);
|
|
for i := 0 to AValueList.Count - 1 do
|
|
Result.Add(AValueList[i].DisplayText);
|
|
finally
|
|
FreeAndNil(AValueList);
|
|
end;
|
|
end;
|
|
|
|
function TfrViewFiltrosStock.GetFocusedView: TcxGridDBTableView;
|
|
begin
|
|
Result := FFocusedView;
|
|
end;
|
|
|
|
procedure TfrViewFiltrosStock.Refresh;
|
|
begin
|
|
inherited;
|
|
RellenarFiltros;
|
|
end;
|
|
|
|
procedure TfrViewFiltrosStock.RellenarFiltros;
|
|
var
|
|
i : integer;
|
|
AList : TStringList;
|
|
begin
|
|
if ColeccionColumnIndex >= 0 then
|
|
with cbColeccion.Properties do
|
|
begin
|
|
Items.Clear;
|
|
Items.AddStrings(GetFilterValueList(ColeccionColumnIndex));
|
|
Items.Delete(1);
|
|
Items.Strings[0] := 'Todos';
|
|
cbColeccion.Text := 'Todos';
|
|
end;
|
|
|
|
if CentroColumnIndex >= 0 then
|
|
with ccbCentro do
|
|
begin
|
|
Items.Clear;
|
|
Items.AddStrings(GetFilterValueList(CentroColumnIndex));
|
|
Items.Delete(1);
|
|
Items.Strings[0] := 'Todos';
|
|
Checked[0] := True;
|
|
end;
|
|
end;
|
|
|
|
procedure TfrViewFiltrosStock.SetFocusedView(
|
|
const Value: TcxGridDBTableView);
|
|
begin
|
|
FFocusedView := Value;
|
|
end;
|
|
|
|
end.
|