*:*****************************************************************************
*: Procedure file: OBJ_OUT
*: 
*: Export objednavek jidel
*:*****************************************************************************
param sk_path, pocet_dnu, ext, exp_path
IF EMPTY(exp_path)
  exp_path = "c:\ftp\data\"
ENDIF 
sk_path = sk_path + IIF(RIGHT(m.sk_path,1)="\", "", "\")
exp_path = exp_path + IIF(RIGHT(m.exp_path,1)="\", "", "\")
if ! directory(m.exp_path)
   mkdir (m.exp_path)
ENDIF
if empty(m.ext)
  ext = "_x"
endif
if empty(m.pocet_dnu)
  m.pocet_dnu = 10
endif

CLOSE ALL
clos data
CLEAR WINDOW
set Safety Off

vysledek = crlf

IF FILE(m.sk_path + "objednan.dbf")
  use (m.sk_path + "objednan")
  do zamkni
  m.od_date = DATE() - m.pocet_dnu
  copy for datum > m.od_date to (m.exp_path + "objout" + m.ext) type fox2x
ENDIF 

clos data


FUNCTION str_datum
PARAMETERS c_date
PRIVATE cs_datum
* c_date ve tvaru rrrrmmdd
 m.cs_datum = RIGHT(m.c_date,2) + "." + SUBSTR(c_date,5,2) + "." + LEFT(c_date,4)
RETURN m.cs_datum
