unit srvAlbaranesProveedor_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:}   uDABusinessProcessor, uDABin2DataStreamer, uDADataStreamer,
  uDAScriptingProvider, uDAClasses,
  FactuGES_Intf, uDAInterfaces;

type
  { TsrvAlbaranesProveedor }
  TsrvAlbaranesProveedor = class(TDataAbstractService, IsrvAlbaranesProveedor)
    bpAlbaranesProveedor: TDABusinessProcessor;
    bpAlbaranesProveedor_Detalles: TDABusinessProcessor;
    Bin2DataStreamer: TDABin2DataStreamer;
    schAlbaranesProveedor: TDASchema;
    DADataDictionary: TDADataDictionary;
    procedure DARemoteServiceBeforeGetDatasetData(const Dataset: IDADataset;
      const IncludeSchema: Boolean; const MaxRecords: Integer);
    procedure DARemoteServiceCreate(Sender: TObject);
    procedure DataAbstractServiceBeforeAcquireConnection(aSender: TObject;
      var aConnectionName: string);
  protected
    { IsrvAlbaranesProveedor methods }
    function GenerateReport(const ID: String): Binary;
  end;

implementation

{$R *.dfm}
uses
  Dialogs,
  {Generated:} FactuGES_Invk, uDataModuleServer, uDatabaseUtils,
  schAlbaranesProveedorClient_Intf, uRestriccionesUsuarioUtils,
  uBizAlbaranProveedorServer;
//  uRptAlbaranesProveedor_Server;

procedure Create_srvAlbaranesProveedor(out anInstance : IUnknown);
begin
  anInstance := TsrvAlbaranesProveedor.Create(NIL);
end;

{ srvAlbaranesProveedor }

procedure TsrvAlbaranesProveedor.DARemoteServiceBeforeGetDatasetData(
  const Dataset: IDADataset; const IncludeSchema: Boolean;
  const MaxRecords: Integer);
begin
{  if DataSet.Name = nme_AlbaranesProveedor then
  begin
    { Aquí se asegura que el usuario sólo accede a pedidos
      de las empresas a las que tiene permiso para acceder
      filtrando DataSet por ID_EMPRESA. }
{    FiltrarAccesoUsuario(Session, Connection, schAlbaranesProveedor, DataSet, fld_AlbaranesProveedorID_EMPRESA);
  end;
}  
end;

procedure TsrvAlbaranesProveedor.DARemoteServiceCreate(Sender: TObject);
begin
  //SessionManager := dmServer.SessionManager;
  bpAlbaranesProveedor.BusinessRulesID := BIZ_SERVER_ALBARAN_PROVEEDOR;
end;

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

function TsrvAlbaranesProveedor.GenerateReport(const ID: String): Binary;
//var
//  AReportGenerator : TRptAlbaranesProveedor;
begin
  Result := NIL;
{  AReportGenerator := TRptAlbaranesProveedor.Create(nil);
  try
    Result := AReportGenerator.GenerarAlbaran(ID);
  finally
    FreeAndNIL(AReportGenerator);
  end;
}
end;

initialization
  TROClassFactory.Create('srvAlbaranesProveedor', Create_srvAlbaranesProveedor, TsrvAlbaranesProveedor_Invoker);

finalization

end.
