Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 13-07-2007
Arturo_ Arturo_ is offline
Miembro
 
Registrado: jul 2007
Posts: 48
Poder: 0
Arturo_ Va por buen camino
Convierte de Numeros a Letras mas Decimales

Código Delphi [-]
// **** SPLASH ****
// Por: Arturo Vidal Gómez
// Versión: 1.000.000
// Copyright © 1980, 2007
// Derechos - Reservados
// Arequipa, Perú
// PASCAL - DELPHI (Client Server Suite)
// Ingeniería de Software
 
unit Splash;
 
interface
 
uses
  SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls, jpeg, Gauges, DateUtils;
 
// For NumbersToLetters
const
  // Table Unidades 0 - 9
  LIBRARY_Table_0001 : packed array[0..9] of string =
                       ('CERO', 'UNO', 'DOS', 'TRES', 'CUATRO', 'CINCO',
                        'SEIS', 'SIETE', 'OCHO', 'NUEVE');
  // Table Decenas 10 - 19
  LIBRARY_Table_0002 : packed array[0..9] of string =
                       ('DIEZ', 'ONCE', 'DOCE', 'TRECE', 'CATORCE', 'QUINCE',
                        'DIECISEIS', 'DIECISIETE', 'DIECIOCHO', 'DIECINUEVE');
  // Table Decenas 20 - 90
  LIBRARY_Table_0003 : packed array[2..9] of string =
                       ('VEINTE', 'TREINTA', 'CUARENTA', 'CINCUENTA',
                        'SESENTA', 'SETENTA', 'OCHENTA', 'NOVENTA');
  // Table Centenas 100 - 900
  LIBRARY_Table_0004 : packed array[0..9] of string =
                       ('', 'CIEN', 'DOSCIENTOS', 'TRESCIENTOS', 'CUATROCIENTOS',
                        'QUINIENTOS', 'SEISCIENTOS', 'SETENCIENTOS',
                        'OCHOCIENTOS', 'NOVECIENTOS');
 
const
  SubChar_ON     : Boolean = True;   // Enabled Reemplazar UNO por UN
  SubChar_OFF    : Boolean = False;  // Disabled Reemplazar UNO por UN
  Sep_NULL       : Integer = 0;      // Value NULL
  Sep_MIL        : Integer = 1;      // Separador de Miles
  Sep_MILLON     : Integer = 2;      // Separador de Millones
 
const
  asm_POINT      : string = '.';
  asm_COMET      : string = ',';
  asm_DECIMALS   : string = '0000000000';
  asm_VALID      : set of char = ['0'..'9', '.', ','];

var
  lib_RESULT_CNA        : string;
  lib_DIGITS_ALF        : string;
  lib_DIGITS_INT        : string;
  lib_DIGITS_DEC        : string;
  lib_TYPE              : string;
 
// INTERFACE Procedimientos para Conversiones

function NumbersToLetters(pmt_NUMBER, pmt_TYPE: string; pmt_DEC: Integer): string; export;
implementation
 
{$R *.DFM}
// IMPLEMENTATION Procedimientos para Conversiones

