Comunidad de diseño web y desarrollo en internet online

cantidad moneda a texto

Citar            
MensajeEscrito el 19 Sep 2007 11:18 pm
alguien ya lo hizo en Flash? convertir cantidad de moneda a texto :?

Por harry - Burn Her Alive

8 de clabLevel



Genero:Masculino  

firefox
Citar            
MensajeEscrito el 19 Sep 2007 11:27 pm
demas, pero me da flojeritis xD suerte

Por bhzrd_rs4

1 de clabLevel



Genero:Masculino  

firefox
Citar            
MensajeEscrito el 20 Sep 2007 04:48 pm
Yo ya lo tengo y te lo paso, pero solo funciona hasta centenas, pero seguro que lo puedes modificar para millares y más:

Código :

arrUnidades = ["", "uno", "dos", "tres", "cuatro", "cinco", "seis", "siete", "ocho", "nueve", "diez", "once", "doce", "trece", "catorce", "quince", "dieciseís", "diecisiete", "dieciocho", "diecinueve", "veinte", "veintiuno", "veintidós", "veintitrés", "veinticuatro", "veinticinco", "veintiseís", "veintisiete", "veintiocho", "veintinueve"];
arrDecenas = ["", "", "", "treinta", "cuarenta", "cincuenta", "sesenta", "setenta", "ochenta", "noventa"];
arrCentenas = ["cien", "ciento", "doscientos", "trescientos", "cuatrocientos", "quinientos", "seiscientos", "setecientos", "ochocientos", "novecientos"];
//**********************************************************************
function SeparaNumero(nTemp)
{
    nText = nTemp.toString();
    if (nText.length > 3) {  // función no habilitada para manejar millares
        return;
    } 
    nText = (nText.length < 3 ? ("0") : ("")) + nText;
    nText = (nText.length < 3 ? ("0") : ("")) + nText;
    Unid = Number(nText.substr(2, 1));
    Dece = Number(nText.substr(1, 1));
    Cent = Number(nText.substr(0, 1));
    DeceUnid = Number(nText.substr(1, 2));
    trace (nTemp + " -> " + DeceUnid + "," + Cent + "," + Dece + "," + Unid);
    return ([DeceUnid, Cent, Dece, Unid]);
} 
//**********************************************************************
function ConvierteNumLet() {
    Centenas = _global.arrNum[1];
    Decenas = _global.arrNum[2];
    Unidades = _global.arrNum[3];
    DecenasUnidades = _global.arrNum[0];
    var _loc2 = "";
    if (Centenas == 1 && Decenas == 0 && Unidades == 0) {
        _loc2 = arrCentenas[0];
    } else if (Centenas > 0) {
        _loc2 = arrCentenas[Centenas];
    } 
   
   if (DecenasUnidades < 21) {
        _loc2 = _loc2 + (" " + arrUnidades[DecenasUnidades]);
    } else if (DecenasUnidades < 30) {
        _loc2 = _loc2 + (" " + arrUnidades[DecenasUnidades]);
    } else {
        _loc2 = _loc2 + (" " + arrDecenas[Decenas]);
        if (Unidades > 0) {
            _loc2 = _loc2 + (" y " + arrUnidades[Unidades]);
        } 
    } 
    trace (_global.arrNum + " -> " + _loc2);
    return (_loc2);
} 
//**********************************************************************
_global.arrNum = SeparaNumero(_root.Numero.text); // se toma el numero de un campo de texto que fue capturado previamente
_root.Letras.text = ConvierteNumLet(); // aqui se muestra el numero convertido a letras, en un campo de texto

Por gabynufe

Claber

446 de clabLevel



 

México, D.F.

msie7
Citar            
MensajeEscrito el 20 Sep 2007 07:56 pm
Wow. Funciona muy bien ^^, lo guardare por si las dudas XD...
Gracias gabynufe.

Por Wako

77 de clabLevel



 

firefox
Citar            
MensajeEscrito el 22 Sep 2007 11:32 pm
:D ok muy bueno lo voy a probar lo antes posible :lol:
gracias

Por harry - Burn Her Alive

8 de clabLevel



Genero:Masculino  

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.