PARAMETERS tparam

&&& imob2003


SET CENTURY ON
SET DELETED ON
SET DATE TO DMY
SET EXCLUSIVE OFF
SET CPDIALOG OFF
SET TALK OFF
SET SAFETY OFF
SET ESCAPE OFF
SET EXACT ON
SET ANSI ON
SET CONSOLE OFF
SET NOTIFY OFF
SET SECONDS OFF
_SCREEN.AUTOCENTER=.T.
_SCREEN.VISIBLE=.F.

LOCAL lcMainClassLib
LOCAL lcLastSetTalk,lcLastSetPath,lcLastSetClassLib,lcOnShutdown
PUBLIC pofirma,poCalendar

PUBLIC dirgen,dirfirm,DATE,datean,calet,nfscurt,m.an,m.nl,M.NUME_2,M.NUMEGEST,m.suma,buton,pc_nume,M.FLUNG,m.id_sectie
PUBLIC m.cod,m.nract,m.dataact,m.datapif,m.nrpif,m.denumire,m.nrinv,m.codmf,m.normat,titlu
PUBLIC m.valoare,m.uzura,m.tipamort,m.gest,m.respons,m.caract,m.scd,m.fdoc,M.EXPLICATIA
PUBLIC totval,PRIMADATA,m.text,m.nr1,m.nr2,_nract,_dataact,_cod,m.sumat,pamort1,pamort2,pnrinv1,pnrinv2,pdata1,pdata2
PUBLIC Tden,Tsuma,Tgest,tscd,m.suma1,m.suma2,m.data1,m.data2,m.suma,bden,bsuma,bgest,bscd,bnrinv,bresp,bcasat
PUBLIC m.an, m.nl, m.t_2121, m.t_2122, m.t_2123, m.t_2124, m.t_2125, m.t_2126, an, nl
PUBLIC s,s1,s2,s3,s4,s5,s6,CALEFIRMA,M.CALEFIRM,parolaactiva,parola,corect
PUBLIC M.R_2121,M.R_2122,M.R_2123,M.R_2124,M.R_2125,M.R_2126
PUBLIC M.V_2121,M.V_2122,M.V_2123,M.V_2124,M.V_2125,M.V_2126
PUBLIC M.Vr_2121,M.Vr_2122,M.Vr_2123,M.Vr_2124,M.Vr_2125,M.Vr_2126
PUBLIC m.uzuraprec,m.amorttot,m.amortlun,m.amortprec,M.P,M.K,m.amortan,anul,luna,m.valin,m.dataeval
PUBLIC OSTART,uz,STARE,m.cota,m.valramasa,m.normat2,m.normaan,m.normat2lun
PUBLIC TVALOARE,ultima_luna,M.NUMELUNA,M.luna,M.ANTET,felul,M.NIVEL,m.tipcalcul
PUBLIC E_INDEPENDENT,LUNA_NEPLATITA,PRIMADATA1,NUMEPROGRAM,op_imob,gnZ
STORE 0 TO gnZ
*E_INDEPENDENT=.T.
PUBLIC luna_inchisa

