Lparameters tcOptiune, tnZile
* tcOptiune: s (lanseaza import silentios)
* tnZile: nnn (numarul de zile pentru import)

Set Century On
Set Date Dmy
Set Exact On
Set Ansi On
Set Deleted On
Set Safety Off
Set Deleted On
Set NullDisplay To ''

PRIVATE gcMainPath, gcLogStamp
gcMainPath = UPPER(ADDBS(JUSTPATH(SYS(16,0))))
gcMainPath = STRTRAN(m.gcMainPath,'PROGRAME\', '')
gcLogStamp = SYS(2015)
lcPath = gcMainPath + 'ferestre\;'

SET DEFAULT TO (m.gcMainPath)
SET PATH TO (m.lcPath) ADDITIVE 

Local lcOptiune, lnOptiune, llSilentios, lnZile
lcOptiune = Lower(Alltrim(Transform(m.tcOptiune)))
llSilentios = (m.lcOptiune = 's')
lnZile = Int(Val(Transform(m.tnZile)))
lnZile = Iif(Empty(m.lnZile), 30, m.lnZile)


WriteLog('Start import RORIS silentios: ' + TRANSFORM(m.llSilentios) + ', zile: ' + ALLTRIM(TRANSFORM(m.lnZile)))

If m.llSilentios
	lnOptiune = 1
	Do importroris_proceduri.prg With llSilentios, m.lnOptiune, m.lnZile
Else
	Do Form importroris
ENDIF

WriteLog('End import RORIS silentios: ' + TRANSFORM(m.llSilentios) + ', zile: ' + ALLTRIM(TRANSFORM(m.lnZile)))
WriteLog('')

PROCEDURE WriteLog
	LPARAMETERS tcMesaj
	lcMesaj = m.gcLogStamp + ' ' + TRANSFORM(DATETIME()) + ' ' + TRANSFORM(m.tcMesaj) + CHR(13)
	lcFile = m.gcMainPath + 'log.txt'
	IF FILE(m.lcFile)
		STRTOFILE(m.lcMesaj, m.lcFile, .T.)
	ENDIF 	
ENDPROC 