unit uViewPresupuestoRelacionado; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, uViewBase, ExtCtrls, StdCtrls, cxControls, cxContainer, cxEdit, cxTextEdit, cxDBEdit, ComCtrls, ToolWin, ImgList, PngImageList, ActnList, DB, uDADataTable, uBizPresupuestosCliente; type IViewPresupuestoRelacionado = interface(IViewBase) ['{42655AAC-2669-452D-8E56-C9AF657EF2BF}'] function GetPresupuesto: IBizPresupuestos; procedure SetPresupuesto(const Value: IBizPresupuestos); property Presupuesto: IBizPresupuestos read GetPresupuesto write SetPresupuesto; function GetOnPresupuestoChanged : TNotifyEvent; procedure SetOnPresupuestoChanged (const Value : TNotifyEvent); property OnPresupuestoChanged : TNotifyEvent read GetOnPresupuestoChanged write SetOnPresupuestoChanged; end; TfrViewPresupuestoRelacionado = class(TfrViewBase, IViewPresupuestoRelacionado) Label5: TLabel; Bevel1: TBevel; ActionList1: TActionList; actElegirPresupuesto: TAction; actVerPresupuesto: TAction; PngImageList: TPngImageList; ToolBar1: TToolBar; ToolButton1: TToolButton; ToolButton3: TToolButton; ToolButton2: TToolButton; lblNombre: TLabel; DADataSource: TDADataSource; edtlReferencia: TcxDBTextEdit; procedure actVerPresupuestoExecute(Sender: TObject); procedure actVerPresupuestoUpdate(Sender: TObject); private FPresupuesto : IBizPresupuestos; FOnPresupuestoChanged : TNotifyEvent; protected function GetPresupuesto: IBizPresupuestos; procedure SetPresupuesto(const Value: IBizPresupuestos); function GetOnPresupuestoChanged : TNotifyEvent; procedure SetOnPresupuestoChanged (const Value : TNotifyEvent); public property Presupuesto: IBizPresupuestos read GetPresupuesto write SetPresupuesto; property OnPresupuestoChanged : TNotifyEvent read GetOnPresupuestoChanged write SetOnPresupuestoChanged; end; var frViewPresupuestoRelacionado: TfrViewPresupuestoRelacionado; implementation uses uDataModulePresupuestos, schPresupuestosClient_Intf; {$R *.dfm} { TfrViewPresupuestoAlbaran } procedure TfrViewPresupuestoRelacionado.actVerPresupuestoExecute( Sender: TObject); begin FPresupuesto.Show; end; procedure TfrViewPresupuestoRelacionado.actVerPresupuestoUpdate( Sender: TObject); begin inherited; (Sender as TAction).Enabled := Assigned(FPresupuesto); end; function TfrViewPresupuestoRelacionado.GetPresupuesto: IBizPresupuestos; begin Result := FPresupuesto; end; procedure TfrViewPresupuestoRelacionado.SetPresupuesto( const Value: IBizPresupuestos); begin FPresupuesto := Value; DADataSource.DataTable := FPresupuesto.DataTable; if not FPresupuesto.DataTable.Active then FPresupuesto.DataTable.Active := True; if Assigned(FOnPresupuestoChanged) then FOnPresupuestoChanged(Self); end; function TfrViewPresupuestoRelacionado.GetOnPresupuestoChanged: TNotifyEvent; begin Result := FOnPresupuestoChanged; end; procedure TfrViewPresupuestoRelacionado.SetOnPresupuestoChanged( const Value: TNotifyEvent); begin FOnPresupuestoChanged := Value; end; end.