Codificacion De Fox Pro Numeros A Letras

Páginas: 3 (651 palabras) Publicado: 13 de marzo de 2013
Function Pesos(ByVal Cantidad)
Dim Pesotes, Centavos, Temp
Dim DecimalPlace, Count
Dim origNumLen, origNum
Dim Sep, Moneda
Dim Decimales As Long

Decimales = Round(100 * (Cantidad -Int(Cantidad)), 0) 'extrae la parte decimal

ReDim place(9) As String
place(2) = " MIL "
place(3) = " MILLONES "
place(4) = " BILLONES "
place(5) = " TRILLONES "

Cantidad = Trim(CStr(Cantidad))origNumLen = Len(Cantidad)
origNum = Cantidad
'Especificar el separador de miles y/o decimales
Sep = "."
'Especificar el tipo de moneda PESOS (default)
Moneda = "PESOS"

If Sep = "." ThenDecimalPlace = InStr(Cantidad, "." )

' Convert Centavos and set Cantidad to currency amount.
If DecimalPlace > 0 Then
Centavos = GetTens(Left(Mid(Cantidad, DecimalPlace + 1) & _
"00", 2))
Cantidad =Trim(Left(Cantidad, DecimalPlace - 1))
End If

Count = 1
Do While Cantidad ""
Temp = GetHundreds(Right(Cantidad, 3))
If Temp "" Then
If Temp = "UN" And Count > 2 Then
Pesotes = Temp &Left(place(Count), Len(place(Count)) - 3) _
& " " & Pesotes
Else
Pesotes = Temp & place(Count) & Pesotes
End If
End If
If Len(Cantidad) > 3 Then
Cantidad = Left(Cantidad, Len(Cantidad) - 3)
ElseCantidad = ""
End If
Count = Count + 1
Loop

Select Case Pesotes
Case ""
Pesotes = " (CERO " & Moneda
Case "UN"
Pesotes = " (UN " & Left(Moneda, Len(Moneda) - 1)

Case Else
If origNumLen > 6 And(origNum Mod 1000000) = 0 Then
Pesotes = " (" & Pesotes & " " & "DE " & Moneda
Else
Pesotes = " (" & Pesotes & " " & Moneda
End If
End Select

Select Case Centavos
Case ""
Centavos = " 00/100M.N.)"
Case Else
If Decimales < 10 Then
Centavos = " 0" & Decimales & "/100 M.N.)"
Else
Centavos = " " & Decimales & "/100 M.N.)"
End If
End Select

Pesos = UCase(Trim(Pesotes & Centavos))End Function


' Convertir rango de numeros del 100 hasta 999 en texto

Private Function GetHundreds(ByVal Cantidad)
Dim Result As String

If Val(Cantidad) = 0 Then Exit Function
Cantidad =...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • fox Pro
  • fox pro media pro
  • Ejemplo de una vista en fox pro
  • visual fox pro
  • Codificacion Fox De Ejercicios
  • Comandos De Visua Fox Pro
  • Comando de visual fox pro
  • programa fox pro

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS