VASCON Posted February 21, 2012 Report Share Posted February 21, 2012 Vejam se podem me ajudar, por favor: Tenho que imprimir um relatório grande que dividi em várias funções. Abaixo está a declaração de variáveis, a definição de impressora, fontes, etc. (apenas o que interessa para a questão) Logo depois tenho uma das funções. Quando mando imprimir dá erro dizendo que não encontra a variável oPrn, pois ela foi declarada como local. Se declaro como estatica dá erro em: oPrn:nVertRes() Estou usando a FW24 Grato Nilson **======================= Jato de Tinta ============================================================= Function GENRE2() Local oPrn, oFont, oFont1 Local nRowStep, nColStep Local nRow := 0, numpagina := 0 Local qtdcolunas := 80 // quantidade de colunas Local qtdlinhas := 60 // quantidade de linhas Local numlinha := 0 // contador de linhas por pagina M->K:=PAG:=AB:=AD:=0 MASO:=SOMA1:=SOMA2:=SOMA3:=SOMA4:=0 SUBSOMA1:=SUBSOMA2:=SUBSOMA3:=SUBSOMA4:=0 TOTA1:=SOMA1:=SOMA2:=SOMA3:=SOMA4:=SOMA5:=SOMA6:=SOMA7:=SOMA8:=SOMA9:=SOMA10:=0 SOMA11:=SOMA12:=SOMA13:=SOMA14:=SOMA18:=0 SOMAA:=SOMAB:=SOMAC:=SOMAD:=SOMAE:=SOMAF:=SOMAG:=SOMAH:=0 MASO=0.01 TOTA1:=SOMA1:=0 MASO=0.01 SAMO=0 PAGINA=1 CONTA=0 PRINT oPrn PREVIEW if Empty( oPrn:hDC ) msginfo("Impressora não esta preparada, verifique !!!","Mensagem de Alerta") return nil endif DEFINE FONT oFont NAME "Arial" SIZE 0, -12 OF oPrn DEFINE FONT oFont1 NAME "Arial" SIZE 0, -09 OF oPrn nRowStep = oPrn:nVertRes() / qtdlinhas nColStep = oPrn:nHorzRes() / qtdcolunas PAGE PAGE:=0 numpagina := 0 numlinha++ nRow += nRowStep STATIC FUNCTION DOFISJ() oPrn:Say(nRow, 000*nColStep, "|",oFont1) oPrn:Say(nRow, 001*nColStep, TAPE,oFont1) oPrn:Say(nRow, 011*nColStep, "|",oFont1) oPrn:Say(nRow, 012*nColStep, COT,oFont1) oPrn:Say(nRow, 016*nColStep, "|",oFont1) oPrn:Say(nRow, 017*nColStep, ALLTRIM(CRECO),oFont1) oPrn:Say(nRow, 020*nColStep, ALLTRIM(CRESU),oFont1) oPrn:Say(nRow, 022*nColStep, "|",oFont1) oPrn:Say(nRow, 024*nColStep, ALLTRIM(DONU),oFont1) oPrn:Say(nRow, 032*nColStep, "|",oFont1) oPrn:Say(nRow, 033*nColStep, DOCTO,oFont1) oPrn:Say(nRow, 043*nColStep, "|",oFont1) oPrn:Say(nRow, 045*nColStep, INSCE,oFont1) oPrn:Say(nRow, 059*nColStep, "|",oFont1) oPrn:Say(nRow, 061*nColStep, TADO ,oFont1) oPrn:Say(nRow, 064*nColStep, "|",oFont1) oPrn:Say(nRow, 066*nColStep, ALLTRIM(TRANSFORM(RALO, "@E 999,999,999.99"),oFont),,39,,,1) oPrn:Say(nRow, 080*nColStep, "|",oFont1) oPrn:Say(nRow, 082*nColStep, " ",oFont1) oPrn:Say(nRow, 086*nColStep, "|",oFont1) oPrn:Say(nRow, 087*nColStep, TODE,oFont1) oPrn:Say(nRow, 093*nColStep, "|",oFont1) RETURN(.T.) Quote Link to comment Share on other sites More sharing options...
VASCON Posted February 21, 2012 Author Report Share Posted February 21, 2012 Vejam se podem me ajudar, por favor: Tenho que imprimir um relatório grande que dividi em várias funções. Abaixo está a declaração de variáveis, a definição de impressora, fontes, etc. (apenas o que interessa para a questão) Logo depois tenho uma das funções. Quando mando imprimir dá erro dizendo que não encontra a variável oPrn, pois ela foi declarada como local. Se declaro como estatica dá erro em: oPrn:nVertRes() Estou usando a FW24 Grato Nilson **======================= Jato de Tinta ============================================================= Function GENRE2() Local oPrn, oFont, oFont1 Local nRowStep, nColStep Local nRow := 0, numpagina := 0 Local qtdcolunas := 80 // quantidade de colunas Local qtdlinhas := 60 // quantidade de linhas Local numlinha := 0 // contador de linhas por pagina M->K:=PAG:=AB:=AD:=0 MASO:=SOMA1:=SOMA2:=SOMA3:=SOMA4:=0 SUBSOMA1:=SUBSOMA2:=SUBSOMA3:=SUBSOMA4:=0 TOTA1:=SOMA1:=SOMA2:=SOMA3:=SOMA4:=SOMA5:=SOMA6:=SOMA7:=SOMA8:=SOMA9:=SOMA10:=0 SOMA11:=SOMA12:=SOMA13:=SOMA14:=SOMA18:=0 SOMAA:=SOMAB:=SOMAC:=SOMAD:=SOMAE:=SOMAF:=SOMAG:=SOMAH:=0 MASO=0.01 TOTA1:=SOMA1:=0 MASO=0.01 SAMO=0 PAGINA=1 CONTA=0 PRINT oPrn PREVIEW if Empty( oPrn:hDC ) msginfo("Impressora não esta preparada, verifique !!!","Mensagem de Alerta") return nil endif DEFINE FONT oFont NAME "Arial" SIZE 0, -12 OF oPrn DEFINE FONT oFont1 NAME "Arial" SIZE 0, -09 OF oPrn nRowStep = oPrn:nVertRes() / qtdlinhas nColStep = oPrn:nHorzRes() / qtdcolunas PAGE PAGE:=0 numpagina := 0 numlinha++ nRow += nRowStep STATIC FUNCTION DOFISJ() oPrn:Say(nRow, 000*nColStep, "|",oFont1) oPrn:Say(nRow, 001*nColStep, TAPE,oFont1) oPrn:Say(nRow, 011*nColStep, "|",oFont1) oPrn:Say(nRow, 012*nColStep, COT,oFont1) oPrn:Say(nRow, 016*nColStep, "|",oFont1) oPrn:Say(nRow, 017*nColStep, ALLTRIM(CRECO),oFont1) oPrn:Say(nRow, 020*nColStep, ALLTRIM(CRESU),oFont1) oPrn:Say(nRow, 022*nColStep, "|",oFont1) oPrn:Say(nRow, 024*nColStep, ALLTRIM(DONU),oFont1) oPrn:Say(nRow, 032*nColStep, "|",oFont1) oPrn:Say(nRow, 033*nColStep, DOCTO,oFont1) oPrn:Say(nRow, 043*nColStep, "|",oFont1) oPrn:Say(nRow, 045*nColStep, INSCE,oFont1) oPrn:Say(nRow, 059*nColStep, "|",oFont1) oPrn:Say(nRow, 061*nColStep, TADO ,oFont1) oPrn:Say(nRow, 064*nColStep, "|",oFont1) oPrn:Say(nRow, 066*nColStep, ALLTRIM(TRANSFORM(RALO, "@E 999,999,999.99"),oFont),,39,,,1) oPrn:Say(nRow, 080*nColStep, "|",oFont1) oPrn:Say(nRow, 082*nColStep, " ",oFont1) oPrn:Say(nRow, 086*nColStep, "|",oFont1) oPrn:Say(nRow, 087*nColStep, TODE,oFont1) oPrn:Say(nRow, 093*nColStep, "|",oFont1) RETURN(.T.) Quote Link to comment Share on other sites More sharing options...
Geraldo (gbsilva) Posted February 21, 2012 Report Share Posted February 21, 2012 Onde voce chama a função DOFISJ()? Se quer declarar como local passe na chamda e também coloque na função. Chamada DOFISJ(oPrn) Function DOFISJ(oPrn) Geraldo B. Silva Fwh1112 Novembro/2011, xHarbour 2.0, Bcc582, Pelles, xDev, Sqllib e MySql. lucgera@terra.com.br São Paulo - SP Quote Link to comment Share on other sites More sharing options...
Theotokos Posted February 22, 2012 Report Share Posted February 22, 2012 ou então tente declara-la como PRIVATE Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.