STORE '' TO dirgen,dirfirm,DATE,datean,calet,nfscurt,m.an,m.nl
STORE 0 TO m.nract,m.valoare,m.normat,m.gest,m.cod,m.uzura,m.suma,buton,totval,_nract,_cod,m.normaan
STORE 0 TO s,s1,s2,s3,s4,s5,s6,M.R_2121,M.R_2122,M.R_2123,M.R_2124,M.R_2125,M.R_2126,M.V_2121,M.V_2122,M.V_2123,M.V_2124,M.V_2125,M.V_2126
STORE 0 TO M.Vr_2121,M.Vr_2122,M.Vr_2123,M.Vr_2124,M.Vr_2125,M.Vr_2126,STARE,m.cota,m.valramasa,m.normat2,m.normat2lun,m.valin
STORE 0 TO m.uzuraprec,m.amorttot,m.amortlun,m.amortprec,uz,M.P,M.K,m.amortan,TVALOARE
STORE '' TO m.denumire,m.nrpif,m.codmf,m.nrinv,m.tipamort,m.respons,m.scd,m.caract,m.fdoc,DATE,pc_nume,M.FLUNG,M.NUMELUNA,M.luna,M.ANTET
STORE '' TO nfscurt,M.NUME_2,M.NUMEGEST,M.EXPLICATIA,m.text,CALEFIRMA,M.CALEFIRM,parolaactiva,parola,anul,luna,titlu,felul,m.id_sectie
STORE DATE() TO m.dataact,m.datapif,_dataact,m.data1,m.data2,pdata1,pdata2
STORE .T. TO PRIMADATA,LUNA_NEPLATITA,PRIMADATA1
STORE .F. TO ultima_luna,corect
STORE 0 TO m.tipcalcul
STORE .F. to luna_inchisa



*-- Save and configure environment.
lcLastSetTalk=SET("TALK")
SET TALK OFF
lcLastSetPath=SET("PATH")

SET PATH TO ;DATE;INCLUDE;FERESTRE;GRAFICE;HELP;CLASE;MENIURI;PROGRAME;RAPOARTE;
	PUSH MENU _MSYSMENU

***
lcLastSetClassLib=SET("CLASSLIB")
lcMainClassLib="clase\mfix2000"
SET CLASSLIB TO (lcMainClassLib) ADDITIVE
SET CLASSLIB TO appwiz ADDITIVE
SET CLASSLIB TO FERESTREBAZA ADDITIVE
SET CLASSLIB TO CAUT ADDITIVE
SET CLASSLIB TO CAUTmf ADDITIVE
SET CLASSLIB TO cont2000-2 ADDITIVE
SET CLASSLIB TO cont2000-3 ADDITIVE
SET CLASSLIB TO registry ADDITIVE
SET CLASSLIB TO imob_2005 ADDITIVE
***
SET PROCEDURE TO PROCEDURI ADDITIVE
SET PROCEDURE TO PROC_menu ADDITIVE
SET PROCEDURE TO TOTV ADDI
SET PROCEDURE TO proceduri_comune ADDITIVE

SET PROCEDURE TO quitapp ADDITIVE
SET PROCEDURE TO init_program ADDITIVE
SET PROCEDURE TO proceduri_verificare_luna.prg ADDITIVE


PUBLIC glVerificTabel && daca se verifica structura tabelelor in totv.prg
glVerificTabel=.T.

PUBLIC glQuit
glQuit = .F.

PUBLIC gnIdIstoric
STORE 0 TO gnIdIstoric

PUBLIC gcAppPath,gcAppName,gcAppDataPath, gcTempPath, gcCaleServerDate,gcAppCaption

gcAppPath = ADDBS(JUSTPATH(SYS(16,0)))
gcAppName = JUSTSTEM(SYS(16,0))
gcAppDataPath=gcAppPath+"Date_"+gcAppName+"\" && D:\CONTAFIN\TRANS\DATE_TRANS && PT OPTIUNI , FISIERE SPECIFICE PROGRAMULUI SI
gcAppCaption = 'CONTAFIN IMOBILIZARI'
STORE "" TO gcTempPath, gcCaleServerDate

IF !DIRECTORY(gcAppDataPath)
	MD (gcAppDataPath)
ENDIF

