*!*********************************************************************
*!*			proc exp_gen
*!*********************************************************************

dokl_rada = SPACE(4)
doklad    = SPACE(20)
davka     = SPACE(2)
zavod     = SPACE(2)
zauctovano= "01" + tran(month(date())-1, "@L 99") + str(year(date()), 4)
porizeno  = tran(day(date()), "@L 99") + tran(month(date()), "@L 99") + str(year(date()), 4)
soubor    = "C:\sp_.txt                          "

DEFINE WINDOW exp FROM 3,10 TO 20, 66 TITLE "  EXPORT UCETNICH DAT BUDVAR  "
ACTIVATE WINDOW exp
@ 1,1     SAY "Dokl rada :" GET m.dokl_rada
@ $+2,1   SAY "Doklad    :" GET m.doklad
@ $+2,1   SAY "Davka     :" GET m.davka
@ $+2,1   SAY "Zavod     :" GET m.zavod
@ $+2,1   SAY "Zauctovano:" GET m.zauctovano
@ $+2,1   SAY "Porizeno  :" GET m.porizeno
@ $+3,1   SAY "Soubor    :" GET m.soubor

READ
RELEASE WINDOW exp
IF LAST() # 27
  do working
  radek = 1
  clos data
  fh = fcreate(m.soubor)
  use (m.dat_path + "u_ex_sum") excl
  scan
    = fwrite(m.fh, m.dokl_rada + m.doklad )
    = fwrite(m.fh, trans(m.radek, "@Z 9999") )
    = fwrite(m.fh, m.davka + zavod )
    = fwrite(m.fh, padr(md, 8) + padr(hs_md, 15) + padr(dal, 8) + padr(hs_dal, 15) )
    = fwrite(m.fh, trans(castka*100, "999999999999999") + padr(pz, 30) )
    = fwrite(m.fh, "ip22" + space(11) + "     " )
    = fwrite(m.fh, zauctovano + porizeno )
    = fwrite(m.fh, chr(13) + chr(10) )
    radek = m.radek + 1
  endscan
  = fclose(m.fh)
  clos data
  do had
endif

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

zavod     = "63"
rok       = right( str(year(date()), 4), 2)
zauctovano= "01" + tran(month(date())-1, "@L 99") + right( str(year(date()), 4), 2)
porizeno  = tran(day(date()), "@L 99") + tran(month(date()), "@L 99") + right( str(year(date()), 4), 2)
soubor    = "C:\pr_.txt                          "

DEFINE WINDOW exp FROM 4,10 TO 20, 66 TITLE "  EXPORT PRIJEMEK BUDVAR  "
ACTIVATE WINDOW exp
@ 1  ,1   SAY "Zavod     :" GET m.zavod
@ $+2,1   SAY "Rok       :" GET m.rok
@ $+2,1   SAY "Zauctovano:" GET m.zauctovano
@ $+2,1   SAY "Porizeno  :" GET m.porizeno
@ $+3,1   SAY "Soubor    :" GET m.soubor

READ
RELEASE WINDOW exp
IF LAST() # 27
  do working
  clos data
  fh = fcreate(m.soubor)
  use (m.dat_path + "u_ex") excl
  scan for "PRIJE" $ pz
    = fwrite(m.fh, m.zavod + m.rok )		&& zavod, rok
    = fwrite(m.fh, trans(val(doklad), "@Z 9999999999") + "001" )	&& prijcis, prijrad
    = fwrite(m.fh, space(12+15) )
    = fwrite(m.fh, padr(id_man, 15) )		utvar
    = fwrite(m.fh, space(11 + 8 + 13 + 13) )
    = fwrite(m.fh, zauctovano + porizeno )
    = fwrite(m.fh, "      1.00        1.000" )	&& cena,mnozstvi
    = fwrite(m.fh, trans(castka, "99999999999999.99") )	&& hodnota
    = fwrite(m.fh, m.zavod + m.rok )		&& zavod, rok
    = fwrite(m.fh, str( val(fakturovan), 10 ) + space(9) )
    = fwrite(m.fh, "111150  111990  6300" + space(11) )	&& md, d, hs
    = fwrite(m.fh, "   09")
    = fwrite(m.fh, chr(13) + chr(10) )
  endscan
  = fclose(m.fh)
  clos data
  do had
endif
