*!*********************************************************************
*!      Function ROUND50
*!      zaokrouhluje pri prepocte medzi skk a eur
*!*********************************************************************
*FUNCTION round50
PARAMETERS p_cislo, typ_zaok, m.p_mist
*typ_zaok=1 - Sk,Kc - 50halierniky
*typ_zaok=2 - EUR - 2desatinne miesta, po 4 dole, od 5 vratane hore
*typ_zaok=3 - EUR - 2desatinne miesta matematicky
*typ_zaok=4 - EUR - 3desatinne miesta, po 4 dole, od 5 vratane hore
*typ_zaok=5 - EUR - 5 centovky
IF PARAMETERS()<3
    m.p_mist=1
ENDIF
DO CASE
    CASE m.typ_zaok=1
        PRIVATE p_pom
        m.frac = ABS(m.p_cislo) - INT(ABS(m.p_cislo))
        DO CASE
            CASE m.p_mist >= 1
                DO CASE
                    CASE (m.frac >= 0) .AND. (m.frac < 0.25)
                        m.p_pom = SIGN(m.p_cislo)* ABS(INT(m.p_cislo))
                    CASE (m.frac >= 0.25) .AND. (m.frac < 0.75)
                        m.p_pom = SIGN(m.p_cislo)* ABS(INT(m.p_cislo))+SIGN(m.p_cislo)*0.5
                    OTHERWISE
                        m.p_pom = SIGN(m.p_cislo)* ABS(INT(m.p_cislo))+SIGN(m.p_cislo)*1.0
                ENDCASE
            OTHERWISE
                m.p_pom = ROUND(m.p_cislo, 0)
        ENDCASE
    CASE  m.typ_zaok=2
        PRIVATE p_pom
        m.p_cislo=m.p_cislo*100
        m.frac = ABS(m.p_cislo) - INT(ABS(m.p_cislo))
        DO CASE
            CASE (m.frac >= 0) .AND. (m.frac < 0.5)
                m.p_pom = SIGN(m.p_cislo)* ABS(INT(m.p_cislo))/100
            OTHERWISE
                m.p_pom = SIGN(m.p_cislo)* (ABS(INT(m.p_cislo))+1)/100
        ENDCASE
    CASE  m.typ_zaok=3
        PRIVATE p_pom
        m.p_pom=ground(m.p_cislo,2)
    CASE  m.typ_zaok=4
        PRIVATE p_pom
        m.p_cislo=m.p_cislo*1000
        m.frac = ABS(m.p_cislo) - INT(ABS(m.p_cislo))
        DO CASE
            CASE (m.frac >= 0) .AND. (m.frac < 0.5)
                m.p_pom = SIGN(m.p_cislo)* ABS(INT(m.p_cislo))/1000
            OTHERWISE
                m.p_pom = SIGN(m.p_cislo)* (ABS(INT(m.p_cislo))+1)/1000
        ENDCASE
    CASE m.typ_zaok=5
        PRIVATE p_pom
        m.frac = ABS(m.p_cislo*10) - INT(ABS(m.p_cislo*10))
        DO CASE
            CASE m.p_mist >= 1
                DO CASE
                    CASE (m.frac >= 0) .AND. (m.frac < 0.25)
                        m.p_pom = SIGN(m.p_cislo)* ABS(INT(m.p_cislo*10))/10
                    CASE (m.frac >= 0.25) .AND. (m.frac < 0.75)
                        m.p_pom = (SIGN(m.p_cislo)* ABS(INT(m.p_cislo*10))+SIGN(m.p_cislo)*0.5)/10
                    OTHERWISE
                        m.p_pom = (SIGN(m.p_cislo)* ABS(INT(m.p_cislo*10))+SIGN(m.p_cislo)*1.0)/10
                ENDCASE
            OTHERWISE
                m.p_pom = ROUND(m.p_cislo, 0)
        ENDCASE
ENDCASE
RETURN m.p_pom
