unit uViewDiario;

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

type
  IViewDiario = interface(IViewGrid)
  ['{5CA170E3-5552-4EF5-A2C0-02E4C9052045}']
    function GetDiario: IBizDiario;
    procedure SetDiario(const Value: IBizDiario);
    property Diario: IBizDiario read GetDiario write SetDiario;
  end;

  TfrViewDiario = class(TfrViewGrid, IViewDiario)
    cxGridViewCONCEPTO: TcxGridDBColumn;
    cxGridViewREF_SUBCUENTA: TcxGridDBColumn;
    cxGridViewID_ASIENTO: TcxGridDBColumn;
    PngImageList: TPngImageList;
    cxGridViewSUBCUENTA: TcxGridDBColumn;
    cxGridViewDEBE: TcxGridDBColumn;
    cxGridViewHABER: TcxGridDBColumn;
    cxGridViewFECHA_ASIENTO: TcxGridDBColumn;
    cxGridViewORDEN: TcxGridDBColumn;
    cxGridViewID_APUNTE: TcxGridDBColumn;
    cxGridViewID_FACTURA: TcxGridDBColumn;
    cxGridViewID_PAGO: TcxGridDBColumn;
    cxGridViewDOCUMENTO: TcxGridDBColumn;
    cxGridViewPUNTEADO: TcxGridDBColumn;
    procedure cxGridViewICONOCustomDrawCell(Sender: TcxCustomGridTableView;
      ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
      var ADone: Boolean);
  protected
    FDiario: IBizDiario;
    function GetDiario: IBizDiario; virtual;
    procedure SetDiario(const Value: IBizDiario); virtual;
  public
    property Diario: IBizDiario read GetDiario write SetDiario;
  end;

implementation
{$R *.dfm}

{ TfrViewDiario }

{
******************************* TfrViewDiario *******************************
}
function TfrViewDiario.GetDiario: IBizDiario;
begin
  Result := FDiario;
end;

procedure TfrViewDiario.SetDiario(const Value: IBizDiario);
begin
  FDiario := Value;
  if Assigned(FDiario) then
    dsDataSource.DataTable := FDiario.DataTable;
end;


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

end.
