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

implementation

uses
  DB, SysUtils;

{ TBizDetallesFacturaProveedor }

procedure TBizDetallesFacturaProveedor.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 TBizDetallesFacturaProveedor.OnNewRecord(Sender: TDADataTable);
begin
  inherited;
  VISIBLE := 1;
end;

initialization
  RegisterDataTableRules(BIZ_CLIENT_DETALLES_FACTURA_PROVEEDOR, TBizDetallesFacturaProveedor);

end.
