#DEFINE PNT  "."
    LOCAL cisloriadku
    cisloriadku=1
    insert_edihlav()
    DO WHILE !FEOF(m.edisubor) OR !EMPTY(m.txtriadok)
        DO CASE 
            CASE LEFT(m.txtriadok,3)="HDR"
                SELECT edihlav
                REPLACE c_faktury WITH SUBSTR(m.txtriadok,AT(";",m.txtriadok,1)+1,AT(";",m.txtriadok,2)-AT(";",m.txtriadok,1)-1)
                REPLACE dat_vyst WITH CTOD(SUBSTR(m.txtriadok,AT(";",m.txtriadok,2)+1,AT(";",m.txtriadok,3)-AT(";",m.txtriadok,2)-1))
                REPLACE ico WITH "36475939", partner WITH "Fega Frost s.r.o.", dic WITH "2020021949", icdph WITH "SK2020021949"
                REPLACE ulica WITH "Tehelòa 675/2"
                REPLACE mesto WITH "Kežmarok"
                REPLACE psc WITH "06001"
            CASE 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, m.cisloriadku,;
                    SUBSTR(m.txtriadok,ATC(";",m.txtriadok,4)+1,ATC(";",m.txtriadok,5)-ATC(";",m.txtriadok,4)-1),;
                    "",;
                    VAL(STRTRAN(SUBSTR(m.txtriadok,ATC(";",m.txtriadok,7)+1,ATC(";",m.txtriadok,8)-ATC(";",m.txtriadok,7)-1),",",PNT)),;
                    VAL(STRTRAN(SUBSTR(m.txtriadok,ATC(";",m.txtriadok,8)+1,ATC(";",m.txtriadok,9)-ATC(";",m.txtriadok,8)-1),",",PNT)),;
                    VAL(STRTRAN(SUBSTR(m.txtriadok,ATC(";",m.txtriadok,9)+1),",",PNT)),;
                    VAL(STRTRAN(SUBSTR(m.txtriadok,ATC(";",m.txtriadok,6)+1,ATC(";",m.txtriadok,7)-ATC(";",m.txtriadok,6)-1),",",PNT)),;
                    SUBSTR(m.txtriadok,ATC(";",m.txtriadok,3)+1,ATC(";",m.txtriadok,4)-ATC(";",m.txtriadok,3)-1)+" "+SUBSTR(m.txtriadok,ATC(";",m.txtriadok,5)+1,ATC(";",m.txtriadok,6)-ATC(";",m.txtriadok,5)-1))
                IF m.hotel_platca_dph
                    REPLACE suma WITH suma+VAL(STRTRAN(SUBSTR(m.txtriadok,ATC(";",m.txtriadok,9)+1),",",PNT))
                ELSE
                    REPLACE suma WITH suma+VAL(STRTRAN(SUBSTR(m.txtriadok,ATC(";",m.txtriadok,9)+1),",",PNT))*(VAL(STRTRAN(SUBSTR(m.txtriadok,ATC(";",m.txtriadok,6)+1,ATC(";",m.txtriadok,7)-ATC(";",m.txtriadok,6)-1),",",PNT))/100+1)
                ENDIF  
        ENDCASE 
        txtriadok=FGETS(m.edisubor)
        cisloriadku=m.cisloriadku+1
    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()
