unit uBizFormasPagoPlazos;

interface

uses
  uDAInterfaces, uDADataTable, schFormasPagoClient_Intf;

const
  BIZ_CLIENT_FORMAPAGOPLAZOS = 'Client.FormaPagoPlazos';

type
  IBizFormaPagoPlazos = interface(IFormasPagoPlazos)
    ['{F90A56C5-F63E-4501-8855-B3967CF15A8A}']
    function EsNuevo : Boolean;
  end;

  TBizFormasPagoPlazos = class(TFormasPagoPlazosDataTableRules, IBizFormaPagoPlazos)
  protected
    procedure OnNewRecord(Sender: TDADataTable); override;
    procedure BeforeInsert(Sender: TDADataTable); override;
  public
    procedure IniciarValoresPlazoNuevo;
    function EsNuevo : Boolean;
  end;


implementation

{ TBizFormasPagoPlazos }

uses
  Dialogs, DB;

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

function TBizFormasPagoPlazos.EsNuevo: Boolean;
begin
  Result := (ID < 0);
end;

procedure TBizFormasPagoPlazos.IniciarValoresPlazoNuevo;
begin
  //
end;

procedure TBizFormasPagoPlazos.OnNewRecord(Sender: TDADataTable);
begin
  inherited;
// Eliminar ID := GetRecNo; // -1, -2, -3...
  IniciarValoresPlazoNuevo
end;

initialization
  RegisterDataTableRules(BIZ_CLIENT_FORMAPAGOPLAZOS, TBizFormasPagoPlazos);

finalization

end.

