PARAMETERS id_man, src_path, c_stredisk, skl_param,datum1,datum2
PRIVATE m.hladajcdata, m.hladajcstredisk, m.hladajcdoklod, m.hladajcdokldo
ostatni = "___ostatni"
old_errh = ON("ERROR")
m.hladajcstredisk=m.c_stredisk
m.hladajcdoklod=m.datum1
m.hladajcdokldo=m.datum2
m.hladajcdata=m.src_path
IF m.issql
	IF USED("uctexpo")
		=REQUERY("uctexpo")
	ELSE 
		IF INLIST(LOWER(m.gcuct_typ),"orion","asseco")
			USE (m.sqlprefix+"rdokladyuctostrediskooddoneprenesene") IN 0 ALIAS uctexpo
		ELSE 
			USE (m.sqlprefix+"rdokladyuctostrediskooddo") IN 0 ALIAS uctexpo
		ENDIF 
	ENDIF 
	IF !USED("skupiny")
		USE (m.sqlprefix+"rskupinyucto") IN 0 ALIAS skupiny
	ENDIF 
ELSE
	IF !USED("obraty")
		USE (m.gccen_path+"obraty") ORDER c_dokl ALIAS obraty AGAIN IN 0
	ENDIF 
	IF !USED("doklady")
		USE (m.gccen_path+"doklady") ORDER c_dokl ALIAS doklady AGAIN IN 0
	ENDIF 
	IF !USED("skupiny")
		USE (m.gccen_path + "skupiny") ORDER druh ALIAS skupiny AGAIN IN 0
	ENDIF 
	IF !USED("karty")
		USE (m.gccen_path + "karty") ORDER c_karty ALIAS karty AGAIN IN 0
	ENDIF 
	IF !USED("partneri")
		USE (m.gccen_path + "partneri") ORDER c_partner ALIAS partneri AGAIN IN 0 
	ENDIF 
	IF INLIST(LOWER(m.gcuct_typ),"orion","asseco")
		SELECT doklady.*, partneri.partner FROM doklady LEFT JOIN partneri ON doklady.c_partner=partneri.c_partner INTO CURSOR uctexpo WHERE c_stredisk=m.c_stredisk AND c_dokl>=m.datum1 AND c_dokl<=m.datum2 AND !INLIST(operace,"PE","VR","VE") READWRITE 
	ELSE 
		SELECT doklady.*, partneri.partner FROM doklady LEFT JOIN partneri ON doklady.c_partner=partneri.c_partner INTO CURSOR uctexpo WHERE c_stredisk=m.c_stredisk AND c_dokl>=m.datum1 AND c_dokl<=m.datum2 READWRITE 
	ENDIF 
ENDIF 
= vytvor_obr_uex(.f., m.hladajcstredisk, m.hladajcdoklod, m.hladajcdokldo, .f., m.hladajcdata)