liat=RAT("\",gcAppPath,2)
dirgen=ADDBS(LEFT(gcAppPath,liat-1))
CD &dirgen


IF verificari()
	_SCREEN.VISIBLE=.T.
	DO mesaj WITH "Se fac verificari programului","Va rugam reveniti"
	glQuit= .T.
	QUIT
ENDIF


IF !Debug_Start()
	lcParam=tparam
	IF EMPTY(tparam) OR (TYPE('tParam')='C' AND !verific_start(tparam,dirgen,gcAppName))
		_SCREEN.VISIBLE=.T.
		DO mesaj WITH "Programul trebuie pornit doar din START",""
		QUIT
	ENDIF
ENDIF

*** verificare serie permanenta
PUBLIC tipar,exista_excel,SER_PERM,SER_PERI,VERSIUNE
STORE .F. TO SER_PERM,SER_PERI

USE &gcAppPath\SER IN 0 ALIAS SER SHARED
SELECT SER
GO TOP
tipar=TIP
SER_PERM=SER_PERMAN
SER_PERI=SER_PERIOD
VERSIUNE=VERcont
MODEL_PROGRAM=MODEL
USE IN SER
PAROLAMEA=SUBSTR(tipar,MONTH(DATE()),1)
PAROLAMEA=PAROLAMEA+ALLT(STR(DAY(DATE())))+ALLT(STR(MONTH(DATE())))

IF !_DEBUG()
	IF SER_PERM AND !verif_ser_perm()
		QUIT
	ENDIF
ENDIF
***********************************************************************
*** INITIALIZEZ CAI DATE
PUBLIC cales,eserver,loc,utilizator
IF !Start_Nou()

	CD C:\
	IF !DIRECTORY('contafin')
		MD contafin
	ENDIF
	CD contafin
	IF !DIRECTORY('temp')
		MD temp
	ENDIF

	eserver=.F.
	STORE '' TO cales,loc
	IF !FILE('c:\contafin\temp\ceprogram.dbf')
		COPY FILE &DIRGEN\_ALFA\TEMPO\CEPROGRAM.* TO c:\contafin\temp\CEPROGRAM.*
	ENDIF
		
	IF FILE('&DIRGEN\START2000\DATA\RETEA.DBF')
		IF !FILE('c:\contafin\temp\RETEA.dbf')
			COPY FILE &dirgen\START2000\DATA\RETEA.* TO C:\contafin\temp\RETEA.*
		ENDIF
		SELE 0
		USE C:\contafin\temp\RETEA
		eserver=SERVER
		cales=ALLT(CALESERVER)
		USE IN RETEA
	ENDIF

	
	UTILIZATOR=''
	IF FILE('c:\contafin\temp\CEPROGRAM.dbf')

		SELE 0
		USE C:\contafin\temp\CEPROGRAM ALIAS CEPROGRAM
		GO TOP
		SCAT MEMV
		UTILIZATOR=m.util
		USE IN CEPROGRAM
	ENDIF
	CD &dirgen
ELSE 
	gcTempPath = Init_Cale_Temp(dirgen)
	IF !DIRECTORY(gcTempPath)
		MD (gcTempPath)
	ENDIF

	CALES = Init_Cale_Server_Date(dirgen)
	ESERVER = .T.
	NUMESTATIE = Init_Nume_Statie(dirgen)
	utilizator = Init_Nume_Utilizator(dirgen)
	M.nivel = ROUND(VAL(Init_Nivel_Utilizator(dirgen)),0)
	M.CONTAB = UPPER(ALLTRIM(Init_NumeAlternativ(dirgen)))

	lcQuitData = ADDBS(ALLTRIM(DIRGEN))+"dateretea"
	lcQuitName = "start_quitapp"
	PRIVATE goQuitApp				&& I'm making it private so it will die with the application.
	goQuitApp = quitapp(lcQuitData,lcQuitName)
	gnIdIstoric = Start_Istoric(m.utilizator, gcAppName, NUMESTATIE, ADDBS(ALLTRIM(DIRGEN))+"DATERETEA\", "START_ISTORIC","start_ids")	
	
ENDIF
**************************************************************************************



	_SCREEN.AUTOCENTER=.T.
	_SCREEN.WINDOWSTATE=2





	lcOnShutdown="ShutDown()"
	ON SHUTDOWN &lcOnShutdown
	ON ERROR ErrorHandler(ERROR(),PROGRAM(),LINENO())
	_SHELL="DO Cleanup IN progs\Imob2003"

*-- Instantiate application object.
	RELEASE goApp
	PUBLIC goApp
	goApp=CREATEOBJECT("cApplication")


*-- Configure application object.
	goApp.SetCaption("CONTAFIN IMOBILIZARI")
	goApp.cStartupMenu=ADDBS(gcAppPath) + "meniuri\mfix2000"
	goApp.cStartupForm=ADDBS(gcAppPath) + "ferestre\fundal"


*-- Show application.
	goApp.SHOW

*-- Release application.
	RELEASE goApp

*-- Restore default menu.
	POP MENU _MSYSMENU

*-- Restore environment.
	ON ERROR
	ON SHUTDOWN
	IF NOT lcLastSetClassLib==SET("classlib")
		RELEASE CLASSLIB (lcMainClassLib)
	ENDIF
	IF EMPTY(lcLastSetPath)
		SET PATH TO
	ELSE
		SET PATH TO &lcLastSetPath
	ENDIF
	IF lcLastSetTalk=="ON"
		SET TALK ON
	ELSE
		SET TALK OFF
	ENDIF
	RETURN



FUNCTION ErrorHandler(nError,cMethod,nLine)
	LOCAL lcErrorMsg,lcCodeLineMsg

	WAIT CLEAR
	lcErrorMsg=MESSAGE()+CHR(13)+CHR(13)
	lcErrorMsg=lcErrorMsg+"Method:    "+cMethod
	lcCodeLineMsg=MESSAGE(1)
	IF BETWEEN(nLine,1,10000) AND NOT lcCodeLineMsg="..."
		lcErrorMsg=lcErrorMsg+CHR(13)+"Line:         "+ALLTRIM(STR(nLine))
		IF NOT EMPTY(lcCodeLineMsg)
			lcErrorMsg=lcErrorMsg+CHR(13)+CHR(13)+lcCodeLineMsg
		ENDIF
	ENDIF
	IF MESSAGEBOX(lcErrorMsg,17,_SCREEN.CAPTION)#1
		ON ERROR
		RETURN .F.
	ENDIF
ENDFUNC



FUNCTION SHUTDOWN

	=End_Istoric(gnIdIstoric, ADDBS(DIRGEN)+"DATERETEA\", "START_ISTORIC")
	IF TYPE("goApp")=="O" AND NOT ISNULL(goApp)
		RETURN goApp.OnShutDown()
	ENDIF
	Cleanup()
	QUIT
ENDFUNC


FUNCTION Cleanup

	IF CNTBAR("_msysmenu")=7
		RETURN
	ENDIF
	ON ERROR
	ON SHUTDOWN
	SET CLASSLIB TO
	SET PATH TO
	CLEAR ALL
	CLOSE ALL
	POP MENU _MSYSMENU
	RETURN






*-----------------------------------------------------

FUNCTION verif_ser_perm
	CLEAR

	RETURN PORNIRE()
********
*?pornire()

FUNCTION PORNIRE
	SET EXACT ON
	PRIVATE calewin,calesys,checksum1,checksum2,serinreg,serdisk,file1,file2,valret,serdisktemp,ser1,ser2,key1,KEY2
	STORE '' TO calewin,serinreg,serdisk,calesys,serdisktemp,catehd,ser1,ser2,key1,KEY2
	STORE 0 TO checksum1,checksum2
	STORE .T. TO valret
	DECLARE INTEGER SHGetFolderPath IN SHFOLDER.DLL ;
		INTEGER hwndOwner, ;
		INTEGER nFolder, ;
		INTEGER hToken, ;
		INTEGER dwFlags, ;
		STRING @ pszPath
	DECLARE INTEGER GetActiveWindow IN WIN32API
	#DEFINE CSIDL_WINDOWS  36
	#DEFINE CSIDL_SYSTEM   37
	#DEFINE CSIDL_PROGRAMS 38
	lcPath = REPL(CHR(0),261)
	=SHGetFolderPath(GetActiveWindow(),CSIDL_WINDOWS,0,0,@lcPath)
	calewin=LEFT(lcPath,AT(CHR(0),lcPath)-1)
	lcPath = REPL(CHR(0),261)
	=SHGetFolderPath(GetActiveWindow(),CSIDL_SYSTEM,0,0,@lcPath)
	calesys=LEFT(lcPath,AT(CHR(0),lcPath)-1)
&&se verifica existenta celor trei fisiere
	IF (NOT FILE(calesys+'\diskserial.dll')) OR (NOT FILE(calesys+'\getmacip.dll')) OR (NOT FILE(calewin+'\comdir.snr'))
		valret=.F.
	ENDIF
	IF valret
		file1=FILETOSTR(calesys+'\diskserial.dll')
		checksum1=SYS(2007,file1)
		file2=FILETOSTR(calesys+'\getmacip.dll')
		checksum2=SYS(2007,file2)
&&severifica daca dll-urile nu au fost modificate
		IF (VAL(checksum1) != 58755) OR (VAL(checksum2) != 30476)
			valret=.F.
		ENDIF
	ENDIF
&&se citesc seriile tutturor celor patru hard disk-uri posibile(pe IDE primary master,primary slave...)
&&se tine minte primul cu seria nenula-daca nu s-a putut citi seria de la nici unul se pune o serie default
&&seria default este "NUAREHAR"
	IF valret
		DECLARE INTEGER GetSerialNumber IN diskSerial.DLL INTEGER ,STRING
		catehd=0
		FOR i=0 TO 3
			serdisktemp=SPACE(40)
			GetSerialNumber(i,@serdisktemp)
			IF (LEN(ALLTRIM(serdisktemp))!=0) AND (catehd=0)
				serdisktemp=sircaracter(serdisktemp)
				serdisk=serdisktemp
				catehd=catehd+1
			ENDIF
		ENDFOR
		IF (LEN(ALLTRIM(serdisk))=0)
			serdisk='NUAREHAR'
		ELSE
			IF ((LEN(ALLTRIM(serdisk))>0) AND (LEN(ALLTRIM(serdisk))<8))
				serdisk=serdisk+REPLICATE('1',8-LEN(ALLTRIM(serdisk)))
			ENDIF
		ENDIF
		serdisk=SUBSTR(ALLTRIM(serdisk),LEN(ALLTRIM(serdisk))-7,8)
	ENDIF
&&se citeste din comdir.snr seria de inregistrare si se verifica egalitatea cu seria obtinuta anterior
	IF valret
		gnFileHandle = FOPEN(calewin+'\comdir.snr')
		nSize =  FSEEK(gnFileHandle, 0, 2)     && Move pointer to EOF
		IF nSize!=9
			valret=.F.
		ELSE
			= FSEEK(gnFileHandle, 0, 0)      && Move pointer to BOF
			cString = FREAD(gnFileHandle,9)
			ser1=SUBSTR(cString,1,4)
			ser2=SUBSTR(cString,5,4)
			key1=SUBSTR(cString,9,1)
			KEY2=DECTOBIN(ALLTRIM(HEXDEC(key1)))
			serinreg=decodare1(ALLTRIM(UPPER(ser1)),KEY2)+decodare1(ALLTRIM(UPPER(ser2)),KEY2)
			IF serdisk!=serinreg
				valret=.F.
			ENDIF
		ENDIF
		= FCLOSE(gnFileHandle)
	ENDIF
	seriedisk1=serdisk
	serieinreg1=serinreg
	ON ERROR valret=.F.
	RETURN valret
*************
FUNCTION decodare1
	PARAMETERS lstring,CHEIE
	LOCAL lens,poz1,poz2,POZ3,lret,LRET2,lcstring,val1,lret1
	lret=''
	lret1=''
	LRET2=''
	lcstring=ALLTRIM(UPPER(lstring))
	lens=LEN(lcstring)
	FOR i=1 TO 4
		poz1=SUBSTR(lcstring,i,1)
		val1=ASC(poz1)
		POZ3=SUBSTR(CHEIE,i,1)
		DO CASE
			CASE val1>=48 AND val1<=57
				IF ((val1-47)+INT(VAL(POZ3)))<=10
					poz2=CHR(val1+INT(VAL(POZ3)))
				ELSE
					poz2=CHR(val1+INT(VAL(POZ3))-10)
				ENDIF
			CASE val1>=65 AND val1<=90
				IF ((val1-64)+2*INT(VAL(POZ3)))<=26
					poz2=CHR(val1+2*INT(VAL(POZ3)))
				ELSE
					poz2=CHR(val1+2*INT(VAL(POZ3))-26)
				ENDIF
		ENDCASE
		LRET2=LRET2+poz2
	ENDFOR
	FOR i=1 TO lens
		poz1=SUBSTR(LRET2,i,1)
		val1=ASC(poz1)
		DO CASE
			CASE val1>=48 AND val1<=57
				IF ((val1-47)+i)<=10
					poz2=CHR(val1+i)
				ELSE
					poz2=CHR(val1+i-10)
				ENDIF
			CASE val1>=65 AND val1<=90
				IF ((val1-64)+2*i)<=26
					poz2=CHR(val1+2*i)
				ELSE
					poz2=CHR(val1+2*i-26)
				ENDIF
		ENDCASE
		lret=lret+poz2
	ENDFOR
	lens=LEN(lret)
	FOR i=1 TO lens
		poz1=SUBSTR(lret,i,1)
		val1=ASC(poz1)
		DO CASE
			CASE val1>=48 AND val1<=57
				poz2=CHR(val1+17)&& din 0-9 in A-J
			CASE val1>=65 AND val1<=74
				poz2=CHR(val1-17)&& din A-J in 0-9
			CASE val1>=75 AND val1<=82
				poz2=CHR(val1+8)&&din K-R in S-Z
			CASE val1>=83 AND val1<=90
				poz2=CHR(val1-8)&&din S-Z in K-R
		ENDCASE
		lret1=lret1+poz2
	ENDFOR
	RETURN lret1
***********
&&transformarea in decimal a unui caracter hexa
FUNCTION HEXDEC
	LPARAMETERS LC
	LOCAL LV
	DO CASE
		CASE LC=='0'
			LV='0'
		CASE LC=='1'
			LV='1'
		CASE LC=='2'
			LV='2'
		CASE LC=='3'
			LV='3'
		CASE LC=='4'
			LV='4'
		CASE LC=='5'
			LV='5'
		CASE LC=='6'
			LV='6'
		CASE LC=='7'
			LV='7'
		CASE LC=='8'
			LV='8'
		CASE LC=='9'
			LV='9'
		CASE LC=='A'
			LV='10'
		CASE LC=='B'
			LV='11'
		CASE LC=='C'
			LV='12'
		CASE LC=='D'
			LV='13'
		CASE LC=='E'
			LV='14'
		CASE LC=='F'
			LV='15'
	ENDCASE
	RETURN LV
****************
&&codarea binara din hexa pe patru biti
FUNCTION DECTOBIN
	PARAMETERS sc
	LOCAL lretf
	DO CASE
		CASE sc=='0'
			lretf='0000'
		CASE sc=='1'
			lretf='0001'
		CASE sc=='2'
			lretf='0010'
		CASE sc=='3'
			lretf='0011'
		CASE sc=='4'
			lretf='0100'
		CASE sc=='5'
			lretf='0101'
		CASE sc=='6'
			lretf='0110'
		CASE sc=='7'
			lretf='0111'
		CASE sc=='8'
			lretf='1000'
		CASE sc=='9'
			lretf='1001'
		CASE sc=='10'
			lretf='1010'
		CASE sc=='11'
			lretf='1011'
		CASE sc=='12'
			lretf='1100'
		CASE sc=='13'
			lretf='1101'
		CASE sc=='14'
			lretf='1110'
		CASE sc=='15'
			lretf='1111'
	ENDCASE
	RETURN lretf
***********
FUNCTION ECARACTER
	PARAMETERS strg1
	PRIVATE pz,ch,lcstring,vret,lg1
	STORE 0 TO pz,lg1
	STORE '' TO ch,lcstring
	STORE .T. TO vret
	lcstring=UPPER(strg1)
	lg1=LEN(lcstring)
	FOR ind1=1 TO lg1
		ch=SUBSTR(lcstring,ind1,1)
		IF (NOT BETWEEN(ASC(ch),48,57)) AND (NOT BETWEEN(ASC(ch),65,90))
			vret=.F.
			EXIT
		ENDIF
	ENDFOR
	RETURN vret
************
FUNCTION sircaracter
	PARAMETERS strg1
	PRIVATE pz,ch,lcstring,vret,lg1,lciesire
	STORE 0 TO pz,lg1
	STORE '' TO ch,lcstring,lciesire
	STORE .T. TO vret
	strg1=STRTRAN(strg1,ALLTRIM(CHR(39)),'')&&caracterul '
	strg1=STRTRAN(strg1,ALLTRIM(CHR(39)),'')&&caracterul "
	lcstring=UPPER(ALLTRIM(strg1))
	lg1=LEN(lcstring)
	FOR ind1=1 TO lg1
		ch=SUBSTR(lcstring,ind1,1)
		IF BETWEEN(ASC(ch),48,57) OR BETWEEN(ASC(ch),65,90)
			lciesire=lciesire+ch
		ENDIF
	ENDFOR
	RETURN lciesire



***-------------------------------------
PROCEDURE _DEBUG

	PRIVATE lcret,lcfisier,lcPath,lccalewin
	DECLARE INTEGER SHGetFolderPath IN SHFOLDER.DLL ;
		INTEGER hwndOwner, ;
		INTEGER nFolder, ;
		INTEGER hToken, ;
		INTEGER dwFlags, ;
		STRING @ pszPath
	DECLARE INTEGER GetActiveWindow IN WIN32API
	#DEFINE CSIDL_WINDOWS  36


	lcPath = REPL(CHR(0),261)
	=SHGetFolderPath(GetActiveWindow(),CSIDL_WINDOWS,0,0,@lcPath)
	lccalewin=LEFT(lcPath,AT(CHR(0),lcPath)-1)

	lcret=.F.
	lcfisier=ADDBS(lccalewin)+[DEBUG.TXT]

	IF FILE(lcfisier)
		LCVAL=FILETOSTR(lcfisier)

		LNVAL1=MOD(VAL(RIGHT(LCVAL,1)),2) && restul 1 sau 0; daca e impar e 1
		lnval2=VAL(LEFT(LCVAL,LEN(LCVAL)-1))
		IF LNVAL1=1 OR YEAR(DATE())-MONTH(DATE())=lnval2
			lcret=.T.
		ENDIF
	ENDIF
	RETURN lcret

ENDPROC


FUNCTION Start_Nou

	RETURN Exista_Branch(,,dirgen)

ENDFUNC && start_nou

PROCEDURE Debug_Start

	lcFile = gcAppPath + "debug.txt"

	IF FILE(lcFile) OR !Start_Nou()
		RETURN .T.
	ENDIF
	RETURN .F.

ENDPROC && Debug_Start
************************************************************************
PROCEDURE verificari
	PARAMETERS tcFisierVerif

	lcverificari = ADDBS(gcAppPath)+gcAppName+".txt"


	IF FILE(lcverificari)
		RETURN .T.
	ENDIF
	RETURN .F.

ENDPROC && verificari
