Ir para conteúdo
Fórum Script Brasil

luisveber

Membros
  • Total de itens

    1
  • Registro em

  • Última visita

Posts postados por luisveber

  1. Bom dia pessoal,

    Estou com uma dúvida, tenho um código que importa os dados de um arquivo xml de uma nota fiscal, porém não estou conseguindo importar a tag "dup" do arquivo xml quando existem mais de uma parcela a ser paga, quando importo para um datagrid eu consigo, porém preciso que estas informações sejam importadas para um textbox assim como as demais informações.

    Segue código:


    Public Sub PRealizaLeituraXML()
         OpenFileDialog1.ShowDialog()
         Dim diretorio = OpenFileDialog1.FileName

         Dim docXML As New XmlDocument
         docXML.Load(diretorio)

         Dim strRetorno As String = "",
             noPai As XmlElement,
             noFilho As XmlElement,
             noNeto As XmlElement,
             noBisneto As XmlElement,
             noTetra As XmlElement,
             nodelist As XmlNodeList = docXML.DocumentElement.ChildNodes
         If Len(docXML.OuterXml) > 0 Then
             For Each noPai In nodelist 'Le os nós principais da NFe
                 If noPai.Name = "NFe" Then
                     For Each noFilho In noPai 'Lê os Nós secundários
                         If noFilho.Name = "infNFe" Then 'Se for o cabecalho da NFe
                             For Each noNeto In noFilho 'Lê as Tags da NFe
                                 If noNeto.Name = "ide" Then 'Verifica a identificação da NFe                                
                                     For Each noBisneto In noNeto 'Verifica os valores da NFe
                                         txtData.Text = noNeto.ChildNodes.Item(7).InnerText
                                         txtDocumento.Text = noNeto.ChildNodes.Item(6).InnerText
                                     Next
                                 ElseIf noNeto.Name = "emit" Then 'Dados do Emitente da NFe                                
                                     For Each noBisneto In noNeto
                                         txtfornec.Text = noNeto.ChildNodes.Item(1).InnerText
                                         If noBisneto.Name = "enderEmit" Then 'Dados do Endereço do emitente
                                             For Each noTetra In noBisneto
                                             Next
                                         Else
                                         End If
                                     Next
                                 ElseIf noNeto.Name = "dest" Then 'Dados do Destinatário                                
                                     For Each noBisneto In noNeto
                                         If noBisneto.Name = "enderDest" Then 'Dados do Endereço do emitente
                                             For Each noTetra In noBisneto
                                             Next
                                         Else
                                         End If
                                     Next
                                 ElseIf noNeto.Name = "transp" Then 'Dados da Transportadora
                                     For Each noBisneto In noNeto
                                         If noBisneto.Name = "transporta" Then
                                             For Each noTetra In noBisneto
                                             Next
                                         End If
                                         If noBisneto.Name = "veicTransp" Then
                                             For Each noTetra In noBisneto
                                             Next
                                         End If
                                         If noBisneto.Name = "vol" Then
                                             For Each noTetra In noBisneto
                                             Next
                                         End If
                                     Next
                                 ElseIf noNeto.Name = "infAdic" Then 'Dados do Destinatário                                
                                     For Each noBisneto In noNeto
                                         If noBisneto.Name = "obsCont" Then 'Dados do Endereço do emitente
                                             For Each noTetra In noBisneto
                                             Next
                                         Else
                                         End If
                                     Next
                                 ElseIf noNeto.Name = "cobr" Then 'Dados do Destinatário                                
                                     For Each noBisneto In noNeto
                                         If noBisneto.Name = "fat" Then 'Dados da fatura
                                             For Each noTetra In noBisneto
                                             Next
                                         End If
                                         If noBisneto.Name = "dup" Then 'Dados da duplicata
                                             For Each noTetra In noBisneto
                                             Next
                                         End If
                                     Next
                                 ElseIf noNeto.Name = "total" Then
                                     For Each noBisneto In noNeto
                                         If noBisneto.Name = "ICMSTot" Then
                                             For Each noTetra In noBisneto
                                                 txtValor.Text = noBisneto.ChildNodes.Item(17).InnerText
                                             Next
                                         End If
                                     Next
                                 ElseIf noNeto.Name = "entrega" Then 'Dados da Entrega
                                     For Each noBisneto In noNeto
                                     Next
                                 ElseIf noNeto.Name = "det" Then 'Verifica os detalhes dos produtos
                                     For Each noBisneto In noNeto
                                         If noBisneto.Name = "prod" Then 'Dados dos Produtos
                                             For Each noTetra In noBisneto
                                             Next
                                         End If
                                         If noBisneto.Name = "ICMS" Then 'Dados do ICMS
                                             For Each noTetra In noBisneto
                                             Next
                                         End If
                                     Next
                                 End If
                             Next
                         End If
                     Next
                 End If
             Next
         End If
    End Sub
    [/CODE]
×
×
  • Criar Novo...