    insert_edihlav()
    SELECT edihlav
    REPLACE c_faktury WITH sss(m.txtriadok, 1)
    REPLACE dat_vyst WITH CTOD(sss(m.txtriadok, 2))
    IF !m.hotel_platca_dph
        REPLACE suma WITH VAL(sss(m.txtriadok, 4))
    ELSE 
        REPLACE suma WITH VAL(sss(m.txtriadok, 3))
    ENDIF 
    txtriadok = FGETS(m.edisubor)
    IF AT(";",m.txtriadok,8) > 0
        REPLACE icdph WITH sss(m.txtriadok, 7)
    ELSE 
        REPLACE icdph WITH SUBSTR(m.txtriadok,AT(";",m.txtriadok,7)+1)
    ENDIF 
    REPLACE dic     WITH sss(m.txtriadok, 6), ico WITH sss(m.txtriadok, 5), partner WITH sss(m.txtriadok, 1)
    REPLACE ulica   WITH sss(m.txtriadok, 2), mesto WITH sss(m.txtriadok, 4), psc WITH sss(m.txtriadok, 3)
    txtriadok = FGETS(m.edisubor)
    IF sss(m.txtriadok, 4) # m.hotel_ico
        TABLEREVERT(.t.,"edihlav")
        FCLOSE(m.edisubor)
        ERASE (m.edimeno)
        IF m.edipor # 0
            STRTOFILE(m.obsah_souboru,                                               LEFT(m.orimeno, RAT(".", orimeno)) + "er")
            STRTOFILE("Doklad nie je urceny pre tento hotel (nesuhlasi ICO)" + CHR(13)+CHR(10), LEFT(m.orimeno, RAT(".", orimeno)) + "err")
        ENDIF 
    ELSE 
        DO WHILE !FEOF(m.edisubor)
            txtriadok=FGETS(m.edisubor)
            IF LEFT(m.txtriadok,3)="LIN"
                INSERT INTO edipol (id_edi, c_data, riadok, ean, kod_zak, mnozstvo, cena, cena_celk, dan, nazov) VALUES ;
                    (m.hladajidedi, m.cdata, v_sss(m.txtriadok, 1), "", sss(m.txtriadok, 2), ;
                    v_sss(m.txtriadok, 4), v_sss(m.txtriadok, 6), v_sss(m.txtriadok, 6), ;
                    IIF(ATC(";",m.txtriadok,10)>0, v_sss(m.txtriadok, 9), VAL(SUBSTR(m.txtriadok,ATC(";",m.txtriadok,9)+1))),;
                    sss(m.txtriadok, 3) + " " + sss(m.txtriadok, 5))
            ENDIF 
        ENDDO     
        SELECT edipol
        IF !m.hotel_platca_dph
            REPLACE ALL cena WITH cena*(dan/100+1), cena_celk WITH cena_celk*(dan/100+1)
            REPLACE ALL dan WITH 0
        ENDIF 
        druhy_doklad_z_minusu()
        uloz_a_zavri( "3 HDR")
    ENDIF 