// NumbersToLetters Numeros a Letras
function NumbersToLetters(pmt_NUMBER, pmt_TYPE: string; pmt_DEC: Integer): string; export;
var
  Loop : Integer;
  // Seleccionar TIPO 1 2 ó 3
  // TIPO 1 = 0   para las Unidades
  // TIPO 2 = 00  para las Decenas
  // TIPO 3 = 000 para las Centenas
  // 12 Digitos y n Decimales
  // 999,000,000,000.00
  function Select_TYPE(pmt_DIGITS_INT: string; Flag_SUB: Boolean;
    Flag_SEP: Integer): string;
    // Seleccionar Separador MIL MILLON...
    procedure Select_SEP(pmt_DIGITS_INT: string; Flag_SUB: Boolean;
      Flag_SEP: Integer);
    begin
      if (Flag_SUB) and
         (Length(lib_DIGITS_INT) >= 4) and
         (Length(lib_DIGITS_INT) <= 12) then
      begin
        if Flag_SEP = sep_MIL then
          lib_DIGITS_ALF := lib_DIGITS_ALF + ' MIL '
        else
        if Flag_SEP = sep_MILLON then
        begin
          lib_DIGITS_ALF := lib_DIGITS_ALF + ' MILLONES ';
          // Elimina 'ES' de 'MILLONES' si Primer Digito es 1
          if (Length(lib_DIGITS_INT) = 7) and
             (Copy(pmt_DIGITS_INT, 1, 1) = '1') then
            SYSTEM.Delete(lib_DIGITS_ALF, 10, 2);
        end;
      end;
    end;
  begin
    (* DIGITS = 1 *)
    if (Length(pmt_DIGITS_INT) = 1) then
    begin
      lib_DIGITS_ALF := LIBRARY_Table_0001[StrToInt(pmt_DIGITS_INT)];
      // Remplaza UNO por UN
      if (Flag_SUB) and
         (Copy(pmt_DIGITS_INT, 1, 1) = '1') then
        SYSTEM.Delete(lib_DIGITS_ALF, Length(lib_DIGITS_ALF), 1);
      Select_SEP(pmt_DIGITS_INT, Flag_SUB, Flag_SEP);
    end;
    (* DIGITS = 2 *)
    if (Length(pmt_DIGITS_INT) = 2) then
    begin
      // Asigna de 10 - 19
      if (Copy(pmt_DIGITS_INT, 1, 1) = '1') then
        lib_DIGITS_ALF := LIBRARY_Table_0002[StrToInt(Copy(pmt_DIGITS_INT, 2, 1))]
      // Asigna de 20 a 99
      else
      begin
        // Asigna de 20 a 90 Decenas
        lib_DIGITS_ALF := LIBRARY_Table_0003[StrToInt(Copy(pmt_DIGITS_INT, 1, 1))];
        // Asigna de 20 a 90 Decenas y 21 a 99 Unidades
        if (Copy(pmt_DIGITS_INT, 2, 1) <> '0') then
        begin
          lib_DIGITS_ALF := Copy(lib_DIGITS_ALF, 1, Length(lib_DIGITS_ALF) - 2)
          + 'TI' + LIBRARY_Table_0001[StrToInt(Copy(pmt_DIGITS_INT, 2, 1))];
          // Remplaza UNO por UN
          if (Flag_SUB) and
             (Copy(pmt_DIGITS_INT, 2, 1) = '1') then
            SYSTEM.Delete(lib_DIGITS_ALF, Length(lib_DIGITS_ALF), 1);
        end;
      end;
      Select_SEP(pmt_DIGITS_INT, Flag_SUB, Flag_SEP);
    end;
    (* DIGITS = 3 *)
    if (Length(pmt_DIGITS_INT) = 3) then
    begin
      // Salir si los tres Digitos son cero
      if (Copy(pmt_DIGITS_INT, 1, 1) = '0') and
         (Copy(pmt_DIGITS_INT, 2, 1) = '0') and
         (Copy(pmt_DIGITS_INT, 3, 1) = '0') then
      begin
        Select_TYPE := '';
        Exit;
      end;
      // Asignar Centenas
      lib_DIGITS_ALF := LIBRARY_Table_0004[StrToInt(Copy(pmt_DIGITS_INT, 1, 1))];
      // Si el Primer Digito es 1 de 100 a 199 Agregar 'TO'
      if (Copy(pmt_DIGITS_INT, 1, 1) = '1') and
         ((Copy(pmt_DIGITS_INT, 2, 1) <> '0') or
          (Copy(pmt_DIGITS_INT, 3, 1) <> '0')) then
        lib_DIGITS_ALF := lib_DIGITS_ALF + 'TO '
      // Si no Agregar Espacio en Blanco si Primer
      // Digito de la Centena no es 0
      else
      if (Copy(pmt_DIGITS_INT, 1, 1) <> '0') then
        lib_DIGITS_ALF := lib_DIGITS_ALF + ' ';
      // Si son Centenas Asignar y Salir
      if (Copy(pmt_DIGITS_INT, 2, 1) = '0') and
         (Copy(pmt_DIGITS_INT, 3, 1) = '0') then
      begin
        Select_SEP(pmt_DIGITS_INT, Flag_SUB, Flag_SEP);
        Select_TYPE := lib_DIGITS_ALF;
        Exit;
      end;
      // Asignar Unidades en Base a Decenas y
      // Asignar Decenas en Base a Centenas
      // Unidades
      if (Copy(pmt_DIGITS_INT, 2, 1) = '0') then
      begin
        lib_DIGITS_ALF := lib_DIGITS_ALF
        + LIBRARY_Table_0001[StrToInt(Copy(pmt_DIGITS_INT, 3, 1))];
        // Remplaza UNO por UN
        if (Flag_SUB) and
           (Copy(pmt_DIGITS_INT, 2, 1) = '0') and
           (Copy(pmt_DIGITS_INT, 3, 1) = '1') then
          SYSTEM.Delete(lib_DIGITS_ALF, Length(lib_DIGITS_ALF), 1);
      end
      // Decenas 10 - 19
      else
      if (Copy(pmt_DIGITS_INT, 2, 1) = '1') then
        lib_DIGITS_ALF := lib_DIGITS_ALF
        + LIBRARY_Table_0002[StrToInt(Copy(pmt_DIGITS_INT, 3, 1))];
      // Decenas 20 - 99
      if (Copy(pmt_DIGITS_INT, 2, 1) >= '2') then
      begin
        lib_DIGITS_ALF := lib_DIGITS_ALF
        + LIBRARY_Table_0003[StrToInt(Copy(pmt_DIGITS_INT, 2, 1))];
        if (Copy(pmt_DIGITS_INT, 3, 1) <> '0') then
        begin
          lib_DIGITS_ALF := Copy(lib_DIGITS_ALF, 1, Length(lib_DIGITS_ALF) - 2)
          + 'TI' + LIBRARY_Table_0001[StrToInt(Copy(pmt_DIGITS_INT, 3, 1))];
          // Remplaza UNO por UN
          if (Flag_SUB) and
             (Copy(pmt_DIGITS_INT, 3, 1) = '1') then
            SYSTEM.Delete(lib_DIGITS_ALF, Length(lib_DIGITS_ALF), 1);
        end;
      end;
      Select_SEP(pmt_DIGITS_INT, Flag_SUB, Flag_SEP);
    end;
    Select_TYPE := lib_DIGITS_ALF;
  end;
