FoxPro/Visual FoxPro - formulario, numeros

 
Vista:

formulario, numeros

Publicado por joshep23 (3 intervenciones) el 22/04/2006 03:54:30
hola tengo que realizar un formulario enm donde se introdusca un numero y ahi mismo lo combierta en ingles, romano, numero o letra, se puede introducir de cualquier manera numero letra, etc. tengo casi todo, mi problema es de que los numero romanos los lee como si fueran el nisma numero, es decir el I, II, II, IV, los toma como si todos fueran " I ".
agradecere su ayuda

este es mi codigo hasta el momento:

do case

case (thisform.tipo.value)=1
*numero uno romano
if (thisform.numero.value)="1"
thisform.numero.value="I"
else
if (thisform.numero.value)="uno"
thisform.numero.value="I"
else
if (thisform.numero.value)="one"
thisform.numero.value="I"
else
if (thisform.numero.value)="I"
thisform.numero.value="I"
endif
endif
endif
endif
case(thisform.tipo.value)=2
* numero uno ingles
if (thisform.numero.value)="1"
thisform.numero.value="one"
else
if (thisform.numero.value)="uno"
thisform.numero.value="one"
else
if (thisform.numero.value)="one"
thisform.numero.value="one"
else
if (thisform.numero.value)="I"
thisform.numero.value="one"
endif
endif
endif
endif
case(thisform.tipo.value)=3
*numero uno español
if (thisform.numero.value)="1"
thisform.numero.value="uno"
else
if (thisform.numero.value)="uno"
thisform.numero.value="uno"
else
if (thisform.numero.value)="one"
thisform.numero.value="uno"
else
if (thisform.numero.value)="I"
thisform.numero.value="uno"
endif
endif
endif
endif
case(thisform.tipo.value)=4
*numero uno en numero
if (thisform.numero.value)="1"
thisform.numero.value="1"
else
if (thisform.numero.value)="uno"
thisform.numero.value="1"
else
if (thisform.numero.value)="one"
thisform.numero.value="1"
else
if (thisform.numero.value)="I"
thisform.numero.value="1"
endif
endif
endif
endif
endcase

*empiesa el numero 2
*numero dos en romano
do case
case (thisform.tipo.value)=1

if (thisform.numero.value)="2"
thisform.numero.value="ii"
else
if (thisform.numero.value)="dos"
thisform.numero.value="ii"
else
if (thisform.numero.value)="two"
thisform.numero.value="ii"
else
if (thisform.numero.value)="II"
thisform.numero.value="ii"
else
endif
endif
endif
endif
*numero dos en ingles
case(thisform.tipo.value)=2
if (thisform.numero.value)="2"
thisform.numero.value="two"
else
if (thisform.numero.value)="dos"
thisform.numero.value="two"
else
if (thisform.numero.value)="two"
thisform.numero.value="two"
else
if (thisform.numero.value)="II"
thisform.numero.value="two"
endif
endif
endif
endif
*numero dos en español
case(thisform.tipo.value)=3
if (thisform.numero.value)="2"
thisform.numero.value="dos"
else
if (thisform.numero.value)="dos"
thisform.numero.value="dos"
else
if (thisform.numero.value)="II"
thisform.numero.value="dos"
else
if (thisform.numero.value)="two"
thisform.numero.value="dos"
endif
endif
endif
endif
* umero dos
case(thisform.tipo.value)=4
if (thisform.numero.value)="2"
thisform.numero.value="2"
else
if (thisform.numero.value)="dos"
thisform.numero.value="2"
else
if (thisform.numero.value)="two"
thisform.numero.value="2"
else
if (thisform.numero.value)="II"
thisform.numero.value="2"
endif
endif
endif
endif
endcase

do case
case (thisform.tipo.value)=1
*empiesa el numero tres EN ROMANO
if (thisform.numero.value)="3"
thisform.numero.value="III"
else
if (thisform.numero.value)="tres"
thisform.numero.value="III"
else
if (thisform.numero.value)="three"
thisform.numero.value="III"
else
if (thisform.numero.value)="III"
thisform.numero.value="III"
else
thisform.numero.value="fuera de rango"

endif
endif
endif
endif

*numero tres en ingles
case(thisform.tipo.value)=2
if (thisform.numero.value)="3"
thisform.numero.value="three"
else
if (thisform.numero.value)="tres"
thisform.numero.value="three"
else
if (thisform.numero.value)="three"
thisform.numero.value="three"
if (thisform.numero.value)="III"
thisform.numero.value="three"
else
endif
endif
endif
endif
*empieza el 3 en español
case(thisform.tipo.value)=3
if(thisform.numero.value)="3"
thisform.numero.value="tres"
else
if (thisform.numero.value)="tres"
thisform.numero.value="tres"
else
if (thisform.numero.value)="three"
thisform.numero.value="tres"
if(thisform.numero.value)="III"
thisform.numero.value="tres"
else
endif
endif
endif
endif
*empieza el 3 en numero
case(thisform.tipo.value)=4
if (thisform.numero.value)="3"
thisform.numero.value="3"
else
if (thisform.numero.value)="tres"
thisform.numero.value="3"
else
if (thisform.numero.value)="three"
thisform.numero.value="3"
else
if (thisform.numero.value)="III"
thisform.numero.value="3"
endif
endif
endif
endif
endcase


muchas gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil

RE:formulario, numeros

Publicado por DALSOM (612 intervenciones) el 24/04/2006 16:54:06
ME PARECE QUE PROGRAMANDO EN SPAGETTIS NO LOGRARAS CON CLARIDAD LO QUE QUIERES.

MODULA TU CODIGO, EN ESTA FORMA,

HAS UN MODULO PARA LAS UNIDADES, OTRO PARA LAS DECENAS, OTRO CENTENAS, HASTA LLEGAR A LA CANTIDAD DE DIGITOS QUE DESEAS.

Y CUANDO TENGAS TODOS LOS MODULOS, PUES, UN MODULO LLAMARA A OTRO.

SI ES DEL DE LAS CENTENAS, ENTONCES ESTE LLAMARA AL DE LAS DECENAS, Y ESTE A SU VEZ AL DE LAS UNIDADES. ARMANDO LA CADENA.

POR EJEMPLO :

?UNIDADES([V]) && Devolvera 5.

FUNCTION UNIDADES
PARAMETERS cDIGIT
DO CASE
CASE cDIGIT=[I]
RET=[ 1]
CASE cDIGIT=[II]
RET=[ 2]
CASE cDIGIT=[III]
RET=[ 3]
CASE cDIGIT=[IV]
RET=[ 4]
CASE cDIGIT=[V]
RET=[ 5]
CASE cDIGIT=[VI]
RET=[ 6]
CASE cDIGIT=[VII]
RET=[ 7]
CASE cDIGIT=[VIII]
RET=[ 8]
CASE cDIGIT=[IX]
RET=[ 9]
CASE cDIGIT=[X]
RET=[ 10]
OTHERWISE
RET=[ ]
ENDCASE
RETURN RET

SALUDOS,
DALSOM.

PD: EN LA SECCION DE CODIGO EXISTE UN CODIGO QUE HACE ESTO, SOLO LO BAJAS Y LO MODIFICAS.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar