unit srvMedicacion_Impl;

{----------------------------------------------------------------------------}
{ This unit was automatically generated by the RemObjects SDK after reading  }
{ the RODL file associated with this project .                               }
{                                                                            }
{ This is where you are supposed to code the implementation of your objects. }
{----------------------------------------------------------------------------}

{$I RemObjects.inc}

interface

uses
  {vcl:} Classes, SysUtils, 
  {RemObjects:} uROXMLIntf, uROClientIntf, uROTypes, uROServer, uROServerIntf, uROSessions,
  {Required:} uRORemoteDataModule,
  {Ancestor Implementation:} DataAbstractService_Impl,
  {Used RODLs:} DataAbstract4_Intf,
  {Generated:} Etiquetas_Intf, uDADataStreamer, uDABin2DataStreamer, uDAClasses,
  uDAScriptingProvider, uDABusinessProcessor,
  uDAInterfaces;

type
  { TsrvMedicacion }
  TsrvMedicacion = class(TDataAbstractService, IsrvMedicacion)
    bpMedicacion: TDABusinessProcessor;
    bpMedicacion_Detalles: TDABusinessProcessor;
    Bin2DataStreamer: TDABin2DataStreamer;
    schMedicacion: TDASchema;
    DADataDictionary: TDADataDictionary;
    procedure DARemoteServiceCreate(Sender: TObject);
    procedure DataAbstractServiceBeforeAcquireConnection(aSender: TObject; var aConnectionName: string);
  protected
    { IsrvMedicacion methods }
    function GenerarInforme(const ListaID: TIntegerArray): Binary;
  end;

implementation

{$R *.dfm}
uses
  {Generated:} Etiquetas_Invk, uDataModuleServer, uDatabaseUtils,
  schMedicacionClient_Intf, uRestriccionesUsuarioUtils, 
  uSistemaFunc, uBizMedicacionServer, uRptMedicaciones_Server;


procedure Create_srvMedicacion(out anInstance : IUnknown);
begin
  anInstance := TsrvMedicacion.Create(nil);
end;

{ srvMedicacion }
procedure TsrvMedicacion.DARemoteServiceCreate(Sender: TObject);
begin
  bpMedicacion.BusinessRulesID := BIZ_SERVER_MEDICACION;
end;

procedure TsrvMedicacion.DataAbstractServiceBeforeAcquireConnection(
  aSender: TObject; var aConnectionName: string);
begin
  ConnectionName := dmServer.ConnectionName;
end;

function TsrvMedicacion.GenerarInforme(const ListaID: TIntegerArray): Binary;
var
  AReportGenerator : TRptMedicaciones;
begin
  AReportGenerator := TRptMedicaciones.Create(nil);
  try
    Result := AReportGenerator.GenerarInforme(ListaID);
  finally
    FreeAndNIL(AReportGenerator);
  end;
end;

var
  fClassFactory: IROClassFactory;
initialization
  fClassFactory := TROClassFactory.Create('srvMedicacion', Create_srvMedicacion, TsrvMedicacion_Invoker);

finalization
  UnRegisterClassFactory(fClassFactory);
  fClassFactory := nil;

end.
