Files
vfp_roaauto/COMUN/programe/proceduri.prg

228 lines
4.8 KiB
Plaintext

*!* *_________________________________________________________
PROCEDURE caut_alfa_cursor
PARAMETERS NUMEBAZA,NUMECIMP,CAPTEXT,VARMEM
LOCAL MC0,MC1,MC2, llVizibil
SET SAFETY OFF
llVizibil = .t.
MC0='SELE '+NUMEBAZA
MC1='VARMEM=M.'+NUMECIMP
MC2 = [INDEX ON ] +NUMECIMP+ [ TAG nume OF &loc\&nfscurt\tempo\xindex.idx COMPACT ASCENDING ]
LOCAL lcNumeCol2
STORE '' TO lcNumeCol2
LcCol = ALLTRIM(NUMEBAZA) + '.cod_fiscal'
IF TYPE(LcCol) # 'U'
lcNumeCol2 = 'cod_fiscal'
ENDIF
LcCol = ALLTRIM(NUMEBAZA) + '.gest'
IF TYPE(LcCol) # 'U'
lcNumeCol2 = 'gest'
ENDIF
LcCol = ALLTRIM(NUMEBAZA) + '.id_sectie'
IF TYPE(LcCol) # 'U'
lcNumeCol2 = 'id_sectie'
ENDIF
IF EMPTY(lcNumeCol2)
lcNumeCol2 = 'space(4)'
llVizibil = .f.
ENDIF
LcCol = ALLTRIM(NUMEBAZA) + '.id'
IF TYPE(LcCol) # 'U'
lcNumeCol3 = 'id'
ELSE
lcNumeCol3 = 'space(4)'
ENDIF
SELECT DISTINCT &NUMECIMP, &lcNumeCol2, &lcNumeCol3 FROM (numebaza) INTO CURSOR tnomenclator READWRITE ORDER BY &NUMECIMP
OCA=CREATEOBJECT("CAUTALFa")
OCA.CAPTION=CAPTEXT
OCA.GRID1.RECORDSOURCE='tnomenclator'
OCA.GRID1.COLUMN1.CONTROLSOURCE = NUMECIMP
OCA.GRID1.COLUMN2.CONTROLSOURCE = lcNumeCol2
OCA.GRID1.COLUMN2.visible = llVizibil
OCA.cmdrenunt1.visible=.t.
OCA.command1.visible=.f.
OCA.command2.visible=.f.
OCA.command3.visible=.f.
OCA.SHOW(1)
IF buton=2
USE IN tnomenclator
RETURN
ENDIF
lcFile = ADDBS(gcTempPath) + 'xindex.idx'
IF FILE(lcFile)
SET INDEX TO
DELETE FILE &lcFile
ENDIF
*!* &MC1
SELECT tnomenclator
SCATTER MEMVAR
&MC1
USE IN tnomenclator
RETURN
*!* *___________________________________________
PROCEDURE MESAJ
PARAMETERS m1,m2
ot=create('text')
ot.label2.caption=m1
ot.label3.caption=m2
ot.show(1)
RETURN
*!* *___________________________________________
*!* PROCEDURE mesajmare
*!* PARAMETERS m1
*!* ot=create('textmare')
*!* ot.label2.caption=m1
*!* ot.show(1)
*!* RETURN
*!* *___________________________________________
*!* PROCEDURE mesajval
*!* PARAMETERS m1,m2
*!* ot=create('textval')
*!* ot.label2.caption=m1
*!* ot.valoare=m2
*!* ot.show(1)
*!* RETURN
*!* *___________________________________________
PROCEDURE mesajatent
PARAMETERS m1,m2
ot=create('atentie')
ot.label2.caption=m1
ot.label3.caption=m2
ot.show(1)
RETURN
*!* *___________________________________________
*!* PROCEDURE mesajrosu
*!* PARAMETERS m1,m2
*!* ot=create('atentierosu')
*!* ot.label2.caption=m1
*!* ot.label3.caption=m2
*!* ot.show(1)
*!* RETURN
*!* *_____________________________________-
*!* PROCEDURE mesajm
*!* PARAM txt,i
*!* LOCAL t,p
*!* p=iif(i<10,str(i,1),str(i,2))
*!* T='orm.label'+p+'.caption="'+txt+'"'
*!* &t
*!* IF i<20
*!* i=i+1
*!* ENDIF
*!* p=iif(i<10,str(i,1),str(i,2))
*!* T='orm.IMAGE'+p+'.VISIBLE=.T.'
*!* &t
*!* RETURN
*!* *___________________________________________
PROCEDURE danu
PARAMETERS m1
od=create('danu')
od.label1.caption=m1
od.show(1)
RETURN
*!* *___________________________________________
*!* *____________________________________
*!* PROC PR
*!* PARAM J
*!* IF J>M
*!* op.release
*!* op=crea('progresbar')
*!* J=0
*!* op.show()
*!* ENDIF
*!* op.PRBAR.VALUE=J
*!* op.p=ROUND(100*op.PRBAR.VALUE/op.PRBAR.MAX,2)
*!* op.REFRESH
*!* J=J+1
*!* RETURN
*!* *_________________________
*!* PROC MESAJT
*!* PARAM M.denumire
*!* OTEXT.oleTreeview.NODES.add(,,,M.denumire,)
*!* STARE=STARE+1
*!* RETURN
*!* *!* ***------------------------------------------------------------------------------------
*!* *!* Procedure lanseaza_excel_standard
*!* *!* Parameters tcalias
*!* *!* Private lcTabelSectii
*!* *!* lcTabelSectii = Alltrim(tcalias)
*!* *!* Select (lcTabelSectii)
*!* *!* lcexcel=Addbs(pccaletempo)+"Fisa de calcul a eficientei"+".XLS"
*!* *!* x=Newobject("XL_Sectie_standard","EXCELX") && alternatively you can drop this class on a VFP form
*!* *!* x.SaveAs=lcexcel && PART.XLS to be created in your TEMP folder
*!* *!* Select centre_profit
*!* *!* Set Filter To
*!* *!* Count For ((!virtual And contribuie) Or SOCIETATE) And ales To lnNrSectii
*!* *!* If !lnNrSectii>0
*!* *!* Return
*!* *!* Endif
*!* *!* Dimension x.oWorkSheet[lnNrSectii] && need four pages
*!* *!* I=0
*!* *!* Select centre_profit
*!* *!* Scan For ((!virtual And contribuie) Or SOCIETATE) And ales
*!* *!* lccentru = Alltrim(centru)
*!* *!* I=I+1
*!* *!* x.oWorkSheet[I] = lccentru
*!* *!* Endscan
*!* *!* x.Go() && remember this calls .populate_pages().
*!* *!* Release x
*!* *!* **************************8
*!* *!* OLEAPP = Getobject("","Excel.Application")
*!* *!* If Type('OLEAPP')!='O'
*!* *!* OLEAPP = Createobject("Excel.Application")
*!* *!* Endif
*!* *!* OLEAPP.WorkBooks.Open(lcexcel)
*!* *!* OLEAPP.Visible=1
*!* *!* Return
*!* *!* Endproc &&lanseaza_excel_standard