// Main
begin
  // Validación Entrada
  if (pmt_NUMBER = '') then
  begin
    NumbersToLetters := '';
    Exit;
  end;
  // Validación de Digitos
  for Loop := 1 to Length(pmt_NUMBER) do
  begin
    if not (pmt_NUMBER[Loop] in asm_VALID) then
    begin
      NumbersToLetters := 'ERROR: No se Permiten Caracteres Alfabeticos.';
      Exit;
    end;
  end;
  // Longitud Permitida en Digitos
  if (Pos(asm_POINT, pmt_NUMBER) - 1 > 12) or
     (Pos(asm_COMET, pmt_NUMBER) - 1 > 12) then
  begin
    NumbersToLetters := 'Solo se Permiten Hasta (12) Enteros y (02) Decimales';
    Exit;
  end;
  // Inicializar
  lib_RESULT_CNA := '';
  lib_DIGITS_ALF := '';
  lib_DIGITS_INT := '';
  lib_DIGITS_DEC := '';
  lib_TYPE := '';
  // Seleccionar Tipo de Moneda
  if (pmt_TYPE = vk_SOLES) then lib_TYPE := vk_SOLES
  else if (pmt_TYPE = vk_DOLAR) then lib_TYPE := vk_DOLAR;
  // Extraer Numero Entero y Decimales
  if (Pos(asm_POINT, pmt_NUMBER) <> 0) then
  begin
    lib_DIGITS_INT := Copy(pmt_NUMBER, 1, Pos(asm_POINT, pmt_NUMBER) - 1);
    lib_DIGITS_DEC := Copy(pmt_NUMBER, Pos(asm_POINT, pmt_NUMBER) + 1, pmt_DEC);
  end
  else
  if (Pos(asm_COMET, pmt_NUMBER) <> 0) then
  begin
    lib_DIGITS_INT := Copy(pmt_NUMBER, 1, Pos(asm_COMET, pmt_NUMBER) - 1);
    lib_DIGITS_DEC := Copy(pmt_NUMBER, Pos(asm_COMET, pmt_NUMBER) + 1, pmt_DEC);
  end
  else
  begin
    lib_DIGITS_INT := pmt_NUMBER;
    lib_DIGITS_DEC := Copy(asm_DECIMALS, 1, pmt_DEC);
  end;
  // Execute_NOW ****
  // Length = 1  Format: 9
  if Length(lib_DIGITS_INT) = 1 then
    lib_RESULT_CNA := Select_TYPE(Copy(lib_DIGITS_INT, 1, 1), SubChar_OFF, Sep_NULL)
  // Length = 2  Format: 99
  else
  if Length(lib_DIGITS_INT) = 2 then
    lib_RESULT_CNA := Select_TYPE(Copy(lib_DIGITS_INT, 1, 2), SubChar_OFF, Sep_NULL)
  // Length = 3  Format: 999
  else
  if Length(lib_DIGITS_INT) = 3 then
    lib_RESULT_CNA := Select_TYPE(Copy(lib_DIGITS_INT, 1, 3), SubChar_OFF, Sep_NULL)
  // Length = 4  Format: 9 999
  else
  if Length(lib_DIGITS_INT) = 4 then
  begin
    lib_RESULT_CNA := Select_TYPE(Copy(lib_DIGITS_INT, 1, 1), SubChar_ON, Sep_MIL)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 2, 3), SubChar_OFF, Sep_NULL);
  end
  // Length = 5  Format: 99 999
  else
  if Length(lib_DIGITS_INT) = 5 then
  begin
    lib_RESULT_CNA := Select_TYPE(Copy(lib_DIGITS_INT, 1, 2), SubChar_ON, Sep_MIL)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 3, 3), SubChar_OFF, Sep_NULL);
  end
  // Length = 6  Format: 999 999
  else
  if Length(lib_DIGITS_INT) = 6 then
  begin
    lib_RESULT_CNA := Select_TYPE(Copy(lib_DIGITS_INT, 1, 3), SubChar_ON, Sep_MIL)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 4, 3), SubChar_OFF, Sep_NULL);
  end
  // Length = 7  Format: 9 999 999
  else
  if Length(lib_DIGITS_INT) = 7 then
  begin
    lib_RESULT_CNA := Select_TYPE(Copy(lib_DIGITS_INT, 1, 1), SubChar_ON, Sep_MILLON)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 2, 3), SubChar_ON, Sep_MIL)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 5, 3), SubChar_OFF, Sep_NULL);
  end
  // Length = 8  Format: 99 999 999
  else
  if Length(lib_DIGITS_INT) = 8 then
  begin
    lib_RESULT_CNA := Select_TYPE(Copy(lib_DIGITS_INT, 1, 2), SubChar_ON, Sep_MILLON)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 3, 3), SubChar_ON, Sep_MIL)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 6, 3), SubChar_OFF, Sep_NULL);
  end
  // Length = 9  Format: 999 999 999
  else
  if Length(lib_DIGITS_INT) = 9 then
  begin
    lib_RESULT_CNA := Select_TYPE(Copy(lib_DIGITS_INT, 1, 3), SubChar_ON, Sep_MILLON)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 4, 3), SubChar_ON, Sep_MIL)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 7, 3), SubChar_OFF, Sep_NULL);
  end
  // Length = 10  Format: 9 999 999 999
  else
  if Length(lib_DIGITS_INT) = 10 then
  begin
    lib_RESULT_CNA := Select_TYPE(Copy(lib_DIGITS_INT, 1, 1), SubChar_ON, Sep_MIL)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 2, 3), SubChar_ON, Sep_MILLON)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 5, 3), SubChar_ON, Sep_MIL)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 8, 3), SubChar_OFF, Sep_NULL);
  end
  // Length = 11  Format: 99 999 999 999
  else
  if Length(lib_DIGITS_INT) = 11 then
  begin
    lib_RESULT_CNA := Select_TYPE(Copy(lib_DIGITS_INT, 1, 2), SubChar_ON, Sep_MIL)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 3, 3), SubChar_ON, Sep_MILLON)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 6, 3), SubChar_ON, Sep_MIL)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 9, 3), SubChar_OFF, Sep_NULL);
  end
  // Length = 12  Format: 999 999 999 999
  else
  if Length(lib_DIGITS_INT) = 12 then
  begin
    lib_RESULT_CNA := Select_TYPE(Copy(lib_DIGITS_INT, 1, 3), SubChar_ON, Sep_MIL)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 4, 3), SubChar_ON, Sep_MILLON)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 7, 3), SubChar_ON, Sep_MIL)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 10, 3), SubChar_OFF, Sep_NULL);
  end;
  // Asignar Resultado
  SYSTEM.Insert('SON: ', lib_RESULT_CNA, 1);
  lib_RESULT_CNA := lib_RESULT_CNA + ' Y ' + lib_DIGITS_DEC + '/100' + lib_TYPE;
  NumbersToLetters := lib_RESULT_CNA;
end;
 
end.

//Edite: Para colocar etiquetas DELPHI.

Última edición por Arturo_ fecha: 13-07-2007 a las 23:16:17.
Responder Con Cita
  #2  
Antiguo 13-07-2007
Avatar de jhonny
jhonny jhonny is offline
Jhonny Suárez
 
Registrado: may 2003
Ubicación: Colombia
Posts: 7.058
Poder: 30
jhonny Va camino a la famajhonny Va camino a la fama
Por favor, usa las etiquetas DELPHI, para que podamos apreciar mejor dicho codigo... Además, si quieres compartir tus tips de codigo con nosotros, sería muy interesante si lo colocaras en la sección de trucos del club.
__________________
Lecciones de mi Madre. Tema: modificación del comportamiento, "Pará de actuar como tu padre!"

http://www.purodelphi.com/
http://www.nosolodelphi.com/

Última edición por jhonny fecha: 13-07-2007 a las 19:13:34.
Responder Con Cita
  #3  
Antiguo 13-07-2007
Avatar de ContraVeneno
ContraVeneno ContraVeneno is offline
Miembro
 
Registrado: may 2005
Ubicación: Torreón, México
Posts: 4.738
Poder: 23
ContraVeneno Va por buen camino
En la sección de trucos ya existe uno:

