unit uBizDetallesFacturaProveedor;

interface

uses
  uDAInterfaces, uDADataTable, schFacturasProveedorClient_Intf;

const
  BIZ_CLIENT_DETALLES_FACTURA_Proveedor = 'Client.DetallesFactura.Proveedor';

type
  IBizDetallesFacturaProveedor = interface(IFacturasProveedor_Detalles)
  ['{785A33CF-17AF-4FFC-9904-33AD3489A6B5}']
  end;

  TBizDetallesFacturaProveedor = class(TFacturasProveedor_DetallesDataTableRules, IBizDetallesFacturaProveedor)
  private
    ContIdAux: Integer;
  protected
    procedure OnNewRecord(Sender: TDADataTable); override;
  public
    constructor Create(aDataTable: TDADataTable); override;
  end;

implementation

uses
  SysUtils;

{ TBizDetallesFacturaProveedor }

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

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

initialization
  RegisterDataTableRules(BIZ_CLIENT_DETALLES_FACTURA_PROVEEDOR, TBizDetallesFacturaProveedor);

end.
