Import initial din SVN ROAAUTO/Trunk @HEAD
This commit is contained in:
184
COMUN/programe/controllere/orasettingscontroller.prg
Normal file
184
COMUN/programe/controllere/orasettingscontroller.prg
Normal file
@@ -0,0 +1,184 @@
|
||||
Define Class oraSettingsController As Custom
|
||||
|
||||
oDBController = Null
|
||||
oDateCalendar = Null
|
||||
oDateFirma = Null
|
||||
nIdSucursala = Null
|
||||
nIdMama = Null
|
||||
lEMama = Null
|
||||
|
||||
Procedure Init
|
||||
Lparameters toDBController
|
||||
This.oDBController = toDBController
|
||||
Endproc
|
||||
******************************************************************
|
||||
Procedure initializeaza_firma
|
||||
Lparameters tnIdFirma,tnIdUtil
|
||||
This.initializeaza_date_firma(tnIdFirma)
|
||||
This.initializeaza_calendar()
|
||||
This.initializeaza_optiuni()
|
||||
This.initializeaza_utilizator(tnIdUtil)
|
||||
Endproc
|
||||
******************************************************************
|
||||
Procedure initializeaza_utilizator
|
||||
Lparameters tnIdUtil
|
||||
This.initializeaza_optiuni_utilizator(tnIdUtil)
|
||||
This.initializeaza_sesiune_server(tnIdUtil)
|
||||
Endproc
|
||||
******************************************************************
|
||||
Procedure initializeaza_date_firma
|
||||
Lparameters tnIdFirma
|
||||
Local loFirma,lcCursor
|
||||
This.oDateFirma = Null
|
||||
lcCursor = [crsdatefirma]
|
||||
If Used(lcCursor)
|
||||
Use In (lcCursor)
|
||||
Endif
|
||||
If This.oDBController.apeleaza_sql_hash(getHash([cColumns=>*??cTables=>syn_nom_firme??cWhere=>id_firma=] + Alltrim(Str(tnIdFirma))),lcCursor)
|
||||
Select (lcCursor)
|
||||
Scatter Name loFirma
|
||||
This.oDateFirma = loFirma
|
||||
This.nIdSucursala = Iif(Nvl(loFirma.id_mama,0) <> 0, loFirma.Id_Firma, Null) && DACA ESTE SUCURSALA - ID-UL SUCURSALA PE CARE IL SCRIU IN TABELE
|
||||
This.nIdMama = Iif(Nvl(loFirma.id_mama,0) <> 0, loFirma.id_mama, Null)
|
||||
This.lEMama = Nvl(loFirma.e_mama,0) <> 0
|
||||
Endif
|
||||
If Used(lcCursor)
|
||||
Use In (lcCursor)
|
||||
Endif
|
||||
Endproc
|
||||
******************************************************************
|
||||
Procedure initializeaza_calendar
|
||||
Local loCalendar,lcCursor
|
||||
This.oDateCalendar = Null
|
||||
lcCursor = [crscalendar]
|
||||
If Used(lcCursor)
|
||||
Use In (lcCursor)
|
||||
Endif
|
||||
If This.oDbController.apeleaza_sql_hash(getHash([cColumns=>*??cTables=>(select * from calendar order by id_calendar desc)??cWhere=>rownum = 1]),lcCursor)
|
||||
If Reccount(lcCursor) = 0
|
||||
amessagebox("Nu exista luni deschise in calendar!",48,"Atentie")
|
||||
Else
|
||||
Select (lcCursor)
|
||||
Scatter Name loCalendar
|
||||
This.oDateCalendar = loCalendar
|
||||
Endif
|
||||
Endif
|
||||
If Used(lcCursor)
|
||||
Use In (lcCursor)
|
||||
Endif
|
||||
Endproc
|
||||
******************************************************************
|
||||
PROCEDURE initializeaza_optiuni_utilizator
|
||||
LPARAMETERS tnIdUtil
|
||||
LOCAL lcCursor
|
||||
lcCursor = [crsOptiuniUtilizator]
|
||||
If Used(lcCursor)
|
||||
Use In (lcCursor)
|
||||
Endif
|
||||
This.oDbController.apeleaza_sql_hash(getHash([cColumns=>*??cTables=>optiuni_util??cWhere=>id_util=] +ALLTRIM(STR(tnIdUtil)) + [??cOrderBy=>varname]),lcCursor)
|
||||
ENDPROC
|
||||
******************************************************************
|
||||
Procedure initializeaza_optiuni
|
||||
Local lcNumeCursor
|
||||
lcNumeCursor = [v_optiuni]
|
||||
If This.citeste_optiuni(lcNumeCursor)
|
||||
Select(lcNumeCursor)
|
||||
Scan For !Empty(varname) And (Isnull(programe) Or gcNumeProgram$programe)
|
||||
lcvarname = Alltrim(&lcNumeCursor..varname)
|
||||
lcvartype = Upper(Alltrim(&lcNumeCursor..Vartype))
|
||||
Do Case
|
||||
Case lcvartype = "CHARACTER"
|
||||
Public gc&lcvarname.
|
||||
luvarvalue = Alltrim(&lcNumeCursor..varvalue)
|
||||
gc&lcvarname. = luvarvalue
|
||||
Case lcvartype = "CURRENCY"
|
||||
Public gy&lcvarname.
|
||||
luvarvalue = Ntom(Val(&lcNumeCursor..varvalue))
|
||||
gy&lcvarname. = luvarvalue
|
||||
Case lcvartype = "NUMERIC"
|
||||
Public gn&lcvarname.
|
||||
luvarvalue = Val(&lcNumeCursor..varvalue)
|
||||
gn&lcvarname. = luvarvalue
|
||||
Case lcvartype = "DATETIME"
|
||||
Public gt&lcvarname.
|
||||
luvarvalue = Ctot(&lcNumeCursor..varvalue)
|
||||
gt&lcvarname. = luvarvalue
|
||||
Case lcvartype = "DATE"
|
||||
Public gd&lcvarname.
|
||||
luvarvalue = Ctod(&lcNumeCursor..varvalue)
|
||||
gd&lcvarname. = luvarvalue
|
||||
Case lcvartype = "LOGICAL"
|
||||
Public gl&lcvarname.
|
||||
luvarvalue = Iif(Inlist(Upper(Left(&lcNumeCursor..varvalue, 1)), "T", "Y"), .T., .F.)
|
||||
gl&lcvarname. = luvarvalue
|
||||
Otherwise
|
||||
pcmsgbuff = "Tip de variabila globala invalid!"
|
||||
pcmsgbuff = pcmsgbuff + Chr(13) + Chr(13) + "Numele variabilei: " + lcvarname
|
||||
pcmsgbuff = pcmsgbuff + Chr(13) + "Tipul variabilei: " + lcvartype
|
||||
pcmsgbuff = pcmsgbuff + Chr(13) + Chr(13) + "Contactati suportul tehnic."
|
||||
=aMessagebox(pcmsgbuff, 48)
|
||||
pcmsgbuff = ""
|
||||
Endcase
|
||||
Endscan
|
||||
|
||||
Endif
|
||||
If Used(lcNumeCursor)
|
||||
Use In (lcNumeCursor)
|
||||
Endif
|
||||
Endproc
|
||||
******************************************************************
|
||||
PROCEDURE initializeaza_sesiune_server
|
||||
Lparameters tnIdUtil
|
||||
Local lcProceduri
|
||||
lcProceduri = [pack_sesiune.set_Id_Util(] + ALLTRIM(STR(tnIdUtil)) + [);] + ;
|
||||
[pack_sesiune.setluna(] + ALLTRIM(STR(This.oDateCalendar.luna)) + [);] + ;
|
||||
[pack_sesiune.setan(] + ALLTRIM(STR(This.oDateCalendar.anul)) + [);] + ;
|
||||
[pack_sesiune.setlunabal(] + ALLTRIM(STR(This.oDateCalendar.luna)) + [);] + ;
|
||||
[pack_sesiune.setanbal(] + ALLTRIM(STR(This.oDateCalendar.anul)) + [);] + ;
|
||||
[pack_contafin.set_data_ron('] + ALLTRIM(This.oDateFirma.schema) + [');] + ;
|
||||
[pack_sesiune.set_data_ron('] + ALLTRIM(This.oDateFirma.schema) + [');] + ;
|
||||
[pack_contafin.set_id_sucursala(] + Iif(Nvl(This.oDateFirma.id_mama,0) <> 0, ALLTRIM(STR(This.oDateFirma.Id_Firma)), [NULL]) + [);] + ;
|
||||
[pack_contafin.set_id_firma(] + ALLTRIM(STR(This.oDateFirma.id_firma)) + [)]
|
||||
This.oDBController.apeleaza_procedura(lcProceduri)
|
||||
ENDPROC
|
||||
******************************************************************
|
||||
Function scrie_optiuni
|
||||
Local lcProcedura
|
||||
lcProcedura = [scrie_optiuni(USER)]
|
||||
Return This.oDBController.apeleaza_procedura(lcProcedura)
|
||||
Endfunc
|
||||
******************************************************************
|
||||
FUNCTION verificaVersiuni
|
||||
LPARAMETERS tcNumeProgram,tcVersiuneProgram,tcVersiuneDBTxt
|
||||
LOCAL lcFunctie
|
||||
lcFunctie = [pack_migrare.VerificaVersiune(']+tcNumeProgram+[', ']+tcVersiuneProgram+[',']+tcVersiuneDBTxt+[')]
|
||||
Return This.oDBController.apeleaza_functie(lcFunctie,[C])
|
||||
ENDfunc
|
||||
******************************************************************
|
||||
Function citeste_optiuni
|
||||
Lparameters tcNumeCursor
|
||||
This.scrie_optiuni()
|
||||
Return This.oDBController.apeleaza_sql_hash(getHash([cColumns=>*??cTables=>optiuni??cOrderBy=>varname]),tcNumeCursor)
|
||||
Endfunc
|
||||
******************************************************************
|
||||
Function getoFirma
|
||||
Return This.oDateFirma
|
||||
Endfunc
|
||||
******************************************************************
|
||||
Function getoCalendar
|
||||
Return This.oDateCalendar
|
||||
Endfunc
|
||||
******************************************************************
|
||||
Function getIdSucursala
|
||||
Return This.nIdSucursala
|
||||
Endfunc
|
||||
******************************************************************
|
||||
Function getIdMama
|
||||
Return This.nIdMama
|
||||
Endfunc
|
||||
******************************************************************
|
||||
Function getEMama
|
||||
Return This.lEMama
|
||||
Endfunc
|
||||
******************************************************************
|
||||
Enddefine
|
||||
Reference in New Issue
Block a user