vbParseXML: Interprete per i file XML delle fatture elettroniche per Visual Basic 6.0. .NET e Access

vbParseXML é una classe per Visual Basic 6.0 e .NET, disponibile anche in VBA per Access, che permette di leggere ed acquisire i dati di una fattura elettronica in formato XML secondo le specifiche 1.6.1 dell’Agenzia delle Entrate, senza l’utilizzo di OCX o DLL esterne: solo puro codice Visual Basic.

Funzioni

  • Supporto per file XML e P7M (anche in Base64)
  • Fattura elettronica B2B (verso privati) e B2G (verso pubblica amministrazione)
  • Gestione cassa di previdenza
  • Gestione ritenuta
  • Documenti correlati su testa documento e su riga documento
  • Dati Fatture Collegate su testa documento e su riga documento
  • Riferimento DDT su testa documento e su riga documento
  • Sconti e maggiorazioni su totali documento e su totali di riga
  • Gestione terzo emittente
  • Dati REA del cedente per soggetti iscritti
  • Dati di trasporto
  • Dati pagamento
  • Cattura dei dati in classi

Screenshot

Ecco alcune schermate del progetto di esempio:

Come ottenere il codice sorgente

Il codice sorgente della libreria vbParseXML è in fase di sviluppo e di test per essere sempre in linea con gli aggiornamenti delle specifiche.

Se ti interessa questa versione o il codice adattato per VBA Access, contattami.

Download demo

Icona

vbParseXML 0.00 KB 979 downloads

...

Esempio di utilizzo

