Integração Advpl - GMaps via XML

Rdmake cria xml que pode posicionar dados no Google Maps num html.



*-------------------------------------------------------------------------------------------------


#INCLUDE 'protheus.ch'
#INCLUDE "XMLXFUN.CH"

*-------------------------------------------------------------------
* Retorna  CLiente Posicionado no Google Maps via XML
*-------------------------------------------------------------------
User Function MpsCli()
Local cCliente  := ""//_QryChec_->C9_CLIENTE
Local cLoja   := ""//_QryChec_->C9_LOJA                               
Local cEol2   := "<br>"
Local cError    := ""
Local cWarning  := ""
Local oScript
Local nRet       



dbselectarea("SA1")

cString := '<markers> '
While !Eof()

  If  Alltrim(SA1->A1_MUN) == "LINHARES"  .and. ;
 Alltrim(SA1->A1_BAIRRO) == "INTERLAGOS" //SA1->A1_ULTCOM > dDate

   cCodigo  := SA1->A1_COD+"-"+SA1->A1_LOJA
  cNome  := SA1->A1_NOME
  cLogad  := SA1->A1_END
  cEstMun  := SA1->A1_MUN
  cEstado  := SA1->A1_EST
                                      
 cEnd := "http://maps.google.com/maps/geo?q="+Alltrim(cLogad)+'+'+;
 Alltrim(cEstMun)+'+'+Alltrim(cEstado)+"&output=csv&sensor=true_or_false&key=abcdefg"
   
 cEnd := strtran(cEnd, " ", "%20")
    cLatiLonge := HTTPGET(cEnd)
    cEnd1 := '{'+cLatiLonge+'}'
 aMaps := &cEnd1
 
 cString += '<marker lat="'+cValtoChar(aMaps[3])+'" lng="'+cValToChar(aMaps[4])+'" html="Endereco&lt;br&gt;'
 cString += cLogad+'"'+'  label='+'"'+cNome+'"'+' />'
 Endif
 dbskip()
Enddo 

cString += '</markers> '
                                
dbgotop()
 //Gera o Objeto XML ref. ao script
 oScript := XmlParser( cString, "_", @cError, @cWarning )

   SAVE oScript XMLFILE "c:\maps\example.xml"

DEFINE MSDIALOG oMaps FROM 0,0 TO 850,1000 PIXEL TITLE "Consulta Cliente"
 oTIBrowser:= TIBrowser():New(0,0,850,650,"c:\maps\map3.htm",oMaps )
          oButton:= TButton():New(310,0070,"OK",oMaps,{||oMaps:End(),lContinue := .T.},40,10,,,,.T.)     
          oButton:= TButton():New(310,0150,"Cancela",oMaps,{||oMaps:End(),lContinue :=.F.},40,10,,,,.T.)     
          oButton:= TButton():New(310,0190,"Imprimir",oMaps,{||oTIBrowser:Print(),lContinue :=.F.},40,10,,,,.T.)     
          //@ 20, 160 BUTTON oBtnPrint PROMPT "Imprimir" SIZE 50,10 ACTION oTIBrowser:Print() OF oDlg PIXEL
ACTIVATE MSDIALOG oMaps CENTERED

Return