Páginas filhas
  • Extenso() - Generic Function

Versões comparadas

Chave

  • Esta linha foi adicionada.
  • Esta linha foi removida.
  • A formatação mudou.

Extenso() - Generic Function

...

Índice


01. OVERVIEW

This function returns values in full.

02. 

...

PARAMETERS

nNumToExt

Value generated in full.

lQuantid

It determines whether it will be full value or full quantity (default = .F.).

nMoeda

It identifies the description of the currency that will be taken from the MV_MOEDAx parameter (x= 1...5).

cPrefixo

Alternative prefix. If specified, prefixes the return and prevents the monetary unit from being returned (default = \" \" ).

cIdioma

It specifies the language in which to return the function value (1=Port,2=Spa,3=Eng). The default is the System language.

lCent

It specifies whether the function must return the cents. The default is .T..

lFrac

It specifies whether the cents return in fractioned mode (only run if cIdioma = 3 (English)).

lUsaCon

It specifies whether "y" or "con" is used (only if the language is Spanish).

cPosMoed

cPosMoed    -It specifies the position of the currency description (1=Before the text; 2=Between full values and cents; 3=At the end of the text) 

Important!
When using the language functionality, the system fetches the currency description using the MV_MOEDAx and MV_MOEDAPx parameters, where x represents the number of the desired currency sent to the Extenso function using the nMoeda variable.
For the text (singular) that represents the currency, the existing MV_MOEDAx parameters are used (where x can be 1 to 5), and 5 more MV_MOEDAPx parameters (where x can be 1 to 5) must be created for the respective plurals.

03. EXAMPLE OF USE


EXTENSO
#Include "Protheus.ch"
#Include "rwmake.ch"
user function Exte()
Local nValor as numeric
Local lQuantid as logical
Local nMoeda as numeric
Local cPrefixo as character
Local cIdioma as character
Local lCent as logical
Local lFrac as logical
Local lUsaCon as logical
Local cPosMoed as character
nValor:= 3456.72
lQuantid := .F.
nMoeda := 1
cPrefixo:= ""
cIdioma := "1"
lCent := .T.
lFrac := .F.
lUsaCon := .T. //Somente espanhol
cPosMoed := "2"
cTexto := Extenso(nValor, lQuantid, nMoeda, cPrefixo,cIdioma,lCent,lFrac,lUsaCon, cPosMoed )
CONOUT("******************")
CONOUT(cTexto)//TRES MIL, QUATROCENTOS E CINQUENTA E SEIS REAIS E SETENTA E DOIS CENTAVOS
CONOUT("******************")

Return
//Exemplos e retornos:
/*
Extenso(500.00)= "QUINHENTOS REAIS"
Extenso(500.00,.f.,2,,1)= "QUINHENTOS DOLARES"
Extenso(1999.78 ,.T.,2) = "ONE THOUNSAND NINE HUNDRED AND NINETY-NINE"
Extenso(1999.78 ,.F.,1) = "ONE THOUNSAND NINE HUNDRED AND NINETY-NINE DOLLARS AND SEVENTY-EIGHT CENTS"
Extenso(1999.78 ,.F.,1,,,.F.) = "ONE THOUNSAND NINE HUNDRED AND NINETY-NINE DOLLARS"
Extenso(1999.78 ,.F.,1,,"3",.T.,.T.) = "ONE THOUNSAND NINE HUNDRED AND NINETY-NINE AND 78/100 DOLLARS"
Extenso(1999.78 ,.F.,1,,"2",.T.,.F.)= "UM MIL, NOVECIENTOS NOVENTA Y NUEVE DOLARES Y SETENTA Y OCHO CENTAVOS"
Extenso(1999.78 ,.F.,1,,"1",.T.,.F.)= "UM MIL, NOVECENTOS E NOVENTA E NOVE DOLARES E SETENTA E OITO CENTAVOS"
Extenso(0.85,.F.,1,,"3",.T.,.T.)= "85/100 DOLLARS"
Extenso(0.85,.F.,1,,"3",.T.,.F.)= "EIGHTY-FIVE CENTS"
Extenso(2001,.F.,1,,"2",.T.,.F.)= "DOS MIL Y UM DOLARES"
Extenso(500.05,.F.,1,,"3",.T.,.F.)= "FIVE HUNDRED DOLLARS AND FIVE CENTS"
Extenso(500.05,.F.,1,,"3",.T.,.T.)= "FIVE HUNDRED AND 5/100 DOLLARS"
Extenso(500.05,.F.,2,,"1",.T.,.T.)= "QUINHENTOS REAIS E CINCO CENTAVOS"
*/

04. OTHER INFORMATION

Generic Function - Extenso
Extenso() (SIGAFAT)
KCS - Extenso() - Conversion to other languages
KCS - Extenso function text in plural
GETMV()