unit uBizDetallesMedicacion;

interface

uses
  uDADataTable, schMedicacionClient_Intf;

const
  BIZ_CLIENT_DETALLES_MEDICACION = 'Client.DetallesMedicacion';


type
  IBizDetallesMedicacion = interface(IMedicacion_Detalles)
  ['{B5ECBD8F-6311-4A96-843D-4ED4B00137BB}']
  end;

  TBizDetallesMedicacion = class(TMedicacion_DetallesDataTableRules, IBizDetallesMedicacion)
  protected
    procedure OnNewRecord(Sender: TDADataTable); override;
    procedure BeforeInsert(Sender: TDADataTable); override;
  end;

implementation

uses
  DB;

{ TBizDetallesMedicacion }

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

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

initialization
  RegisterDataTableRules(BIZ_CLIENT_DETALLES_MEDICACION, TBizDetallesMedicacion);

end.
