unit uBizDetallesFacturaCliente;

interface

uses
  uDAInterfaces, uDADataTable, schFacturasClienteClient_Intf;

const
  BIZ_CLIENT_DETALLES_FACTURA_CLIENTE = 'Client.DetallesFactura.Cliente';

type
  IBizDetallesFacturaCliente = interface(IFacturasCliente_Detalles)
  ['{6C1BDF6E-242E-4921-819F-096278C3331C}']
  end;

  TBizDetallesFacturaCliente = class(TFacturasCliente_DetallesDataTableRules, IBizDetallesFacturaCliente)
  protected
    procedure OnNewRecord(Sender: TDADataTable); override;  
    procedure BeforeInsert(Sender: TDADataTable); override;
  end;

implementation

uses
  DB;

{ TBizDetallesFacturaCliente }

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

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

initialization
  RegisterDataTableRules(BIZ_CLIENT_DETALLES_FACTURA_CLIENTE, TBizDetallesFacturaCliente);

end.