http://www.clubdelphi.com/trucos/ind...ll=0&scrollb=0

De hecho, el que se puso originalmente, tiene una que otra falla.

Por eso decidí colocar mi propuesta, pero nadie la ha comentado, la cuál es más compacta y con menos ciclos.
pero bueno, yo no soy el experto.

------edito

Arturo, ¿para que son estas unidades: Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls, jpeg, Gauges, DateUtils ?

No veo la definición de pmt_Type...
Ni tampoco nada de lo que tienes como asm_*
__________________


Última edición por ContraVeneno fecha: 13-07-2007 a las 19:36:35.
Responder Con Cita
  #4  
Antiguo 13-07-2007
Avatar de jhonny
jhonny jhonny is offline
Jhonny Suárez
 
Registrado: may 2003
Ubicación: Colombia
Posts: 7.058
Poder: 30
jhonny Va camino a la famajhonny Va camino a la fama
Cita:
Empezado por ContraVeneno

pero bueno, yo no soy el experto.
Mmmmmhhhh, ¿Se delicó?
__________________
Lecciones de mi Madre. Tema: modificación del comportamiento, "Pará de actuar como tu padre!"

http://www.purodelphi.com/
http://www.nosolodelphi.com/
Responder Con Cita
  #5  
Antiguo 13-07-2007
Arturo_ Arturo_ is offline
Miembro
 
Registrado: jul 2007
Posts: 48
Poder: 0
Arturo_ Va por buen camino
Arturo_

Las unidades incluidas son para otro tipo de trabajo lo que he hecho es extraer parte del codigo de un modulo de mis sistemas y la variable pmt_TYPE tiene su función estudialo y te daras cuenta
Responder Con Cita
  #6  
Antiguo 13-07-2007
Arturo_ Arturo_ is offline
Miembro
 
Registrado: jul 2007
Posts: 48
Poder: 0
Arturo_ Va por buen camino
Talking Arturo_

Otra cosa en que parte de la sección trucos puedo insertar m codigo ha compartir ó lo pongo en foros.
Responder Con Cita
  #7  
Antiguo 13-07-2007
Avatar de ContraVeneno
ContraVeneno ContraVeneno is offline
Miembro
 
Registrado: may 2005
Ubicación: Torreón, México
Posts: 4.738
Poder: 23
ContraVeneno Va por buen camino
¿o sea que pmt_type y todo lo que tienes como asm_* lo tengo que declarar yo ?
__________________

Responder Con Cita
  #8  
Antiguo 13-07-2007
Arturo_ Arturo_ is offline
Miembro
 
Registrado: jul 2007
Posts: 48
Poder: 0
Arturo_ Va por buen camino
Arturo_

Mi estimado veneno esas variables eran de una versión anterior no tienes que declararlas si deseas las eliminas, y las unidades extras de la cabecera pertenecen a otras rutinas que no se encuentas en el Modulo SPLASH.

Claro esta que esta rutina de Converción funciona a la perfección la tengo instalada en varias empresas.
Responder Con Cita
  #9  
Antiguo 13-07-2007
[egostar] egostar is offline
Registrado
 
Registrado: feb 2006
Posts: 6.557
Poder: 25
egostar Va camino a la fama
Amigo ContraVeneno pmt_TYPE si está declarada como parte de una función.

Código Delphi [-]
 
function NumbersToLetters(pmt_NUMBER, pmt_TYPE: string; pmt_DEC: Integer): string; export;

Lo que no veo por ningún lado son los asm_* seguro están declarados en otra de las unidades.

Salud OS.
__________________
"La forma de empezar es dejar de hablar y empezar a hacerlo." - Walt Disney
Responder Con Cita
  #10  
Antiguo 13-07-2007
Arturo_ Arturo_ is offline
Miembro
 
Registrado: jul 2007
Posts: 48
Poder: 0
Arturo_ Va por buen camino
Tenias razon

ya te puse los asm me los olvide disculpa ok.........
Responder Con Cita
  #11  
Antiguo 13-07-2007
Avatar de ContraVeneno
ContraVeneno ContraVeneno is offline
Miembro
 
Registrado: may 2005
Ubicación: Torreón, México
Posts: 4.738
Poder: 23
ContraVeneno Va por buen camino
Estoy tratando de probarlo, pero me marca error al querer compilarlo:

[Pascal Error] E1026 File not found: 'splash.DFM'

en delphi 2006

Seguro esto no tiene nada que ver con el código y me esta faltanto habilitar alguna otra cosa, pero me declaro ignorante en este aspecto.

¿alguna idea?
__________________

Responder Con Cita
  #12  
Antiguo 13-07-2007
Arturo_ Arturo_ is offline
Miembro
 
Registrado: jul 2007
Posts: 48
Poder: 0
Arturo_ Va por buen camino
Error de compilación

Ese error se debe a que yo cree un modulo con una form, y esta rutina, la agregue al la form, lo que tienes que hacer es extraer el procedimiento y todas sus constantes y variables y copiarlo en uno tuyo y asi podras compilarlo sin errores.
Responder Con Cita
  #13  
Antiguo 13-07-2007
Avatar de ContraVeneno
ContraVeneno ContraVeneno is offline
Miembro
 
Registrado: may 2005
Ubicación: Torreón, México
Posts: 4.738
Poder: 23
ContraVeneno Va por buen camino
listo, ya quedó sí funciona.

Aunque me quedo con la versión que tengo porque en México sería
"sesenta y cinco", no "sesenticinco".

Saludos
__________________

Responder Con Cita
  #14  
Antiguo 14-07-2007
Arturo_ Arturo_ is offline
Miembro
 
Registrado: jul 2007
Posts: 48
Poder: 0
Arturo_ Va por buen camino
Arturo_

Pero eso es facil de modificar en la parte que dice + 'TI' en vez de sumar 'TI' suma ' Y' y listo.

Puedes modificar la rutina ya que tienes el codigo fuente de repente hasta la mejoras y me avisas.
Responder Con Cita
  #15  
Antiguo 14-07-2007
Avatar de ContraVeneno
ContraVeneno ContraVeneno is offline
Miembro
 
