Como paso preliminar , debemos poder convertir cualquier numero de cuenta a procesar en su numero iban .
He encontrado este código en javascript que puede facilitar mucho el construir una función para crear codigo iban :
el codigo pasado a harbour pasado rápido ( sin comprobar ) :
Code: Select all | Expand
Function MakeIbanSpain(nEntidad,nOficina,nDc,nCuenta)
local Country_Code := "1428"
local iban, MOD_1,MOD_iban
if !validarCC(nEntidad,nOficina,nDc,nCuenta)
Msginfo("cuenta no valida")
Return .f.
endif
iban := alltrim(Str(nEntidad) + Alltrim(str(nOficina)
MOD_1 = iban % 97
iban = "" + MOD_1 + alltrim(str(nDC) + left( alltrim(str(ncuenta)) ,2 )
MOD_1 = iban % 97
iban = "" + MOD_1 + substr( alltrim(str(ncuenta)),3,7) + Country_Code + '00';
MOD_iban = iban % 97
Return MOD_iban
el codigo original :
Code: Select all | Expand
function MakeIBANSpain(form, lang)
{
if (lang == "en") {
alert('This conversion tool is provided for information purposes only. The authors reserve the right to remove or cancel its diffusion, either partially or in whole, as well as to modify its structure or contents without previous notice. Access to the information supplied by this tool can be restricted or forbidden anytime.\n\n Though every attempt has been made to ensure that the information contained in this tool is reliable and up-to-date in order to try to avoid and minimize potential mistakes, the authors are not responsible for any errors, omissions or even for the interruption of the service. Hence, all information in this site is provided "as is", with no guarantee of completeness, accuracy, timeliness or of the results obtained from the use of this information.\n\n In no event will the authors be liable to provide compensation to anyone for any decisions made or actions taken in reliance of the information obtained from the use of this tool or for any consequential, special or similar damages including those on the user software or hardware, even if advised of the possibility of such damages. \n\nBy using this conversion tool, you acknowledge you have read, understood and accepted the above provisions and agreed with the terms of the service.');
} else {
alert('La presente herramienta de conversión se facilita únicamente a título informativo, reservándose los autores el derecho de eliminar o suspender su difusión, total o parcialmente, y de modificar la estructura y contenido de esta herramienta sin aviso previo, pudiendo incluso limitar o no permitir el acceso a la información que suministra dicha herramienta.\n\n El propósito de los autores es mantener la calidad y actualización de su información y evitar y minimizar posibles errores causados por fallos. Sin embargo, no garantiza que este servicio no sea interrumpido o afectado por eventuales fallos. \n\nComo consecuencia de lo anterior, los autores no responderán de los daños o perjuicios causados por decisiones tomadas en base a la información obtenida de esta herramienta; ni de posibles inexactitudes, omisiones o errores contenidos en dicha información, ni de los problemas que se originen por el uso de esta herramienta, ni de los daños y/o perjuicios en el software o hardware del usuario que se deriven su utilización. \n\nLos usuarios de esta herramienta, al acceder a la misma, aceptan la presente cláusula, estando de acuerdo con su contenido.');
}
if (!validarCC(form)) {
document.getElementById("ibanprintxt").innerHTML="";
if (lang == "en") {
alert('The account number is incorrect.');
} else {
alert('El numero de cuenta introducido es incorrecto.');
}
} else {
Country_Code = "1428"; // Código de españa
iban = String(form.entitat.value) + String(form.oficina.value);
MOD_1 = iban % 97;
iban = "" + MOD_1 + form.dc.value + form.compte.value.substring(0,2);
MOD_1 = iban % 97;
iban = "" + MOD_1 + form.compte.value.substring(2,form.compte.value.length) + Country_Code + '00';
MOD_iban = iban % 97;
CC_iban = 98 - MOD_iban;
if(CC_iban<10){
CC_iban = "0" + CC_iban;
}
document.getElementById("ibanprintxt").innerHTML = "IBAN " + "ES" + CC_iban + " " + form.entitat.value + " " + form.oficina.value + " " + form.dc.value + form.compte.value.substring(0, 2) + " " + form.compte.value.substring(2, 6) + " " + form.compte.value.substring(6);
}
}