*----------------------------------------------------------------------------------
*FUNCTION SUMA_IN_VORBE
param suma
local i,lit,numar1
store 0 to i
store '' to lit,numar1

copy file &dirgen\_ALFA\datean\mila1.* to &loc\&nfscurt\tempo\mila1.*
use &loc\&nfscurt\tempo\mila1 in 0 alias mila1
numar1=space(12)

numar1=str(suma,12)
dimension a(12)
a(1)=subs(numar1,12,1)
a(2)=subs(numar1,11,1)
a(3)=subs(numar1,10,1)
a(4)=subs(numar1,9,1)
a(5)=subs(numar1,8,1)
a(6)=subs(numar1,7,1)
a(7)=subs(numar1,6,1)
a(8)=subs(numar1,5,1)
a(9)=subs(numar1,4,1)
a(10)=subs(numar1,3,1)
a(11)=subs(numar1,2,1)
a(12)=subs(numar1,1,1)
sele mila1
*********************
  loca for nr=val(a(12))
  lit=lit+alltri(cr1)
 
  if val(a(11))=1
   if val(a(10))=0
    loca for nr=val(a(11))
    lit=lit+alltri(cr5)
   else
    loca for nr=val(a(10))
    lit=lit+alltri(cr4)
   endif
 else
     if val(a(10))=0
    loca for nr=val(a(11))
    lit=lit+alltrim(cr5)
   else
    loca for nr=val(a(11))
    lit=lit+alltrim(cr2)
    loca for nr=val(a(10))
    lit=lit+alltrim(cr3)
  endif
 endif
 do case
   case val(a(12)) # 0
    lit=lit+' miliarde'
   case val(a(11)) # 0
    lit=lit+' miliarde'
   case val(a(10)) # 0
    lit=lit+' miliarde'
 endcase
 ***********************
  loca for nr=val(a(9))
  lit=lit+alltri(cr1)
 
  if val(a(8))=1
   if val(a(7))=0
    loca for nr=val(a(8))
    lit=lit+alltri(cr5)
   else
    loca for nr=val(a(7))
    lit=lit+alltri(cr4)
   endif
 else
     if val(a(7))=0
    loca for nr=val(a(8))
    lit=lit+alltrim(cr5)
   else
    loca for nr=val(a(8))
    lit=lit+alltrim(cr2)
    loca for nr=val(a(7))
    lit=lit+alltrim(cr3)
  endif
 endif
 do case
   case val(a(9)) # 0
    lit=lit+' milioane'
   case val(a(8)) # 0
    lit=lit+' milioane'
   case val(a(7)) # 0
    lit=lit+' milioane'
 endcase
***********************
  loca for nr=val(a(6))
  lit=lit+alltri(cr1)
 
  if val(a(5))=1
   if val(a(4))=0
    loca for nr=val(a(5))
    lit=lit+alltri(cr5)
   else
    loca for nr=val(a(4))
    lit=lit+alltri(cr4)
   endif
 else
     if val(a(4))=0
    loca for nr=val(a(5))
    lit=lit+alltrim(cr5)
   else
    loca for nr=val(a(5))
    lit=lit+alltrim(cr2)
    loca for nr=val(a(4))
    lit=lit+alltrim(cr3)
  endif
 endif
 do case
   case val(a(6)) # 0
    lit=lit+' mii'
   case val(a(5)) # 0
    lit=lit+' mii'
   case val(a(4)) # 0
    lit=lit+' mii'
 endcase

*********************
  loca for nr=val(a(3))
  lit=lit+alltri(cr1)
 
  if val(a(2))=1
   if val(a(1))=0
    loca for nr=val(a(2))
    lit=lit+alltri(cr5)
   else
    loca for nr=val(a(1))
    lit=lit+alltri(cr4)
   endif
 else
     if val(a(1))=0
    loca for nr=val(a(2))
    lit=lit+alltrim(cr5)
   else
    loca for nr=val(a(2))
    lit=lit+alltrim(cr2)
    loca for nr=val(a(1))
    lit=lit+alltrim(cr3)
  endif
 endif
 do case
   case val(a(3)) # 0
    lit=lit+' lei'
   case val(a(2)) # 0
    lit=lit+' lei'
   case val(a(1)) # 0
    lit=lit+' lei'
 endcase

sele mila1
use

lit=strtran(lit,' ','')
return lit