unit uViewTotalesPresupuesto; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, uViewTotales, cxGraphics, dxLayoutLookAndFeels, DB, uDAInterfaces, uDADataTable, dxLayoutControl, cxCheckBox, cxDBEdit, StdCtrls, cxDropDownEdit, cxLookupEdit, cxDBLookupEdit, cxDBLookupComboBox, cxMaskEdit, cxSpinEdit, cxContainer, cxEdit, cxTextEdit, cxCurrencyEdit, ExtCtrls, cxControls, uBizPresupuestosCliente, uPresupuestosClienteController, cxCalendar; type TfrViewTotalesPresupuesto = class(TfrViewTotales) dxLayoutControl1Item20: TdxLayoutItem; cbBonificacion: TcxCheckBox; dxLayoutControl1Item22: TdxLayoutItem; eDescripcionBonificacion: TcxDBTextEdit; dxLayoutControl1Item23: TdxLayoutItem; eImporteBonificacion: TcxDBCurrencyEdit; dxLayoutControl1Group13: TdxLayoutGroup; procedure CustomViewDestroy(Sender: TObject); procedure CustomViewShow(Sender: TObject); procedure OnBonificacionPropertiesEditValueChanged(Sender: TObject); protected FPresupuesto: IBizPresupuestoCliente; FController : IPresupuestosClienteController; function GetPresupuesto: IBizPresupuestoCliente; procedure SetPresupuesto(const Value: IBizPresupuestoCliente); function GetController : IPresupuestosClienteController; procedure SetController (const Value : IPresupuestosClienteController); virtual; public property Presupuesto: IBizPresupuestoCliente read GetPresupuesto write SetPresupuesto; property Controller : IPresupuestosClienteController read GetController write SetController; end; implementation {$R *.dfm} { TfrViewTotalesPresupuesto } procedure TfrViewTotalesPresupuesto.CustomViewDestroy(Sender: TObject); begin cbBonificacion.Properties.OnEditValueChanged := Nil; FPresupuesto := NIL; FController := NIL; inherited; end; procedure TfrViewTotalesPresupuesto.CustomViewShow(Sender: TObject); begin inherited; if not Presupuesto.DESCRIPCION_BONIFICACIONIsNull or not Presupuesto.IMPORTE_BONIFICACIONIsNull then begin cbBonificacion.Checked := True; eDescripcionBonificacion.Enabled := True; eImporteBonificacion.Enabled := True; end; cbBonificacion.Properties.OnEditValueChanged := OnBonificacionPropertiesEditValueChanged; end; function TfrViewTotalesPresupuesto.GetController: IPresupuestosClienteController; begin Result := FController; end; function TfrViewTotalesPresupuesto.GetPresupuesto: IBizPresupuestoCliente; begin Result := FPresupuesto; end; procedure TfrViewTotalesPresupuesto.OnBonificacionPropertiesEditValueChanged( Sender: TObject); begin if cbBonificacion.Checked then begin eDescripcionBonificacion.Enabled := True; eImporteBonificacion.Enabled := True; end else begin eDescripcionBonificacion.Enabled := False; eImporteBonificacion.Enabled := False; Controller.BorrarBonificacion(Presupuesto); end; end; procedure TfrViewTotalesPresupuesto.SetController(const Value: IPresupuestosClienteController); begin FController := Value; end; procedure TfrViewTotalesPresupuesto.SetPresupuesto(const Value: IBizPresupuestoCliente); begin FPresupuesto := Value; end; end.