unit srvAsientos_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, uDAScriptingProvider, uDABusinessProcessor, uDADataTable, uDABINAdapter; type { TsrvAsientos } TsrvAsientos = class(TDARemoteService, IsrvAsientos) schAsientos: TDASchema; DABINAdapter: TDABINAdapter; protected function AsignarPunteo(const CodigoCuenta: Integer; const FechaIni: DateTime; const FechaFin: DateTime; const ValorPunteado: Integer): Boolean; function darPenultimoCierre(const CodigoCuenta: Integer): DateTime; function darSumaAcumulada(const CodigoCuenta: Integer; const FechaIni: DateTime; const FechaFin: DateTime): Currency; end; implementation {$R *.dfm} uses {Generated:} FactuGES_Invk, uDataModuleServer, uDAInterfaces, schAsientosClient_Intf; procedure Create_srvAsientos(out anInstance : IUnknown); begin anInstance := TsrvAsientos.Create(NIL); end; { srvAsientos } { TsrvAsientos } function TsrvAsientos.AsignarPunteo(const CodigoCuenta: Integer; const FechaIni: DateTime; const FechaFin: DateTime; const ValorPunteado: Integer): Boolean; var dsData: IDASQLCommand; begin try Result:= True; dsData := schAsientos.NewCommand(Connection, 'AsignarPunteo', ['CODIGOCUENTA', 'FECHAINI', 'FECHAFIN', 'VALORPUNTEADO'], [CodigoCuenta, FechaIni, FechaFin, ValorPunteado]); except on E: Exception do Result := False; end; end; function TsrvAsientos.darPenultimoCierre(const CodigoCuenta: Integer): DateTime; var ADataSet : IDADataset; begin try Result:= MinDateTime; ADataSet := schAsientos.NewDataset(Connection, 'darPenultimoCierre', ['CODIGOCUENTA'], [CodigoCuenta]); if not ADataSet.Dataset.FieldByName(fld_AsientosFECHAASIENTO).IsNull then begin //Todavia no se ha hecho el commit y por tanto aparece la fecha de cierre que se va a eliminar por ello dos NEXT ADataSet.Next; ADataSet.Next; if not ADataSet.EOF then Result := ADataSet.FieldByName(fld_AsientosFECHAASIENTO).AsDateTime; end; finally ADataSet.Close; end; end; function TsrvAsientos.darSumaAcumulada(const CodigoCuenta: Integer; const FechaIni: DateTime; const FechaFin: DateTime): Currency; var ADataSet : IDADataset; begin try Result:= 0; ADataSet := schAsientos.NewDataset(Connection, 'darSumaAcumulada', ['CODIGOCUENTA', 'FECHAINI', 'FECHAFIN'], [CodigoCuenta, FechaIni, FechaFin]); if not ADataSet.EOF then Result := ADataSet.Dataset.Fields[0].AsCurrency; finally ADataSet.Close; end; end; initialization TROClassFactory.Create('srvAsientos', Create_srvAsientos, TsrvAsientos_Invoker); finalization end.