371 lines
9.4 KiB
Plaintext
371 lines
9.4 KiB
Plaintext
&& ------------------------------INCEPUT: Citeste_Cheie ------------------------------
|
|
*!* Functie: Citeste_Cheie
|
|
*!* Parametri: tcKey, tcBranch, tcLeafe
|
|
*!* Data/Ora generarii: 16/02/2004 14:26:22
|
|
*!* Autor: MARIUS.MUTU
|
|
FUNCTION Citeste_Cheie
|
|
LPARAMETERS tcKey, tnBranch, tcLeafe
|
|
|
|
LOCAL lcRet,loApi, lcKey, lnBranch, lcLeafe
|
|
|
|
lcKey = ALLTRIM(tcKey)
|
|
lnBranch = tnBranch
|
|
lcLeafe = ALLTRIM(tcLeafe)
|
|
lcRet = []
|
|
|
|
loApi = CREATE("registry")
|
|
|
|
IF loApi.iskey(lcKey, lnBranch)
|
|
|
|
loApi.openkey(lcKey, lnBranch,.F.)
|
|
lcRet = loApi.getkeyvalue(lcLeafe,)
|
|
ENDIF
|
|
|
|
RELEASE loApi
|
|
RETURN lcRet
|
|
|
|
ENDFUNC
|
|
&& ------------------------------SFARSIT: Citeste_Cheie ------------------------------
|
|
|
|
&& ------------------------------INCEPUT: Exista_Branch ------------------------------
|
|
*!* Functie: Exista_Branch
|
|
*!* Parametri: tcKey
|
|
*!* Data/Ora generarii: 18/02/2004 14:01:29
|
|
*!* Autor: MARIUS.MUTU
|
|
FUNCTION Exista_Branch
|
|
LPARAMETERS tcKey, tnBranch,tcCale
|
|
|
|
|
|
LOCAL lcRet,loApi, lcKey, lnBranch
|
|
|
|
lccale="serverdate_"+STRTRAN(tccale,"\","")
|
|
|
|
IF EMPTY(tcKey)
|
|
lcKey = [contafin\] + lcCale + [\util]
|
|
ELSE
|
|
lcKey = ALLTRIM(tcKey)
|
|
ENDIF
|
|
|
|
IF EMPTY(tnBranch)
|
|
lnBranch = -2147483647
|
|
ELSE
|
|
lnBranch = tnBranch
|
|
ENDIF
|
|
|
|
|
|
llRet = .F.
|
|
loApi = CREATE("registry")
|
|
IF loApi.iskey(lcKey, lnBranch)
|
|
llret = .T.
|
|
ENDIF
|
|
|
|
RELEASE loApi
|
|
|
|
RETURN llRet
|
|
|
|
ENDFUNC
|
|
&& ------------------------------SFARSIT: Exista_Branch ------------------------------
|
|
|
|
&& ------------------------------INCEPUT: Verific_Start ------------------------------
|
|
*!* Functia: Verific_Start
|
|
*!* Parametri: tcParam
|
|
*!* Data/Ora generarii: 16/02/2004 13:32:11
|
|
*!* Autor: MARIUS.MUTU
|
|
*!* returneza TRUE daca parametrul trimis codat in binar este egal cu variabila <session> citita din registri
|
|
FUNCTION Verific_Start
|
|
LPARAMETERS tcSesiune,tccale,tcAppName
|
|
|
|
LOCAL llRet,loApi, lcKey, lnBranch, lcSesiune
|
|
|
|
lccale="serverdate_"+STRTRAN(tccale,"\","")
|
|
IF EMPTY(tcAppName)
|
|
lcAppName = JUSTSTEM(SYS(16,0))
|
|
ELSE
|
|
lcAppName = ALLTRIM(tcAppName)
|
|
ENDIF
|
|
|
|
llRet = .T.
|
|
lcKey = [contafin\]+lccale+[\util]
|
|
lnBranch = -2147483647
|
|
lcLeafe = [session]
|
|
lcSesiune = []
|
|
|
|
IF EMPTY(tcSesiune)
|
|
llRet = .F.
|
|
ELSE
|
|
lcSesiune = tcSesiune
|
|
|
|
*!* lcSesiune1 = citeste_cheie(lcKey, lnBranch, lcLeafe)
|
|
lcSesiune2 = VAL(Citeste_Cheie(lcKey, lnBranch, lcLeafe))
|
|
lcSesiune3 = BINTOC(lcSesiune2,4)
|
|
lcsesiune1=SUBSTR(lcSesiune3,1,1)+SUBSTR(lcSesiune3,3,2)
|
|
*!* IF EMPTY(lcSesiune1)
|
|
*!* lcSesiune1 = []
|
|
*!* ENDIF
|
|
|
|
lcsesiune1 = STUFF(lcsesiune1,2,0,lcAppName)
|
|
IF SYS(2007,ALLTRIM(UPPER(lcSesiune))) # SYS(2007,ALLTRIM(UPPER(lcsesiune1)))
|
|
llRet = .F.
|
|
|
|
ENDIF
|
|
ENDIF
|
|
|
|
|
|
RETURN llRet
|
|
|
|
ENDFUNC
|
|
&& ------------------------------SFARSIT: Verific_Start ------------------------------
|
|
|
|
&& ------------------------------INCEPUT: Init_Cale_Temp------------------------------
|
|
*!* Functia: Init_Cale_Temp
|
|
*!* Parametri:
|
|
*!* Data/Ora generarii: 16/02/2004 13:32:11
|
|
*!* Autor: MARIUS.MUTU
|
|
*!* citeste directorul temporar din registrii si il creeaza
|
|
FUNCTION Init_Cale_Temp
|
|
PARAMETERS tccale
|
|
* lccale="serverdate_"+STRTRAN(tccale,"\","")
|
|
|
|
LOCAL lcTempPath,loApi, lcKey, lnBranch, lcSesiune
|
|
llRet = .T.
|
|
lcKey = [contafin\temporare]
|
|
* lcKey = [contafin\]+lccale+[\temporare]
|
|
lnBranch = -2147483647
|
|
lcLeafe = [temp]
|
|
|
|
|
|
lcTempPath=Citeste_Cheie(lcKey, lnBranch, lcLeafe)
|
|
|
|
RETURN lcTempPath
|
|
|
|
ENDFUNC
|
|
&& ------------------------------SFARSIT: Init_Cale_Temp------------------------------
|
|
|
|
&& ------------------------------INCEPUT: Init_Cale_Server_Date ------------------------------
|
|
*!* Functia: Init_Cale_Server_Date
|
|
*!* Parametri:
|
|
*!* Data/Ora generarii: 16/02/2004 13:32:11
|
|
*!* Autor: MARIUS.MUTU
|
|
*!* citeste calea serverului de date din registri
|
|
FUNCTION Init_Cale_Server_Date
|
|
PARAMETERS tccale
|
|
lccale="serverdate_"+STRTRAN(tccale,"\","")
|
|
LOCAL lcCaleServerDate, loApi, lcKey, lnBranch, lcSesiune
|
|
lcCaleServerDate= []
|
|
lcKey = [contafin\]+lccale
|
|
lnBranch = -2147483647
|
|
lcLeafe = [cale]
|
|
|
|
|
|
lcCaleServerDate=Citeste_Cheie(lcKey, lnBranch, lcLeafe)
|
|
|
|
|
|
RETURN lcCaleServerDate
|
|
|
|
ENDFUNC
|
|
&& ------------------------------SFARSIT: Init_Cale_Server_Date ------------------------------
|
|
|
|
&& ------------------------------INCEPUT: Init_Nume_Utilizator ------------------------------
|
|
*!* Functia: Init_Nume_Utilizator
|
|
*!* Parametri:
|
|
*!* Data/Ora generarii: 16/02/2004 13:32:11
|
|
*!* Autor: MARIUS.MUTU
|
|
*!* citeste numele utilizatorului logat la START din registri
|
|
FUNCTION Init_Nume_Utilizator
|
|
PARAMETERS tccale
|
|
|
|
LOCAL lcNumeUtilizator, loApi, lcKey, lnBranch, lcSesiune
|
|
|
|
lccale="serverdate_"+STRTRAN(tccale,"\","")
|
|
lcNumeUtilizator = []
|
|
lcKey = [contafin\]+lccale+[\util]
|
|
lnBranch = -2147483647
|
|
lcLeafe = [nume]
|
|
|
|
|
|
lcNumeUtilizator=Citeste_Cheie(lcKey, lnBranch, lcLeafe)
|
|
|
|
|
|
RETURN lcNumeUtilizator
|
|
|
|
ENDFUNC
|
|
&& ------------------------------SFARSIT: Init_Nume_Utilizator------------------------------
|
|
|
|
&& ------------------------------INCEPUT: Init_Nivel_Utilizator ------------------------------
|
|
*!* Functia: Init_Nivel_Utilizator
|
|
*!* Parametri:
|
|
*!* Data/Ora generarii: 16/02/2004 13:32:11
|
|
*!* Autor: MARIUS.MUTU
|
|
*!* citeste nivelul utilizatorului logat la START din registri
|
|
FUNCTION Init_Nivel_Utilizator
|
|
PARAMETERS tccale
|
|
lccale="serverdate_"+STRTRAN(tccale,"\","")
|
|
LOCAL lcNivelUtilizator, loApi, lcKey, lnBranch, lcSesiune
|
|
lcNumeUtilizator = []
|
|
lcKey = [contafin\]+lccale+[\prog\]+gcAppName
|
|
lnBranch = -2147483647
|
|
lcLeafe = [nivel]
|
|
|
|
|
|
lcNivelUtilizator=Citeste_Cheie(lcKey, lnBranch, lcLeafe)
|
|
|
|
|
|
RETURN lcNivelUtilizator
|
|
|
|
ENDFUNC
|
|
&& ------------------------------SFARSIT: Init_Nume_Utilizator------------------------------
|
|
|
|
&& ------------------------------INCEPUT: Init_Nume_Statie------------------------------
|
|
*!* Functia: Init_Nume_Statie
|
|
*!* Parametri:
|
|
*!* Data/Ora generarii: 16/02/2004 13:32:11
|
|
*!* Autor: MARIUS.MUTU
|
|
*!* citeste numele statiei
|
|
FUNCTION Init_Nume_Statie
|
|
PARAMETERS tccale
|
|
lccale="serverdate_"+STRTRAN(tccale,"\","")
|
|
LOCAL lcNumeStatie, loApi, lcKey, lnBranch
|
|
lcNumeStatie= []
|
|
lcKey = [contafin\]+lccale
|
|
lnBranch = -2147483647
|
|
lcLeafe = [numestatie]
|
|
|
|
|
|
lcNumeStatie=Citeste_Cheie(lcKey, lnBranch, lcLeafe)
|
|
|
|
|
|
RETURN lcNumeStatie
|
|
|
|
ENDFUNC
|
|
&& ------------------------------SFARSIT: Init_Nume_Statie
|
|
|
|
&& ------------------------------INCEPUT: Init_NumeAlternativ------------------------------
|
|
*!* Functia: Init_NumeAlternativ
|
|
*!* Parametri:
|
|
*!* Data/Ora generarii: 18/02/2004 16:29:11
|
|
*!* Autor: MARIUS.MUTU
|
|
*!* citeste nume2 ex: (CONT2003) CASA
|
|
FUNCTION Init_NumeAlternativ
|
|
PARAMETERS tccale,tcAppName
|
|
LOCAL lcNumeAlternativ, loApi, lcKey, lnBranch
|
|
lccale="serverdate_"+STRTRAN(tccale,"\","")
|
|
IF EMPTY(tcAppName)
|
|
lcAppName = JUSTSTEM(SYS(16,0))
|
|
ELSE
|
|
lcAppName = ALLTRIM(tcAppName)
|
|
ENDIF
|
|
|
|
lcNumeAlternativ= []
|
|
* lcKey = [contafin\prog\]+gcAppName
|
|
lcKey = [contafin\]+lccale+[\prog\]+lcAppName
|
|
lnBranch = -2147483647
|
|
lcLeafe = [nume2]
|
|
|
|
|
|
lcNumeAlternativ = Citeste_Cheie(lcKey, lnBranch, lcLeafe)
|
|
|
|
|
|
RETURN lcNumeAlternativ
|
|
|
|
ENDFUNC
|
|
&& ------------------------------SFARSIT: Init_NumeAlternativ
|
|
|
|
&& ------------------------------INCEPUT: Start_Istoric ------------------------------
|
|
*!* Functie: Start_Istoric
|
|
*!* Parametri: tcNumeUtilizator, tcNumeProgram, tcNumeStatie
|
|
*!* Data/Ora generarii: 08/03/2004 15:31:58
|
|
*!* Autor: MARIUS.MUTU
|
|
FUNCTION Start_Istoric
|
|
LPARAMETERS tcNumeUtilizator, tcNumeProgram, tcNumeStatie, tcCaleIstoric, tcNumeIstoric, tcNumeIds
|
|
|
|
lcNumeUtilizator = ALLTRIM(tcNumeUtilizator)
|
|
lcNumeProgram = ALLTRIM(tcNumeProgram)
|
|
lcNumeStatie = ALLTRIM(tcNumeStatie)
|
|
lcCaleIstoric = ADDBS(tcCaleIstoric)
|
|
lcNumeIstoric = ALLTRIM(tcNumeIstoric)
|
|
lcNumeIds = ALLTRIM(tcNumeIds)
|
|
|
|
lcNume = ALLTRIM(lcNumeIstoric)
|
|
lcFile = ADDBS(lcCaleIstoric) + lcNumeIstoric + ".dbf"
|
|
|
|
IF !FILE(lcFile)
|
|
RETURN
|
|
ENDIF
|
|
|
|
llUsed = .T.
|
|
IF !USED('Istoric')
|
|
USE (lcFile) IN 0 SHARED AGAIN ALIAS Istoric
|
|
llUsed = .F.
|
|
ENDIF
|
|
|
|
lcFile = ADDBS(lcCaleIstoric) + lcNumeIDS + ".dbf"
|
|
IF !FILE(lcFile)
|
|
RETURN
|
|
ENDIF
|
|
|
|
llUsed2 = .T.
|
|
IF !USED('ids')
|
|
USE (lcFile) IN 0 SHARED AGAIN ALIAS Ids
|
|
llUsed2 = .F.
|
|
ENDIF
|
|
|
|
lnNewId = new_id("istoric","id",.T.)
|
|
SELECT Istoric
|
|
IF FLOCK()
|
|
APPEND BLANK
|
|
REPLACE ID WITH lnNewId, statie WITH lcNUMESTATIE, PROGRAM WITH lcNumeProgram, utilizator WITH lcNumeUtilizator, dataoraint WITH DATETIME()
|
|
UNLOCK
|
|
ENDIF
|
|
|
|
IF !llUsed
|
|
USE IN Istoric
|
|
ENDIF
|
|
|
|
IF !llUsed2
|
|
USE IN ids
|
|
ENDIF
|
|
|
|
RETURN lnNewId
|
|
|
|
ENDFUNC
|
|
&& ------------------------------SFARSIT: Start_Istoric ------------------------------
|
|
|
|
&& ------------------------------INCEPUT: End_Istoric ------------------------------
|
|
*!* Functie: End_Istoric
|
|
*!* Parametri: tnIdIstoric
|
|
*!* Data/Ora generarii: 08/03/2004 15:51:32
|
|
*!* Autor: MARIUS.MUTU
|
|
FUNCTION End_Istoric
|
|
LPARAMETERS tnIdIstoric, tcCaleIstoric, tcNumeIstoric
|
|
|
|
lcCaleIstoric = ADDBS(tcCaleIstoric)
|
|
lcNumeIstoric = ALLTRIM(tcNumeIstoric)
|
|
|
|
lcNume = ALLTRIM(lcNumeIstoric)
|
|
lcFile = ADDBS(lcCaleIstoric) + lcNume + ".dbf"
|
|
IF !FILE(lcFile)
|
|
RETURN
|
|
ENDIF
|
|
|
|
llUsed = .T.
|
|
IF !USED('Istoric')
|
|
USE (lcFile) IN 0 SHARED AGAIN ALIAS Istoric
|
|
llUsed = .F.
|
|
ENDIF
|
|
|
|
SELECT Istoric
|
|
LOCATE FOR ID = tnIdIstoric
|
|
IF FOUND()
|
|
IF FLOCK()
|
|
REPLACE dataoraies WITH DATETIME()
|
|
UNLOCK
|
|
ENDIF
|
|
ENDIF
|
|
|
|
IF !llUsed
|
|
USE IN Istoric
|
|
ENDIF
|
|
|
|
ENDFUNC
|
|
&& ------------------------------SFARSIT: End_Istoric ------------------------------
|