Registrado: may 2005
Ubicación: Torreón, México
Posts: 4.738
Poder: 23
ContraVeneno Va por buen camino
Con los centavos de una vez tambien en letra:
Código Delphi [-]
Function CantidadEnLetra(curCantidad: Currency; MonNal: integer): String;
 var i: integer;
     Cantidad, Centavos: Currency;
     BloqueCero, NumeroBloques, Digito: Byte;
     PrimerDigito, SegundoDigito, TercerDigito: Byte;
     Resultado, Temp, strCentavos, Bloque: String;
     Unidades: Array[0..28] of String;
     Decenas: Array[0..8] of String;
     Centenas: Array[0..8] of String;
begin

Unidades[0] := 'UN'; Unidades[1] := 'DOS'; Unidades[2] := 'TRES'; Unidades[3] := 'CUATRO';
Unidades[4] := 'CINCO'; Unidades[5] := 'SEIS'; Unidades[6] := 'SIETE'; Unidades[7] := 'OCHO';
Unidades[8] := 'NUEVE'; Unidades[9] := 'DIEZ'; Unidades[10] := 'ONCE'; Unidades[11] := 'DOCE';
Unidades[12] := 'TRECE'; Unidades[13] := 'CATORCE'; Unidades[14] := 'QUINCE'; Unidades[15] := 'DIECISÉIS';
Unidades[16] := 'DIECISIETE'; Unidades[17] := 'DIECIOCHO'; Unidades[18] := 'DIECINUEVE';
Unidades[19] := 'VEINTE'; Unidades[20] := 'VEINTIUNO'; Unidades[21] := 'VEINTIDÓS';
Unidades[22] := 'VEINTITRÉS'; Unidades[23] := 'VEINTICUATRO'; Unidades[24] := 'VEINTICINCO';
Unidades[25] := 'VEINTISÉIS'; Unidades[26] := 'VEINTISIETE'; Unidades[27] := 'VEINTIOCHO'; Unidades[28] := 'VEINTINUEVE';

Decenas[0] := 'DIEZ'; Decenas[1] := 'VEINTE'; Decenas[2] := 'TREINTA'; Decenas[3] := 'CUARENTA';
Decenas[4] := 'CINCUENTA'; Decenas[5] := 'SESENTA'; Decenas[6] := 'SETENTA'; Decenas[7] := 'OCHENTA'; Decenas[8] := 'NOVENTA';

Centenas[0] := 'CIENTO'; Centenas[1] := 'DOSCIENTOS'; Centenas[2] := 'TRESCIENTOS'; Centenas[3] := 'CUATROCIENTOS';
Centenas[4] := 'QUINIENTOS'; Centenas[5] := 'SEISCIENTOS'; Centenas[6] := 'SETECIENTOS'; Centenas[7] := 'OCHOCIENTOS'; Centenas[8] := 'NOVECIENTOS';

Cantidad := Trunc(curCantidad);
Centavos := (curCantidad - Cantidad) * 100;
NumeroBloques := 1;
Repeat
 PrimerDigito := 0;
 SegundoDigito := 0;
 TercerDigito := 0;
 Bloque := '';
 BloqueCero := 0;
 For i := 1 To 3 do begin
  Digito := Round(Cantidad) Mod 10;
  If Digito <> 0 Then begin
   Case i of
    1: begin
     Bloque := ' ' + Unidades[Digito - 1];
     PrimerDigito := Digito;
    end; //case 1
    2: begin
      If Digito <= 2 Then begin
       Bloque := ' ' + Unidades[(Digito * 10 + PrimerDigito - 1)];
      end Else begin
       If PrimerDigito <> 0 then
        Temp := ' Y' else Temp := '';
       Bloque := ' ' + Decenas[Digito - 1] + Temp + Bloque;
      End; //if
      SegundoDigito := Digito;
     end; //case 2
    3: begin
     If (Digito = 1) and (PrimerDigito = 0) and (SegundoDigito = 0) then
      Temp := 'CIEN' else Temp := Centenas[Digito-1];
     Bloque := ' ' + Temp + Bloque;
     TercerDigito := Digito;
     end; //case 3
    End; //case
  end Else begin
  BloqueCero := BloqueCero + 1;
  End; // If Digito <>0
  Cantidad := Int(Cantidad / 10);
  If Cantidad = 0 Then begin
   Break;
  End; // If Cantidad=0
 end; //for
 Case NumeroBloques of
  1:
   Resultado := Bloque;
  2: begin
   if BloqueCero = 3 then
    Temp := '' else Temp := ' MIL';
   Resultado := Bloque + Temp + Resultado;
   end; //case 2
  3: begin
   If (PrimerDigito = 1) and (SegundoDigito = 0) and (TercerDigito = 0) then
    Temp := ' MILLON' else Temp := ' MILLONES';
   Resultado := Bloque + Temp + Resultado;
   end; //case 3
 End; //case
 NumeroBloques := NumeroBloques + 1;
Until Cantidad = 0; //repeat
case MonNal of
 0: begin
 If curCantidad > 1 then
  Temp := ' CENTAVOS ***' else Temp := ' CENTAVO ***';
 CantidadEnLetra := Resultado + Temp;

 end;
 1: begin
   If curCantidad > 1 then
    Temp := ' PESOS ' else Temp := ' PESO ';
   if Centavos=0 then strCentavos := '' else strCentavos := 'CON '+CantidadEnLetra(Centavos, 0);
   CantidadEnLetra := 'SON: *** ' + Resultado + Temp + strCentavos;
 end;
 2: begin
  If curCantidad > 1 then
   Temp := ' DLLS ' else Temp := ' DOLAR ';
   if Centavos=0 then strCentavos := '' else strCentavos := 'CON '+CantidadEnLetra(Centavos, 0);
   CantidadEnLetra := 'SON: *** ' + Resultado + Temp + strCentavos;
 end;
end;

End;



Esta versión es con "SESENTA Y CINCO", no con "SESENTICINCO".
Saludos
__________________


Última edición por ContraVeneno fecha: 23-10-2007 a las 23:34:30.
Responder Con Cita
  #16  
Antiguo 14-07-2007
Arturo_ Arturo_ is offline
Miembro
 
Registrado: jul 2007
Posts: 48
Poder: 0
Arturo_ Va por buen camino
Convertidor de Numeros a Letras Modificado

