IF .not. m.issql

    IF !FILE(gchom_path + "ug_skup.dbf")
        DO creafile WITH gchom_path + "ug_skup"
    ENDIF
    IF !FILE(gchom_path + "kursy.dbf")
        DO creafile WITH gchom_path + "kursy"
    ENDIF
    IF !FILE(gchom_path + "prn_def.dbf")
        DO creafile WITH gchom_path + "prn_def"
    ENDIF
    IF !FILE(gchom_path + "uctobd.dbf")
        DO creafile WITH gchom_path + "uctobd"
    ENDIF
    IF !FILE(gchom_path + "errors.dbf")
        DO creafile WITH gchom_path + "errors"
    ENDIF
    IF !FILE(gchom_path + "food_set.dbf")
        DO creafile WITH gchom_path + "food_set"
    ENDIF
    IF !FILE(gchom_path + "maxima.dbf")
        DO creafile WITH gchom_path + "maxima"
    ENDIF
    IF !FILE(gchom_path + "users.dbf")
        DO creafile WITH gchom_path + "users"
    ENDIF
    IF !FILE(gchom_path + "semafory.dbf")
        DO creafile WITH gchom_path + "semafory"
    ENDIF
    IF !FILE(gchom_path + "edi_prev.dbf")
        DO creafile WITH gchom_path + "edi_prev"
    ENDIF
*    IF !FILE(gchom_path + "ser_time.dbf")
*        DO creafile WITH gchom_path + "ser_time"
*    ENDIF
    IF !FILE(gchom_path + "gr___man.dbf")
        DO creafile WITH gchom_path + "gr___man"
    ENDIF
    IF !FILE(gchom_path + "ug___man.dbf")
        DO creafile WITH gchom_path + "ug___man"
    ENDIF
    IF !FILE(gchom_path + "gr___k32.dbf")
        DO creafile WITH gchom_path + "gr___k32"
    ENDIF
    IF !FILE(gchom_path + "ug___k32.dbf")
        DO creafile WITH gchom_path + "ug___k32"
    ENDIF
    IF !FILE(gchom_path + "gr___set.dbf")
        DO creafile WITH gchom_path + "gr___set"
    ENDIF
    IF !FILE(gchom_path + "ug___set.dbf")
        DO creafile WITH gchom_path + "ug___set"
    ENDIF
    IF !FILE(gchom_path + "gr___tch.dbf")
        DO creafile WITH gchom_path + "gr___tch"
    ENDIF
    IF !FILE(gchom_path + "ug___tch.dbf")
        DO creafile WITH gchom_path + "ug___tch"
    ENDIF
    IF !FILE(gchom_path + "druhy_pl.dbf")
        DO creafile WITH gchom_path + "druhy_pl"
    ENDIF

	IF !FILE(gchom_path + "food_dat.dbf")
	    = MESSAGEBOX("Neexistuje soubor " + m.gchom_path + "FOOD_DAT.DBF" + CHR(13) + "podle definicniho souboru " + m.gcini_file, 16, "FoodMan",2222)
	    CLOSE ALL
	    QUIT 
	ENDIF

	hodne_stary_food_dat = .T.
	IF f_acc(fn_food_dat)
	   IF FSIZE("typ_inst") > 0
	       LOCATE FOR typ_inst=1
	       IF FOUND()
	            m.gityp_inst=1
	       ELSE
	            m.gityp_inst=0
	       ENDIF
	   ELSE
	       m.gityp_inst=0
	   ENDIF
	   hodne_stary_food_dat = ( FSIZE("pozadi") = 0 )
	ENDIF 
ELSE
	m.hodne_stary_food_dat=.f.
ENDIF 

**    **    **    **    **    **    **    **    **    **    **    **    **    **    


