_Screen.WindowState= 2  &&Specifies properties and methods for the main Visual FoxPro window
&& 0-normal/1-minimized (minimized to an icon)/2-maximized (enlarged to fill the screen)
Set Deleted On &&ignore records that are marked for deletion.
Set Century On &&Specifies a four-digit year in a format that includes 10 characters (including date delimiters).
Set Date Dmy &&Date/Mounth/Year
Set Safety Off &&Determines whether Visual FoxPro displays a dialog box before overwriting an existing file, or whether table or field rules, default values, and error messages are evaluated when changes are made in the Table Designer or with ALTER TABLE
Set Console Off &&Suppresses output to the main Visual FoxPro window or to the active user-defined window
Set NullDisplay To '*' &&Specifies the text displayed for null values.
Set Seconds Off &&Specifies that seconds are not displayed in DateTime values
Set Hours To 24
Set Exclusive Off &&Allows a table opened on a network to be shared and modified by any user on the network.
Set Ansi On &&'Tommy' = 'Tom'  is false (.F.)
Set Exact On &&Specifies the rules Visual FoxPro uses when comparing two strings of different lengths


Local lcMainClassLib
Local lcLastSetTalk, lcLastSetPath, lcLastSetClassLib, lcOnShutdown, lcPath

*-- Save and configure environment.
lcLastSetTalk=Set("TALK")
Set Talk Off

lcLastSetPath=Set("PATH")
Public gcAppDir, gcDatePath, gcDataPath, buton, gcTempPath, recordNumber, gnConnHandle
Store 2 To buton
Store 0 To recordNumeber
gnConnHandle = 0

&&declarare variabile pt. nr crt
&& in programul principal
Public m.nrord
Private nror
Declare nror[65000]

*!*	lcOnShutdown = "inchide()"
*!*	On Shutdown &lcOnShutdown
On Error ErrorHandler(Error(),Program(),Lineno())

gcAppDir=Addbs(Justpath(Sys(16,0)))
*gcAppDir=SYS(5)+ SYS(2003)+"\"
gcAppDir = Strtran(gcAppDir, 'PROGRAME\','')
gpos = Rat('\',gcAppDir,2)
gcDatePath = Left(gcAppDir,gpos) + 'date_aplicatii\'


If Not Directory(gcDatePath)
	Md (gcDatePath)
Endif

gcDataPath = gcAppDir + "date\"
gcTempPath = "c:\temp\"
If Not Directory(gcTempPath)
	Md (gcTempPath)
Endif

Cd (gcAppDir)   && init: CD "\soft_clienti\"


lcclase = gcAppDir + [clase]
lcLastSetClassLib=Set("CLASSLIB")

Set Procedure To proceduri_sql Additive
*!*	Set Procedure To proceduri_start Additive
*!*	Set Procedure To proceduri_soft_clienti Additive


*gnConnHandle = conecteaza([jcsServer],[soft],[soft])
gnConnHandle = conecteaza([ROA_ROMFAST2],[soft],[soft])
Do Form sc_form_main

*******************	inceput ErrorHandler *******************************************
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


**************************************** inceput Shutdown ************************************
Function inchide()

	If Type("goApp")=="O" And Not Isnull(goApp)
		Return goApp.OnShutDown()
	Endif
	Cleanup()
	If _vfp.StartMode = 4
		Quit
	Endif

	*!*		If gnConnHandle > 0
	*!*			deconecteaza(gnConnHandle)
	*!*		Endif
Endfunc

**************************************** inceput Cleanup *************************************
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
Endfunc