Código Delphi [-]
// **** SPLASH ****
// Por: Arturo Vidal Gómez
// Versión: 1.000.000
// Copyright © 1980, 2007
// Derechos - Reservados
// Arequipa, Perú
// PASCAL - DELPHI (Client Server Suite)
// Ingeniería de Software
 
unit Splash;
 
interface
 
uses
  SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls, jpeg, Gauges, DateUtils;
 
// For NumbersToLetters
const
  // Table Unidades 0 - 9
  LIBRARY_Table_0001 : packed array[0..9] of string =
                       ('CERO', 'UNO', 'DOS', 'TRES', 'CUATRO', 'CINCO',
                        'SEIS', 'SIETE', 'OCHO', 'NUEVE');
  // Table Decenas 10 - 19
  LIBRARY_Table_0002 : packed array[0..9] of string =
                       ('DIEZ', 'ONCE', 'DOCE', 'TRECE', 'CATORCE', 'QUINCE',
                        'DIECISEIS', 'DIECISIETE', 'DIECIOCHO', 'DIECINUEVE');
  // Table Decenas 20 - 90
  LIBRARY_Table_0003 : packed array[2..9] of string =
                       ('VEINTE', 'TREINTA', 'CUARENTA', 'CINCUENTA',
                        'SESENTA', 'SETENTA', 'OCHENTA', 'NOVENTA');
  // Table Centenas 100 - 900
  LIBRARY_Table_0004 : packed array[0..9] of string =
                       ('', 'CIEN', 'DOSCIENTOS', 'TRESCIENTOS', 'CUATROCIENTOS',
                        'QUINIENTOS', 'SEISCIENTOS', 'SETENCIENTOS',
                        'OCHOCIENTOS', 'NOVECIENTOS');
 
const
  SubChar_ON     : Boolean = True;   // Enabled Reemplazar UNO por UN
  SubChar_OFF    : Boolean = False;  // Disabled Reemplazar UNO por UN
  Sep_NULL       : Integer = 0;      // Value NULL
  Sep_MIL        : Integer = 1;      // Separador de Miles
  Sep_MILLON     : Integer = 2;      // Separador de Millones
 
const
  asm_POINT      : string = '.';
  asm_COMET      : string = ',';
  asm_DECIMALS   : string = '0000000000';
  asm_VALID      : set of char = ['0'..'9', '.', ','];
var
  lib_RESULT_CNA        : string;
  lib_DIGITS_ALF        : string;
  lib_DIGITS_INT        : string;
  lib_DIGITS_DEC        : string;
  lib_TYPE              : string;
 
// INTERFACE Procedimientos para Conversiones
function NumbersToLetters(pmt_NUMBER, pmt_TYPE: string; pmt_DEC: Integer): string; export;
implementation
 
