Jump to content
Fivewin Brasil

tag "exporta" nao cria no xml (RESOLVIDO)


trufelli

Recommended Posts

O problema era no AINS, porque ao usar essa função o último vetor é eliminado, portanto,

precisa ser utilizado o ASIZE ou AADD para incluir um novo vetor no final do array.

Exemplo :

 aArray := { 1, 2, 3 }          // Resulta: aArray  { 1, 2, 3 } 
 AINS(aArray, 2)                // Resulta: aArray { 1, NIL, 2 } 

Alterei o Metodo AddItem

METHOD AddItem( oItem )  CLASS TVoNFe2G
   local cID,  axArray := {},nPos

   If oItem:Classname=="TVONFEPROD"
     cID := 'nItem="'+alltrim(str(len(::axItems)+1) ) +'"'
     aadd(::axItems, {cId,{} }  )
     aadd(::axItems[len(::axItems),2], {"prod"     , ::StruProduto(oItem),  1     }  )
     aadd(::axItems[len(::axItems),2], {"imposto"  , ::StruImpostos(oItem), 1     }  )
      aadd(::axItems[len(::axItems),2], {"infAdProd", TVoNFeItem():New("C", 0, 1,500,,,oItem:infAdProd   )}  )
   ElseIf oItem:ClassName=="TVONFEREFNF"
     nPos:=ascan(::axNodes, {|x| x[1]=="ide" } )
     if nPos!=0
      Do Case
         Case ::nTipoRef==1
            AAdd(::axNodes[nPos,2],{"NFref"  , ::SetRefNfe(oItem) })
         Case ::nTipoRef==2
            AAdd(::axNodes[nPos,2],{"NFref"  , ::SetrefNF(oItem) })
         Case ::nTipoRef==3
            AAdd(::axNodes[nPos,2],{"NFref"  , ::SetrefECF(oItem) })
         Case ::nTipoRef==4
            AAdd(::axNodes[nPos,2],{"NFref"  , ::SetrefNFP(oItem) })
      EndCase
     Endif
   ElseIf oItem:ClassName=="TVONFECOBR"
      //if ::cModeloDoc == "55"
         nPos:=ascan(::axNodes, {|x| x[1]=="cobr" } )
         if nPos==0
            nPos:=ascan(::axNodes, {|x| x[1]=="transp" } )

            ASize(::axNodes, Len( ::axNodes ) + 1 )

            Ains(::axNodes,nPos+1)
            ::axNodes[nPos+1]:={"cobr"  , {},0 }
            nPos:=ascan(::axNodes, {|x| x[1]=="cobr" } )

            if nPos!=0
               aadd(::axNodes[nPos,2], {"fat"  , ::StruFatura(oItem) } )
            Endif

         Endif
         if nPos!=0
                //aadd(::axNodes[nPos,2], {"fat"  , ::StruFatura(oItem) } )
               aadd(::axNodes[nPos,2], {"dup"  , ::StruDuplicata(oItem)  }  )
         Endif
  ElseIf oItem:ClassName=="TVONFEPAG"
         // pag
         nPos:=ascan(::axNodes, {|x| x[1]=="pag" } )
         if nPos==0
            nPos:=ascan(::axNodes, {|x| x[1]=="cobr" } )
            if nPos==0
               nPos:=ascan(::axNodes, {|x| x[1]=="transp" } )
            Endif

            ASize(::axNodes, Len( ::axNodes ) + 1 )

            Ains(::axNodes,nPos+1)
            ::axNodes[nPos+1]:={ "pag", {}, 0 }
            nPos:=ascan(::axNodes, {|x| x[1]=="pag" } )
         Endif
         if nPos!=0
            aadd(::axNodes[nPos,2], {"detPag"  , ::StruDetPag(oItem)  }  )
            aadd(::axNodes[nPos,2], {"vTroco", TVoNFeItem():new("N", 0, 1,15, 02,,oItem:vTroco )  }  )
         Endif
   Endif

Return( Nil )
 

Obrigado a todos.

Link to comment
Share on other sites

Eu fiz isso, mas não deu certo, porque o AIns não tem esse terceiro parâmetro, mas graças a essa dica consegui "enxergar" o problema.

Existe o HB_AIns, esse sim tem 4 parâmetros e um deles é justamente o .T. para incrementar um novo vetor

hb_AIns( <aArray>, [<nPos>], [<xValue>], [<lAutoSize>] ) → aArray

Obrigado

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...