* to_hex
parameter p_cislo
privat p_hex,p_zn
m.p_hex = ""
m.pom = m.p_cislo
do case
case m.p_cislo = 0
  m.p_hex = "00"
case between(m.p_cislo, 0, 9)
  m.p_hex = '0'+str(m.p_cislo,1)  
case between(m.p_cislo, 10, 15)
  m.p_hex = '0'+chr(m.p_cislo+55)
otherwise
 do while .T.
  m.n_cislo = round((pom/16 - int(m.pom/16)) * 16,0)
  do case
  case between(n_cislo, 0, 9)
    m.p_zn = str(m.n_cislo, 1)
  case m.n_cislo = 10
    m.p_zn = 'A'
  case m.n_cislo = 11
    m.p_zn = 'B'
  case m.n_cislo = 12
    m.p_zn = 'C'
  case m.n_cislo = 13
    m.p_zn = 'D'
  case m.n_cislo = 14
    m.p_zn = 'E'
  case m.n_cislo = 15
    m.p_zn = 'F'
  endcase
  m.p_hex = m.p_zn + m.p_hex
  m.pom = int(m.pom/16)
  if m.pom = 0
    exit
  endif
 enddo
endcase
return p_hex
