unit uViewComisiones;

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, uBizComisiones, ActnList, Menus,
  cxGridBandedTableView, cxGridDBBandedTableView, JvComponent,
  JvFormAutoSize, PngImageList, ImgList, dxPSGlbl, dxPSUtl, dxPSEngn,
  dxPrnPg, dxBkgnd, dxWrap, dxPrnDev, dxPSCompsProvider, dxPSFillPatterns,
  dxPSEdgePatterns, dxPSCore, dxPScxCommon, dxPScxGrid6Lnk,
  cxGridCustomPopupMenu, cxGridPopupMenu, cxCurrencyEdit, cxSpinEdit, cxCheckBox,
  cxCheckComboBox, cxImageComboBox, TB2Item, TBX, TB2Toolbar, TBXDkPanels,
  TB2Dock, uViewFiltroBase, dxPgsDlg, uDAInterfaces;

type
  IViewComisiones = interface(IViewGrid)
  ['{5E6A5CE4-EEF5-4CCB-B944-D028C5391676}']
    function GetComisiones: IBizComisiones;
    procedure SetComisiones(const Value: IBizComisiones);
    property Comisiones: IBizComisiones read GetComisiones write SetComisiones;
  end;

  TfrViewComisiones = class(TfrViewGrid, IViewComisiones)
    PngImageList: TPngImageList;
    cxGridViewREFERENCIA: TcxGridDBColumn;
    cxGridViewFECHA: TcxGridDBColumn;
    cxGridViewDESCRIPCION: TcxGridDBColumn;
    cxGridViewAGENTE: TcxGridDBColumn;
    cxGridViewIMPORTE_TOTAL: TcxGridDBColumn;
    procedure cxGridViewIDCustomDrawCell(
      Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
      AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
  protected
    FComisiones: IBizComisiones;
    function GetComisiones: IBizComisiones; virtual;
    procedure SetComisiones(const Value: IBizComisiones); virtual;
  public
    property Comisiones: IBizComisiones read GetComisiones write SetComisiones;
  end;

implementation

uses uDataModuleComisiones;


{$R *.dfm}

{ TfrViewComisiones }

{
******************************* TfrViewComisiones *******************************
}
function TfrViewComisiones.GetComisiones: IBizComisiones;
begin
  Result := FComisiones;
end;

procedure TfrViewComisiones.SetComisiones(const Value: IBizComisiones);
begin
  FComisiones := Value;
  if Assigned(FComisiones) then
    dsDataSource.DataTable := FComisiones.DataTable;
end;


procedure TfrViewComisiones.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.
