unit uViewRecibosObra; interface uses uViewGrid, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, dxPSGlbl, dxPSUtl, dxPSEngn, dxPrnPg, dxBkgnd, dxWrap, dxPrnDev, dxPSCompsProvider, dxPSFillPatterns, dxPSEdgePatterns, cxImageComboBox, Menus, ImgList, Controls, PngImageList, Classes, ActnList, ComCtrls, ToolWin, cxGridCustomTableView, cxGridTableView, cxGridDBTableView, dxPSCore, dxPScxCommon, dxPScxGridLnk, uDADataTable, cxGridLevel, cxClasses, cxControls, cxGridCustomView, cxGrid, uBizObraFinal, ExtCtrls, JvExControls, JvComponent, JvNavigationPane; type IViewRecibosObra = interface(IViewGrid) ['{76655999-13D6-4579-8ABE-2E595A320E14}'] function GetRecibos: IBizRecibosObras; procedure SetRecibos(const Value: IBizRecibosObras); property Recibos: IBizRecibosObras read GetRecibos write SetRecibos; end; TfrViewRecibosObra = class(TfrViewGrid, IViewRecibosObra) PngImageList: TPngImageList; cxGridViewRecID: TcxGridDBColumn; cxGridViewCODIGO: TcxGridDBColumn; cxGridViewFECHARECIBO: TcxGridDBColumn; cxGridViewNIFCIF: TcxGridDBColumn; cxGridViewIMPORTE: TcxGridDBColumn; cxGridViewNOMBRE: TcxGridDBColumn; actAnadir: TAction; actEditar: TAction; actEliminar: TAction; actDuplicar: TAction; PngImageList1: TPngImageList; MenuFacObr: TPopupMenu; MenuItem1: TMenuItem; MenuItem2: TMenuItem; MenuItem3: TMenuItem; MenuItem4: TMenuItem; MenuItem5: TMenuItem; ToolBar2: TToolBar; ToolButton5: TToolButton; ToolButton6: TToolButton; ToolButton7: TToolButton; ToolButton8: TToolButton; ToolButton9: TToolButton; actEliminarTodo: TAction; ToolButton10: TToolButton; JvNavPanelHeader: TJvNavPanelHeader; Image1: TImage; cxGridViewCODIGOOBRA: TcxGridDBColumn; procedure actEliminarUpdate(Sender: TObject); procedure actEditarUpdate(Sender: TObject); procedure actDuplicarUpdate(Sender: TObject); procedure actEliminarTodoUpdate(Sender: TObject); protected FRecibos: IBizRecibosObras; function GetRecibos: IBizRecibosObras; procedure SetRecibos(const Value: IBizRecibosObras); public property Recibos: IBizRecibosObras read GetRecibos write SetRecibos; procedure setFiltro(CodigoObra: Integer); end; implementation {$R *.dfm} uses SysUtils; { TfrViewREcibosObra } { ******************************* TfrViewRecibosObra ******************************* } function TfrViewRecibosObra.GetRecibos: IBizRecibosObras; begin Result := FRecibos; end; procedure TfrViewRecibosObra.SetRecibos(const Value: IBizRecibosObras); begin FRecibos := Value; if Assigned(FRecibos) then begin DADataSource.DataTable := FRecibos.Datatable; DADataSource.DataTable.Active := True; end; end; procedure TfrViewRecibosObra.actEliminarUpdate(Sender: TObject); begin inherited; if Assigned(DADataSource.DataTable) then (Sender as TAction).Enabled := (not DADataSource.DataTable.IsEmpty) else (Sender as TAction).Enabled := False; end; procedure TfrViewRecibosObra.actEditarUpdate(Sender: TObject); begin inherited; if Assigned(DADataSource.DataTable) then (Sender as TAction).Enabled := (not DADataSource.DataTable.IsEmpty) else (Sender as TAction).Enabled := False; end; procedure TfrViewRecibosObra.actDuplicarUpdate(Sender: TObject); begin inherited; if Assigned(DADataSource.DataTable) then (Sender as TAction).Enabled := (not DADataSource.DataTable.IsEmpty) else (Sender as TAction).Enabled := False; end; procedure TfrViewRecibosObra.setFiltro(CodigoObra: Integer); begin cxGridView.DataController.Filter.BeginUpdate; cxGridView.DataController.Filter.Clear; cxGridView.DataController.Filter.Root.AddItem(cxGridViewCODIGOOBRA, foEqual, IntToStr(CodigoObra), IntToStr(CodigoObra)); cxGridView.DataController.Filter.EndUpdate; end; procedure TfrViewRecibosObra.actEliminarTodoUpdate(Sender: TObject); begin inherited; if Assigned(DADataSource.DataTable) then (Sender as TAction).Enabled := (not DADataSource.DataTable.IsEmpty) else (Sender as TAction).Enabled := False; end; end.