*!* 24.06.2011 *!* marius.mutu *!* calc_indicatori_randuri *!* daca un indicator avea valoare negativa, formula dadea eroare *!* am transformat +-valoare in +(-valoare) *!* 31.07.2012 *!* marius.mutu *!* evalueaza_randul *** Nu reevaluez totalurile cu CASE/IIF (ex R15 = CASE WHEN R15A > 0 THEN R15A ELSE 0 END) *** pentru ca doresc sa suprascriu R15 *!* 27.02.2019 *!* marius.mutu *!* evalueaza_randul - upper(allt(rand)) *!* 13.02.2026 *!* calc_indicatori_randuri - lcRandEval = 0 daca nu exista randul Procedure viz_set_calc Parameters tctable, tnId_set, tlFaraGrafic, tcNumeSet, tnId_sectie, tnId_venchelt Private pcDataOra pcDataOra = Get_Ora(2) Local llFaraGrafic, lcTitlu llFaraGrafic = tlFaraGrafic If !Empty(tcNumeSet) lcTitlu = Alltrim(tcNumeSet) Else lcTitlu = '' Endif *!* If !Empty(tcFCentru) *!* If !("FIRMA"$Upper(Alltrim(tcFCentru))) *!* lcTitlu = Proper(Alltrim(tcFCentru)) + ' - ' + lcTitlu *!* Endif *!* Endif If !Used(tctable) Return Endif Select (tctable) && id_ind, rand, nume_ind, comentariu -> ....date frml = Createobject("frm_viz_set_calc", tnId_set, tlFaraGrafic, lcTitlu, tnId_sectie, tnId_venchelt) frml.lb_titlu_alb_b121.Caption = "Set calculat - " + lcTitlu frml.grid1.RecordSource = tctable frml.grid1.DeleteColumn(1) && id_ind frml.grid1.DeleteColumn(1) && ord_rand frml.grid1.DeleteColumn(3) && comentariu * frml.grid1.FontName = "Arial Narrow" lnnrcoloane = frml.grid1.ColumnCount frml.grid1.column4.Width = 300 && nume_ind For i = 6 To lnnrcoloane+3 cformat = "frml.grid1.Column"+Alltrim(Str(i))+".format='rk'" &cformat cinputmask = "frml.grid1.Column"+Alltrim(Str(i))+".inputmask" &cinputmask = "999 999 999 999.99" Endfor *!* frml.grid1.Width = frml.edtcomentariu.Left + frml.edtcomentariu.Width frml.edtComentariu.ControlSource = tctable + ".comentariu" *!* If tlcalculat *!* frml.cb_save1.Visible = .F. *!* frml.cb_print1.Left = frml.cb_print1.Left+frml.cb_print1.Width+1 *!* frml.cb_excel1.Left=frml.cb_excel1.Left+frml.cb_excel1.Width+1 *!* frml.cb_explorer1.Left=frml.cb_explorer1.Left+frml.cb_explorer1.Width+1 *!* Endif *frml.lockscreen=.f. frml.Show(1) If Used('gtemp') Use In gtemp Endif If Used('xtab') Use In xtab Endif Endproc && viz_set_calc ***------------------------------------------------------------------------------------ Procedure lanseaza_excel Parameters tcalias, tcTitlu, tlfara_grafic Private pctitlu Local llEsteExcel llEsteExcel = .F. llEsteExcel=isComobject("Excel.Application") If !llEsteExcel Do mesaj With "Instalati Microsoft Excel","" Return Endif If Empty(tcTitlu) pctitlu="Indicatori" Else pctitlu=Alltrim(tcTitlu) Endif Declare aranduri[1] Declare acoloane[1] Declare arand[1] Select (tcalias) lcField2=Field(4) && campul cu descrierea indicatorilor lcSelect = [select ] + lcField2 + " "+[from ] + tcalias +" "+[into cursor tdesc] &lcSelect lnCount = _Tally Dimension aranduri[lnCount] &&& obtin array pt grafic i=0 Select tdesc Scan i=i+1 aranduri[i]=tdesc.nume_ind Endscan If Used("tdesc") Use In tdesc Endif *** Select (tcalias) lcField1=Field(3) && campul cu numele randului (indicatorului) lcSelect1 = [select ] + lcField1 + " "+[from ] + tcalias +" "+[into cursor trand] &lcSelect1 lnCount1 = _Tally Dimension arand[lnCount1] j=0 Select trand Scan j=j+1 arand[j]=Right(Alltrim(trand.Rand),2) Endscan If Used("trand") Use In trand Endif Select (tcalias) lnFields=Fcount() Dimension acoloane[lnFields] Select (tcalias) lcSelect = [select ] For i=5 To lnFields lcField=Field(i) lcSelect = lcSelect + lcField + [,] Endfor lcSelect=Left(lcSelect,Len(lcSelect)-1) lcSelect = lcSelect +" "+[ from ]+tcalias+" "+[ into cursor tExcel] &lcSelect lnCount = _Tally &&& obtin d200331001 , 200304 Select (tcalias) For i=5 To lnFields lcTipCumul=Left(Field(i),1) lcan=Substr(Field(i),2,4) lcgrup=Right(Field(i),2) acoloane[i-4]=cluna(lcgrup,lcTipCumul,lcan) Endfor lcfis = Alltrim(pctitlu) For i=0 To Len(lcfis)-1 lccar = Substr(lcfis,i,1) If Inlist(lccar,":","*","/","\","<",">",'"',"|","?") lcfis= Strtran(lcfis,lccar,"_") Endif Endfor lcexcel= Addbs(Strtran(gcTempPath,"\\","\"))+lcfis+"_"+Sys(2)+".XLS" lcClasa = "EXCELX" x=Newobject("XL_Manager",lcClasa) && alternatively you can drop this class on a VFP form x.SaveAs=lcexcel && PART.XLS to be created in your TEMP folder Dimension x.oWorkSheet[1] && need one page x.oWorkSheet[1] = "Page 1 (with chart)" x.Go() && remember this calls .populate_pages(). *WAIT WINDOW 'Check out! ' + x.SAVEAS && Presto! (the output XLS document) Release x OLEAPP = Getobject("","Excel.Application") If Type('OLEAPP')!='O' OLEAPP = Createobject("Excel.Application") Endif OLEAPP.WorkBooks.Open(lcexcel) OLEAPP.Visible=1 Use In texcel Return Endproc &&lanseaza_excel ***------------------------------------------------------------------------------------ ***------------------------------------------------------------------------------------ Procedure lanseaza_html Parameters tcFile, tcTitluHtml, tlFaraGrafic Local llFaraGrafic, lcTitluHtml llFaraGrafic = tlFaraGrafic lcTitluHtml = Alltrim(tcTitluHtml) Select (tcFile) lcfisd = gcTempPath + "copie.dbf" Copy To (lcfisd) Use (lcfisd) In 0 Exclusive Select Copie losc = Createobject("aShowCursor") With losc .lAlternateRows = .T. .CTABLEWIDTH = '100%' .cCellspacing = '3' .cAlternatingBGColor = "white" .cTableBorder = "1" .nForceToPreList = 75000 .ShowCursor() Endwith ****** *!* DEBUG *!* SUSPEND lcBar = "" loGraph = Createobject('wwWebGraphs') *** Make sure you pick a directory that exists *** and is accessible through the Web If Type("loGraph") = "O" loGraph.cPhysicalPath = gcTempPath loGraph.cLogicalPath = gcTempPath loGraph.ShowGraphFromCursor() lcBar = loGraph.GetOutput() Endif ****** lcFile = Strtran(Addbs(gcTempPath),"\\","\")+"Indicatori.htm" lchtml = [