unit schTiposIVAServer_Intf;

interface

uses
  Classes, DB, SysUtils, uROClasses, uDADataTable, uDABusinessProcessor, FmtBCD, uROXMLIntf, 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 = '{22B67F19-4406-4659-A4A0-F4894916A1C1}';

type
  { ITiposIVADelta }
  ITiposIVADelta = interface(ITiposIVA)
  ['{22B67F19-4406-4659-A4A0-F4894916A1C1}']
    { 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 GetIDIsNull: Boolean; virtual;
    function GetOldIDValue: Integer; virtual;
    function GetOldIDIsNull: Boolean; virtual;
    procedure SetIDValue(const aValue: Integer); virtual;
    procedure SetIDIsNull(const aValue: Boolean); virtual;
    function GetREFERENCIAValue: String; virtual;
    function GetREFERENCIAIsNull: Boolean; virtual;
    function GetOldREFERENCIAValue: String; virtual;
    function GetOldREFERENCIAIsNull: Boolean; virtual;
    procedure SetREFERENCIAValue(const aValue: String); virtual;
    procedure SetREFERENCIAIsNull(const aValue: Boolean); virtual;
    function GetDESCRIPCIONValue: String; virtual;
    function GetDESCRIPCIONIsNull: Boolean; virtual;
    function GetOldDESCRIPCIONValue: String; virtual;
    function GetOldDESCRIPCIONIsNull: Boolean; virtual;
    procedure SetDESCRIPCIONValue(const aValue: String); virtual;
    procedure SetDESCRIPCIONIsNull(const aValue: Boolean); virtual;
    function GetIVAValue: Float; virtual;
    function GetIVAIsNull: Boolean; virtual;
    function GetOldIVAValue: Float; virtual;
    function GetOldIVAIsNull: Boolean; virtual;
    procedure SetIVAValue(const aValue: Float); virtual;
    procedure SetIVAIsNull(const aValue: Boolean); virtual;
    function GetREValue: Float; virtual;
    function GetREIsNull: Boolean; virtual;
    function GetOldREValue: Float; virtual;
    function GetOldREIsNull: Boolean; virtual;
    procedure SetREValue(const aValue: Float); virtual;
    procedure SetREIsNull(const aValue: Boolean); virtual;

    { Properties }
    property ID : Integer read GetIDValue write SetIDValue;
    property IDIsNull : Boolean read GetIDIsNull write SetIDIsNull;
    property OldID : Integer read GetOldIDValue;
    property OldIDIsNull : Boolean read GetOldIDIsNull;
    property REFERENCIA : String read GetREFERENCIAValue write SetREFERENCIAValue;
    property REFERENCIAIsNull : Boolean read GetREFERENCIAIsNull write SetREFERENCIAIsNull;
    property OldREFERENCIA : String read GetOldREFERENCIAValue;
    property OldREFERENCIAIsNull : Boolean read GetOldREFERENCIAIsNull;
    property DESCRIPCION : String read GetDESCRIPCIONValue write SetDESCRIPCIONValue;
    property DESCRIPCIONIsNull : Boolean read GetDESCRIPCIONIsNull write SetDESCRIPCIONIsNull;
    property OldDESCRIPCION : String read GetOldDESCRIPCIONValue;
    property OldDESCRIPCIONIsNull : Boolean read GetOldDESCRIPCIONIsNull;
    property IVA : Float read GetIVAValue write SetIVAValue;
    property IVAIsNull : Boolean read GetIVAIsNull write SetIVAIsNull;
    property OldIVA : Float read GetOldIVAValue;
    property OldIVAIsNull : Boolean read GetOldIVAIsNull;
    property RE : Float read GetREValue write SetREValue;
    property REIsNull : Boolean read GetREIsNull write SetREIsNull;
    property OldRE : Float read GetOldREValue;
    property OldREIsNull : Boolean read GetOldREIsNull;

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

  end;

implementation

uses
  Variants, uROBinaryHelpers, uDAInterfaces;

{ 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.GetIDIsNull: Boolean;
begin
  result := VarIsNull(BusinessProcessor.CurrentChange.NewValueByName[fld_TiposIVAID]);
end;

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

function TTiposIVABusinessProcessorRules.GetOldIDIsNull: Boolean;
begin
  result := VarIsNull(BusinessProcessor.CurrentChange.OldValueByName[fld_TiposIVAID]);
end;

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

procedure TTiposIVABusinessProcessorRules.SetIDIsNull(const aValue: Boolean);
begin
  if aValue then
    BusinessProcessor.CurrentChange.NewValueByName[fld_TiposIVAID] := Null;
end;

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

function TTiposIVABusinessProcessorRules.GetREFERENCIAIsNull: Boolean;
begin
  result := VarIsNull(BusinessProcessor.CurrentChange.NewValueByName[fld_TiposIVAREFERENCIA]);
end;

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

function TTiposIVABusinessProcessorRules.GetOldREFERENCIAIsNull: Boolean;
begin
  result := VarIsNull(BusinessProcessor.CurrentChange.OldValueByName[fld_TiposIVAREFERENCIA]);
end;

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

procedure TTiposIVABusinessProcessorRules.SetREFERENCIAIsNull(const aValue: Boolean);
begin
  if aValue then
    BusinessProcessor.CurrentChange.NewValueByName[fld_TiposIVAREFERENCIA] := Null;
end;

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

function TTiposIVABusinessProcessorRules.GetDESCRIPCIONIsNull: Boolean;
begin
  result := VarIsNull(BusinessProcessor.CurrentChange.NewValueByName[fld_TiposIVADESCRIPCION]);
end;

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

function TTiposIVABusinessProcessorRules.GetOldDESCRIPCIONIsNull: Boolean;
begin
  result := VarIsNull(BusinessProcessor.CurrentChange.OldValueByName[fld_TiposIVADESCRIPCION]);
end;

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

procedure TTiposIVABusinessProcessorRules.SetDESCRIPCIONIsNull(const aValue: Boolean);
begin
  if aValue then
    BusinessProcessor.CurrentChange.NewValueByName[fld_TiposIVADESCRIPCION] := Null;
end;

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

function TTiposIVABusinessProcessorRules.GetIVAIsNull: Boolean;
begin
  result := VarIsNull(BusinessProcessor.CurrentChange.NewValueByName[fld_TiposIVAIVA]);
end;

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

function TTiposIVABusinessProcessorRules.GetOldIVAIsNull: Boolean;
begin
  result := VarIsNull(BusinessProcessor.CurrentChange.OldValueByName[fld_TiposIVAIVA]);
end;

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

procedure TTiposIVABusinessProcessorRules.SetIVAIsNull(const aValue: Boolean);
begin
  if aValue then
    BusinessProcessor.CurrentChange.NewValueByName[fld_TiposIVAIVA] := Null;
end;

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

function TTiposIVABusinessProcessorRules.GetREIsNull: Boolean;
begin
  result := VarIsNull(BusinessProcessor.CurrentChange.NewValueByName[fld_TiposIVARE]);
end;

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

function TTiposIVABusinessProcessorRules.GetOldREIsNull: Boolean;
begin
  result := VarIsNull(BusinessProcessor.CurrentChange.OldValueByName[fld_TiposIVARE]);
end;

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

procedure TTiposIVABusinessProcessorRules.SetREIsNull(const aValue: Boolean);
begin
  if aValue then
    BusinessProcessor.CurrentChange.NewValueByName[fld_TiposIVARE] := Null;
end;


initialization
  RegisterBusinessProcessorRules(RID_TiposIVADelta, TTiposIVABusinessProcessorRules);

end.
