******************************************************************************
* Procedure file: SMAZ_STARE_ZURNALY.PRG
*
*  2015-07-27  maze ctyrmistne i dvojmistne zurnaly 12 mesicu pred poctem mesicu, ktere chceme zachovat
*
*:*****************************************************************************
PARAMETERS kas_path, pocet_mesicu

IF EMPTY(m.kas_path)
    kas_path = " neni zadana cesta k zurnalum: DO smaz_stare_zurnaly WITH kas_path[, pocet_mesicu]"
ELSE 
    kas_path = m.kas_path + IIF(RIGHT(m.kas_path,1)="\", "", "\")
ENDIF 

vysledek = " v.2015-0727: " + UPPER(m.kas_path)

IF EMPTY(m.pocet_mesicu)
    pocet_mesicu = 12
ENDIF 

datum_zurnalu = GOMONTH(DATE(), - pocet_mesicu)

FOR ii = 0 TO 12
    naz_zur4 = "zu" + SUBSTR( DTOS(GOMONTH(m.datum_zurnalu, -ii)), 3,4)    && ZUrrmm
    naz_zur2 = "zu" + SUBSTR( DTOS(GOMONTH(m.datum_zurnalu, -ii)), 5,2)    && ZUmm
    vysledek = m.vysledek + " " + m.naz_zur4

    cmd = "run del /S /Q " + m.kas_path + naz_zur4 + ".txt " + m.kas_path + m.naz_zur2 + ".txt "
*    ? m.cmd
    &cmd
ENDFOR

vysledek = m.vysledek + " ... EXEC OK "
? m.vysledek
