Tema: Visual Basic
Ver Mensaje Individual
  #5 (permalink)  
Antiguo 16/07/2004, 09:43
rsiles
 
Fecha de Ingreso: abril-2004
Ubicación: Managua
Mensajes: 150
Antigüedad: 20 años
Puntos: 0
'Z******** SOLO PARA BILLONES CUANDO MILLARDOS ES MAS DE CERO
If paso = 7 And valor = "biliones" And cifra = 13 _
And Val(Mid(entero, 5, 3)) = 0 And BandBilion Then
expresion = expresion & "millones "
BandBilion = False
End If

If paso = 7 And valor = "biliones" And cifra = 14 _
And Val(Mid(entero, 6, 3)) = 0 And BandBilion Then
expresion = expresion & "millones "
BandBilion = False
End If

If paso = 7 And valor = "biliones" And cifra = 15 _
And Val(Mid(entero, 7, 3)) = 0 And BandBilion Then
expresion = expresion & "millones "
BandBilion = False
End If

'Z********** SOLO PARA MILLARDOS PRONUNCIADOS EN MILES DE MILLONES.
If paso = 10 And valor = "miliardos" Then
expresion = expresion & "mil "
End If
'**********"TERMINAMOS CONDICIONES PARA USAR PALABRA MILES DE MILLONES"**********


'**********"INICIAMOS CONDICIONES PARA USAR PALABRA MILLARDO(S)"**********
Case Else ' Desea usar la palabra millardos

If paso = 10 And valor = "biliones" And cifra = 13 _
And Val(Mid(entero, 2, 3)) > 0 Then
If Val(Mid(entero, 2, 3)) = 1 Then
expresion = expresion & "millardo "
Else
expresion = expresion & "millardos "
End If
End If
If paso = 10 And valor = "biliones" And cifra = 14 _
And Val(Mid(entero, 3, 3)) > 0 Then
If Val(Mid(entero, 3, 3)) = 1 Then
expresion = expresion & "millardo "
Else
expresion = expresion & "millardos "
End If
End If
If paso = 10 And valor = "biliones" And cifra = 15 _
And Val(Mid(entero, 4, 3)) > 0 Then
If Val(Mid(entero, 4, 3)) = 1 Then
expresion = expresion & "millardo "
Else
expresion = expresion & "millardos "
End If
End If

'********** MILLARDOS

If paso = 10 And valor = "miliardos" Then
If Len(entero) = 10 And Mid(entero, 1, 1) = "1" Then
expresion = expresion & "millardo "
Else
expresion = expresion & "millardos "
End If
End If
'**********"TERMINAMOS CONDICIONES PARA USAR PALABRA MILLARDO(S)"**********
'************************************************* *************************
End Select

'*******[SOLO PARA MILLARDOS] CUANDO MILLONES ES MAS DE CERO

If paso = 7 And valor = "miliardos" And cifra = 10 And _
Val(Mid(entero, 2, 3)) > 0 Then
If Val(Mid(entero, 2, 3)) = 1 Then
expresion = expresion & "millón "
Else
expresion = expresion & "millones "
End If
End If

If paso = 7 And valor = "miliardos" And cifra = 11 _
And Val(Mid(entero, 3, 3)) > 0 Then
If Val(Mid(entero, 3, 3)) = 1 Then
expresion = expresion & "millón "
Else
expresion = expresion & "millones "
End If
End If

If paso = 7 And valor = "miliardos" And cifra = 12 _
And Val(Mid(entero, 4, 3)) > 0 Then
If Val(Mid(entero, 4, 3)) = 1 Then
expresion = expresion & "millón "
Else
expresion = expresion & "millones "
End If
End If

'*************************************************


'******** SOLO BILLONES

If paso = 7 And valor = "biliones" And cifra = 13 _
And Val(Mid(entero, 5, 3)) > 0 Then
If Val(Mid(entero, 5, 3)) = 1 Then
expresion = expresion & "millón "
Else
expresion = expresion & "millones "
End If
End If

If paso = 7 And valor = "biliones" And cifra = 14 _
And Val(Mid(entero, 6, 3)) > 0 Then
If Val(Mid(entero, 6, 3)) = 1 Then
expresion = expresion & "millón "
Else
expresion = expresion & "millones "
End If
End If

If paso = 7 And valor = "biliones" And cifra = 15 _
And Val(Mid(entero, 7, 3)) > 0 Then
If Val(Mid(entero, 7, 3)) = 1 Then
expresion = expresion & "millón "
Else
expresion = expresion & "millones "
End If
End If
'************************************************* ***


'********** SOLO PARA MILLONES
If paso = 7 And valor = "milion" Then
If Len(entero) = 7 And Mid(entero, 1, 1) = "1" Then
expresion = expresion & "millón "
Else
expresion = expresion & "millones "
End If
End If

'******** SOLO PARA BILLONES
If paso = 13 Then
If Len(entero) = 13 And Mid(entero, 1, 1) = "1" Then
expresion = expresion & "billón "
Else
expresion = expresion & "billones "
End If
End If


Next paso




'*** EVALUAR QUE ESCRIBIR
If deci <> "" Then 'SI EL VALOR RESULTANTE ES NEGATIVO CON DECIMAL
If Mid(entero, 1, 1) = "-" Or Mid(entero, 1, 1) = "(" Then
EnLetras = "Menos " & expresion & "con " & deci 'ANTES & "/100"
Else
EnLetras = expresion & "con " & deci 'ANTES & "/100"
End If
Else 'SI EL VALOR RESULTANTE ES NEGATIVO SIN DECIMAL
If Mid(entero, 1, 1) = "-" Or Mid(entero, 1, 1) = "(" Then
EnLetras = "Menos " & expresion
Else
EnLetras = expresion 'si no tiene decimal
End If
End If

If Val(numero) = 0 Then EnLetras = "Monto es igual a cero." 'NO DEBERÍA LLEAGR AQUI
Else 'si el numero a convertir está fuera del rango superior o inferior
EnLetras = "Error en el dato introducido"
End If
End Function