ok = .T.
ON ERROR ok = .F.
USE (m.fn_food_dat) EXCLUSIVE
IF m.ok
     DO indexuj IN indexy
     IF m.hodne_stary_food_dat
          ALTER table (m.fn_food_dat) ADD pozadi C(30) NOCPTRANS 
          ALTER table (m.fn_food_dat) ADD a1 C(2) NOCPTRANS 
          ALTER table (m.fn_food_dat) ADD a2 C(2) NOCPTRANS 
          ALTER table (m.fn_food_dat) ADD a3 C(2) NOCPTRANS 
          ALTER table (m.fn_food_dat) ADD a4 C(2) NOCPTRANS 
          ALTER table (m.fn_food_dat) ADD a5 C(2) NOCPTRANS 
          ALTER table (m.fn_food_dat) ADD a6 C(2) NOCPTRANS 
          ALTER table (m.fn_food_dat) ADD a7 C(2) NOCPTRANS 
          ALTER table (m.fn_food_dat) ADD a8 C(2) NOCPTRANS 
          ALTER table (m.fn_food_dat) ADD a9 C(2) NOCPTRANS 
          ALTER table (m.fn_food_dat) ADD b1 C(2) NOCPTRANS 
          ALTER table (m.fn_food_dat) ADD b2 C(2) NOCPTRANS 
          ALTER table (m.fn_food_dat) ADD b3 C(2) NOCPTRANS 
          ALTER table (m.fn_food_dat) ADD b4 C(2) NOCPTRANS 
          ALTER table (m.fn_food_dat) ADD b5 C(2) NOCPTRANS 
          ALTER table (m.fn_food_dat) ADD b6 C(2) NOCPTRANS 
          ALTER table (m.fn_food_dat) ADD b7 C(2) NOCPTRANS 
          ALTER table (m.fn_food_dat) ADD b8 C(2) NOCPTRANS 
          ALTER table (m.fn_food_dat) ADD b9 C(2) NOCPTRANS 
          ALTER table (m.fn_food_dat) ADD c6 C(2) NOCPTRANS 
          ALTER table (m.fn_food_dat) ADD c7 C(2) NOCPTRANS 
          ALTER table (m.fn_food_dat) ADD c8 C(2) NOCPTRANS 
          ALTER table (m.fn_food_dat) ADD c9 C(2) NOCPTRANS 
     ENDIF
ENDIF
USE 

**    **    **    **    **    **    **    **    **    **    **    **    **    **    

ok = .T.
ON ERROR ok = .F.
USE (m.fn_food_dat) 
IF m.ok
    REPLACE FOR EMPTY(c1) c1 WITH "01"
    REPLACE FOR EMPTY(c2) c2 WITH "02"
    REPLACE FOR EMPTY(c3) c3 WITH "03"
    REPLACE FOR EMPTY(c4) c4 WITH "04"
    REPLACE FOR EMPTY(c5) c5 WITH "05"
    REPLACE FOR EMPTY(c6) c6 WITH "06"
    REPLACE FOR EMPTY(c7) c7 WITH "07"
    REPLACE FOR EMPTY(c8) c8 WITH "08"
    REPLACE FOR EMPTY(c9) c9 WITH "09"

    REPLACE FOR EMPTY(a1) a1 WITH c1
    REPLACE FOR EMPTY(a2) a2 WITH c2
    REPLACE FOR EMPTY(a3) a3 WITH c3
    REPLACE FOR EMPTY(a4) a4 WITH c4
    REPLACE FOR EMPTY(a5) a5 WITH c5
    REPLACE FOR EMPTY(a6) a6 WITH c6
    REPLACE FOR EMPTY(a7) a7 WITH c7
    REPLACE FOR EMPTY(a8) a8 WITH c8
    REPLACE FOR EMPTY(a9) a9 WITH c9

    REPLACE FOR EMPTY(b1) b1 WITH c1
    REPLACE FOR EMPTY(b2) b2 WITH c2
    REPLACE FOR EMPTY(b3) b3 WITH c3
    REPLACE FOR EMPTY(b4) b4 WITH c4
    REPLACE FOR EMPTY(b5) b5 WITH c5
    REPLACE FOR EMPTY(b6) b6 WITH c6
    REPLACE FOR EMPTY(b7) b7 WITH c7
    REPLACE FOR EMPTY(b8) b8 WITH c8
    REPLACE FOR EMPTY(b9) b9 WITH c9

ENDIF
CLOSE DATABASES 
