From 1dbfbd1fca2603a47f69d969da9858248aee67d5 Mon Sep 17 00:00:00 2001 From: david Date: Fri, 13 Dec 2013 13:07:39 +0000 Subject: [PATCH] =?UTF-8?q?-=20Generar=20y=20comprobar=20los=20c=C3=B3digo?= =?UTF-8?q?s=20IBAN=20en=20empresas=20y=20contactos.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://192.168.0.254/svn/Proyectos.LuisLeon_FactuGES2/trunk@205 b2cfbe5a-eba1-4a0c-8b32-7feea0a119f2 --- Source/ApplicationBase/ApplicationBase.res | Bin 4748 -> 384 bytes .../uDatosBancariosEmpresaController.pas | 47 +- .../Views/uEditorDatosBancariosEmpresa.dfm | 28 +- .../Views/uEditorDatosBancariosEmpresa.pas | 59 +- Source/Base/Base.RES | Bin 384 -> 4748 bytes Source/Base/Base.dproj | 128 ++- Source/Base/Utiles/uIBANUtils.pas | 19 +- .../Controller/uContactosController.pas | 2 +- .../uDatosBancariosContactoController.pas | 50 +- .../Contactos/Views/Contactos_view.identcache | Bin 3843 -> 3843 bytes Source/Servidor/FactuGES_Server.RES | Bin 23212 -> 23212 bytes Source/Servidor/FactuGES_Server.dproj | 829 +++++++++--------- Source/Servidor/FactuGES_Server.rc | 2 +- 13 files changed, 634 insertions(+), 530 deletions(-) diff --git a/Source/ApplicationBase/ApplicationBase.res b/Source/ApplicationBase/ApplicationBase.res index 1641339fcc482e7e3492d1b45813a86619622c33..8b251f312bcccec5485024f6fe8d80e1cdf25746 100644 GIT binary patch delta 11 ScmeBCZD5|Duvteife`=|>;pCc 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 diff --git a/Source/ApplicationBase/Empresas/Controller/uDatosBancariosEmpresaController.pas b/Source/ApplicationBase/Empresas/Controller/uDatosBancariosEmpresaController.pas index ebdfe04..23ee298 100644 --- a/Source/ApplicationBase/Empresas/Controller/uDatosBancariosEmpresaController.pas +++ b/Source/ApplicationBase/Empresas/Controller/uDatosBancariosEmpresaController.pas @@ -10,6 +10,9 @@ uses type IDatosBancariosEmpresaController = interface(IControllerBase) ['{E9B0313E-7B16-420A-B47E-20E42E96BAC6}'] + function GenerarCodigoIBAN (ADatosBancarios : IBizEmpresasDatosBancarios) : string; + function ValidarCodigoIBAN (AIBAN : string) : boolean; + function ValidarDatosBancarios(ADatosBancarios : IBizEmpresasDatosBancarios; AEmpresa : IBizEmpresa): Boolean; procedure Ver(ADatosBancarios : IBizEmpresasDatosBancarios); end; @@ -18,7 +21,9 @@ type FDataModule : IDataModuleEmpresas; protected public - function ValidarDatosBancarios(ADatosBancarios : IBizEmpresasDatosBancarios; AEmpresa : IBizEmpresa): Boolean; virtual; + function GenerarCodigoIBAN (ADatosBancarios : IBizEmpresasDatosBancarios) : string; + function ValidarCodigoIBAN (AIBAN : string) : boolean; + function ValidarDatosBancarios(ADatosBancarios : IBizEmpresasDatosBancarios; AEmpresa : IBizEmpresa): Boolean; virtual; procedure Ver(ADatosBancarios : IBizEmpresasDatosBancarios); constructor Create; override; destructor Destroy; override; @@ -30,7 +35,7 @@ implementation uses uDataModuleEmpresas, schEmpresasClient_Intf, uIEditorDatosBancarioEmpresa, - uEditorRegistryUtils, cxControls, uIBANUtils; + uEditorRegistryUtils, cxControls, uIBANUtils, uStringsUtils; constructor TDatosBancariosEmpresaController.Create; begin @@ -44,38 +49,58 @@ begin inherited; end; +function TDatosBancariosEmpresaController.GenerarCodigoIBAN( + ADatosBancarios: IBizEmpresasDatosBancarios): string; +begin + Result := uIBANUtils.GenerarCodigoIBAN(ADatosBancarios.ENTIDAD, + ADatosBancarios.SUCURSAL, ADatosBancarios.DC, ADatosBancarios.CUENTA); +end; + +function TDatosBancariosEmpresaController.ValidarCodigoIBAN( + AIBAN: string): boolean; +begin + result := EsCodigoIBANValido(AIBAN) +end; + function TDatosBancariosEmpresaController.ValidarDatosBancarios( ADatosBancarios: IBizEmpresasDatosBancarios; AEmpresa : IBizEmpresa): Boolean; begin ADatosBancarios.DataTable.Edit; try - if not ADatosBancarios.IBANIsNull then + if not EsCadenaVacia(ADatosBancarios.IBAN) then begin ADatosBancarios.IBAN := StringReplace(ADatosBancarios.IBAN, ' ', '', [rfReplaceAll]); // Quitar espacios - if EsCodigoIBANValido(ADatosBancarios.IBAN) then - raise Exception.Create('Comprueba que el código IBAN indicado es correcto.'); + if not ValidarCodigoIBAN(ADatosBancarios.IBAN) then + raise Exception.Create(Format('Compruebe que el código IBAN de la cuenta %s es correcto.', [ADatosBancarios.NOMBRE])); + end + else begin + if not EsCadenaVacia(ADatosBancarios.ENTIDAD) and + not EsCadenaVacia(ADatosBancarios.SUCURSAL) and + not EsCadenaVacia(ADatosBancarios.DC) and + not EsCadenaVacia(ADatosBancarios.CUENTA) then + ADatosBancarios.IBAN := GenerarCodigoIBAN(ADatosBancarios); end; - if ADatosBancarios.SUFIJO_PRESENTADORIsNull then + if not EsCadenaVacia(ADatosBancarios.SUFIJO_PRESENTADOR) then ADatosBancarios.SUFIJO_PRESENTADOR := ADatosBancarios.SUFIJO_ACREEDOR; - if ADatosBancarios.ENTIDAD_PRESENTADORIsNull then + if not EsCadenaVacia(ADatosBancarios.ENTIDAD_PRESENTADOR) then ADatosBancarios.ENTIDAD_PRESENTADOR := ADatosBancarios.ENTIDAD; - if ADatosBancarios.SUCURSAL_PRESENTADORIsNull then + if not EsCadenaVacia(ADatosBancarios.SUCURSAL_PRESENTADOR) then ADatosBancarios.SUCURSAL_PRESENTADOR := ADatosBancarios.SUCURSAL; - if ADatosBancarios.NIF_CIF_PRESENTADORIsNull then + if not EsCadenaVacia(ADatosBancarios.NIF_CIF_PRESENTADOR) then ADatosBancarios.NIF_CIF_PRESENTADOR := AEmpresa.NIF_CIF; - if ADatosBancarios.NOMBRE_PRESENTADORIsNull then + if not EsCadenaVacia(ADatosBancarios.NOMBRE_PRESENTADOR) then ADatosBancarios.NOMBRE_PRESENTADOR := AEmpresa.NOMBRE; finally ADatosBancarios.DataTable.Post; - Result := True; end; + Result := True; end; procedure TDatosBancariosEmpresaController.Ver(ADatosBancarios : IBizEmpresasDatosBancarios); diff --git a/Source/ApplicationBase/Empresas/Views/uEditorDatosBancariosEmpresa.dfm b/Source/ApplicationBase/Empresas/Views/uEditorDatosBancariosEmpresa.dfm index 75c60fa..18d94be 100644 --- a/Source/ApplicationBase/Empresas/Views/uEditorDatosBancariosEmpresa.dfm +++ b/Source/ApplicationBase/Empresas/Views/uEditorDatosBancariosEmpresa.dfm @@ -9,6 +9,7 @@ object fEditorDatosBancariosEmpresa: TfEditorDatosBancariosEmpresa ParentFont = True OldCreateOrder = True Position = poOwnerFormCenter + OnCloseQuery = FormCloseQuery DesignSize = ( 449 469) @@ -117,6 +118,7 @@ object fEditorDatosBancariosEmpresa: TfEditorDatosBancariosEmpresa DataSource = dsDatosBancarios MaxLength = 4 TabOrder = 1 + OnExit = eCodEntidadExit end object eCodSucursal: TDBEdit Left = 109 @@ -127,6 +129,7 @@ object fEditorDatosBancariosEmpresa: TfEditorDatosBancariosEmpresa DataSource = dsDatosBancarios MaxLength = 4 TabOrder = 2 + OnExit = eCodSucursalExit end object eDC: TDBEdit Left = 109 @@ -137,6 +140,7 @@ object fEditorDatosBancariosEmpresa: TfEditorDatosBancariosEmpresa DataSource = dsDatosBancarios MaxLength = 2 TabOrder = 3 + OnExit = eDCExit end object eCuenta: TDBEdit Left = 109 @@ -146,6 +150,7 @@ object fEditorDatosBancariosEmpresa: TfEditorDatosBancariosEmpresa DataField = 'CUENTA' DataSource = dsDatosBancarios TabOrder = 4 + OnExit = eCuentaExit end object eSWIFT: TDBEdit Left = 109 @@ -154,17 +159,18 @@ object fEditorDatosBancariosEmpresa: TfEditorDatosBancariosEmpresa Height = 21 DataField = 'SWIFT' DataSource = dsDatosBancarios - TabOrder = 5 + TabOrder = 6 + end + object eIBAN: TDBEdit + Left = 109 + Top = 170 + Width = 204 + Height = 21 + DataField = 'IBAN' + DataSource = dsDatosBancarios + TabOrder = 5 + OnExit = eIBANExit end - end - object eIBAN: TDBEdit - Left = 117 - Top = 178 - Width = 204 - Height = 21 - DataField = 'IBAN' - DataSource = dsDatosBancarios - TabOrder = 3 end object GroupBox3: TGroupBox Left = 8 @@ -172,7 +178,7 @@ object fEditorDatosBancariosEmpresa: TfEditorDatosBancariosEmpresa Width = 433 Height = 215 Caption = 'Configuraci'#243'n de norma SEPA' - TabOrder = 4 + TabOrder = 3 object Label10: TLabel Left = 12 Top = 28 diff --git a/Source/ApplicationBase/Empresas/Views/uEditorDatosBancariosEmpresa.pas b/Source/ApplicationBase/Empresas/Views/uEditorDatosBancariosEmpresa.pas index 35e006f..9654e23 100644 --- a/Source/ApplicationBase/Empresas/Views/uEditorDatosBancariosEmpresa.pas +++ b/Source/ApplicationBase/Empresas/Views/uEditorDatosBancariosEmpresa.pas @@ -45,6 +45,12 @@ type eCodEntidadPresentador: TDBEdit; Label18: TLabel; eCodSucursalPresentador: TDBEdit; + procedure eCodEntidadExit(Sender: TObject); + procedure eCodSucursalExit(Sender: TObject); + procedure eDCExit(Sender: TObject); + procedure eCuentaExit(Sender: TObject); + procedure eIBANExit(Sender: TObject); + procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); protected FController : IDatosBancariosEmpresaController; FDatosBancarios: IBizEmpresasDatosBancarios; @@ -54,6 +60,8 @@ type function GetDatosBancarios: IBizEmpresasDatosBancarios; procedure SetDatosBancarios(const Value: IBizEmpresasDatosBancarios); + + procedure CalcularCodigoIBAN(); public constructor Create(AOwner: TComponent); override; destructor Destroy; override; @@ -65,12 +73,24 @@ type implementation uses - Variants; + Variants, uStringsUtils; {$R *.dfm} { TfEditorDireccion } +procedure TfEditorDatosBancariosEmpresa.CalcularCodigoIBAN; +begin + if not EsCadenaVacia(FDatosBancarios.ENTIDAD) and + not EsCadenaVacia(FDatosBancarios.SUCURSAL) and + not EsCadenaVacia(FDatosBancarios.DC) and + not EsCadenaVacia(FDatosBancarios.CUENTA) then + begin + FDatosBancarios.Edit; + FDatosBancarios.IBAN := FController.GenerarCodigoIBAN(FDatosBancarios); + end; +end; + constructor TfEditorDatosBancariosEmpresa.Create(AOwner: TComponent); begin inherited; @@ -83,6 +103,43 @@ begin inherited; end; +procedure TfEditorDatosBancariosEmpresa.eCodEntidadExit(Sender: TObject); +begin + CalcularCodigoIBAN(); +end; + +procedure TfEditorDatosBancariosEmpresa.eCodSucursalExit(Sender: TObject); +begin + CalcularCodigoIBAN(); +end; + +procedure TfEditorDatosBancariosEmpresa.eCuentaExit(Sender: TObject); +begin + CalcularCodigoIBAN(); +end; + +procedure TfEditorDatosBancariosEmpresa.eDCExit(Sender: TObject); +begin + CalcularCodigoIBAN(); +end; + +procedure TfEditorDatosBancariosEmpresa.eIBANExit(Sender: TObject); +begin + if not EsCadenaVacia(eIBAN.Text) and not FController.ValidarCodigoIBAN(eIBAN.Text) then + begin + raise Exception.Create('Compruebe que el código IBAN indicado es correcto.'); + end; +end; + +procedure TfEditorDatosBancariosEmpresa.FormCloseQuery(Sender: TObject; + var CanClose: Boolean); +begin + if not EsCadenaVacia(eIBAN.Text) and not FController.ValidarCodigoIBAN(eIBAN.Text) then + begin + raise Exception.Create('Compruebe que el código IBAN indicado es correcto.'); + end; +end; + function TfEditorDatosBancariosEmpresa.GetController: IDatosBancariosEmpresaController; begin Result := FController; 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/Base/Base.dproj b/Source/Base/Base.dproj index 5157b67..970fa2b 100644 --- a/Source/Base/Base.dproj +++ b/Source/Base/Base.dproj @@ -53,30 +53,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - Microsoft Office 2000 Sample Automation Server Wrapper Components Microsoft Office XP Sample Automation Server Wrapper Components Base.dpk @@ -95,6 +71,58 @@ TDataModule + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
fConfigurarConexion
TForm @@ -118,59 +146,14 @@
dmBase
TDataModule
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -194,13 +177,6 @@ - - - - - - -