unit uViewElegirArticulosPedidosCliente;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, uViewArticulos, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
  cxDataStorage, cxEdit, DB, cxDBData, cxImageComboBox, cxCurrencyEdit,
  cxSpinEdit, dxPSGlbl, dxPSUtl, dxPSEngn, dxPrnPg, dxBkgnd, dxWrap, dxPrnDev,
  dxPSCompsProvider, dxPSFillPatterns, dxPSEdgePatterns, ImgList, PngImageList,
  cxGridCustomPopupMenu, cxGridPopupMenu, dxPSCore, dxPScxCommon, dxPScxGrid6Lnk,
  uDADataTable, cxGridLevel, cxGridCustomTableView, cxGridTableView,
  cxGridDBTableView, cxClasses, cxControls, cxGridCustomView, cxGrid, dxPgsDlg,
  ActnList, TB2Item, TBX, TB2Toolbar, TBXDkPanels, TB2Dock, uViewFiltroBase,
  uBizContactos, uDAInterfaces, uCustomView, uViewBase;

type
  IViewElegirArticulosPedidosCliente = interface(IViewArticulos)
  ['{641DF51D-3057-4D10-8311-FD36910A4515}']
    function GetCliente: IBizCliente;
    procedure SetCliente(const Value: IBizCliente);
    property Cliente: IBizCliente read GetCliente write SetCliente;
  end;

  TfrViewElegirArticulosPedidosCliente = class(TfrViewArticulos, IViewElegirArticulosPedidosCliente)
    cxGridLevel1: TcxGridLevel;

    procedure cxGridActiveTabChanged(Sender: TcxCustomGrid; ALevel: TcxGridLevel);
    procedure CustomViewDestroy(Sender: TObject);

  private
    FCliente: IBizCliente;
    function GetCliente: IBizCliente;
    procedure SetCliente(const Value: IBizCliente);

  public
    property Cliente: IBizCliente read GetCliente write SetCliente;
  end;

implementation

uses uViewGrid;
{$R *.dfm}

procedure TfrViewElegirArticulosPedidosCliente.CustomViewDestroy(Sender: TObject);
begin
  FCliente := Nil;
  inherited;
end;

procedure TfrViewElegirArticulosPedidosCliente.cxGridActiveTabChanged(
  Sender: TcxCustomGrid; ALevel: TcxGridLevel);
begin
  inherited;
  RefrescarFiltro;
end;

function TfrViewElegirArticulosPedidosCliente.GetCliente: IBizCliente;
begin
  Result := FCliente;
end;

procedure TfrViewElegirArticulosPedidosCliente.SetCliente(const Value: IBizCliente);
begin
  FCliente := Value;
  if Assigned(FCliente) then
  begin
     cxGrid.ActiveLevel.Caption := FCliente.NOMBRE;
     RefrescarFiltro;
  end;
end;

end.