'' Visual Basic 6.0

  Dim ObjMult As Object

   Dim Obj As vbParseXML
   
   txtReport.Text = ""
   
   Set Obj = New vbParseXML
   If (Obj.Initialize(__FILEXML__)) Then
   
     txtReport.Text = txtReport.Text & "[Cedente]" & vbCrLf
     With Obj.Cedente
      txtReport.Text = txtReport.Text & "  Paese - ID Codice: " & .IdPaese & .IdCodice & vbCrLf
      txtReport.Text = txtReport.Text & "  Codice fiscale: " & .CodiceFiscale & vbCrLf
      If (.Denominazione <> "") Then
        txtReport.Text = txtReport.Text & "  Denominazione: " & .Denominazione & vbCrLf
      Else
        txtReport.Text = txtReport.Text & "  Cognome: " & .Cognome & vbCrLf
        txtReport.Text = txtReport.Text & "  Nome: " & .Nome & vbCrLf
      End If
      
      txtReport.Text = txtReport.Text & "  Indirizzo: " & .Indirizzo & " " & .NumeroCivico & vbCrLf
      txtReport.Text = txtReport.Text & "  Comune: " & .CAP & " " & .Comune & " (" & .Provincia & ")" & vbCrLf
      txtReport.Text = txtReport.Text & vbCrLf
     End With
     
     txtReport.Text = txtReport.Text & "[Dati trasmissione]" & vbCrLf
     With Obj.DatiTrasmissione
      txtReport.Text = txtReport.Text & "  Paese - ID Codice: " & .IdPaese & .IdCodice & vbCrLf
      txtReport.Text = txtReport.Text & "  Progressivo invio: " & .ProgressivoInvio & vbCrLf
      txtReport.Text = txtReport.Text & "  Formato trasmissione: " & .FormatoTrasmissione & vbCrLf
      txtReport.Text = txtReport.Text & "  Codice destinatario: " & .CodiceDestinatario & vbCrLf
      txtReport.Text = txtReport.Text & "  PEC: " & .PECDestinatario & vbCrLf
      
      txtReport.Text = txtReport.Text & "  Telefono: " & .Telefono & vbCrLf
      txtReport.Text = txtReport.Text & "  Email: " & .Email & vbCrLf
      txtReport.Text = txtReport.Text & vbCrLf
     End With
     
     txtReport.Text = txtReport.Text & "[Cessionario]" & vbCrLf
     With Obj.Cessionario
      txtReport.Text = txtReport.Text & "  Paese - ID Codice: " & .IdPaese & .IdCodice & vbCrLf
      txtReport.Text = txtReport.Text & "  Codice fiscale: " & .CodiceFiscale & vbCrLf
      If (.Denominazione <> "") Then
        txtReport.Text = txtReport.Text & "  Denominazione: " & .Denominazione & vbCrLf
      Else
        txtReport.Text = txtReport.Text & "  Cognome: " & .Cognome & vbCrLf
        txtReport.Text = txtReport.Text & "  Nome: " & .Nome & vbCrLf
      End If
      
      txtReport.Text = txtReport.Text & "  Indirizzo: " & .Indirizzo & " " & .NumeroCivico & vbCrLf
      txtReport.Text = txtReport.Text & "  Comune: " & .CAP & " " & .Comune & " (" & .Provincia & ")" & vbCrLf
      txtReport.Text = txtReport.Text & "  Nazione: " & .Nazione & vbCrLf
      txtReport.Text = txtReport.Text & vbCrLf
     End With
     
     txtReport.Text = txtReport.Text & "[Terzo emittente]" & vbCrLf
     With Obj.TerzoEmittente
      txtReport.Text = txtReport.Text & "  Paese - ID Codice: " & .IdPaese & .IdCodice & vbCrLf
      txtReport.Text = txtReport.Text & "  Codice fiscale: " & .CodiceFiscale & vbCrLf
      If (.Denominazione <> "") Then
        txtReport.Text = txtReport.Text & "  Denominazione: " & .Denominazione & vbCrLf
      Else
        txtReport.Text = txtReport.Text & "  Cognome: " & .Cognome & vbCrLf
        txtReport.Text = txtReport.Text & "  Nome: " & .Nome & vbCrLf
      End If
      txtReport.Text = txtReport.Text & vbCrLf
     End With

     txtReport.Text = txtReport.Text & "[Dati generali]" & vbCrLf
     With Obj.DatiGenerali
      txtReport.Text = txtReport.Text & "  Tipo documento: " & .TipoDocumento & vbCrLf
      txtReport.Text = txtReport.Text & "  Divisa: " & .Divisa & vbCrLf
      txtReport.Text = txtReport.Text & "  Data: " & .Data & vbCrLf
      txtReport.Text = txtReport.Text & "  Numero: " & .Numero & vbCrLf
      
      If (.Bollo <> 0) Then
        txtReport.Text = txtReport.Text & "  Bollo Virtuale: " & .BolloVirtuale & vbCrLf
        If (.ImportoBollo <> 0) Then
          txtReport.Text = txtReport.Text & "  Importo Bollo: " & Format(.ImportoBollo, "0.00") & vbCrLf
        End If
      End If
      
      If (.DatiRitenuta.Count > 0) Then
       txtReport.Text = txtReport.Text & "  Dati Ritenute" & vbCrLf
       For Each ObjMult In .DatiRitenuta
          If (ObjMult.TipoRitenuta <> "") Then
            txtReport.Text = txtReport.Text & "    Tipo Ritenuta: " & ObjMult.TipoRitenuta & vbCrLf
            txtReport.Text = txtReport.Text & "    Importo Ritenuta: " & Format(ObjMult.ImportoRitenuta, "0.00") & vbCrLf
            txtReport.Text = txtReport.Text & "    Aliquota Ritenuta: " & Format(ObjMult.AliquotaRitenuta, "0.00") & vbCrLf
            txtReport.Text = txtReport.Text & "    Causale Pagamento: " & ObjMult.CausalePagamento & vbCrLf
          End If
       Next
      End If
            
      
      If (.DatiCassaPrevidenziale.Count > 0) Then
       txtReport.Text = txtReport.Text & "  Dati Cassa Previdenziale" & vbCrLf
       For Each ObjMult In .DatiCassaPrevidenziale
        txtReport.Text = txtReport.Text & "    Tipo cassa: " & ObjMult.TipoCassa & vbCrLf
        txtReport.Text = txtReport.Text & "    Aliquota Cassa: " & Format(ObjMult.AlCassa, "0.00") & vbCrLf
        txtReport.Text = txtReport.Text & "    Importo Cassa: " & Format(ObjMult.ImportoContributoCassa, "0.00") & vbCrLf
        txtReport.Text = txtReport.Text & "    Imponibile Cassa: " & Format(ObjMult.ImponibileCassa, "0.00") & vbCrLf
        txtReport.Text = txtReport.Text & "    Aliquota IVA: " & Format(ObjMult.AliquotaIVA, "0.00") & vbCrLf
        txtReport.Text = txtReport.Text & "    Ritenuta: " & ObjMult.Ritenuta & vbCrLf
        txtReport.Text = txtReport.Text & "    Natura: " & ObjMult.Natura & vbCrLf
        txtReport.Text = txtReport.Text & "    Riferimento Amministrazione: " & ObjMult.RiferimentoAmministrazione & vbCrLf
       Next
      End If
      
      If (.ScontoMaggiorazione.Count > 0) Then
       txtReport.Text = txtReport.Text & "  Sconto/Maggiorazione" & vbCrLf
       For Each ObjMult In .ScontoMaggiorazione
        txtReport.Text = txtReport.Text & "    Tipo: " & ObjMult.Tipo & vbCrLf
        txtReport.Text = txtReport.Text & "    Percentuale: " & Format(ObjMult.Percentuale, "0.00") & vbCrLf
        txtReport.Text = txtReport.Text & "    Importo: " & Format(ObjMult.Importo, "0.00") & vbCrLf
       Next
      End If
      
      txtReport.Text = txtReport.Text & "  Importo totale: " & Format(.ImportoTotaleDocumento, "0.00") & vbCrLf
      txtReport.Text = txtReport.Text & "  Arrotondamento: " & Format(.Arrotondamento, "0.00") & vbCrLf
      txtReport.Text = txtReport.Text & "  Causale: " & .Causale & vbCrLf
      
      txtReport.Text = txtReport.Text & "  Art. 73: " & .Art73 & vbCrLf

      
      txtReport.Text = txtReport.Text & vbCrLf
     End With
     
    
     
     If (Obj.DatiOrdineAcquisto.Count > 0) Then
      txtReport.Text = txtReport.Text & "[Ordine di acquisto]" & vbCrLf
      For Each ObjMult In Obj.DatiOrdineAcquisto
        With ObjMult
         txtReport.Text = txtReport.Text & "  Riferimento num. linea: " & .RiferimentoNumeroLinea & vbCrLf
         txtReport.Text = txtReport.Text & "  IdDocumento: " & .IdDocumento & vbCrLf
         txtReport.Text = txtReport.Text & "  Data: " & .Data & vbCrLf
         txtReport.Text = txtReport.Text & "  NumItem: " & .NumItem & vbCrLf
         txtReport.Text = txtReport.Text & "  Codice commessa: " & .CodiceCommessaConvenzione & vbCrLf
         txtReport.Text = txtReport.Text & "  CUP: " & .CodiceCUP & vbCrLf
         txtReport.Text = txtReport.Text & "  CIG: " & .CodiceCIG & vbCrLf
         txtReport.Text = txtReport.Text & vbCrLf
        End With
      Next
     End If
     
     If (Obj.DatiContratto.Count > 0) Then
      txtReport.Text = txtReport.Text & "[Dati Contratto]" & vbCrLf
      For Each ObjMult In Obj.DatiContratto
        With ObjMult
         txtReport.Text = txtReport.Text & "  Riferimento num. linea: " & .RiferimentoNumeroLinea & vbCrLf
         txtReport.Text = txtReport.Text & "  IdDocumento: " & .IdDocumento & vbCrLf
         txtReport.Text = txtReport.Text & "  Data: " & .Data & vbCrLf
         txtReport.Text = txtReport.Text & "  NumItem: " & .NumItem & vbCrLf
         txtReport.Text = txtReport.Text & "  Codice commessa: " & .CodiceCommessaConvenzione & vbCrLf
         txtReport.Text = txtReport.Text & "  CUP: " & .CodiceCUP & vbCrLf
         txtReport.Text = txtReport.Text & "  CIG: " & .CodiceCIG & vbCrLf
         txtReport.Text = txtReport.Text & vbCrLf
        End With
      Next
     End If
     
     If (Obj.DatiConvenzione.Count > 0) Then
      txtReport.Text = txtReport.Text & "[Dati Convenzione]" & vbCrLf
      For Each ObjMult In Obj.DatiConvenzione
        With ObjMult
         txtReport.Text = txtReport.Text & "  Riferimento num. linea: " & .RiferimentoNumeroLinea & vbCrLf
         txtReport.Text = txtReport.Text & "  IdDocumento: " & .IdDocumento & vbCrLf
         txtReport.Text = txtReport.Text & "  Data: " & .Data & vbCrLf
         txtReport.Text = txtReport.Text & "  NumItem: " & .NumItem & vbCrLf
         txtReport.Text = txtReport.Text & "  Codice commessa: " & .CodiceCommessaConvenzione & vbCrLf
         txtReport.Text = txtReport.Text & "  CUP: " & .CodiceCUP & vbCrLf
         txtReport.Text = txtReport.Text & "  CIG: " & .CodiceCIG & vbCrLf
         txtReport.Text = txtReport.Text & vbCrLf
        End With
      Next
     End If
     
     If (Obj.DatiRicezione.Count > 0) Then
      txtReport.Text = txtReport.Text & "[Dati Ricezione]" & vbCrLf
      For Each ObjMult In Obj.DatiRicezione
        With ObjMult
         txtReport.Text = txtReport.Text & "  Riferimento num. linea: " & .RiferimentoNumeroLinea & vbCrLf
         txtReport.Text = txtReport.Text & "  IdDocumento: " & .IdDocumento & vbCrLf
         txtReport.Text = txtReport.Text & "  Data: " & .Data & vbCrLf
         txtReport.Text = txtReport.Text & "  NumItem: " & .NumItem & vbCrLf
         txtReport.Text = txtReport.Text & "  Codice commessa: " & .CodiceCommessaConvenzione & vbCrLf
         txtReport.Text = txtReport.Text & "  CUP: " & .CodiceCUP & vbCrLf
         txtReport.Text = txtReport.Text & "  CIG: " & .CodiceCIG & vbCrLf
         txtReport.Text = txtReport.Text & vbCrLf
        End With
      Next
     End If
     
     If (Obj.DatiFattureCollegate.Count > 0) Then
      txtReport.Text = txtReport.Text & "[Dati Fatture Collegate]" & vbCrLf
      For Each ObjMult In Obj.DatiFattureCollegate
        With ObjMult
         txtReport.Text = txtReport.Text & "  Riferimento num. linea: " & .RiferimentoNumeroLinea & vbCrLf
         txtReport.Text = txtReport.Text & "  IdDocumento: " & .IdDocumento & vbCrLf
         txtReport.Text = txtReport.Text & "  Data: " & .Data & vbCrLf
         txtReport.Text = txtReport.Text & "  NumItem: " & .NumItem & vbCrLf
         txtReport.Text = txtReport.Text & "  Codice commessa: " & .CodiceCommessaConvenzione & vbCrLf
         txtReport.Text = txtReport.Text & "  CUP: " & .CodiceCUP & vbCrLf
         txtReport.Text = txtReport.Text & "  CIG: " & .CodiceCIG & vbCrLf
         txtReport.Text = txtReport.Text & vbCrLf
        End With
      Next
     End If
     
     If (Obj.DatiDDT.Count > 0) Then
      txtReport.Text = txtReport.Text & "[Dati DDT]" & vbCrLf
      For Each ObjMult In Obj.DatiDDT
        With ObjMult
         txtReport.Text = txtReport.Text & "  Riferimento num. linea: " & .RiferimentoNumeroLinea & vbCrLf
         txtReport.Text = txtReport.Text & "  Numero: " & .NumeroDDT & vbCrLf
         txtReport.Text = txtReport.Text & "  Data: " & .DataDDT & vbCrLf
         txtReport.Text = txtReport.Text & vbCrLf
        End With
      Next
     End If
     
     If (Obj.DettaglioLinee.Count > 0) Then
      txtReport.Text = txtReport.Text & "[Dettaglio linee]" & vbCrLf
      Dim Linea As vbXML_DettaglioLinee
      For Each Linea In Obj.DettaglioLinee
        With Linea
         txtReport.Text = txtReport.Text & "  Linea : " & CStr(.NumeroLinea) & vbCrLf
         If (.TipoCessionePrestazione <> "") Then
          txtReport.Text = txtReport.Text & "  TipoCessionePrestazione: " & .TipoCessionePrestazione & vbCrLf
         End If
         txtReport.Text = txtReport.Text & "  Descrizione: " & .Descrizione & vbCrLf
         If (.Quantita <> 0) Then
          txtReport.Text = txtReport.Text & "  Quantità: " & .Quantita & vbCrLf
         End If
         If (.UnitaMisura <> "") Then
          txtReport.Text = txtReport.Text & "  UM: " & .UnitaMisura & vbCrLf
         End If
         txtReport.Text = txtReport.Text & "  PrezzoUnitario: " & Format(.PrezzoUnitario, "0.00") & vbCrLf
         
          If (.ScontoMaggiorazione.Count > 0) Then
           txtReport.Text = txtReport.Text & "  Sconto/Maggiorazione" & vbCrLf
           For Each ObjMult In .ScontoMaggiorazione
            txtReport.Text = txtReport.Text & "    Tipo: " & ObjMult.Tipo & vbCrLf
            txtReport.Text = txtReport.Text & "    Percentuale: " & Format(ObjMult.Percentuale, "0.00") & vbCrLf
            txtReport.Text = txtReport.Text & "    Importo: " & Format(ObjMult.Importo, "0.00") & vbCrLf
           Next
          End If
         
         txtReport.Text = txtReport.Text & "  PrezzoTotale: " & Format(.PrezzoTotale, "0.00") & vbCrLf
         txtReport.Text = txtReport.Text & "  Aliquota: " & Format(.AliquotaIVA, "0.00") & vbCrLf
         txtReport.Text = txtReport.Text & "  Ritenuta: " & .Ritenuta & vbCrLf
         If (.AliquotaIVA = 0) Then
          txtReport.Text = txtReport.Text & "  Natura: " & .Natura & vbCrLf
         End If
         txtReport.Text = txtReport.Text & vbCrLf
        End With
      Next
    End If
     
    If (Obj.DatiRiepilogo.Count > 0) Then
      txtReport.Text = txtReport.Text & "[DatiRiepilogo]" & vbCrLf
      Dim LineaIva As vbXML_DatiRiepilogo
      For Each LineaIva In Obj.DatiRiepilogo
        With LineaIva
         txtReport.Text = txtReport.Text & "  Aliquota: " & Format(.AliquotaIVA, "0.00") & vbCrLf
         If (.AliquotaIVA = 0) Then
          txtReport.Text = txtReport.Text & "  Natura: " & .Natura & vbCrLf
         End If
         txtReport.Text = txtReport.Text & "  Spese accessorie: " & Format(.SpeseAccessorie, "0.00") & vbCrLf
         txtReport.Text = txtReport.Text & "  Arrotondamento: " & Format(.Arrotondamento, "0.00") & vbCrLf
         txtReport.Text = txtReport.Text & "  Imponibile: " & Format(.ImponibileImporto, "0.00") & vbCrLf
         txtReport.Text = txtReport.Text & "  Imposta: " & Format(.Imposta, "0.00") & vbCrLf
         txtReport.Text = txtReport.Text & "  Esigibilità IVA: " & .EsigibilitaIVA & vbCrLf
         If (.RiferimentoNormativo <> "") Then
          txtReport.Text = txtReport.Text & "  Riferimento Normativo: " & .RiferimentoNormativo & vbCrLf
         End If
         txtReport.Text = txtReport.Text & vbCrLf
        End With
      Next
    End If
     
     
    If (Obj.DettaglioPagamento.Count > 0) Then
      txtReport.Text = txtReport.Text & "[Dettaglio Pagamento]" & vbCrLf
      
      txtReport.Text = txtReport.Text & "  Condizioni di pagamento: " & Obj.CondizioniPagamento & vbCrLf
      For Each ObjMult In Obj.DettaglioPagamento
        With ObjMult
         txtReport.Text = txtReport.Text & "  Beneficiario: " & .Beneficiario & vbCrLf
         txtReport.Text = txtReport.Text & "  Modalita Pagamento: " & .ModalitaPagamento & vbCrLf
         txtReport.Text = txtReport.Text & "  Data Riferimento Termini Pagamento: " & .DataRiferimentoTerminiPagamento & vbCrLf
         txtReport.Text = txtReport.Text & "  Giorni Termini Pagamento: " & .GiorniTerminiPagamento & vbCrLf
         txtReport.Text = txtReport.Text & "  Data Scadenza Pagamento: " & .DataScadenzaPagamento & vbCrLf
         txtReport.Text = txtReport.Text & "  Importo Pagamento: " & Format(.ImportoPagamento, "0.00") & vbCrLf
         txtReport.Text = txtReport.Text & "  Cod Ufficio Postale: " & .CodUfficioPostale & vbCrLf
         txtReport.Text = txtReport.Text & "  Cognome Quietanzante: " & .CognomeQuietanzante & vbCrLf
         txtReport.Text = txtReport.Text & "  Nome Quietanzante: " & .NomeQuietanzante & vbCrLf
         txtReport.Text = txtReport.Text & "  CF Quietanzante: " & .CFQuietanzante & vbCrLf
         txtReport.Text = txtReport.Text & "  Titolo Quietanzante: " & .TitoloQuietanzante & vbCrLf
         txtReport.Text = txtReport.Text & "  Istituto Finanziario: " & .IstitutoFinanziario & vbCrLf
         txtReport.Text = txtReport.Text & "  IBAN: " & .IBAN & vbCrLf
         txtReport.Text = txtReport.Text & "  ABI: " & .ABI & vbCrLf
         txtReport.Text = txtReport.Text & "  CAB: " & .CAB & vbCrLf
         txtReport.Text = txtReport.Text & "  BIC: " & .BIC & vbCrLf
         txtReport.Text = txtReport.Text & "  Sconto Pagamento Anticipato: " & Format(.ScontoPagamentoAnticipato, "0.00") & vbCrLf
         txtReport.Text = txtReport.Text & "  Data Limite Pagamento Anticipato: " & .DataLimitePagamentoAnticipato & vbCrLf
         txtReport.Text = txtReport.Text & "  Penalita Pagamenti Ritardati: " & Format(.PenalitaPagamentiRitardati, "0.00") & vbCrLf
         txtReport.Text = txtReport.Text & "  Data Decorrenza Penale: " & .DataDecorrenzaPenale & vbCrLf
         txtReport.Text = txtReport.Text & "  Codice Pagamento: " & .CodicePagamento & vbCrLf
         txtReport.Text = txtReport.Text & vbCrLf
        End With
      Next
     End If
     
    
   Else
    MsgBox "Impossibile completare la decodifica del file XML"
   End If

Riferimenti utili