{$R *.DFM}
// IMPLEMENTATION Procedimientos para Conversiones
// NumbersToLetters Numeros a Letras
function NumbersToLetters(pmt_NUMBER, pmt_TYPE: string; pmt_DEC: Integer): string; export;
var
  Loop : Integer;
  // Seleccionar TIPO 1 2 ó 3
  // TIPO 1 = 0   para las Unidades
  // TIPO 2 = 00  para las Decenas
  // TIPO 3 = 000 para las Centenas
  // 12 Digitos y n Decimales
  // 999,000,000,000.00
  function Select_TYPE(pmt_DIGITS_INT: string; Flag_SUB: Boolean;
    Flag_SEP: Integer): string;
    // Seleccionar Separador MIL MILLON...
    procedure Select_SEP(pmt_DIGITS_INT: string; Flag_SUB: Boolean;
      Flag_SEP: Integer);
    begin
      if (Flag_SUB) and
         (Length(lib_DIGITS_INT) >= 4) and
         (Length(lib_DIGITS_INT) <= 12) then
      begin
        if Flag_SEP = sep_MIL then
          lib_DIGITS_ALF := lib_DIGITS_ALF + ' MIL '
        else
        if Flag_SEP = sep_MILLON then
        begin
          lib_DIGITS_ALF := lib_DIGITS_ALF + ' MILLONES ';
          // Elimina 'ES' de 'MILLONES' si Primer Digito es 1
          if (Length(lib_DIGITS_INT) = 7) and
             (Copy(pmt_DIGITS_INT, 1, 1) = '1') then
            SYSTEM.Delete(lib_DIGITS_ALF, 10, 2);
        end;
      end;
    end;
  begin
    (* DIGITS = 1 *)
    if (Length(pmt_DIGITS_INT) = 1) then
    begin
      lib_DIGITS_ALF := LIBRARY_Table_0001[StrToInt(pmt_DIGITS_INT)];
      // Remplaza UNO por UN
      if (Flag_SUB) and
         (Copy(pmt_DIGITS_INT, 1, 1) = '1') then
        SYSTEM.Delete(lib_DIGITS_ALF, Length(lib_DIGITS_ALF), 1);
      Select_SEP(pmt_DIGITS_INT, Flag_SUB, Flag_SEP);
    end;
    (* DIGITS = 2 *)
    if (Length(pmt_DIGITS_INT) = 2) then
    begin
      // Asigna de 10 - 19
      if (Copy(pmt_DIGITS_INT, 1, 1) = '1') then
        lib_DIGITS_ALF := LIBRARY_Table_0002[StrToInt(Copy(pmt_DIGITS_INT, 2, 1))]
      // Asigna de 20 a 99
      else
      begin
        // Asigna de 20 a 90 Decenas
        lib_DIGITS_ALF := LIBRARY_Table_0003[StrToInt(Copy(pmt_DIGITS_INT, 1, 1))];
        // Asigna de 20 a 90 Decenas y 21 a 99 Unidades
        if (Copy(pmt_DIGITS_INT, 2, 1) <> '0') then
        begin
          // Comment: Salida >> SESENTICINCO
          // lib_DIGITS_ALF := Copy(lib_DIGITS_ALF, 1, Length(lib_DIGITS_ALF) - 2)
          // + 'TI' + LIBRARY_Table_0001[StrToInt(Copy(pmt_DIGITS_INT, 2, 1))];
         
          // **** OJO Aqui se reemplaza este codigo para que te sirva ****
          // Comment: Salida >> SESENTA Y CINCO
          lib_DIGITS_ALF := lib_DIGITS_ALF + ' Y ' 
          + LIBRARY_Table_0001[StrToInt(Copy(pmt_DIGITS_INT, 2, 1))];
          // Remplaza UNO por UN
          if (Flag_SUB) and
             (Copy(pmt_DIGITS_INT, 2, 1) = '1') then
            SYSTEM.Delete(lib_DIGITS_ALF, Length(lib_DIGITS_ALF), 1);
        end;
      end;
      Select_SEP(pmt_DIGITS_INT, Flag_SUB, Flag_SEP);
    end;
    (* DIGITS = 3 *)
    if (Length(pmt_DIGITS_INT) = 3) then
    begin
      // Salir si los tres Digitos son cero
      if (Copy(pmt_DIGITS_INT, 1, 1) = '0') and
         (Copy(pmt_DIGITS_INT, 2, 1) = '0') and
         (Copy(pmt_DIGITS_INT, 3, 1) = '0') then
      begin
        Select_TYPE := '';
        Exit;
      end;
      // Asignar Centenas
      lib_DIGITS_ALF := LIBRARY_Table_0004[StrToInt(Copy(pmt_DIGITS_INT, 1, 1))];
      // Si el Primer Digito es 1 de 100 a 199 Agregar 'TO'
      if (Copy(pmt_DIGITS_INT, 1, 1) = '1') and
         ((Copy(pmt_DIGITS_INT, 2, 1) <> '0') or
          (Copy(pmt_DIGITS_INT, 3, 1) <> '0')) then
        lib_DIGITS_ALF := lib_DIGITS_ALF + 'TO '
      // Si no Agregar Espacio en Blanco si Primer
      // Digito de la Centena no es 0
      else
      if (Copy(pmt_DIGITS_INT, 1, 1) <> '0') then
        lib_DIGITS_ALF := lib_DIGITS_ALF + ' ';
      // Si son Centenas Asignar y Salir
      if (Copy(pmt_DIGITS_INT, 2, 1) = '0') and
         (Copy(pmt_DIGITS_INT, 3, 1) = '0') then
      begin
        Select_SEP(pmt_DIGITS_INT, Flag_SUB, Flag_SEP);
        Select_TYPE := lib_DIGITS_ALF;
        Exit;
      end;
      // Asignar Unidades en Base a Decenas y
      // Asignar Decenas en Base a Centenas
      // Unidades
      if (Copy(pmt_DIGITS_INT, 2, 1) = '0') then
      begin
        lib_DIGITS_ALF := lib_DIGITS_ALF
        + LIBRARY_Table_0001[StrToInt(Copy(pmt_DIGITS_INT, 3, 1))];
        // Remplaza UNO por UN
        if (Flag_SUB) and
           (Copy(pmt_DIGITS_INT, 2, 1) = '0') and
           (Copy(pmt_DIGITS_INT, 3, 1) = '1') then
          SYSTEM.Delete(lib_DIGITS_ALF, Length(lib_DIGITS_ALF), 1);
      end
      // Decenas 10 - 19
      else
      if (Copy(pmt_DIGITS_INT, 2, 1) = '1') then
        lib_DIGITS_ALF := lib_DIGITS_ALF
        + LIBRARY_Table_0002[StrToInt(Copy(pmt_DIGITS_INT, 3, 1))];
      // Decenas 20 - 99
      if (Copy(pmt_DIGITS_INT, 2, 1) >= '2') then
      begin
        lib_DIGITS_ALF := lib_DIGITS_ALF
        + LIBRARY_Table_0003[StrToInt(Copy(pmt_DIGITS_INT, 2, 1))];
        if (Copy(pmt_DIGITS_INT, 3, 1) <> '0') then
        begin
          lib_DIGITS_ALF := Copy(lib_DIGITS_ALF, 1, Length(lib_DIGITS_ALF) - 2)
          + 'TI' + LIBRARY_Table_0001[StrToInt(Copy(pmt_DIGITS_INT, 3, 1))];
          // Remplaza UNO por UN
          if (Flag_SUB) and
             (Copy(pmt_DIGITS_INT, 3, 1) = '1') then
            SYSTEM.Delete(lib_DIGITS_ALF, Length(lib_DIGITS_ALF), 1);
        end;
      end;
      Select_SEP(pmt_DIGITS_INT, Flag_SUB, Flag_SEP);
    end;
    Select_TYPE := lib_DIGITS_ALF;
  end;
