¿Qué función utilizo para insertar un montante escrito en el programa Power Bulider?

HoLA ... MIRA NESECITO CUAL FUNCION A DE OCUPAR
UN MONTOESCRITO EJ: 1200 ( MIL DOCIENTOS)
DE ANTEMANO GRACIAS........
1

1 respuesta

Respuesta
1
Importa estas 3 funciones o ok...
Saludos
AlexM
/******* funcion 1************/
$PBExportHeader$fx_ciento.srf
$PBExportComments$Sub función de fx_MoneyToString
global type fx_ciento from function_object
end type
forward prototypes
global function string fx_ciento (integer num)
end prototypes
global function string fx_ciento (integer num);string cad, ls, ret
cad = string(num, "000")
choose case Left(cad, 1)
case '2'
ret = 'doscientos'
case '3'
ret = 'trescientos'
case '4'
ret = 'cuatrocientos'
case '5'
ret = 'quinientos'
case '6'
ret = 'seiscientos'
case '7'
ret = 'setecientos'
case '8'
ret = 'ochocientos'
case '9'
ret = 'novecientos'
End choose
If Left(cad, 1) = '1' then
If Mid(cad, 2,2) = '00' then
ret = 'cien'
Else
ret = 'ciento'
End if
End if
If Mid(cad, 2,2) = '00' then return ret
If ret <> "" then ret = ret + " "
If Mid(cad, 2, 2) < '16' then
ret = ret + fx_unidad(Mid(cad, 2, 2))
Elseif Mid(cad, 3, 1) = '0' then
choose case Mid(cad, 2, 1)
case '2'
ls = 'veinte'
case '3'
ls = 'treinta'
case '4'
ls = 'cuarenta'
case '5'
ls = 'cincuenta'
case '6'
ls = 'sesenta'
case '7'
ls = 'setenta'
case '8'
ls = 'ochenta'
case '9'
ls = 'noventa'
End choose
Else
choose case Mid(cad, 2, 1)
case '1'
ls = 'dieci'
case '2'
ls = 'veinti'
case '3'
ls = 'treinta y '
case '4'
ls = 'cuarenta y '
case '5'
ls = 'cincuenta y '
case '6'
ls = 'sesenta y '
case '7'
ls = 'setenta y '
case '8'
ls = 'ochenta y '
case '9'
ls = 'noventa y '
End choose
ls = ls + fx_unidad(Mid(cad, 3, 1))
End if
return ret + ls
end function
/******* funcion ************/
$PBExportHeader$fx_millon.srf
$PBExportComments$Sub función de fx_MoneyToString
global type fx_millon from function_object
end type
forward prototypes
global function string fx_millon (long num)
end prototypes
global function string fx_millon (long num);string cad, ls, ret, ls2
cad = string(num, "000000")
ls = Mid(cad,1,3)
If ls <> "000" then
ret = fx_ciento(integer(ls))
//If left(ls,1) = "1" then ret = Mid(ret,1, len(ret)-1)
ret = ret + " mil"
End if
ls = Mid(cad,4,3)
If ls <> "000" then
ls = fx_ciento(integer(ls))
If ret <> "" then ret = ret + " "
ret = ret + ls
End if
return ret
end function
/******* funcion ************/
$PBExportHeader$fx_moneytostring.srf
$PBExportComments$Convierte dato numerico a letras.
global type fx_moneytostring from function_object
end type
forward prototypes
global function string fx_moneytostring (double num)
end prototypes
global function string fx_moneytostring (double num);string cad, ret, ls
cad = string(num, "0000000000000.00")
/*9,000,000,000,000.00*/
ls = Left(cad, 1)
If ls <> "0" then
If ls = '1' then
ret = 'un'
Else
ret = fx_unidad(ls)
End if
ret += " billon"
If integer(ls) > 1 then ret = ret + "es"
End if
ls = Mid(cad,2,6)
If ls <> "000000" then
If ret <> "" then ret = ret + " "
If long(ls) = 1 then
ret += "un millon"
Else
ret += fx_millon(long(ls)) + " millones"
End if
End if
ls = Mid(cad, 8, 6)
If ls <> "000000" then
IF mid(ls,1,3) = "001" then
ret ='un mil ' + fx_ciento(integer(mid(ls,4)))
else
If ret <> "" then ret = ret + " "
ret += fx_millon(long(ls))
end if
End if
If ret = "" then ret = "cero"
ls = Mid(cad, 15, 2)
ret = ret + " con " + ls + "/100"
return ret
end function

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas