unit uViewCobrosCliente;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, uViewGrid, uViewPreview, cxStyles, cxCustomData, cxGraphics,
  cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, dxPSGlbl, dxPSUtl,
  dxPSEngn, dxPrnPg, dxBkgnd, dxWrap, dxPrnDev, dxPSCompsProvider,
  dxPSFillPatterns, dxPSEdgePatterns, cxImageComboBox, cxTextEdit, ImgList,
  PngImageList, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
  dxPSCore, dxPScxCommon, dxPScxGridLnk, ActnList, uDADataTable,
  cxGridLevel, cxClasses, cxControls, cxGridCustomView, cxGrid,
  cxImage, Grids, DBGrids, uBizCobrosCliente, cxGridCustomPopupMenu,
  cxGridPopupMenu, cxCalendar, cxCurrencyEdit;

type
  IViewCobrosCliente = interface(IViewGrid)
  ['{0A1584A7-BCCA-4CAB-9E6B-54B8DEF3F0EC}']
    function GetCobros: IBizCobroCliente;
    procedure SetCobros(const Value: IBizCobroCliente);
    property Cobros: IBizCobroCliente read GetCobros write SetCobros;
  end;

  TfrViewCobrosCliente = class(TfrViewGrid, IViewCobrosCliente)
    cxGridViewNOMBRE: TcxGridDBColumn;
    cxGridViewREFERENCIA: TcxGridDBColumn;
    cxGridViewICONO: TcxGridDBColumn;
    cxGridViewFECHA_COBRO: TcxGridDBColumn;
    cxGridViewIMPORTE: TcxGridDBColumn;
    cxStylePagada: TcxStyle;
    PngImageList: TPngImageList;
    procedure cxGridViewICONOCustomDrawCell(Sender: TcxCustomGridTableView;
      ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
      var ADone: Boolean);
  protected
    FCobros: IBizCobroCliente;
    function GetCobros: IBizCobroCliente;
    procedure SetCobros(const Value: IBizCobroCliente);
  public
    property Cobros: IBizCobroCliente read GetCobros write SetCobros;
  end;


implementation

uses
  uDataModuleCobrosCliente, DateUtils;

{$R *.dfm}

{ TfrViewCobrosCliente }

procedure TfrViewCobrosCliente.cxGridViewICONOCustomDrawCell(
  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;

function TfrViewCobrosCliente.GetCobros: IBizCobroCliente;
begin
  Result := FCobros;
end;

procedure TfrViewCobrosCliente.SetCobros(const Value: IBizCobroCliente);
begin
  FCobros := Value;
  if Assigned(FCobros) then
    dsDataSource.DataTable := FCobros.DataTable;
end;

end.
