insert_edihlav()
DO WHILE !FEOF(m.edisubor)
    txtriadok=FGETS(m.edisubor)
    DO CASE 
    CASE LEFT(m.txtriadok,3)="HDR" AND LEN(ALLTRIM(m.txtriadok)) < 50 
            SELECT edihlav
            REPLACE c_faktury WITH alsu(4,15), dat_vyst WITH CTOD(SUBSTR(m.txtriadok,25,2)+"."+SUBSTR(m.txtriadok,23,2)+"."+SUBSTR(m.txtriadok,19,4))
            REPLACE ico WITH "28234642",partner WITH "Bidvest Czech Republic s.r.o."

    CASE LEFT(m.txtriadok,3)="LIN"
            IF SUBSTR(m.txtriadok,75,1)="," && Bidvest
                INSERT INTO edipol (id_edi, c_data, riadok, ean, kod_zak, mnozstvo, cena, cena_celk, dan, nazov) VALUES ;
                    (m.hladajidedi, m.cdata, valsu(4,6), alsu(10,25), alsu(35,25), valsu(64,14), valsu(80,12), valsu(64,14) * valsu(80,12), valsu(94,6), alsu(184,45))

            ELSE
                INSERT INTO edipol (id_edi, c_data, riadok, ean, kod_zak, mnozstvo, cena, cena_celk, dan, nazov) VALUES ;
                    (m.hladajidedi, m.cdata, valsu(4,6), alsu(10,25), alsu(35,25), valsu(93,12), valsu(76,12), valsu(76,12) * valsu(93,12), valsu(88,5), alsu(177,45))
            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
druhy_doklad_z_minusu_a_suma()
uloz_a_zavri("SYS P")
