× Linguagem de Programação ADVPL

Perguntas URL Nota Fiscal

Mais
9 anos 8 meses atrás #25189 por rafaelamaral
URL Nota Fiscal foi criado por rafaelamaral
Prezados, Bom dia !

Estou desenvolvendo uma rotina para abertura de uma pagina HTML com a função TIBROWSER, encontrei uma e preciso custmoizar para criar um tipo de recordset para abrir e navegar nas notas fiscais de serviço da prefeitura....consegui em partes mas preciso ajustar muita coisa alguem poderia me dar uma dica ?? segue o fonte

#include "protheus.ch"
User Function U_Navegador()// A função deve ser chamada com o U_, pois se trata de uma User Function.

dbSelectArea("SF2") //abre a tabela de Cabecalho de Notas de Saida da empresa correspondente
dbsetorder(1) //Define o indice utilizado na ordenção
cQuery := "select top 50 F2_DOC, F2_EMINFE, F2_CODNFE, F2_NFELETR from SF2010 where F2_SERIE ='RPS' and F2_CODNFE <> ''"
cQuery := cQuery + " WHERE SF2_FILIAL = '" + xFilial("SF2") + "'"
cQuery := cQuery + " AND D_E_L_E_T_ = ' ' "
cQuery := cQuery + " ORDER BY F2_NFELETRO,"
cQuery := ChangeQuery(cQuery)

cRes := FIELD ->F2_DOC
Private aPages := {}
Private nPgVist := -1

Private aSize := MsAdvSize()
Private oDlg1, oTIBrw
Private cNavegado := Space(80)
Private lcont := .T.

DEFINE MSDIALOG oDlg1 TITLE "Consulta NFE" From aSize[7],0 to aSize[6],aSize[5] of oMainWnd PIXEL

cNavegado := " nfe.prefeitura.sp.gov.br/nfe.aspx?ccm=XX...=XXXXXX&cod=BJ7P2MAV "
oNav:= TGet():New(10,10,{|u| if(PCount()>0,cNavegado:=u,cNavegado)}, oDlg1,340,5,,,,,,,,.T.,,,,,,,,,,)

@ 010, 350 Button oBtnIr PROMPT "Ir" Size 40,10 Action(Processa({||Navegar()},"Abrindo","Aguarde...")) Of oDlg1 Pixel
@ 010, 390 Button oBtnImp PROMPT "Imprimir" Size 40,10 Action oTIBrw:Print() Of oDlg1 Pixel



@ 010, 430 Button oBtnAnte PROMPT "Anterior" Size 40,10 Action (Retorna()) Of oDlg1 Pixel
@ 010, 470 Button oBtnDep PROMPT "Avançar" Size 40,10 Action(Avanca()) Of oDlg1 Pixel
@ 010, 510 Button oBtnSair PROMPT "Sair" Size 40,10 Action(Sair()) Of oDlg1 Pixel



oTIBrw:= TIBrowser():New( 025,010,aSize[5]-640, 270, " nfe.prefeitura.sp.gov.br ", oDlg1 )

aaDD(aPages," nfe.prefeitura.sp.gov.br ")

oNav:bLostFocus := { || Valido()}


Activate MsDialog oDlg1 Centered

Return

Static Function Valido()

Ir()

Return .T.



Static Function U_Navegador()

Ir()

Return


Static Function Ir()

oTIBrw:Navigate(AllTrim(cNavegado),oDlg1)
aaDD(aPages,AllTrim(cNavegado))
nPgVist := Len(aPages)

Return



Static Function Avanca()

if(Len(aPages) > nPgVist .and. Len(aPages) > 1 )
nPgVist++
oTIBrw:Navigate(aPages[nPgVist],oDlg1)
cNavegado := aPages[nPgVist]
oNav:Refresh()
EndIf

Return

Static Function Retorna()
if(nPgVist>1)
nPgVist--
oTIBrw:Navigate(aPages[nPgVist],oDlg1)
cNavegado := aPages[nPgVist]
oNav:Refresh()
EndIf

Return



Static Function Sair()
oDlg1:End()
Return

Por favor Acessar ou Registrar para participar da conversa.

Tempo para a criação da página:0.096 segundos
Joomla templates by a4joomla