Italian E-Invoice XML import / export

#1

Hi, is there anybody in the community that is familiar with the management of the Italian electronic invoices ? In the project that I would like to start, I need to:

-) import the Italian standard xml e-invoices files received from the National Exchange System (via API or scheduled SFTP), parse the content and save the information in my database;

-) issue new sales invoices, save the data, create the Italian standard xml files and send files via API to one of the several private hub available in the market (that will take care of the final delivery to the National Exchange System).

I don’t know if it is possible in Wappler to add some external code, but in GitHub there is a PHP package available for the whole e-invoice management (click here)

Any advice about what I should do to achieve this goal is very much appreciated. Thanks

#2

I have to start with an admission, i have never used this functionality in Wappler however Server Connect does have the capability to import and export XML (see Data Management options) so I assume you could import the invoice then write the data to a database all within server connect. Without knowing the xml file structure/ content it is difficult to the definitive.

1 Like
#3

This is an example of an XML file. It is also available an official document with the technical specification in English (231 pages long :joy:). I have tried, with the help of the tutorials, the import / export of xml file in Server Connect but I could not manage the complexity of this file structure.

Now, this is the situation. If I want to develop my project in Wappler I must solve this issue. Given for granted that for this specific feature is needed a skilled PHP developer, I was wondering if someone in the community (maybe some #Italian member) has already worked on the Italian e-invoice and/or is willing to face the challenge and give me some help (also on a consultancy base).

The way we could do this are basically two: start from scratch and implement all the rules and controls in Wappler or save time and use the PHP code that Italian developers made available in GitHub for all the people interested in e-invoicing. In order to not reinvent the wheel, my question is: is it possible to add some PHP code in Wappler for specific functions like the one I want to build ?

But before even thinking about the approach to adopt, I need to find at least one skilled expert that is willing to work with me on this issue. Thanks.

ITALIAN E-INVOICE XML FILE (EXAMPLE)

<?xml version="1.0" encoding="UTF-8"?>
<p:FatturaElettronica versione="FPR12" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" 
xmlns:p="http://ivaservizi.agenziaentrate.gov.it/docs/xsd/fatture/v1.2" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://ivaservizi.agenziaentrate.gov.it/docs/xsd/fatture/v1.2 http://www.fatturapa.gov.it/export/fatturazione/sdi/fatturapa/v1.2/Schema_del_file_xml_FatturaPA_versione_1.2.xsd">
  <FatturaElettronicaHeader>
    <DatiTrasmissione>
      <IdTrasmittente>
        <IdPaese>IT</IdPaese>
        <IdCodice>01234567890</IdCodice>
      </IdTrasmittente>
      <ProgressivoInvio>00001</ProgressivoInvio>
      <FormatoTrasmissione>FPR12</FormatoTrasmissione>
      <CodiceDestinatario>ABC1234</CodiceDestinatario>
      <ContattiTrasmittente/>
    </DatiTrasmissione>
    <CedentePrestatore>
      <DatiAnagrafici>
        <IdFiscaleIVA>
          <IdPaese>IT</IdPaese>
          <IdCodice>01234567890</IdCodice>
        </IdFiscaleIVA>
        <Anagrafica>
          <Denominazione>SOCIETA' ALPHA SRL</Denominazione>
        </Anagrafica>
        <RegimeFiscale>RF19</RegimeFiscale>
      </DatiAnagrafici>
      <Sede>
        <Indirizzo>VIALE ROMA 543</Indirizzo>
        <CAP>07100</CAP>
        <Comune>SASSARI</Comune>
        <Provincia>SS</Provincia>
        <Nazione>IT</Nazione>
      </Sede>
    </CedentePrestatore>
    <CessionarioCommittente>
      <DatiAnagrafici>
        <CodiceFiscale>09876543210</CodiceFiscale>
        <Anagrafica>
          <Denominazione>DITTA BETA</Denominazione>
        </Anagrafica>
      </DatiAnagrafici>
      <Sede>
        <Indirizzo>VIA TORINO 38-B</Indirizzo>
        <CAP>00145</CAP>
        <Comune>ROMA</Comune>
        <Provincia>RM</Provincia>
        <Nazione>IT</Nazione>
      </Sede>
    </CessionarioCommittente>
  </FatturaElettronicaHeader>
  <FatturaElettronicaBody>
    <DatiGenerali>
      <DatiGeneraliDocumento>
        <TipoDocumento>TD01</TipoDocumento>
        <Divisa>EUR</Divisa>
        <Data>2014-12-18</Data>
        <Numero>123</Numero>
        <Causale>LA FATTURA FA RIFERIMENTO AD UNA OPERAZIONE AAAA BBBBBBBBBBBBBBBBBB CCC DDDDDDDDDDDDDDD E FFFFFFFFFFFFFFFFFFFF GGGGGGGGGG HHHHHHH II LLLLLLLLLLLLLLLLL MMM NNNNN OO PPPPPPPPPPP QQQQ RRRR SSSSSSSSSSSSSS</Causale>
        <Causale>SEGUE DESCRIZIONE CAUSALE NEL CASO IN CUI NON SIANO STATI SUFFICIENTI 200 CARATTERI AAAAAAAAAAA BBBBBBBBBBBBBBBBB</Causale>
      </DatiGeneraliDocumento>
      <DatiOrdineAcquisto>
        <RiferimentoNumeroLinea>1</RiferimentoNumeroLinea>
        <IdDocumento>66685</IdDocumento>
        <NumItem>1</NumItem>
      </DatiOrdineAcquisto>
      <DatiContratto>
	    <RiferimentoNumeroLinea>1</RiferimentoNumeroLinea>
	    <IdDocumento>123</IdDocumento>
	    <Data>2012-09-01</Data>
	    <NumItem>5</NumItem>
	    <CodiceCUP>123abc</CodiceCUP>
	    <CodiceCIG>456def</CodiceCIG>
      </DatiContratto>
      <DatiTrasporto>
	    <DatiAnagraficiVettore>				
	      <IdFiscaleIVA>
	        <IdPaese>IT</IdPaese>
	        <IdCodice>24681012141</IdCodice>
	      </IdFiscaleIVA>
    	  <Anagrafica>
	        <Denominazione>Trasporto spa</Denominazione>
	      </Anagrafica>
	    </DatiAnagraficiVettore>
	    <DataOraConsegna>2012-10-22T16:46:12.000+02:00</DataOraConsegna>
      </DatiTrasporto>
    </DatiGenerali>
    <DatiBeniServizi>
      <DettaglioLinee>
        <NumeroLinea>1</NumeroLinea>
        <Descrizione>DESCRIZIONE DELLA FORNITURA</Descrizione>
        <Quantita>5.00</Quantita>
        <PrezzoUnitario>1.00</PrezzoUnitario>
        <PrezzoTotale>5.00</PrezzoTotale>
        <AliquotaIVA>22.00</AliquotaIVA>
      </DettaglioLinee>
      <DatiRiepilogo>
        <AliquotaIVA>22.00</AliquotaIVA>
        <ImponibileImporto>5.00</ImponibileImporto>
        <Imposta>1.10</Imposta>
        <EsigibilitaIVA>I</EsigibilitaIVA>
      </DatiRiepilogo>
    </DatiBeniServizi>
    <DatiPagamento>
      <CondizioniPagamento>TP01</CondizioniPagamento>
      <DettaglioPagamento>
        <ModalitaPagamento>MP01</ModalitaPagamento>
        <DataScadenzaPagamento>2015-01-30</DataScadenzaPagamento>
        <ImportoPagamento>6.10</ImportoPagamento>
      </DettaglioPagamento>
    </DatiPagamento>
  </FatturaElettronicaBody>
</p:FatturaElettronica>