Prueba estos ejemplos a ver que tal
- Code: Select all Expand view
Function Eloy()
local nValor
Calcula( 7 )
Calcula( 17.37 )
Calcula( 13.53 )
Calcula( 17 )
Calcula( 8 )
Calcula( 9 )
Return nil
Function Calcula( nValor )
Local nBase
Local nIva
Local nIva1
Local nTotal
nBase := ROUND( nValor / 1.21, 8 )
nIva := ROUND( nBase * 0.21, 8 )
nBase := Round( nBase, 2 )
nIva := Round( nIva, 2 )
nIva1 := nValor - nBase
nTotal := nBase + nIva
MsgInfo( "Valor..: "+Str( nValor, 8, 2 ) + CRLF + ;
"Base...: "+Str( nBase , 8, 2 ) + CRLF + ;
"Iva....: "+Str( nIva , 8, 2 ) + CRLF + ;
"Iva1...: "+Str( nIva1 , 8, 2 ) + CRLF + ;
"Total..: "+Str( nTotal, 8, 2 ) )
Return nil