unit uViewAlmacenes;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, uViewGrid, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
  cxDataStorage, cxEdit, DB, cxDBData, uDADataTable, cxGridLevel,
  cxClasses, cxControls, cxGridCustomView, cxGridCustomTableView,
  cxGridTableView, cxGridDBTableView, cxGrid, uBizAlmacenes, ActnList, Menus,
  cxGridBandedTableView, cxGridDBBandedTableView, JvComponent,
  JvFormAutoSize, PngImageList, ImgList, dxPSGlbl, dxPSUtl, dxPSEngn,
  dxPrnPg, dxBkgnd, dxWrap, dxPrnDev, dxPSCompsProvider, dxPSFillPatterns,
  dxPSEdgePatterns, cxIntlPrintSys3, dxPSCore, dxPScxCommon, dxPScxGridLnk,
  cxGridCustomPopupMenu, cxGridPopupMenu, uViewFiltroBase, TB2Item, TBX,
  TB2Toolbar, TBXDkPanels, TB2Dock, dxPgsDlg;

type
  IViewAlmacenes = interface(IViewGrid)
    ['{E6798DF7-011C-40EC-B368-160C48697445}']
    function GetAlmacenes: IBizAlmacen;
    procedure SetAlmacenes(const Value: IBizAlmacen);
    property Almacenes: IBizAlmacen read GetAlmacenes write SetAlmacenes;
  end;

  TfrViewAlmacenes = class(TfrViewGrid, IViewAlmacenes)
    cxGridViewPERSONACONTACTO: TcxGridDBColumn;
    cxGridViewNOMBRE: TcxGridDBColumn;
    cxGridViewTELEFONO: TcxGridDBColumn;
    cxGridViewID: TcxGridDBColumn;
    PngImageList: TPngImageList;
    cxGridViewCALLE: TcxGridDBColumn;
    cxGridViewPROVINCIA: TcxGridDBColumn;
    cxGridViewPOBLACION: TcxGridDBColumn;
    cxGridViewCODIGO_POSTAL: TcxGridDBColumn;
    cxGridViewMOVIL: TcxGridDBColumn;
    cxGridViewFAX: TcxGridDBColumn;
    procedure cxGridViewIDCustomDrawCell(
      Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
      AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
  protected
    FAlmacenes: IBizAlmacen;
    function GetAlmacenes: IBizAlmacen; virtual;
    procedure SetAlmacenes(const Value: IBizAlmacen); virtual;
  public
    property Almacenes: IBizAlmacen read GetAlmacenes write SetAlmacenes;
  end;

implementation

uses uDataModuleAlmacenes;


{$R *.dfm}

{ TfrViewAlmacenes }

{
******************************* TfrViewAlmacenes *******************************
}
function TfrViewAlmacenes.GetAlmacenes: IBizAlmacen;
begin
  Result := FAlmacenes;
end;

procedure TfrViewAlmacenes.SetAlmacenes(const Value: IBizAlmacen);
begin
  FAlmacenes := Value;
  if Assigned(FAlmacenes) then
    dsDataSource.DataTable := FAlmacenes.DataTable;
end;


procedure TfrViewAlmacenes.cxGridViewIDCustomDrawCell(
  Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
  AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
var
  R : TRect;
begin
  inherited;
  R := AViewInfo.ContentBounds;
  ACanvas.FillRect(R);
  ACanvas.DrawImage(PngImageList, R.Left, R.Top, 0);
  ADone := True;
end;

end.
