unit uViewObras;

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, uBizObras, ActnList, Menus,
  cxGridBandedTableView, cxGridDBBandedTableView, JvComponent,
  JvFormAutoSize, PngImageList, ImgList, dxPSGlbl, dxPSUtl, dxPSEngn,
  dxPrnPg, dxBkgnd, dxWrap, dxPrnDev, dxPSCompsProvider, dxPSFillPatterns,
  dxPSEdgePatterns, cxIntlPrintSys3, dxPSCore, dxPScxCommon, dxPScxGrid6Lnk,
  cxGridCustomPopupMenu, cxGridPopupMenu, uViewFiltroBase, TB2Item, TBX,
  TB2Toolbar, TBXDkPanels, TB2Dock, dxPgsDlg, uDAInterfaces, cxTextEdit;
    
type
  IViewObras = interface(IViewGrid)
    ['{C04FA358-5EAC-444D-8E48-490302D9DE15}']
    function GetObras: IBizObra;
    procedure SetObras(const Value: IBizObra);
    property Obras: IBizObra read GetObras write SetObras;
  end;

  TfrViewObras = class(TfrViewGrid, IViewObras)
    cxGridViewPERSONACONTACTO: TcxGridDBColumn;
    cxGridViewNOMBRE: TcxGridDBColumn;
    cxGridViewTELEFONO: TcxGridDBColumn;
    cxGridViewCALLE: TcxGridDBColumn;
    cxGridViewPROVINCIA: TcxGridDBColumn;
    cxGridViewPOBLACION: TcxGridDBColumn;
    cxGridViewCODIGO_POSTAL: TcxGridDBColumn;
    cxGridViewMOVIL: TcxGridDBColumn;
    cxGridViewFAX: TcxGridDBColumn;
    cxGridViewNOMBRE_CLIENTE: TcxGridDBColumn;
    cxGridViewNOMBRE_SUBCONTRATA: TcxGridDBColumn;
    cxGridViewID_EJECUCION: TcxGridDBColumn;
    procedure cxGridViewICONOCustomDrawCell(Sender: TcxCustomGridTableView;
      ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
      var ADone: Boolean);
  protected
    FObras: IBizObra;
    function GetObras: IBizObra; virtual;
    procedure SetObras(const Value: IBizObra); virtual;
  public
    property Obras: IBizObra read GetObras write SetObras;
  end;

implementation

uses uDataModuleObras;


{$R *.dfm}

{ TfrViewObras }

{
******************************* TfrViewObras *******************************
}
procedure TfrViewObras.cxGridViewICONOCustomDrawCell(
  Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
  AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
begin
  // Poner el icono sólo a las obras activas.
  if (cxGridView.DataController.DisplayTexts[AViewInfo.GridRecord.RecordIndex,
    cxGridViewID_EJECUCION.Index] <> '') then
    inherited;
end;

function TfrViewObras.GetObras: IBizObra;
begin
  Result := FObras;
end;

procedure TfrViewObras.SetObras(const Value: IBizObra);
begin
  FObras := Value;
  if Assigned(FObras) then
    dsDataSource.DataTable := FObras.DataTable;
end;


end.
