diff --git a/Source/ApplicationBase/Ejercicios/Servidor/srvEjercicios_Impl.dfm b/Source/ApplicationBase/Ejercicios/Servidor/srvEjercicios_Impl.dfm new file mode 100644 index 00000000..f362cbf2 --- /dev/null +++ b/Source/ApplicationBase/Ejercicios/Servidor/srvEjercicios_Impl.dfm @@ -0,0 +1,264 @@ +object srvEjercicios: TsrvEjercicios + OldCreateOrder = True + OnCreate = DARemoteServiceCreate + SessionManager = dmServer.SessionManager + ServiceSchema = schEjercicios + ServiceDataStreamer = Bin2DataStreamer + ExportedDataTables = <> + BeforeAcquireConnection = DataAbstractServiceBeforeAcquireConnection + Height = 181 + Width = 350 + object Diagrams: TDADiagrams + Left = 150 + Top = 90 + DiagramData = + ''#13#10' '#13#10' '#13#10' '#13#10''#13#10 + end + object DataDictionary: TDADataDictionary + Fields = < + item + Name = 'Ejercicios_ID' + DataType = datAutoInc + GeneratorName = 'GEN_CONT_EJERCICIOS_ID' + Required = True + DisplayLabel = 'ID' + ServerAutoRefresh = True + end + item + Name = 'Ejercicios_NOMBRE' + DataType = datString + Size = 255 + DisplayLabel = 'Nombre' + end + item + Name = 'Ejercicios_FECHA_INICIO' + DataType = datDateTime + DisplayLabel = 'Fecha inicio' + end + item + Name = 'Ejercicios_FECHA_FIN' + DataType = datDateTime + DisplayLabel = 'Fecha fin' + end + item + Name = 'Ejercicios_ESTADO' + DataType = datString + Size = 255 + DisplayLabel = 'Estado' + end + item + Name = 'Ejercicios_LONG_SUB_CUENTA' + DataType = datSmallInt + DisplayLabel = 'Long. Subcuenta' + end + item + Name = 'Ejercicios_ID_ASIENTO_APERTURA' + DataType = datInteger + end + item + Name = 'Ejercicios_ID_ASIENTO_PERYGAN' + DataType = datInteger + end + item + Name = 'Ejercicios_ID_ASIENTO_CIERRE' + DataType = datInteger + end + item + Name = 'Ejercicios_ID_EMPRESA' + DataType = datInteger + end + item + Name = 'Ejercicios_ACTIVO' + DataType = datSmallInt + ServerAutoRefresh = True + end> + Left = 150 + Top = 24 + end + object schEjercicios: TDASchema + ConnectionManager = dmServer.ConnectionManager + DataDictionary = DataDictionary + Diagrams = Diagrams + Datasets = < + item + Params = <> + Statements = < + item + Connection = 'IBX' + TargetTable = 'CONT_EJERCICIOS' + StatementType = stAutoSQL + ColumnMappings = < + item + DatasetField = 'ID' + TableField = 'ID' + end + item + DatasetField = 'ID_EMPRESA' + TableField = 'ID_EMPRESA' + end + item + DatasetField = 'NOMBRE' + TableField = 'NOMBRE' + end + item + DatasetField = 'FECHA_INICIO' + TableField = 'FECHA_INICIO' + end + item + DatasetField = 'FECHA_FIN' + TableField = 'FECHA_FIN' + end + item + DatasetField = 'ESTADO' + TableField = 'ESTADO' + end + item + DatasetField = 'LONG_SUB_CUENTA' + TableField = 'LONG_SUB_CUENTA' + end + item + DatasetField = 'ID_ASIENTO_APERTURA' + TableField = 'ID_ASIENTO_APERTURA' + end + item + DatasetField = 'ID_ASIENTO_PERYGAN' + TableField = 'ID_ASIENTO_PERYGAN' + end + item + DatasetField = 'ID_ASIENTO_CIERRE' + TableField = 'ID_ASIENTO_CIERRE' + end + item + DatasetField = 'ACTIVO' + TableField = 'ACTIVO' + end> + end> + Name = 'Ejercicios' + Fields = < + item + Name = 'ID' + DataType = datAutoInc + GeneratorName = 'GEN_CONT_EJERCICIOS_ID' + ServerAutoRefresh = True + DictionaryEntry = 'Ejercicios_ID' + InPrimaryKey = True + end + item + Name = 'ID_EMPRESA' + DataType = datInteger + DictionaryEntry = 'Ejercicios_ID_EMPRESA' + end + item + Name = 'NOMBRE' + DataType = datString + Size = 255 + DictionaryEntry = 'Ejercicios_NOMBRE' + end + item + Name = 'FECHA_INICIO' + DataType = datDateTime + DictionaryEntry = 'Ejercicios_FECHA_INICIO' + end + item + Name = 'FECHA_FIN' + DataType = datDateTime + DictionaryEntry = 'Ejercicios_FECHA_FIN' + end + item + Name = 'ESTADO' + DataType = datString + Size = 255 + DictionaryEntry = 'Ejercicios_ESTADO' + end + item + Name = 'LONG_SUB_CUENTA' + DataType = datSmallInt + DictionaryEntry = 'Ejercicios_LONG_SUB_CUENTA' + end + item + Name = 'ID_ASIENTO_APERTURA' + DataType = datInteger + DictionaryEntry = 'Ejercicios_ID_ASIENTO_APERTURA' + end + item + Name = 'ID_ASIENTO_PERYGAN' + DataType = datInteger + DictionaryEntry = 'Ejercicios_ID_ASIENTO_PERYGAN' + end + item + Name = 'ID_ASIENTO_CIERRE' + DataType = datInteger + DictionaryEntry = 'Ejercicios_ID_ASIENTO_CIERRE' + end + item + Name = 'ACTIVO' + DataType = datSmallInt + DictionaryEntry = 'Ejercicios_ACTIVO' + end> + end> + JoinDataTables = <> + UnionDataTables = <> + Commands = < + item + Params = < + item + Name = 'id_empresa' + Value = '' + end> + Statements = < + item + Connection = 'IBX' + ConnectionType = 'Interbase' + Default = True + Name = 'IBX' + SQL = 'execute procedure proc_set_ejercicios_noactivos :id_empresa'#10 + StatementType = stSQL + ColumnMappings = <> + end> + Name = 'SetEjerciciosNoActivos' + end + item + Params = < + item + Name = 'id_ejercicio_copia' + Value = '' + end + item + Name = 'id_ejercicio' + Value = '' + end> + Statements = < + item + Connection = 'IBX' + ConnectionType = 'Interbase' + Default = True + Name = 'IBX' + SQL = + 'execute procedure proc_new_pgc :id_ejercicio_copia, :id_ejercici' + + 'o'#10 + StatementType = stSQL + ColumnMappings = <> + end> + Name = 'GenerarPGC' + end> + RelationShips = <> + UpdateRules = <> + Version = 0 + Left = 48 + Top = 24 + end + object Bin2DataStreamer: TDABin2DataStreamer + Left = 48 + Top = 88 + end + object bpEjercicios: TDABusinessProcessor + Schema = schEjercicios + ReferencedDataset = 'Ejercicios' + ProcessorOptions = [poAutoGenerateInsert, poAutoGenerateUpdate, poAutoGenerateDelete, poAutoGenerateRefreshDataset, poPrepareCommands] + UpdateMode = updWhereKeyOnly + Left = 248 + Top = 24 + end +end diff --git a/Source/ApplicationBase/Ejercicios/Servidor/srvEjercicios_Impl.pas b/Source/ApplicationBase/Ejercicios/Servidor/srvEjercicios_Impl.pas new file mode 100644 index 00000000..96e8265c --- /dev/null +++ b/Source/ApplicationBase/Ejercicios/Servidor/srvEjercicios_Impl.pas @@ -0,0 +1,82 @@ +unit srvEjercicios_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, uDADataStreamer, + uDABin2DataStreamer; + +type + { TsrvEjercicios } + TsrvEjercicios = class(TDataAbstractService, IsrvEjercicios) + Diagrams: TDADiagrams; + Bin2DataStreamer: TDABin2DataStreamer; + bpEjercicios: TDABusinessProcessor; + schEjercicios: TDASchema; + DataDictionary: TDADataDictionary; + procedure DARemoteServiceCreate(Sender: TObject); + procedure DataAbstractServiceBeforeAcquireConnection(aSender: TObject; var aConnectionName: string); + + protected + function GenerarPGC(const ID_EJERCICIO_COPIA: Integer; const ID_EJERCICIO: Integer): Boolean; + + end; + +implementation + +{$R *.dfm} +uses + {Generated:} FactuGES_Invk, uBizEjerciciosServer, uDataModuleServer, uROClasses, + uDatabaseUtils; + +procedure Create_srvEjercicios(out anInstance : IUnknown); +begin + anInstance := TsrvEjercicios.Create(NIL); +end; + +{ srvEjercicios } +procedure TsrvEjercicios.DARemoteServiceCreate(Sender: TObject); +begin + SessionManager := dmServer.SessionManager; + bpEjercicios.BusinessRulesID := BIZ_SERVER_EJERCICIOS; +end; + +procedure TsrvEjercicios.DataAbstractServiceBeforeAcquireConnection( + aSender: TObject; var aConnectionName: string); +begin + ConnectionName := dmServer.ConnectionName; +end; + +function TsrvEjercicios.GenerarPGC(const ID_EJERCICIO_COPIA, ID_EJERCICIO: Integer): Boolean; +begin + Result := False; + + try + Connection.BeginTransaction; + schEjercicios.NewCommand(Connection, 'GenerarPGC', ['ID_EJERCICIO_COPIA', 'ID_EJERCICIO'], [ID_EJERCICIO_COPIA, ID_EJERCICIO]); + Connection.CommitTransaction; + Result := True; + except + Connection.RollbackTransaction; + RaiseError('Error al generar el PGC'); + end; +end; + +initialization + TROClassFactory.Create('srvEjercicios', Create_srvEjercicios, TsrvEjercicios_Invoker); + +finalization + +end.