ola Mustafá utilizo una función para tratar variables tipo moneda en sql siguemustafa wrote: ↑Sun Jun 16, 2019 1:07 pm Hola amigos:
Siguiendo con los experimentos con SQLite
La suma de cantidades económicas de precios.
No consigo que en los GRID y en el Listado PDF
las cantidades económicas que terminan en "0"
salgan , vean la muestra sale 3,8 cuando tendía
que ser 3,80 ó 4,0 cuando tendría que ser 4,00
el problema de la "," de los Euros no es el problema
porque si no se aplica STRTRAN ( precio , '.',',')
sale lo mismo falta el "0"
También he aplicado --> ROUND( precio, 2 ) , indicando
que son 2 decimales, solo pasa con los "0" ?
Si alguien puede indicar alguna solución, agradecido
Un cordial saludo.
Mustafa
*---------------------------- Google ---------------------------------------*
Hello friends:
Continuing with the experiments with SQLite
The sum of economic quantities of prices.
I do not get that in the GRID and in the PDF List
the economic amounts that end in "0"
come out, see the sample comes out 3.8 when I tended
that would be 3.80 or 4.0 when it would have to be 4.00
the problem of the "," of the Euros is not the problem
because if STRTRAN is not applied ( precio , '.', ',')
the same thing is missing the "0"
I have also applied -> ROUND ( precio, 2), indicating
which are 2 decimals, only happens with the "0"?
If someone can indicate some solution, grateful
A cordial greeting.
Mustafa
english
Hello Mustafa I use a function to treat currency type variables in sql follows
Code: Select all
poner = "aCurRow[1],aCurRow[2],aCurRow[3], MoedaMysql( VAL(aCurRow[4])),aCurRow[5]" // La coma "," decimal para €
*************************************************************************************************************************************
Function MoedaMysql(nVar)
*************************************************************************************************************************************
cTotal := ALLTRIM(TransForm( nVar , "9999,999.99"))
//Msginfo("nVar Entrada " + cTotal )
IF LEN(cTotal) <= 6
cTotal := Alltrim(StrTran( cTotal , ".", "," ,1,1 ))
ENDIF
IF LEN(cTotal) >= 7
cTotal := Alltrim(StrTran( cTotal , ".", "," ,1,1 ))
cTotal := Alltrim(StrTran( cTotal , ",", "." ,1,1 ))
ENDIF
// Msginfo("nVar saida " + cTotal )
Return cTotal