*!*****************************************************************************
*!       Procedure : PRREPORT
*!*****************************************************************************
*PROCEDURE prreport
PARAMETERS repo_name
PRIVATE m.lcrepo_path
m.lcrepo_path=m.gcrepo_path
PRIVATE boltool,oldsele, boltoolskl
m.boltool=.F.
m.boltoolskl=.F.
m.oldsele=SELECT()
IF VARTYPE('tbscreen') = 'O' THEN
	tbscreen.timer1.enabled=.f.
	tbscreen.HIDE()
	m.boltool=.T.
ENDIF
IF VARTYPE('tbscreenskl') = 'O' THEN
	IF tbscreenskl.VISIBLE
		tbscreenskl.HIDE()
	ENDIF
	tbscreenskl.TAG="pr_report"
	m.boltoolskl=.T.
ENDIF
IF VARTYPE(m.repo_txt)<>"C"
	m.repo_txt=""
ENDIF 
IF VARTYPE(m.gcrepo_special)=="C" AND !EMPTY(m.gcrepo_special)
    IF FILE(m.gcrepo_path+m.gcrepo_special+"\"+m.repo_name+".frx")
        m.lcrepo_path=m.gcrepo_path+m.gcrepo_special+"\"
    ENDIF 
ENDIF 

IF FILE (m.lcrepo_path + m.repo_name + ".frx")
    IF m.gnprintprompt >= 0
        DEFINE WINDOW pr_repo FROM 2,2 TO 22, 22 FONT gcdefa_font, 8 SYSTEM ZOOM GROW NOFLOAT TITLE (m.repo_name)
        ZOOM WIND pr_repo MAX
        err_h_info = m.lcrepo_path + m.repo_name
		SELECT (m.oldsele)
        REPORT FORM (m.lcrepo_path + m.repo_name) PREVIEW WINDOW pr_repo &gctxt_summary
        RELEASE WINDOWS pr_repo
        IF m.gnprintprompt > 0
			SELECT (m.oldsele)
            REPORT FORM (m.lcrepo_path + m.repo_name) TO PRINTER PROMPT NOCONSOLE &gctxt_summary
        ENDIF
        IF ! EMPTY(m.gcexportpath)
            pocet_souboru = ADIR(prrsoubory, m.gcexportpath + m.prrexp_filename + "*.xls")   && smazou se vsechny starsi do vcerejska
            FOR iii = 1 TO pocet_souboru
                IF prrsoubory(iii, 3) < IIF(m.xls_prepisovat,DATE()+999, DATE())
                    TRY
                       DELETE FILE (m.gcexportpath + prrsoubory(iii, 1))
                    CATCH
                    ENDTRY
                ENDIF 
            ENDFOR 
            TRY
                IF FILE (m.gcexportpath + m.prrexp_filename + ".xls")
					SELECT (m.oldsele)
                    EXPORT ALL TO (m.gcexportpath + m.prrexp_filename + ALLTRIM(STR(MOD(SECONDS(), 9)))) TYPE XLS
                ELSE
					SELECT (m.oldsele)
                    EXPORT ALL TO (m.gcexportpath + m.prrexp_filename) TYPE XLS
                ENDIF
            CATCH
            ENDTRY

        ENDIF
    ELSE
        SET PRINTER OFF
    ENDIF
ELSE
    WAIT "chybi report " + m.lcrepo_path + m.repo_name WINDOW TIMEOUT 1111 AT 22,22
    ACTIVATE SCREEN
	SELECT (m.oldsele)
    BROWSE NOAPPEND NODELETE NOEDIT 
    IF ! "EXE" $ VERSION(1)
        MODI REPO (m.lcrepo_path + m.repo_name)
    ENDIF
ENDIF
err_h_info = ""
IF m.boltool
	tbscreen.SHOW()
	tbscreen.timer1.enabled=.t.
ENDIF
IF m.boltoolskl
	IF tbscreenskl.TAG="pr_report"
		tbscreenskl.SHOW()
	ENDIF
	tbscreenskl.TAG=""
ENDIF
SELECT (m.oldsele)
