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)
  protected
    procedure OnNewRecord(Sender: TDADataTable); override;
    procedure BeforeInsert(Sender: TDADataTable); override;
  end;

implementation

uses
  DB;

{ TBizDetallesAlbaranCliente }

procedure TBizDetallesAlbaranCliente.BeforeInsert(Sender: TDADataTable);
var
  AMasterTable : TDADataTable;
begin
  inherited;
  AMasterTable := DataTable.GetMasterDataTable;
  if Assigned(AMasterTable) and (AMasterTable.State = dsInsert) then
    AMasterTable.Post;
end;

procedure TBizDetallesAlbaranCliente.OnNewRecord(Sender: TDADataTable);
begin
  inherited;
  VISIBLE := 1;
end;

initialization
  RegisterDataTableRules(BIZ_CLIENT_DETALLES_ALBARAN_CLIENTE, TBizDetallesAlbaranCliente);

end.
