unit schTiposIVAServer_Intf;

interface

uses
  Classes, DB, SysUtils, uROClasses, uDADataTable, uDABusinessProcessor, schTiposIVAClient_Intf;

const
  { Delta rules ids 
       Feel free to change them to something more human readable
       but make sure they are unique in the context of your application }
  RID_TiposIVADelta = '{2A97AB6B-F1E7-4CEF-BB65-E0155C2C9A47}';

type
  { ITiposIVADelta }
  ITiposIVADelta = interface(ITiposIVA)
  ['{2A97AB6B-F1E7-4CEF-BB65-E0155C2C9A47}']
    { Property getters and setters }
    function GetOldIDValue : Integer;
    function GetOldREFERENCIAValue : String;
    function GetOldDESCRIPCIONValue : String;
    function GetOldIVAValue : Float;
    function GetOldREValue : Float;

    { Properties }
    property OldID : Integer read GetOldIDValue;
    property OldREFERENCIA : String read GetOldREFERENCIAValue;
    property OldDESCRIPCION : String read GetOldDESCRIPCIONValue;
    property OldIVA : Float read GetOldIVAValue;
    property OldRE : Float read GetOldREValue;
  end;

  { TTiposIVABusinessProcessorRules }
  TTiposIVABusinessProcessorRules = class(TDABusinessProcessorRules, ITiposIVA, ITiposIVADelta)
  private
  protected
    { Property getters and setters }
    function GetIDValue: Integer; virtual;
    function GetOldIDValue: Integer; virtual;
    procedure SetIDValue(const aValue: Integer); virtual;
    function GetREFERENCIAValue: String; virtual;
    function GetOldREFERENCIAValue: String; virtual;
    procedure SetREFERENCIAValue(const aValue: String); virtual;
    function GetDESCRIPCIONValue: String; virtual;
    function GetOldDESCRIPCIONValue: String; virtual;
    procedure SetDESCRIPCIONValue(const aValue: String); virtual;
    function GetIVAValue: Float; virtual;
    function GetOldIVAValue: Float; virtual;
    procedure SetIVAValue(const aValue: Float); virtual;
    function GetREValue: Float; virtual;
    function GetOldREValue: Float; virtual;
    procedure SetREValue(const aValue: Float); virtual;

    { Properties }
    property ID : Integer read GetIDValue write SetIDValue;
    property OldID : Integer read GetOldIDValue;
    property REFERENCIA : String read GetREFERENCIAValue write SetREFERENCIAValue;
    property OldREFERENCIA : String read GetOldREFERENCIAValue;
    property DESCRIPCION : String read GetDESCRIPCIONValue write SetDESCRIPCIONValue;
    property OldDESCRIPCION : String read GetOldDESCRIPCIONValue;
    property IVA : Float read GetIVAValue write SetIVAValue;
    property OldIVA : Float read GetOldIVAValue;
    property RE : Float read GetREValue write SetREValue;
    property OldRE : Float read GetOldREValue;

  public
    constructor Create(aBusinessProcessor: TDABusinessProcessor); override;
    destructor Destroy; override;

  end;

implementation

uses
  Variants, uROBinaryHelpers;

{ TTiposIVABusinessProcessorRules }
constructor TTiposIVABusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor);
begin
  inherited;
end;

destructor TTiposIVABusinessProcessorRules.Destroy;
begin
  inherited;
end;

function TTiposIVABusinessProcessorRules.GetIDValue: Integer;
begin
  result := BusinessProcessor.CurrentChange.NewValueByName[fld_TiposIVAID];
end;

function TTiposIVABusinessProcessorRules.GetOldIDValue: Integer;
begin
  result := BusinessProcessor.CurrentChange.OldValueByName[fld_TiposIVAID];
end;

procedure TTiposIVABusinessProcessorRules.SetIDValue(const aValue: Integer);
begin
  BusinessProcessor.CurrentChange.NewValueByName[fld_TiposIVAID] := aValue;
end;

function TTiposIVABusinessProcessorRules.GetREFERENCIAValue: String;
begin
  result := BusinessProcessor.CurrentChange.NewValueByName[fld_TiposIVAREFERENCIA];
end;

function TTiposIVABusinessProcessorRules.GetOldREFERENCIAValue: String;
begin
  result := BusinessProcessor.CurrentChange.OldValueByName[fld_TiposIVAREFERENCIA];
end;

procedure TTiposIVABusinessProcessorRules.SetREFERENCIAValue(const aValue: String);
begin
  BusinessProcessor.CurrentChange.NewValueByName[fld_TiposIVAREFERENCIA] := aValue;
end;

function TTiposIVABusinessProcessorRules.GetDESCRIPCIONValue: String;
begin
  result := BusinessProcessor.CurrentChange.NewValueByName[fld_TiposIVADESCRIPCION];
end;

function TTiposIVABusinessProcessorRules.GetOldDESCRIPCIONValue: String;
begin
  result := BusinessProcessor.CurrentChange.OldValueByName[fld_TiposIVADESCRIPCION];
end;

procedure TTiposIVABusinessProcessorRules.SetDESCRIPCIONValue(const aValue: String);
begin
  BusinessProcessor.CurrentChange.NewValueByName[fld_TiposIVADESCRIPCION] := aValue;
end;

function TTiposIVABusinessProcessorRules.GetIVAValue: Float;
begin
  result := BusinessProcessor.CurrentChange.NewValueByName[fld_TiposIVAIVA];
end;

function TTiposIVABusinessProcessorRules.GetOldIVAValue: Float;
begin
  result := BusinessProcessor.CurrentChange.OldValueByName[fld_TiposIVAIVA];
end;

procedure TTiposIVABusinessProcessorRules.SetIVAValue(const aValue: Float);
begin
  BusinessProcessor.CurrentChange.NewValueByName[fld_TiposIVAIVA] := aValue;
end;

function TTiposIVABusinessProcessorRules.GetREValue: Float;
begin
  result := BusinessProcessor.CurrentChange.NewValueByName[fld_TiposIVARE];
end;

function TTiposIVABusinessProcessorRules.GetOldREValue: Float;
begin
  result := BusinessProcessor.CurrentChange.OldValueByName[fld_TiposIVARE];
end;

procedure TTiposIVABusinessProcessorRules.SetREValue(const aValue: Float);
begin
  BusinessProcessor.CurrentChange.NewValueByName[fld_TiposIVARE] := aValue;
end;


initialization
  RegisterBusinessProcessorRules(RID_TiposIVADelta, TTiposIVABusinessProcessorRules);

end.
