unit srvComisiones_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. }
{----------------------------------------------------------------------------}

interface

uses
  {vcl:} Classes, SysUtils,
  {RemObjects:} uROClientIntf, uROTypes, uROServer, uROServerIntf, uROSessions,
  {Ancestor Implementation:} DataAbstractService_Impl,
  {Used RODLs:} DataAbstract4_Intf,
  {Generated:} FactuGES_Intf, uDADataTable, uDABINAdapter, uDAClasses,
  uDAScriptingProvider, uDABusinessProcessor, uDAInterfaces, Variants,
  uDADataStreamer, uDABin2DataStreamer;

type
  { TsrvComisiones }
  TsrvComisiones = class(TDataAbstractService, IsrvComisiones)
    Diagrams: TDADiagrams;
    bpFacturas_Comision: TDABusinessProcessor;
    Bin2DataStreamer: TDABin2DataStreamer;
    bpVendedores_Comision: TDABusinessProcessor;
    bpComisiones: TDABusinessProcessor;
    schComisiones: TDASchema;
    DataDictionary: TDADataDictionary;
    procedure DARemoteServiceCreate(Sender: TObject);
    procedure DataAbstractServiceBeforeAcquireConnection(aSender: TObject;
      var aConnectionName: string);
    { IsrvComisiones methods }
  protected
    function GenerateReport(const AComisionID: String): Binary;
  end;

implementation

{$R *.dfm}
uses
  {Generated:} FactuGES_Invk, uDataModuleServer,
  uDatabaseUtils, schComisionesClient_Intf, uRestriccionesUsuarioUtils,
  uBizComisionesServer, uRptComisiones_Server;

procedure Create_srvComisiones(out anInstance : IUnknown);
begin
  anInstance := TsrvComisiones.Create(NIL);
end;

{ srvComisiones }
procedure TsrvComisiones.DARemoteServiceCreate(Sender: TObject);
begin
  SessionManager := dmServer.SessionManager;
  bpComisiones.BusinessRulesID := BIZ_SERVER_COMISIONES;
end;

procedure TsrvComisiones.DataAbstractServiceBeforeAcquireConnection(
  aSender: TObject; var aConnectionName: string);
begin
  ConnectionName := dmServer.ConnectionName;
end;
function TsrvComisiones.GenerateReport(const AComisionID: String): Binary;
var
  AReportGenerator : TRptComisiones;
begin
  AReportGenerator := TRptComisiones.Create(nil);
  try
    Result := AReportGenerator.GenerarComision(AComisionID);
  finally
    FreeAndNIL(AReportGenerator);
  end;
end;

initialization
  TROClassFactory.Create('srvComisiones', Create_srvComisiones, TsrvComisiones_Invoker);

finalization

end.
