Import initial din SVN ROAAUTO/Trunk @HEAD
This commit is contained in:
216
COMUN/Drepturi utilizatori/ROAMANAGER/adaugare_drepturi.prg
Normal file
216
COMUN/Drepturi utilizatori/ROAMANAGER/adaugare_drepturi.prg
Normal file
@@ -0,0 +1,216 @@
|
||||
Procedure citeste_obiecte
|
||||
Local lcMeniu,lcPageframe
|
||||
lcMeniu=[manager]
|
||||
lcPageframe=[oprinc.pagefr1]
|
||||
Create Cursor CRSOBIECTE(ID_PROG N(1),CHEIE C(20),NIVEL N(2),EXPLICATIE C(100),TATA C(20),COD C(2),ID_OBIECT N(10),ID_TATA N(10))
|
||||
plCursor=.T.
|
||||
citeste_meniu(90,lcmeniu,"Meniu")
|
||||
citeste_pageframe(65,lcpageframe)
|
||||
select * FROM crsobiecte INTO TABLE C:\crsobiecte.dbf
|
||||
Endproc
|
||||
************************************************************************
|
||||
Procedure citeste_meniu
|
||||
Lparameters lnKey,lcNumeMeniu,lcOptiune
|
||||
lcKey=Chr(lnKey)
|
||||
*!* This.Nodes.Add(,1,lcKey,lcOptiune)
|
||||
If plCursor
|
||||
Insert Into CRSOBIECTE (CHEIE,NIVEL,EXPLICATIE,TATA) Values(lcKey,1,lcOptiune,[ ])
|
||||
Endif
|
||||
lnKey2=65
|
||||
k=0
|
||||
Try
|
||||
lcKey2=lcKey+Chr(lnKey2)
|
||||
lnKey2=lnKey2+1
|
||||
If plCursor
|
||||
Insert Into CRSOBIECTE (CHEIE,NIVEL,EXPLICATIE,TATA) Values(lcKey2,4,[Optiuni],lcKey)
|
||||
Endif
|
||||
For i=1 To Cntbar('optiuni')
|
||||
lcOptiune=Prmbar('optiuni',i)
|
||||
If !Empty(lcOptiune)
|
||||
k=k+1
|
||||
If plCursor
|
||||
Insert Into CRSOBIECTE (CHEIE,NIVEL,EXPLICATIE,TATA) Values(lcKey2+Padl(Alltrim(Str(k)),2,[0]),4,lcOptiune,lcKey2)
|
||||
Endif
|
||||
Endif
|
||||
Endfor
|
||||
Catch
|
||||
ENDTRY
|
||||
k=0
|
||||
Try
|
||||
lcKey2=lcKey+Chr(lnKey2)
|
||||
lnKey2=lnKey2+1
|
||||
*!* This.Nodes.Add(lcKey,4,lcKey2,'Initializare')
|
||||
If plCursor
|
||||
Insert Into CRSOBIECTE (CHEIE,NIVEL,EXPLICATIE,TATA) Values(lcKey2,4,[Vizualizare],lcKey)
|
||||
Endif
|
||||
For i=1 To Cntbar('vizualizar')
|
||||
lcOptiune=Prmbar('vizualizar',i)
|
||||
If !Empty(lcOptiune)
|
||||
k=k+1
|
||||
*!* This.Nodes.Add(lcKey2,4,lcKey2+Padl(Alltrim(Str(k)),2,[0]),lcOptiune)
|
||||
If plCursor
|
||||
Insert Into CRSOBIECTE (CHEIE,NIVEL,EXPLICATIE,TATA) Values(lcKey2+Padl(Alltrim(Str(k)),2,[0]),4,lcOptiune,lcKey2)
|
||||
Endif
|
||||
Endif
|
||||
Endfor
|
||||
Catch
|
||||
Endtry
|
||||
k=0
|
||||
Try
|
||||
lcKey2=lcKey+Chr(lnKey2)
|
||||
*!* This.Nodes.Add(lcKey,4,lcKey2,'Actualizari')
|
||||
If plCursor
|
||||
Insert Into CRSOBIECTE (CHEIE,NIVEL,EXPLICATIE,TATA) Values(lcKey2,4,[Rapoarte generale],lcKey)
|
||||
Endif
|
||||
For i=1 To Cntbar('rapoartege')
|
||||
lcOptiune=Prmbar('rapoartege',i)
|
||||
If !Empty(lcOptiune)
|
||||
k=k+1
|
||||
*!* This.Nodes.Add(lcKey2,4,lcKey2+Padl(Alltrim(Str(k)),2,[0]),lcOptiune)
|
||||
If plCursor
|
||||
Insert Into CRSOBIECTE (CHEIE,NIVEL,EXPLICATIE,TATA) Values(lcKey2+Padl(Alltrim(Str(k)),2,[0]),4,lcOptiune,lcKey2)
|
||||
Endif
|
||||
Endif
|
||||
Endfor
|
||||
Catch
|
||||
Endtry
|
||||
************************************************************************
|
||||
Procedure citeste_pageframe
|
||||
Lparameters lnKey,lcPageframe,lcTata
|
||||
Local lcKey,lcProp,lcOptiune,lnNivel,lnPozitie,i,j,k,l
|
||||
Store [] To lcKey,lcProp,lcOptiune
|
||||
Store 0 To lnNivel,lnPozitie,i,j,k,l
|
||||
If Empty(lcTata)
|
||||
lcTata=Null
|
||||
lnNivel=1
|
||||
Else
|
||||
lnNivel=4
|
||||
Endif
|
||||
Set Exact On
|
||||
With &lcPageframe
|
||||
For i=1 To .PageCount
|
||||
For j=1 To .PageCount
|
||||
If .Pages(j).PageOrder=i
|
||||
Exit
|
||||
Endif
|
||||
Endfor
|
||||
With .Pages(j)
|
||||
lcKey=Nvl(lcTata,[])+Chr(lnKey)
|
||||
*!* This.Nodes.Add(lcTata,lnNivel,lcKey,.Caption)
|
||||
lcProp="cnt"+lcKey
|
||||
*!* This.AddProperty(lcProp,0)
|
||||
If plCursor
|
||||
Insert Into CRSOBIECTE (CHEIE,NIVEL,EXPLICATIE,TATA) Values(lcKey,lnNivel,.Caption,Nvl(lcTata,[ ]))
|
||||
Endif
|
||||
lcProp="cnt"+lcKey
|
||||
*!* This.AddProperty(lcProp,0)
|
||||
Dimension copii(128,3)
|
||||
k=1
|
||||
For l=1 To .ControlCount
|
||||
Do Case
|
||||
Case Alltrim(Upper(.Objects(l).Class))='PAGEFRAME'
|
||||
lcNume=lcPageframe+'.'+Alltrim(.Name)+'.'+Alltrim(Upper(.Objects(l).Name))
|
||||
citeste_pageframe(65,lcNume,lcKey)
|
||||
Case Alltrim(Upper(.Objects(l).Class))='CW' And .Objects(l).nid_cw>0
|
||||
lcOptiune=.Objects(l).label_item1.Caption
|
||||
lnPozitie=.Objects(l).nid_cw
|
||||
copii(lnPozitie,1)=lcOptiune
|
||||
copii(lnPozitie,2)=.Objects(l).ntip
|
||||
copii(lnPozitie,3)=.Objects(l).cmeniu
|
||||
k=k+1
|
||||
Endcase
|
||||
Endfor
|
||||
For l=1 To k-1
|
||||
*!* This.Nodes.Add(lcKey,4,lcKey+Padl(Alltrim(Str(l)),2,[0]),copii(l,1))
|
||||
If plCursor
|
||||
Insert Into CRSOBIECTE (CHEIE,NIVEL,EXPLICATIE,TATA) Values(lcKey+Padl(Alltrim(Str(l)),2,[0]),4,copii(l,1),lcKey)
|
||||
Endif
|
||||
*!* If !Empty(copii(l,3))
|
||||
*!* This.adauga_meniuri(copii(l,3),copii(l,2),lcKey+Padl(Alltrim(Str(l)),2,[0]))
|
||||
*!* Else
|
||||
adauga_frunze(copii(l,2),lcKey+Padl(Alltrim(Str(l)),2,[0]))
|
||||
*!* Endif
|
||||
Endfor
|
||||
Endwith
|
||||
lnKey=lnKey+1
|
||||
Endfor
|
||||
Endwith
|
||||
Set Exact Off
|
||||
Endproc
|
||||
************************************************************************
|
||||
Procedure adauga_frunze
|
||||
Lparameters lnTip,lcKey
|
||||
Do Case
|
||||
Case lnTip=0 && introducere
|
||||
Case lnTip=1 && raport
|
||||
*!* lcProp="cnt"+lcKey
|
||||
*!* This.AddProperty(lcProp,0)
|
||||
*!* This.Nodes.Add(lcKey,4,lcKey+"1","Export")
|
||||
*!* This.Nodes.Add(lcKey,4,lcKey+"2","Listare")
|
||||
If plCursor
|
||||
Insert Into CRSOBIECTE (CHEIE,NIVEL,EXPLICATIE,TATA) Values(lcKey+"1",4,"Export",lcKey)
|
||||
Insert Into CRSOBIECTE (CHEIE,NIVEL,EXPLICATIE,TATA) Values(lcKey+"2",4,"Listare",lcKey)
|
||||
Endif
|
||||
Case lnTip=2 && registru
|
||||
*!* lcProp="cnt"+lcKey
|
||||
*!* This.AddProperty(lcProp,0)
|
||||
*!* This.Nodes.Add(lcKey,4,lcKey+"1","Export")
|
||||
*!* This.Nodes.Add(lcKey,4,lcKey+"2","Listare")
|
||||
*!* This.Nodes.Add(lcKey,4,lcKey+"3","Modificare")
|
||||
*!* This.Nodes.Add(lcKey,4,lcKey+"4","Refacere")
|
||||
If plCursor
|
||||
Insert Into CRSOBIECTE (CHEIE,NIVEL,EXPLICATIE,TATA) Values(lcKey+"1",4,"Export",lcKey)
|
||||
Insert Into CRSOBIECTE (CHEIE,NIVEL,EXPLICATIE,TATA) Values(lcKey+"2",4,"Listare",lcKey)
|
||||
Insert Into CRSOBIECTE (CHEIE,NIVEL,EXPLICATIE,TATA) Values(lcKey+"3",4,"Modificare",lcKey)
|
||||
Insert Into CRSOBIECTE (CHEIE,NIVEL,EXPLICATIE,TATA) Values(lcKey+"4",4,"Refacere",lcKey)
|
||||
Endif
|
||||
Case lnTip=3 && balanta\inreg.
|
||||
*!* lcProp="cnt"+lcKey
|
||||
*!* This.AddProperty(lcProp,0)
|
||||
*!* This.Nodes.Add(lcKey,4,lcKey+"1","Export")
|
||||
*!* This.Nodes.Add(lcKey,4,lcKey+"2","Listare")
|
||||
*!* This.Nodes.Add(lcKey,4,lcKey+"3","Modificare")
|
||||
*!* This.Nodes.Add(lcKey,4,lcKey+"4","Refacere")
|
||||
If plCursor
|
||||
Insert Into CRSOBIECTE (CHEIE,NIVEL,EXPLICATIE,TATA) Values(lcKey+"1",4,"Export",lcKey)
|
||||
Insert Into CRSOBIECTE (CHEIE,NIVEL,EXPLICATIE,TATA) Values(lcKey+"2",4,"Listare",lcKey)
|
||||
Insert Into CRSOBIECTE (CHEIE,NIVEL,EXPLICATIE,TATA) Values(lcKey+"3",4,"Modificare",lcKey)
|
||||
Insert Into CRSOBIECTE (CHEIE,NIVEL,EXPLICATIE,TATA) Values(lcKey+"4",4,"Refacere",lcKey)
|
||||
Endif
|
||||
Case lnTip=4 && vizualizare
|
||||
*!* lcProp="cnt"+lcKey
|
||||
*!* This.AddProperty(lcProp,0)
|
||||
*!* This.Nodes.Add(lcKey,4,lcKey+"1","Export")
|
||||
*!* This.Nodes.Add(lcKey,4,lcKey+"2","Listare")
|
||||
*!* This.Nodes.Add(lcKey,4,lcKey+"3","Modificare")
|
||||
*!* This.Nodes.Add(lcKey,4,lcKey+"4","Stergere")
|
||||
*!* This.Nodes.Add(lcKey,4,lcKey+"5","Vizualizare inreg. proprii")
|
||||
*!* This.Nodes.Add(lcKey,4,lcKey+"6","Vizualizare toate inreg.")
|
||||
If plCursor
|
||||
Insert Into CRSOBIECTE (CHEIE,NIVEL,EXPLICATIE,TATA) Values(lcKey+"1",4,"Export",lcKey)
|
||||
Insert Into CRSOBIECTE (CHEIE,NIVEL,EXPLICATIE,TATA) Values(lcKey+"2",4,"Listare",lcKey)
|
||||
Insert Into CRSOBIECTE (CHEIE,NIVEL,EXPLICATIE,TATA) Values(lcKey+"3",4,"Modificare",lcKey)
|
||||
Insert Into CRSOBIECTE (CHEIE,NIVEL,EXPLICATIE,TATA) Values(lcKey+"4",4,"Stergere",lcKey)
|
||||
Insert Into CRSOBIECTE (CHEIE,NIVEL,EXPLICATIE,TATA) Values(lcKey+"5",4,"Vizualizare inreg.proprii",lcKey)
|
||||
Insert Into CRSOBIECTE (CHEIE,NIVEL,EXPLICATIE,TATA) Values(lcKey+"6",4,"Vizualizare tot",lcKey)
|
||||
ENDIF
|
||||
Case lnTip=5 && personalizat
|
||||
*!* lcProp="cnt"+lcKey
|
||||
*!* This.AddProperty(lcProp,0)
|
||||
*!* This.Nodes.Add(lcKey,4,lcKey+"1","Export")
|
||||
*!* This.Nodes.Add(lcKey,4,lcKey+"2","Listare")
|
||||
*!* This.Nodes.Add(lcKey,4,lcKey+"3","Modificare")
|
||||
*!* This.Nodes.Add(lcKey,4,lcKey+"4","Stergere")
|
||||
*!* This.Nodes.Add(lcKey,4,lcKey+"7","Altele...")
|
||||
*!* This.Nodes.Add(lcKey,4,lcKey+"8","Altele...")
|
||||
If plCursor
|
||||
Insert Into CRSOBIECTE (CHEIE,NIVEL,EXPLICATIE,TATA) Values(lcKey+"1",4,"Export",lcKey)
|
||||
Insert Into CRSOBIECTE (CHEIE,NIVEL,EXPLICATIE,TATA) Values(lcKey+"2",4,"Listare",lcKey)
|
||||
Insert Into CRSOBIECTE (CHEIE,NIVEL,EXPLICATIE,TATA) Values(lcKey+"3",4,"Modificare",lcKey)
|
||||
Insert Into CRSOBIECTE (CHEIE,NIVEL,EXPLICATIE,TATA) Values(lcKey+"4",4,"Stergere",lcKey)
|
||||
Insert Into CRSOBIECTE (CHEIE,NIVEL,EXPLICATIE,TATA) Values(lcKey+"7",4,"Altele...",lcKey)
|
||||
Insert Into CRSOBIECTE (CHEIE,NIVEL,EXPLICATIE,TATA) Values(lcKey+"8",4,"Altele...",lcKey)
|
||||
Endif
|
||||
Endcase
|
||||
Endproc
|
||||
************************************************************************
|
||||
BIN
COMUN/Drepturi utilizatori/ROAMANAGER/crsobiecte.dbf
Normal file
BIN
COMUN/Drepturi utilizatori/ROAMANAGER/crsobiecte.dbf
Normal file
Binary file not shown.
BIN
COMUN/Drepturi utilizatori/ROAMANAGER/obiecte.dbf
Normal file
BIN
COMUN/Drepturi utilizatori/ROAMANAGER/obiecte.dbf
Normal file
Binary file not shown.
62
COMUN/Drepturi utilizatori/ROAMANAGER/scrie_obiecte.prg
Normal file
62
COMUN/Drepturi utilizatori/ROAMANAGER/scrie_obiecte.prg
Normal file
@@ -0,0 +1,62 @@
|
||||
&& id = 7
|
||||
lnIdProgram = 7
|
||||
lcLocalDir=Addbs(Justpath(Sys(16,0)))
|
||||
Cd (lcLocalDir)
|
||||
If Used('obiecte')
|
||||
Use In obiecte
|
||||
Endif
|
||||
Use obiecte In 0
|
||||
gnhandle=SQLConnect('jcsserver','contafin_oracle','123')
|
||||
If Used('crsmax')
|
||||
Use In CrsMax
|
||||
Endif
|
||||
lcSql=[select pack_drepturi.getid_obiect() as maxid from dual]
|
||||
lnSucces=SQLExec(gnhandle,lcSql,'crsmax')
|
||||
If lnSucces<0
|
||||
Messagebox("Eroare la citirea id-ului!")
|
||||
Exit
|
||||
Endif
|
||||
Select CrsMax
|
||||
lnMaxId=maxid
|
||||
Use In CrsMax
|
||||
MESSAGEBOX(lnMaxId,0,"Id maxim pentru obiecte")
|
||||
|
||||
Select obiecte
|
||||
Replace id_prog With lnIdProgram All
|
||||
Replace cod With Padl(Substr(Padl(Alltrim(cheie),5,[ ]),5,1),2,[0]) FOR TYPE(SUBSTR(ALLTRIM(cheie),LEN(ALLTRIM(cheie))-2))='N'
|
||||
Replace cod With Padl(Substr(Padl(Alltrim(cheie),5,[ ]),4,2),2,[0]) FOR TYPE(SUBSTR(ALLTRIM(cheie),LEN(ALLTRIM(cheie))-2))<>'N'
|
||||
Replace cod With Substr(cod,2,1) For !Inlist(Len(Alltrim(tata)),1,2) Or Type(Substr(cod,2,1))!='N'
|
||||
Replace id_obiect With Recno()+lnMaxId All
|
||||
Replace cheie With Alltrim(tata)+Alltrim(cod) All
|
||||
Replace id_tata With -1 All
|
||||
Select id_obiect,cheie From obiecte Where Alltrim(cheie) In (Select Distinct Alltrim(tata) As cheie From obiecte) Into Cursor crstati
|
||||
Select crstati
|
||||
Scan
|
||||
lnIdObiect=id_obiect
|
||||
lcCheie=Alltrim(cheie)
|
||||
Select obiecte
|
||||
Replace id_tata With lnIdObiect For Alltrim(tata)=lcCheie
|
||||
Select crstati
|
||||
Endscan
|
||||
Use In crstati
|
||||
|
||||
lcSql=[update def_obiecte set sters=2 where id_program=]+ALLTRIM(STR(lnIdProgram))+[ and sters=0]
|
||||
lnSucces=SQLExec(gnhandle,lcSql)
|
||||
If lnSucces<0
|
||||
Messagebox("Eroare la stergerea vechilor obiecte!")
|
||||
Exit
|
||||
Endif
|
||||
|
||||
Select obiecte
|
||||
Browse
|
||||
Scan
|
||||
lcSql=[insert into def_obiecte (id_obiect,id_program,id_tata,descriere,cod) ]+;
|
||||
[values (]+Alltrim(Str(id_obiect))+[,]+ALLTRIM(STR(id_prog))+[,]+;
|
||||
ALLTRIM(Str(id_tata))+[,']+Alltrim(explicatie)+[',']+Alltrim(cod)+[')]
|
||||
lnSucces=SQLExec(gnhandle,lcSql)
|
||||
If lnSucces<1
|
||||
Wait Window lcSql
|
||||
Endif
|
||||
Endscan
|
||||
SQLDisconnect(gnhandle)
|
||||
Use In obiecte
|
||||
Reference in New Issue
Block a user