    insert_edihlav()
    DO WHILE !FEOF(m.edisubor)
        txtriadok=FGETS(m.edisubor)
        DO CASE 
            CASE LEFT(m.txtriadok,3)="HDR"
                SELECT edihlav
                REPLACE c_faktury WITH ALLTRIM(SUBSTR(m.txtriadok,4,15)),dat_vyst WITH CTOD(SUBSTR(m.txtriadok,31,2)+"."+SUBSTR(m.txtriadok,29,2)+"."+SUBSTR(m.txtriadok,25,4))
                txtriadok=FGETS(m.edisubor)
                REPLACE ico WITH alsu(324-254,15), dic WITH alsu(339-254,15), icdph WITH alsu(419-254,15), iban WITH alsu(449-254,34), swift WITH alsu(483-254,10)
                IF !EMPTY(alsu(273-254,17))
                    REPLACE edi_kod WITH alsu(273-254,17)
                ENDIF 
                txtriadok=FGETS(m.edisubor)
                txtriadok=FGETS(m.edisubor)
            CASE LEFT(m.txtriadok,3)="HDD"
                txtriadok=FGETS(m.edisubor)
                SELECT edihlav
                REPLACE partner WITH alsu(360-254,35)
                txtriadok=FGETS(m.edisubor)
                REPLACE ulica WITH alsu(535-508,35), mesto WITH alsu(675-508,35), psc WITH alsu(710-508,6)
                txtriadok=FGETS(m.edisubor)
            CASE LEFT(m.txtriadok,3)="LIN"
                INSERT INTO edipol (id_edi, c_data, riadok, ean, kod_zak, mnozstvo, cena, cena_celk, dan) VALUES ;
                    (m.hladajidedi, m.cdata, valsu(4,6), alsu(10,25), alsu(35,25), valsu(63,12), valsu(75,12), valsu(118,12), valsu(130,5))
                txtriadok=FGETS(m.edisubor)
                SELECT edipol
                REPLACE nazov WITH ALLTRIM(SUBSTR(m.txtriadok,358-254,70))
                IF cena_celk=0
                    REPLACE cena_celk WITH mnozstvo*cena
                ENDIF 
            CASE LEFT(m.txtriadok,3)="SUM"
                SELECT edihlav
                IF m.hotel_platca_dph
                    REPLACE suma WITH valsu(40,12)
                ELSE 
                    REPLACE suma WITH valsu(40,12) + valsu(74,12)
                ENDIF 
                txtriadok=FGETS(m.edisubor)
        ENDCASE 
    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("SYS P hotel_edikod")
