104 lines
3.6 KiB
ObjectPascal
104 lines
3.6 KiB
ObjectPascal
|
|
unit srvFacturasCliente_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:} DARemoteService_Impl,
|
|||
|
|
{Used RODLs:} DataAbstract_Intf,
|
|||
|
|
{Generated:} FactuGES_Intf, uDAClasses, uDADataTable, uDABINAdapter,
|
|||
|
|
uDAInterfaces, frxClass, DB, IBCustomDataSet, IBDatabase,
|
|||
|
|
uDABusinessProcessor, uDAScriptingProvider, uDACDSDataTable;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
{ TsrvFacturasCliente }
|
|||
|
|
TsrvFacturasCliente = class(TDARemoteService, IsrvFacturasCliente)
|
|||
|
|
DABINAdapter: TDABINAdapter;
|
|||
|
|
Diagrams: TDADiagrams;
|
|||
|
|
bpFacturasCliente: TDABusinessProcessor;
|
|||
|
|
bpFacturasCliente_Detalles: TDABusinessProcessor;
|
|||
|
|
schFacturasCliente: TDASchema;
|
|||
|
|
DataDictionary: TDADataDictionary;
|
|||
|
|
procedure DARemoteServiceBeforeAcquireConnection(Sender: TDARemoteService;
|
|||
|
|
var ConnectionName: string);
|
|||
|
|
procedure DARemoteServiceBeforeGetDatasetData(const Dataset: IDADataset;
|
|||
|
|
const IncludeSchema: Boolean; const MaxRecords: Integer);
|
|||
|
|
procedure DARemoteServiceCreate(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
protected
|
|||
|
|
{ IsrvFacturasCliente methods }
|
|||
|
|
function GetNextAutoInc(const GeneratorName: String): Integer;
|
|||
|
|
function GenerateReport(const FacturaID: Integer): Binary;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
uses
|
|||
|
|
{Generated:} FactuGES_Invk, Dialogs,
|
|||
|
|
uDataModuleServer, uDatabaseUtils, uUsersManager, schFacturasClienteClient_Intf,
|
|||
|
|
uRestriccionesUsuarioUtils, uRptFacturasCliente_Server, uBizFacturasClienteServer;
|
|||
|
|
|
|||
|
|
procedure Create_srvFacturasCliente(out anInstance : IUnknown);
|
|||
|
|
begin
|
|||
|
|
anInstance := TsrvFacturasCliente.Create(NIL);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
{ srvFacturasCliente }
|
|||
|
|
procedure TsrvFacturasCliente.DARemoteServiceBeforeAcquireConnection(
|
|||
|
|
Sender: TDARemoteService; var ConnectionName: string);
|
|||
|
|
begin
|
|||
|
|
ConnectionName := dmServer.ConnectionName;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TsrvFacturasCliente.DARemoteServiceBeforeGetDatasetData(
|
|||
|
|
const Dataset: IDADataset; const IncludeSchema: Boolean;
|
|||
|
|
const MaxRecords: Integer);
|
|||
|
|
begin
|
|||
|
|
if DataSet.Name = nme_FacturasCliente then
|
|||
|
|
begin
|
|||
|
|
{ Aqu<EFBFBD> se asegura que el usuario s<EFBFBD>lo accede a facturas
|
|||
|
|
de las empresas a las que tiene permiso para acceder
|
|||
|
|
filtrando DataSet por ID_EMPRESA. }
|
|||
|
|
FiltrarAccesoUsuario(Session, Connection, schFacturasCliente, DataSet, fld_FacturasClienteID_EMPRESA);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TsrvFacturasCliente.DARemoteServiceCreate(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
SessionManager := dmServer.SessionManager;
|
|||
|
|
bpFacturasCliente.BusinessRulesID := BIZ_SERVER_FACTURAS_CLIENTE;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TsrvFacturasCliente.GenerateReport(const FacturaID: Integer): Binary;
|
|||
|
|
var
|
|||
|
|
AReportGenerator : TRptFacturasCliente;
|
|||
|
|
begin
|
|||
|
|
AReportGenerator := TRptFacturasCliente.Create(nil);
|
|||
|
|
try
|
|||
|
|
Result := AReportGenerator.GenerarFactura(FacturaID);
|
|||
|
|
finally
|
|||
|
|
FreeAndNIL(AReportGenerator);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TsrvFacturasCliente.GetNextAutoInc(const GeneratorName: String): Integer;
|
|||
|
|
begin
|
|||
|
|
Result := uDatabaseUtils.GetNextAutoInc(GeneratorName)
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
initialization
|
|||
|
|
TROClassFactory.Create('srvFacturasCliente', Create_srvFacturasCliente, TsrvFacturasCliente_Invoker);
|
|||
|
|
|
|||
|
|
finalization
|
|||
|
|
|
|||
|
|
end.
|