unit uBizDetallesFacturaCliente;

interface

uses
  uDAInterfaces, uDADataTable, schFacturasClienteClient_Intf;

const
  BIZ_CLIENT_DETALLES_FACTURA_CLIENTE = 'Client.DetallesFactura.Cliente';

type
  IBizDetallesFacturaCliente = interface(IFacturasCliente_Detalles)
  ['{B0FB7ED5-700B-4F76-A23B-3BE9440F8464}']
  end;

  TBizDetallesFacturaCliente = class(TFacturasCliente_DetallesDataTableRules, IBizDetallesFacturaCliente)
  private
    ContIdAux: Integer;
  protected
    procedure OnNewRecord(Sender: TDADataTable); override;
  public
    constructor Create(aDataTable: TDADataTable); override;
  end;

implementation

uses
  SysUtils;

{ TBizDetallesFacturaCliente }

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

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

initialization
  RegisterDataTableRules(BIZ_CLIENT_DETALLES_FACTURA_CLIENTE, TBizDetallesFacturaCliente);

end.
