From 2b113642b058c71d5bde38781d90fff3434e1797 Mon Sep 17 00:00:00 2001 From: roberto Date: Thu, 28 Feb 2008 12:06:57 +0000 Subject: [PATCH] Generacion automatica de subcuenta en clientes git-svn-id: https://192.168.0.254/svn/Proyectos.Acana_FactuGES2/trunk@160 f4e31baf-9722-1c47-927c-6f952f962d4b --- .../Servidor/srvEjercicios_Impl.dfm | 30 ++++ .../Servidor/srvEjercicios_Impl.pas | 29 +++- Source/Base/Base.res | Bin 384 -> 4748 bytes .../Contabilidad/Contabilidad_Group.groupproj | 16 +- .../Servidor/srvContabilidad_Impl.dfm | 142 +++++++++++++++++ .../Servidor/srvContabilidad_Impl.pas | 149 +++++++++++++++++- .../Controller/uClientesController.pas | 4 - .../Contactos/Model/uBizClientesServer.pas | 25 ++- .../Views/uViewSubCuentaContacto.dfm | 20 +-- Source/Servicios/FactuGES.RODL | 42 +++++ Source/Servicios/FactuGES_Intf.pas | 79 ++++++++++ Source/Servicios/FactuGES_Invk.pas | 96 +++++++++++ Source/Servicios/RODLFILE.res | Bin 24344 -> 25835 bytes Source/Servidor/uDataModuleServer.dfm | 5 +- 14 files changed, 610 insertions(+), 27 deletions(-) diff --git a/Source/ApplicationBase/Ejercicios/Servidor/srvEjercicios_Impl.dfm b/Source/ApplicationBase/Ejercicios/Servidor/srvEjercicios_Impl.dfm index c709a50a..3c8abd9e 100644 --- a/Source/ApplicationBase/Ejercicios/Servidor/srvEjercicios_Impl.dfm +++ b/Source/ApplicationBase/Ejercicios/Servidor/srvEjercicios_Impl.dfm @@ -82,6 +82,36 @@ object srvEjercicios: TsrvEjercicios DataDictionary = DataDictionary Diagrams = Diagrams Datasets = < + item + Params = < + item + Name = 'ID_EMPRESA' + Value = '' + ParamType = daptInput + end> + Statements = < + item + Connection = 'IBX' + ConnectionType = 'Interbase' + Default = True + Name = 'IBX' + SQL = + 'select ID'#10'from cont_ejercicios'#10'where cont_ejercicios.activo = 1'#10 + + 'and cont_ejercicios.id_empresa = :ID_EMPRESA'#10 + StatementType = stSQL + ColumnMappings = < + item + DatasetField = 'ID' + TableField = 'ID' + end> + end> + Name = 'darEjercicioActivo' + Fields = < + item + Name = 'ID' + DataType = datInteger + end> + end item Params = <> Statements = < diff --git a/Source/ApplicationBase/Ejercicios/Servidor/srvEjercicios_Impl.pas b/Source/ApplicationBase/Ejercicios/Servidor/srvEjercicios_Impl.pas index 96e8265c..a1cf5798 100644 --- a/Source/ApplicationBase/Ejercicios/Servidor/srvEjercicios_Impl.pas +++ b/Source/ApplicationBase/Ejercicios/Servidor/srvEjercicios_Impl.pas @@ -31,14 +31,15 @@ type protected function GenerarPGC(const ID_EJERCICIO_COPIA: Integer; const ID_EJERCICIO: Integer): Boolean; - + public + function DarEjercicioActivo(const ID_EMPRESA: Integer): Integer; end; implementation {$R *.dfm} uses - {Generated:} FactuGES_Invk, uBizEjerciciosServer, uDataModuleServer, uROClasses, + {Generated:} FactuGES_Invk, uDAInterfaces, uBizEjerciciosServer, uDataModuleServer, uROClasses, uDatabaseUtils; procedure Create_srvEjercicios(out anInstance : IUnknown); @@ -47,6 +48,30 @@ begin end; { srvEjercicios } +function TsrvEjercicios.DarEjercicioActivo(const ID_EMPRESA: Integer): Integer; +var + AConn : IDAConnection; + dsData: IDADataset; + +begin + AConn := dmServer.ConnectionManager.NewConnection(dmServer.ConnectionManager.GetDefaultConnectionName); + + try + try + dsData := schEjercicios.NewDataset(AConn, 'darEjercicioActivo', ['ID_EMPRESA'], [ID_EMPRESA]); + dsData.Active := True; + Result := dsData.FieldValues[0]; + AConn.CommitTransaction; + + except + RaiseError('Error al buscar ejercicio activo de la empresa'); + AConn.RollbackTransaction; + end; + finally + dsData := NIL; + end; +end; + procedure TsrvEjercicios.DARemoteServiceCreate(Sender: TObject); begin SessionManager := dmServer.SessionManager; diff --git a/Source/Base/Base.res b/Source/Base/Base.res index 8b251f312bcccec5485024f6fe8d80e1cdf25746..1641339fcc482e7e3492d1b45813a86619622c33 100644 GIT binary patch literal 4748 zcmbW5&ub)A5XUPdpe&2#;C*uNAUVhgd+&(4um@dnom`vXF9g}ZuHJ;se=<3UNdFJg zbCw+UD9j$byGIXV`~6hC>h4S?F|k9X-j90q{Z_qtZ<;nUJCO8!h?p${kR>3GhM`oH*q zk=UsjOCIgA_4!`B+Gb&`I84R)bT4dy-BQV<-SyFz?R8ILEQ(+JB$u{sEXE@j@B*7W zT;iZH#|OJ<&DO$RCkM6VbK3(B(k{nbdv1lpc;E$xz9as|v3uE1V{hw2w~g3eD0an7 z{BT%G%irdMe*|oDJmgvJaA2`9B<6Xi*?M~Q;)@Sbfwf3uf zVaWkbUjU=;sL{BlYemIZXv%qZ{SZw{-TCU+;!nH6KDDIJumU+9{E0zXW4>7T)y|>$DQlv zRJe?TjSp{c!DqeayAnSMTtZZT;>LN7J0Rls+5m@q)MbyB*eL%Eu@(+$Cw}Pd@q7N| z%Q0*AHpCP^b9v`@jx-l_FD>khpW2W8(OU2&V5TrnoAY-m_hlcV?zq3;7{2gF{J#Hc z6R+o~mVenX?>@W0@_DVzyOFs(5464CY{!q9ChoF#_*eXi@4gFuV8?vhl=_w5$iKL0 zEV0nMBcN08xtRmsgJrqjh@s#|{?*ssnsG)mH*wa6{efF0JFWHok@kA5%b661{B38= zCcgJ|*ZFTpV$8<-&+AWpa)Q8*`wL&hMeNQ^v6I7$HSdLZhZ^&+6<@Uw_Zsml9^v3W zVvPDBKHh;i=RU4J_ta3E;)Mn>Y+L zKLZ0UQ+*km9FO-b?U4gmn-62iwzH6&*duKGo~aUV)bYDla8wWZ9+^7p-F<8lP@i!m z@vhbD_${F}h>^T;C(?(b*OJDk?{dEXB?nuehoON3HAb!7Mr7-ls!84-5V-jJugbu<_$}mU=Yd9!?TOX;|B-#B)+0x#9q*yqJiqS!`49d=7ztk$O+9=1i;?K_|J<8T z?0b7=-`Z3A#vV$4XJ5(lQ~TOZHUFdA%oWvK5zg&_IKXIbughQBA8XAsd#=@|TFLXC zy(^m((;DnQmDQKatmw!@c`| G?EMQ&4NnpP delta 11 ScmeBCZD5|Duvteife`=|>;pCc diff --git a/Source/Modulos/Contabilidad/Contabilidad_Group.groupproj b/Source/Modulos/Contabilidad/Contabilidad_Group.groupproj index 84ec7d0c..d2e89d03 100644 --- a/Source/Modulos/Contabilidad/Contabilidad_Group.groupproj +++ b/Source/Modulos/Contabilidad/Contabilidad_Group.groupproj @@ -10,6 +10,7 @@ + @@ -52,6 +53,15 @@ + + + + + + + + + @@ -152,13 +162,13 @@ - + - + - + \ No newline at end of file diff --git a/Source/Modulos/Contabilidad/Servidor/srvContabilidad_Impl.dfm b/Source/Modulos/Contabilidad/Servidor/srvContabilidad_Impl.dfm index ddab206e..74151962 100644 --- a/Source/Modulos/Contabilidad/Servidor/srvContabilidad_Impl.dfm +++ b/Source/Modulos/Contabilidad/Servidor/srvContabilidad_Impl.dfm @@ -338,6 +338,110 @@ object srvContabilidad: TsrvContabilidad DataDictionary = DataDictionary Diagrams = Diagrams Datasets = < + item + Params = < + item + Name = 'ID_EMPRESA' + Value = '' + ParamType = daptInput + end + item + Name = 'ID_TIENDA' + Value = '' + ParamType = daptInput + end> + Statements = < + item + Connection = 'IBX' + ConnectionType = 'Interbase' + Default = True + Name = 'IBX' + SQL = + 'select CODIGO_CONTABLE'#10'from empresas_tiendas'#10'where ID_EMPRESA = ' + + ':ID_EMPRESA'#10'and ID = :ID_TIENDA'#10 + StatementType = stSQL + ColumnMappings = < + item + DatasetField = 'CODIGO_CONTABLE' + TableField = 'CODIGO_CONTABLE' + end> + end> + Name = 'DarCodigoContableTienda' + Fields = < + item + Name = 'CODIGO_CONTABLE' + DataType = datString + Size = 2 + end> + end + item + Params = < + item + Name = 'ID_EJERCICIO' + Value = '' + ParamType = daptInput + end + item + Name = 'REF_CUENTA' + Value = '' + ParamType = daptInput + end> + Statements = < + item + Connection = 'IBX' + ConnectionType = 'Interbase' + Default = True + Name = 'IBX' + SQL = + 'select max(cast(substr(cont_subcuentas.ref_subcuenta, 6, 10) as ' + + 'Integer))'#10'from cont_subcuentas'#10'left join cont_cuentas on cont_cu' + + 'entas.id = cont_subcuentas.id_cuenta'#10'where cont_subcuentas.id_ej' + + 'ercicio = :ID_EJERCICIO'#10'and cont_cuentas.ref_cuenta = :REF_CUENT' + + 'A'#10 + StatementType = stSQL + ColumnMappings = < + item + DatasetField = 'MAX' + TableField = 'MAX' + end> + end> + Name = 'DarMaxRefSubCuenta' + Fields = < + item + Name = 'MAX' + DataType = datInteger + end> + end + item + Params = < + item + Name = 'ID_CONTACTO' + Value = '' + ParamType = daptInput + end> + Statements = < + item + Connection = 'IBX' + ConnectionType = 'Interbase' + Default = True + Name = 'IBX' + SQL = + 'select COUNT(ID)'#10'from CONT_SUBCUENTAS'#10'where ID_CONTACTO = :ID_CO' + + 'NTACTO'#10'and {where}'#10#10#10 + StatementType = stSQL + ColumnMappings = < + item + DatasetField = 'COUNT' + TableField = 'COUNT' + end> + end> + Name = 'ExisteSubCuenta' + Fields = < + item + Name = 'COUNT' + DataType = datInteger + end> + end item Params = <> Statements = < @@ -1117,6 +1221,44 @@ object srvContabilidad: TsrvContabilidad JoinDataTables = <> UnionDataTables = <> Commands = < + item + Params = < + item + Name = 'REFERENCIA' + Value = '' + end + item + Name = 'DESCRIPCION' + Value = '' + end + item + Name = 'ID_CUENTA' + Value = '' + end + item + Name = 'ID_EJERCICIO' + Value = '' + end + item + Name = 'ID_CONTACTO' + Value = '' + end> + Statements = < + item + Connection = 'IBX' + ConnectionType = 'Interbase' + Default = True + Name = 'IBX' + SQL = + 'insert into CONT_SUBCUENTAS (ID, REF_SUBCUENTA, DESCRIPCION, ID_' + + 'CUENTA, ID_EJERCICIO, ID_CONTACTO)'#10'values (GEN_ID(gen_cont_subcu' + + 'entas_id, 1), :REFERENCIA, :DESCRIPCION, :ID_CUENTA, :ID_EJERCIC' + + 'IO, :ID_CONTACTO)'#10 + StatementType = stSQL + ColumnMappings = <> + end> + Name = 'AnadirSubCuenta' + end item Params = < item diff --git a/Source/Modulos/Contabilidad/Servidor/srvContabilidad_Impl.pas b/Source/Modulos/Contabilidad/Servidor/srvContabilidad_Impl.pas index 4ab62329..e516dc0b 100644 --- a/Source/Modulos/Contabilidad/Servidor/srvContabilidad_Impl.pas +++ b/Source/Modulos/Contabilidad/Servidor/srvContabilidad_Impl.pas @@ -16,7 +16,11 @@ uses {Used RODLs:} DataAbstract4_Intf, {Generated:} FactuGES_Intf, uDADataTable, uDABINAdapter, uDAClasses, uDAScriptingProvider, uDABusinessProcessor, uDADataStreamer, - uDABin2DataStreamer; + uDABin2DataStreamer, uDAInterfaces; + +const + REFERENCIA_CLIENTES = 430; + REFERENCIA_PROVEEDORES = 400; type { TsrvContabilidad } @@ -33,15 +37,21 @@ type procedure DARemoteServiceCreate(Sender: TObject); procedure DataAbstractServiceBeforeAcquireConnection(aSender: TObject; var aConnectionName: string); private - protected + function darEjercicioActivo(const ID_EMPRESA: Integer): Integer; + + public + function TieneCuentaAsociada(const ID_CONTACTO: Integer; const ID_EMPRESA: Integer): Boolean; + function AnadirSubCuentaCliente(const ID_CONTACTO: Integer; const ID_TIENDA: Integer; const ID_EMPRESA: Integer): Boolean; + function AnadirSubCuentaProveedor(const ID_CONTACTO: Integer; const ID_TIENDA: Integer; const ID_EMPRESA: Integer): Boolean; + end; implementation {$R *.dfm} uses - {Generated:} FactuGES_Invk, uDataModuleServer, - uDatabaseUtils; + {Generated:} FactuGES_Invk, uROClasses, uDataModuleServer, + uDatabaseUtils, srvEjercicios_Impl, Variants; procedure Create_srvContabilidad(out anInstance : IUnknown); begin @@ -49,6 +59,98 @@ begin end; { srvContabilidad } +function TsrvContabilidad.AnadirSubCuentaCliente(const ID_CONTACTO, ID_TIENDA: Integer; const ID_EMPRESA: Integer): Boolean; +var + AConn : IDAConnection; + dsData: IDADataset; + dsCommand: IDASQLCommand; + + RefSubCuenta: String; + NumCuenta: Integer; + RefTienda: String; + NumTienda: Integer; + + +begin + Result := False; + + AConn := dmServer.ConnectionManager.NewConnection(dmServer.ConnectionManager.GetDefaultConnectionName); + + try + try + dsData := schContabilidad.NewDataset(AConn, 'DarMaxRefSubCuenta', ['ID_EJERCICIO', 'REF_CUENTA'], [darEjercicioActivo(ID_EMPRESA), REFERENCIA_CLIENTES]); + dsData.Active := True; + + if VarIsNull(dsData.FieldValues[0]) then + NumCuenta := 0 + else + NumCuenta := dsData.FieldValues[0]; + + Inc(NumCuenta); + RefSubCuenta := format('%.5d', [NumCuenta]); + dsData := NIL; + + dsData := schContabilidad.NewDataset(AConn, 'DarCodigoContableTienda', ['ID_EMPRESA', 'ID_TIENDA'], [ID_EMPRESA, ID_TIENDA]); + dsData.Active := True; + + if VarIsNull(dsData.FieldValues[0]) then + NumTienda := 0 + else + NumTienda := dsData.FieldValues[0]; + + RefTienda := format('%.2d', [NumTienda]); + RefSubCuenta := IntToStr(REFERENCIA_CLIENTES) + RefTienda + RefSubCuenta; + dsData := NIL; + AConn.CommitTransaction; + + except + RaiseError('Error al buscar nueva referencia para la subcuenta'); + AConn.RollbackTransaction; + end; + finally + dsData := NIL; + end; + +// AConn := dmServer.ConnectionManager.NewConnection(dmServer.ConnectionManager.GetDefaultConnectionName); + + try + try + dsCommand := schContabilidad.NewCommand(AConn, 'AnadirSubCuenta'); + with dsCommand do + begin + ParamByName('REFERENCIA').AsString := RefSubCuenta; + ParamByName('DESCRIPCION').AsString := 'Cuenta de Clieeeeeeeeeeeeeeeeeeeeeeente'; + ParamByName('ID_CUENTA').AsInteger := 1; + ParamByName('ID_EJERCICIO').AsInteger := darEjercicioActivo(ID_EMPRESA); + ParamByName('ID_CONTACTO').AsInteger := ID_CONTACTO; + end; + dsCommand.Execute; + AConn.CommitTransaction; + Result := True; + except + RaiseError('Error al crear la nueva subcuenta en tablas'); + AConn.RollbackTransaction; + end; + finally + dsCommand := NIL; + end; +end; + +function TsrvContabilidad.AnadirSubCuentaProveedor(const ID_CONTACTO, ID_TIENDA: Integer; const ID_EMPRESA: Integer): Boolean; +begin + Result := True; +end; + +function TsrvContabilidad.darEjercicioActivo(const ID_EMPRESA: Integer): Integer; +begin + with TsrvEjercicios.Create(NIL) do + try + Result := DarEjercicioActivo(ID_EMPRESA) + finally + Free; + end; +end; + procedure TsrvContabilidad.DARemoteServiceCreate(Sender: TObject); begin SessionManager := dmServer.SessionManager; @@ -60,6 +162,45 @@ begin ConnectionName := dmServer.ConnectionName; end; +function TsrvContabilidad.TieneCuentaAsociada(const ID_CONTACTO: Integer; const ID_EMPRESA: Integer): Boolean; +var + AConn : IDAConnection; + dsData: IDADataset; + AWhere : TDAWhereExpression; + +begin + Result := False; + AWhere := NIL; + + AConn := dmServer.ConnectionManager.NewConnection(dmServer.ConnectionManager.GetDefaultConnectionName); + { Construir la expresión del Where a partir de los parámetros + que se han recibido. + } + with TDAWhereBuilder.Create do + try + AWhere := NewBinaryExpression(NewField('', 'ID_EJERCICIO'), NewConstant(darEjercicioActivo(ID_EMPRESA), datInteger), dboEqual); + finally + Free; + end; + + try + try + dsData := schContabilidad.NewDataset(AConn, 'ExisteSubCuenta', ['ID_CONTACTO'], [ID_CONTACTO]); + dsData.DynamicWhere.Expression := AWhere; + + dsData.Active := True; + Result := (dsData.FieldValues[0] > 0); + AConn.CommitTransaction; + + except + RaiseError('Error al buscar subcuentas del contacto'); + AConn.RollbackTransaction; + end; + finally + dsData := NIL; + end; +end; + initialization TROClassFactory.Create('srvContabilidad', Create_srvContabilidad, TsrvContabilidad_Invoker); diff --git a/Source/Modulos/Contactos/Controller/uClientesController.pas b/Source/Modulos/Contactos/Controller/uClientesController.pas index 380536b5..bc97fb83 100644 --- a/Source/Modulos/Contactos/Controller/uClientesController.pas +++ b/Source/Modulos/Contactos/Controller/uClientesController.pas @@ -321,10 +321,6 @@ begin if (SubCuentas.DataTable.State in dsEditModes) then SubCuentas.DataTable.Post; - if (IGNORAR_CONTABILIDAD = 0) - and (SubCuentas.DataTable.RecordCount = 0) then - raise Exception.Create('El cliente debe tener asociada una subcuenta contable'); - if (BLOQUEADO = 0) then begin Edit; diff --git a/Source/Modulos/Contactos/Model/uBizClientesServer.pas b/Source/Modulos/Contactos/Model/uBizClientesServer.pas index 5918e60b..9dc05e62 100644 --- a/Source/Modulos/Contactos/Model/uBizClientesServer.pas +++ b/Source/Modulos/Contactos/Model/uBizClientesServer.pas @@ -20,7 +20,7 @@ type implementation uses - uDataModuleServer, uDAClasses, + uDataModuleServer, uDAClasses, srvContabilidad_Impl, schContactosClient_Intf, uBusinessUtils; { TBizClienteServer } @@ -53,9 +53,13 @@ var ASchema : TDASchema; ACurrentConn : IDAConnection; ACommand : IDASQLCommand; + idCliente: integer; + idTienda: integer; + idEmpresa: integer; + begin inherited; - + ASchema := BusinessProcessor.Schema; ACurrentConn := GetBusinessProcessorConnection(BusinessProcessor); @@ -80,6 +84,23 @@ begin ParamByName('PROCEDENCIA_CLIENTE').Value := aChange.NewValueByName[fld_ClientesPROCEDENCIA_CLIENTE]; Execute; end; + + + //En caso de no ignorar contabilidad se deberá dar de alta una cuenta para el cliente si el usuario no la ha asignado + if (aChange.NewValueByName[fld_ClientesIGNORAR_CONTABILIDAD] = 0) then + begin + with TsrvContabilidad.Create(NIL) do + try + idCliente := aChange.NewValueByName[fld_ClientesID]; + idTienda := aChange.NewValueByName[fld_ClientesID_TIENDA]; + idEmpresa := aChange.NewValueByName[fld_ClientesID_EMPRESA]; + if not TieneCuentaAsociada(idCliente, idEmpresa) then + AnadirSubCuentaCliente(idCliente, idTienda, idEmpresa); + finally + Free; + end; + end; + finally ACommand := NIL; end; diff --git a/Source/Modulos/Contactos/Views/uViewSubCuentaContacto.dfm b/Source/Modulos/Contactos/Views/uViewSubCuentaContacto.dfm index 13ad0db2..ad5e40a5 100644 --- a/Source/Modulos/Contactos/Views/uViewSubCuentaContacto.dfm +++ b/Source/Modulos/Contactos/Views/uViewSubCuentaContacto.dfm @@ -1,6 +1,5 @@ inherited frViewSubCuentaContacto: TfrViewSubCuentaContacto - Width = 451 - Height = 304 + Width = 575 Align = alClient AutoSize = True OnCreate = CustomViewCreate @@ -10,16 +9,17 @@ inherited frViewSubCuentaContacto: TfrViewSubCuentaContacto object layoutApunte: TdxLayoutControl Left = 0 Top = 0 - Width = 451 - Height = 304 + Width = 575 + Height = 291 Align = alClient ParentBackground = True TabOrder = 0 AutoContentSizes = [acsWidth, acsHeight] - ExplicitWidth = 591 + ExplicitWidth = 451 + ExplicitHeight = 304 DesignSize = ( - 451 - 304) + 575 + 291) object eRefSubCuenta: TcxDBTextEdit Left = 93 Top = 37 @@ -41,7 +41,7 @@ inherited frViewSubCuentaContacto: TfrViewSubCuentaContacto Width = 346 end object BitBtn3: TBitBtn - Left = 119 + Left = 233 Top = 37 Width = 110 Height = 25 @@ -105,7 +105,7 @@ inherited frViewSubCuentaContacto: TfrViewSubCuentaContacto Width = 265 end object BitBtn1: TBitBtn - Left = 235 + Left = 349 Top = 37 Width = 120 Height = 25 @@ -149,7 +149,7 @@ inherited frViewSubCuentaContacto: TfrViewSubCuentaContacto E000E248D100E407DB00FF00FF00FF00FF00FF00FF00FF00FF00} end object BitBtn2: TBitBtn - Left = 361 + Left = 475 Top = 37 Width = 90 Height = 25 diff --git a/Source/Servicios/FactuGES.RODL b/Source/Servicios/FactuGES.RODL index 2d4c6868..d088129f 100644 --- a/Source/Servicios/FactuGES.RODL +++ b/Source/Servicios/FactuGES.RODL @@ -338,6 +338,14 @@ + + + + + + + + @@ -377,6 +385,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/Servicios/FactuGES_Intf.pas b/Source/Servicios/FactuGES_Intf.pas index 899dc100..11e551f2 100644 --- a/Source/Servicios/FactuGES_Intf.pas +++ b/Source/Servicios/FactuGES_Intf.pas @@ -571,6 +571,7 @@ type IsrvEjercicios = interface(IDataAbstractService) ['{E99052D5-4ED9-480C-B4D4-384E8C6E4B08}'] function GenerarPGC(const ID_EJERCICIO_COPIA: Integer; const ID_EJERCICIO: Integer): Boolean; + function darEjercicioActivo(const ID_EMPRESA: Integer): Integer; end; { CosrvEjercicios } @@ -584,6 +585,7 @@ type function __GetInterfaceName:string; override; function GenerarPGC(const ID_EJERCICIO_COPIA: Integer; const ID_EJERCICIO: Integer): Boolean; + function darEjercicioActivo(const ID_EMPRESA: Integer): Integer; end; { IsrvReferencias } @@ -613,6 +615,9 @@ type { IsrvContabilidad } IsrvContabilidad = interface(IDataAbstractService) ['{04CDF2E1-EFC2-4247-AA4F-09BE782C73FA}'] + function TieneCuentaAsociada(const ID_CONTACTO: Integer; const ID_EMPRESA: Integer): Boolean; + function AnadirSubCuentaCliente(const ID_CONTACTO: Integer; const ID_TIENDA: Integer; const ID_EMPRESA: Integer): Boolean; + function AnadirSubCuentaProveedor(const ID_CONTACTO: Integer; const ID_TIENDA: Integer; const ID_EMPRESA: Integer): Boolean; end; { CosrvContabilidad } @@ -625,6 +630,9 @@ type protected function __GetInterfaceName:string; override; + function TieneCuentaAsociada(const ID_CONTACTO: Integer; const ID_EMPRESA: Integer): Boolean; + function AnadirSubCuentaCliente(const ID_CONTACTO: Integer; const ID_TIENDA: Integer; const ID_EMPRESA: Integer): Boolean; + function AnadirSubCuentaProveedor(const ID_CONTACTO: Integer; const ID_TIENDA: Integer; const ID_EMPRESA: Integer): Boolean; end; { IsrvUnidadesMedida } @@ -1542,6 +1550,22 @@ begin end end; +function TsrvEjercicios_Proxy.darEjercicioActivo(const ID_EMPRESA: Integer): Integer; +begin + try + __Message.InitializeRequestMessage(__TransportChannel, 'FactuGES', __InterfaceName, 'darEjercicioActivo'); + __Message.Write('ID_EMPRESA', TypeInfo(Integer), ID_EMPRESA, []); + __Message.Finalize; + + __TransportChannel.Dispatch(__Message); + + __Message.Read('Result', TypeInfo(Integer), result, []); + finally + __Message.UnsetAttributes(__TransportChannel); + __Message.FreeStream; + end +end; + { CosrvReferencias } class function CosrvReferencias.Create(const aMessage: IROMessage; aTransportChannel: IROTransportChannel): IsrvReferencias; @@ -1598,11 +1622,66 @@ begin result := TsrvContabilidad_Proxy.Create(aMessage, aTransportChannel); end; +{ TsrvContabilidad_Proxy } + function TsrvContabilidad_Proxy.__GetInterfaceName:string; begin result := 'srvContabilidad'; end; +function TsrvContabilidad_Proxy.TieneCuentaAsociada(const ID_CONTACTO: Integer; const ID_EMPRESA: Integer): Boolean; +begin + try + __Message.InitializeRequestMessage(__TransportChannel, 'FactuGES', __InterfaceName, 'TieneCuentaAsociada'); + __Message.Write('ID_CONTACTO', TypeInfo(Integer), ID_CONTACTO, []); + __Message.Write('ID_EMPRESA', TypeInfo(Integer), ID_EMPRESA, []); + __Message.Finalize; + + __TransportChannel.Dispatch(__Message); + + __Message.Read('Result', TypeInfo(Boolean), result, []); + finally + __Message.UnsetAttributes(__TransportChannel); + __Message.FreeStream; + end +end; + +function TsrvContabilidad_Proxy.AnadirSubCuentaCliente(const ID_CONTACTO: Integer; const ID_TIENDA: Integer; const ID_EMPRESA: Integer): Boolean; +begin + try + __Message.InitializeRequestMessage(__TransportChannel, 'FactuGES', __InterfaceName, 'AnadirSubCuentaCliente'); + __Message.Write('ID_CONTACTO', TypeInfo(Integer), ID_CONTACTO, []); + __Message.Write('ID_TIENDA', TypeInfo(Integer), ID_TIENDA, []); + __Message.Write('ID_EMPRESA', TypeInfo(Integer), ID_EMPRESA, []); + __Message.Finalize; + + __TransportChannel.Dispatch(__Message); + + __Message.Read('Result', TypeInfo(Boolean), result, []); + finally + __Message.UnsetAttributes(__TransportChannel); + __Message.FreeStream; + end +end; + +function TsrvContabilidad_Proxy.AnadirSubCuentaProveedor(const ID_CONTACTO: Integer; const ID_TIENDA: Integer; const ID_EMPRESA: Integer): Boolean; +begin + try + __Message.InitializeRequestMessage(__TransportChannel, 'FactuGES', __InterfaceName, 'AnadirSubCuentaProveedor'); + __Message.Write('ID_CONTACTO', TypeInfo(Integer), ID_CONTACTO, []); + __Message.Write('ID_TIENDA', TypeInfo(Integer), ID_TIENDA, []); + __Message.Write('ID_EMPRESA', TypeInfo(Integer), ID_EMPRESA, []); + __Message.Finalize; + + __TransportChannel.Dispatch(__Message); + + __Message.Read('Result', TypeInfo(Boolean), result, []); + finally + __Message.UnsetAttributes(__TransportChannel); + __Message.FreeStream; + end +end; + { CosrvUnidadesMedida } class function CosrvUnidadesMedida.Create(const aMessage: IROMessage; aTransportChannel: IROTransportChannel): IsrvUnidadesMedida; diff --git a/Source/Servicios/FactuGES_Invk.pas b/Source/Servicios/FactuGES_Invk.pas index 4569ec5a..ae3db3ef 100644 --- a/Source/Servicios/FactuGES_Invk.pas +++ b/Source/Servicios/FactuGES_Invk.pas @@ -174,6 +174,7 @@ type protected published procedure Invoke_GenerarPGC(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions); + procedure Invoke_darEjercicioActivo(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions); end; TsrvReferencias_Invoker = class(TDataAbstractService_Invoker) @@ -188,6 +189,9 @@ type private protected published + procedure Invoke_TieneCuentaAsociada(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions); + procedure Invoke_AnadirSubCuentaCliente(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions); + procedure Invoke_AnadirSubCuentaProveedor(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions); end; TsrvUnidadesMedida_Invoker = class(TDataAbstractService_Invoker) @@ -707,6 +711,26 @@ begin end; end; +procedure TsrvEjercicios_Invoker.Invoke_darEjercicioActivo(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions); +{ function darEjercicioActivo(const ID_EMPRESA: Integer): Integer; } +var + ID_EMPRESA: Integer; + lResult: Integer; +begin + try + __Message.Read('ID_EMPRESA', TypeInfo(Integer), ID_EMPRESA, []); + + lResult := (__Instance as IsrvEjercicios).darEjercicioActivo(ID_EMPRESA); + + __Message.InitializeResponseMessage(__Transport, 'FactuGES', 'srvEjercicios', 'darEjercicioActivoResponse'); + __Message.Write('Result', TypeInfo(Integer), lResult, []); + __Message.Finalize; + __Message.UnsetAttributes(__Transport); + + finally + end; +end; + { TsrvReferencias_Invoker } procedure TsrvReferencias_Invoker.Invoke_DarNuevaReferencia(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions); @@ -755,5 +779,77 @@ begin end; end; +{ TsrvContabilidad_Invoker } + +procedure TsrvContabilidad_Invoker.Invoke_TieneCuentaAsociada(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions); +{ function TieneCuentaAsociada(const ID_CONTACTO: Integer; const ID_EMPRESA: Integer): Boolean; } +var + ID_CONTACTO: Integer; + ID_EMPRESA: Integer; + lResult: Boolean; +begin + try + __Message.Read('ID_CONTACTO', TypeInfo(Integer), ID_CONTACTO, []); + __Message.Read('ID_EMPRESA', TypeInfo(Integer), ID_EMPRESA, []); + + lResult := (__Instance as IsrvContabilidad).TieneCuentaAsociada(ID_CONTACTO, ID_EMPRESA); + + __Message.InitializeResponseMessage(__Transport, 'FactuGES', 'srvContabilidad', 'TieneCuentaAsociadaResponse'); + __Message.Write('Result', TypeInfo(Boolean), lResult, []); + __Message.Finalize; + __Message.UnsetAttributes(__Transport); + + finally + end; +end; + +procedure TsrvContabilidad_Invoker.Invoke_AnadirSubCuentaCliente(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions); +{ function AnadirSubCuentaCliente(const ID_CONTACTO: Integer; const ID_TIENDA: Integer; const ID_EMPRESA: Integer): Boolean; } +var + ID_CONTACTO: Integer; + ID_TIENDA: Integer; + ID_EMPRESA: Integer; + lResult: Boolean; +begin + try + __Message.Read('ID_CONTACTO', TypeInfo(Integer), ID_CONTACTO, []); + __Message.Read('ID_TIENDA', TypeInfo(Integer), ID_TIENDA, []); + __Message.Read('ID_EMPRESA', TypeInfo(Integer), ID_EMPRESA, []); + + lResult := (__Instance as IsrvContabilidad).AnadirSubCuentaCliente(ID_CONTACTO, ID_TIENDA, ID_EMPRESA); + + __Message.InitializeResponseMessage(__Transport, 'FactuGES', 'srvContabilidad', 'AnadirSubCuentaClienteResponse'); + __Message.Write('Result', TypeInfo(Boolean), lResult, []); + __Message.Finalize; + __Message.UnsetAttributes(__Transport); + + finally + end; +end; + +procedure TsrvContabilidad_Invoker.Invoke_AnadirSubCuentaProveedor(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions); +{ function AnadirSubCuentaProveedor(const ID_CONTACTO: Integer; const ID_TIENDA: Integer; const ID_EMPRESA: Integer): Boolean; } +var + ID_CONTACTO: Integer; + ID_TIENDA: Integer; + ID_EMPRESA: Integer; + lResult: Boolean; +begin + try + __Message.Read('ID_CONTACTO', TypeInfo(Integer), ID_CONTACTO, []); + __Message.Read('ID_TIENDA', TypeInfo(Integer), ID_TIENDA, []); + __Message.Read('ID_EMPRESA', TypeInfo(Integer), ID_EMPRESA, []); + + lResult := (__Instance as IsrvContabilidad).AnadirSubCuentaProveedor(ID_CONTACTO, ID_TIENDA, ID_EMPRESA); + + __Message.InitializeResponseMessage(__Transport, 'FactuGES', 'srvContabilidad', 'AnadirSubCuentaProveedorResponse'); + __Message.Write('Result', TypeInfo(Boolean), lResult, []); + __Message.Finalize; + __Message.UnsetAttributes(__Transport); + + finally + end; +end; + initialization end. diff --git a/Source/Servicios/RODLFILE.res b/Source/Servicios/RODLFILE.res index 88ed20958a82d103e480fc3bc375c46c66c3d019..2762cfb95d0a917ab984f6032b8f650643a648dd 100644 GIT binary patch delta 469 zcmbWzO-jQ+7{+m`h(!@<@Bp>@k(tbA7DeVO+C@LGachZ577Ac`9=@c!QabN}4-%~* zh@_5&HGo{3dd+X*g_1>_=GAz9xq|d{jn1;QV-VI%NCN~%rcTii2*E4}EJR#}$TA`R za<(T?&koF2*l*YTa7R_S$g;Go*0S{t<5(#W%AhW!to{K~1FYgy2bdvE$$#Y4#_xTy F{|TanhKc|H delta 33 pcmaETl5xg9#t8~cC*n3L9dn;7AmX;!$+LiUa=)_Y=3T*tf&lIz4Fv!I diff --git a/Source/Servidor/uDataModuleServer.dfm b/Source/Servidor/uDataModuleServer.dfm index 269792d9..01de9c07 100644 --- a/Source/Servidor/uDataModuleServer.dfm +++ b/Source/Servidor/uDataModuleServer.dfm @@ -39,8 +39,9 @@ object dmServer: TdmServer item Name = 'IBX' ConnectionString = - 'IBX?Server=localhost;Database=C:\Codigo Acana\Database\ACANA.FDB' + - ';UserID=sysdba;Password=masterkey;Dialect=3;Charset=ISO8859_1;' + 'IBX?Server=localhost;Database=C:\Codigo Acana\Output\Debug\Datab' + + 'ase\FactuGES.FDB;UserID=sysdba;Password=masterkey;Dialect=3;Char' + + 'set=ISO8859_1;' ConnectionType = 'Interbase' Default = True end>