unit uEditorVariarPrecios; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, cxControls, cxContainer, cxEdit, cxTextEdit, cxMaskEdit, cxDropDownEdit, cxCalendar, ExtCtrls, uEditorBasico, uIEditorVariarPrecios, cxGraphics, DB, uDAInterfaces, uDADataTable, cxDBEdit, uEmpresasController, cxSpinEdit, cxRadioGroup, ActnList; type TfEditorVariarPrecios = class(TfEditorBasico, IEditorVariarPrecios) Label1: TLabel; bAceptar: TButton; bCancelar: TButton; Panel1: TPanel; sDescuento: TcxSpinEdit; Label3: TLabel; rdDescuento: TcxRadioButton; rdAumento: TcxRadioButton; sAumento: TcxSpinEdit; Label2: TLabel; ActionListContenido: TActionList; actDescuento: TAction; actAumento: TAction; procedure actDescuentoExecute(Sender: TObject); procedure actAumentoExecute(Sender: TObject); private FPorcentaje: Variant; function GetPorcentaje: Variant; procedure SetPorcentaje(const Value: Variant); function GetTipoOperacion: Integer; public property TipoOperacion: Integer Read GetTipoOperacion; property Porcentaje: Variant Read GetPorcentaje write SetPorcentaje; end; implementation {$R *.dfm} uses uFactuGES_App; procedure TfEditorVariarPrecios.actAumentoExecute(Sender: TObject); begin if rdAumento.Checked then begin sDescuento.Clear; sDescuento.Enabled := False; sAumento.Enabled := True; end; end; procedure TfEditorVariarPrecios.actDescuentoExecute(Sender: TObject); begin if rdDescuento.Checked then begin sAumento.Clear; sAumento.Enabled := False; sDescuento.Enabled := True; end; end; function TfEditorVariarPrecios.GetPorcentaje: Variant; begin if rdDescuento.Checked then Result := sDescuento.EditValue else Result := sAumento.EditValue end; function TfEditorVariarPrecios.GetTipoOperacion: Integer; begin if rdDescuento.Checked then Result := -1 else if rdAumento.Checked then Result := 1 else Result := 0; end; procedure TfEditorVariarPrecios.SetPorcentaje(const Value: Variant); begin if rdDescuento.Checked then sDescuento.EditValue := Value else sAumento.EditValue := Value; end; end.