// Main
begin
  // Validación Entrada
  if (pmt_NUMBER = '') then
  begin
    NumbersToLetters := '';
    Exit;
  end;
  // Validación de Digitos
  for Loop := 1 to Length(pmt_NUMBER) do
  begin
    if not (pmt_NUMBER[Loop] in asm_VALID) then
    begin
      NumbersToLetters := 'ERROR: No se Permiten Caracteres Alfabeticos.';
      Exit;
    end;
  end;
  // Longitud Permitida en Digitos
  if (Pos(asm_POINT, pmt_NUMBER) - 1 > 12) or
     (Pos(asm_COMET, pmt_NUMBER) - 1 > 12) then
  begin
    NumbersToLetters := 'Solo se Permiten Hasta (12) Enteros y (02) Decimales';
    Exit;
  end;
  // Inicializar
  lib_RESULT_CNA := '';
  lib_DIGITS_ALF := '';
  lib_DIGITS_INT := '';
  lib_DIGITS_DEC := '';
  lib_TYPE := '';
  // Seleccionar Tipo de Moneda
  if (pmt_TYPE = vk_SOLES) then lib_TYPE := vk_SOLES
  else if (pmt_TYPE = vk_DOLAR) then lib_TYPE := vk_DOLAR;
  // Extraer Numero Entero y Decimales
  if (Pos(asm_POINT, pmt_NUMBER) <> 0) then
  begin
    lib_DIGITS_INT := Copy(pmt_NUMBER, 1, Pos(asm_POINT, pmt_NUMBER) - 1);
    lib_DIGITS_DEC := Copy(pmt_NUMBER, Pos(asm_POINT, pmt_NUMBER) + 1, pmt_DEC);
  end
  else
  if (Pos(asm_COMET, pmt_NUMBER) <> 0) then
  begin
    lib_DIGITS_INT := Copy(pmt_NUMBER, 1, Pos(asm_COMET, pmt_NUMBER) - 1);
    lib_DIGITS_DEC := Copy(pmt_NUMBER, Pos(asm_COMET, pmt_NUMBER) + 1, pmt_DEC);
  end
  else
  begin
    lib_DIGITS_INT := pmt_NUMBER;
    lib_DIGITS_DEC := Copy(asm_DECIMALS, 1, pmt_DEC);
  end;
  // Execute_NOW ****
  // Length = 1  Format: 9
  if Length(lib_DIGITS_INT) = 1 then
    lib_RESULT_CNA := Select_TYPE(Copy(lib_DIGITS_INT, 1, 1), SubChar_OFF, Sep_NULL)
  // Length = 2  Format: 99
  else
  if Length(lib_DIGITS_INT) = 2 then
    lib_RESULT_CNA := Select_TYPE(Copy(lib_DIGITS_INT, 1, 2), SubChar_OFF, Sep_NULL)
  // Length = 3  Format: 999
  else
  if Length(lib_DIGITS_INT) = 3 then
    lib_RESULT_CNA := Select_TYPE(Copy(lib_DIGITS_INT, 1, 3), SubChar_OFF, Sep_NULL)
  // Length = 4  Format: 9 999
  else
  if Length(lib_DIGITS_INT) = 4 then
  begin
    lib_RESULT_CNA := Select_TYPE(Copy(lib_DIGITS_INT, 1, 1), SubChar_ON, Sep_MIL)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 2, 3), SubChar_OFF, Sep_NULL);
  end
  // Length = 5  Format: 99 999
  else
  if Length(lib_DIGITS_INT) = 5 then
  begin
    lib_RESULT_CNA := Select_TYPE(Copy(lib_DIGITS_INT, 1, 2), SubChar_ON, Sep_MIL)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 3, 3), SubChar_OFF, Sep_NULL);
  end
  // Length = 6  Format: 999 999
  else
  if Length(lib_DIGITS_INT) = 6 then
  begin
    lib_RESULT_CNA := Select_TYPE(Copy(lib_DIGITS_INT, 1, 3), SubChar_ON, Sep_MIL)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 4, 3), SubChar_OFF, Sep_NULL);
  end
  // Length = 7  Format: 9 999 999
  else
  if Length(lib_DIGITS_INT) = 7 then
  begin
    lib_RESULT_CNA := Select_TYPE(Copy(lib_DIGITS_INT, 1, 1), SubChar_ON, Sep_MILLON)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 2, 3), SubChar_ON, Sep_MIL)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 5, 3), SubChar_OFF, Sep_NULL);
  end
  // Length = 8  Format: 99 999 999
  else
  if Length(lib_DIGITS_INT) = 8 then
  begin
    lib_RESULT_CNA := Select_TYPE(Copy(lib_DIGITS_INT, 1, 2), SubChar_ON, Sep_MILLON)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 3, 3), SubChar_ON, Sep_MIL)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 6, 3), SubChar_OFF, Sep_NULL);
  end
  // Length = 9  Format: 999 999 999
  else
  if Length(lib_DIGITS_INT) = 9 then
  begin
    lib_RESULT_CNA := Select_TYPE(Copy(lib_DIGITS_INT, 1, 3), SubChar_ON, Sep_MILLON)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 4, 3), SubChar_ON, Sep_MIL)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 7, 3), SubChar_OFF, Sep_NULL);
  end
  // Length = 10  Format: 9 999 999 999
  else
  if Length(lib_DIGITS_INT) = 10 then
  begin
    lib_RESULT_CNA := Select_TYPE(Copy(lib_DIGITS_INT, 1, 1), SubChar_ON, Sep_MIL)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 2, 3), SubChar_ON, Sep_MILLON)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 5, 3), SubChar_ON, Sep_MIL)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 8, 3), SubChar_OFF, Sep_NULL);
  end
  // Length = 11  Format: 99 999 999 999
  else
  if Length(lib_DIGITS_INT) = 11 then
  begin
    lib_RESULT_CNA := Select_TYPE(Copy(lib_DIGITS_INT, 1, 2), SubChar_ON, Sep_MIL)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 3, 3), SubChar_ON, Sep_MILLON)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 6, 3), SubChar_ON, Sep_MIL)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 9, 3), SubChar_OFF, Sep_NULL);
  end
  // Length = 12  Format: 999 999 999 999
  else
  if Length(lib_DIGITS_INT) = 12 then
  begin
    lib_RESULT_CNA := Select_TYPE(Copy(lib_DIGITS_INT, 1, 3), SubChar_ON, Sep_MIL)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 4, 3), SubChar_ON, Sep_MILLON)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 7, 3), SubChar_ON, Sep_MIL)
                    + Select_TYPE(Copy(lib_DIGITS_INT, 10, 3), SubChar_OFF, Sep_NULL);
  end;
  // Asignar Resultado
  SYSTEM.Insert('SON: ', lib_RESULT_CNA, 1);
  lib_RESULT_CNA := lib_RESULT_CNA + ' Y ' + lib_DIGITS_DEC + '/100' + lib_TYPE;
  NumbersToLetters := lib_RESULT_CNA;
end;
 
end.
//Edite: Para colocar etiquetas DELPHI.

Última edición por Arturo_ fecha: 14-07-2007 a las 00:44:29.
Responder Con Cita
  #17  
Antiguo 14-07-2007
Arturo_ Arturo_ is offline
Miembro
 
Registrado: jul 2007
Posts: 48
Poder: 0
Arturo_ Va por buen camino
Arturo_

Tu rutina esta bien, existen varias rutinas para hacer este tipo de trabajos de conversión claro esta que cada persona tiene su propia logica bueno es cuestion de opiniones.

nos vemos.
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Convertir números en letras c748a Varios 14 10-04-2015 20:52:18
Numeros y letras Caral Varios 11 28-03-2008 18:22:53
Numeros En Letras Cañones Impresión 2 11-06-2007 23:55:12
Numeros a Letras!! jmedina Varios 26 20-10-2005 20:19:42
trasformar numeros a letras NestorN Varios 1 17-09-2005 01:33:44


La franja horaria es GMT +2. Ahora son las 09:08:41.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi