* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
*
* program slouzi instalacim, kde v jednech datech je dohromady vice subjektu a je treba jim tisknout ruzne hlavicky dokladu
* program pri prepnuti skladu porovna food_dat.eet_dico s m.hotel_dico, 
* pokud se lisi, naplni pametove promene hotel_name, hotel_naz* z nasledujicich eeteckovych sloupcu food_dat:
*     hotel_dico z eet_dic
*     hotel_ico  z eet_dic2
*     hotel_name z eet_url
*     hotel_naz1-3 z eet_url2 oddeleny svislou carou "|"
*
* 2017-01-20
* 2020-04-06 - nepousti se pro sql 
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
#DEFINE CRLF CHR(13)+CHR(10)

IF m.issql
    RETURN
ENDIF 

IF TYPE("g__hotel_params") = "U"    && prvni volani, ulozi se promenne z food_set
PUBLIC ARRAY g__hotel_params (9)
    g__hotel_params(1) = m.hotel_dico
    g__hotel_params(2) = m.hotel_ico
    g__hotel_params(3) = m.hotel_name
    g__hotel_params(4) = m.hotel_naz1
    g__hotel_params(5) = m.hotel_naz2
    g__hotel_params(6) = m.hotel_naz3
ENDIF 

USE (m.gcpri_path + "strediska") AGAIN ALIAS hn_stred
LOCATE FOR c_stredisk = m.gic_stredisk 
IF FOUND()
    IF EMPTY(eet_dic)
        DO nastav_z_food_set
    ELSE
        IF ALLTRIM(eet_dic) # m.hotel_dico
            DO nastav_z_food_dat
        ENDIF 
    ENDIF 
ELSE 
    zaznamenej (" not found")
ENDIF 


*    *    *    *    *    *    *    *    *    *    *    *    
PROCEDURE nastav_z_food_dat

hotel_dico = ALLTRIM(hn_stred.eet_dic)
hotel_ico  = ALLTRIM(hn_stred.eet_dic2)
hotel_name = ALLTRIM(hn_stred.eet_url)

#DEFINE ODDELOVAC "|"
*DIMENSION rrr(4)

radek = hn_stred.eet_url2 + REPLICATE(ODDELOVAC, 5)

hotel_naz1 = ALLTRIM(LEFT(m.radek, AT(ODDELOVAC, m.radek)-1))
radek = SUBST(m.radek, AT(ODDELOVAC, m.radek)+1)

hotel_naz2 = ALLTRIM(LEFT(m.radek, AT(ODDELOVAC, m.radek)-1))
radek = SUBST(m.radek, AT(ODDELOVAC, m.radek)+1)

hotel_naz3 = ALLTRIM(LEFT(m.radek, AT(ODDELOVAC, m.radek)-1))
radek = SUBST(m.radek, AT(ODDELOVAC, m.radek)+1)
zaznamenej (" food_dat")


*    *    *    *    *    *    *    *    *    *    *    *    
PROCEDURE nastav_z_food_set
hotel_dico = g__hotel_params(1)
hotel_ico  = g__hotel_params(2)
hotel_name = g__hotel_params(3)
hotel_naz1 = g__hotel_params(4)
hotel_naz2 = g__hotel_params(5)
hotel_naz3 = g__hotel_params(6)
zaznamenej (" food_set")


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
FUNCTION zaznamenej (texticek)
*WAIT m.hotel_name + m.texticek WINDOW AT 22,22 time 2
*STRTOFILE(TTOC(DATETIME(), 3) +" c_stred: " + STR(m.gic_stredisk,6) + " " + m.machine + " " + m.hotel_name + " "+ m.texticek + CRLF, m.gchom_path + "nastav_hotel_name.txt", 1)
