unit uBizDetallesAlbaranCliente;

interface

uses
  uDADataTable, schAlbaranesClienteClient_Intf;

const
  BIZ_CLIENT_DETALLES_ALBARAN_CLIENTE = 'Client.DetallesAlbaran.Cliente';


type
  IBizDetallesAlbaranCliente = interface(IAlbaranesCliente_Detalles)
  ['{8EC1F1B2-C00D-4B58-9F97-C74DBADA4980}']
  end;

  TBizDetallesAlbaranCliente = class(TAlbaranesCliente_DetallesDataTableRules, IBizDetallesAlbaranCliente)
  private
    ContIdAux: Integer;
  protected
    procedure OnNewRecord(Sender: TDADataTable); override;
  public
    constructor Create(aDataTable: TDADataTable); override;
  end;

implementation

{ TBizDetallesAlbaranCliente }

uses
  uDataTableUtils;


constructor TBizDetallesAlbaranCliente.Create(aDataTable: TDADataTable);
begin
  inherited Create(aDataTable);
  ContIdAux := -1;
end;

procedure TBizDetallesAlbaranCliente.OnNewRecord(Sender: TDADataTable);
begin
  inherited;
  ID := ContIdAux; // -1, -2, -3...
  Dec(ContIdAux);
end;

initialization
  RegisterDataTableRules(BIZ_CLIENT_DETALLES_ALBARAN_CLIENTE, TBizDetallesAlbaranCliente);

end.
