From e80c8ea0f37085b0d53519e6b896daa938e1a9a0 Mon Sep 17 00:00:00 2001 From: Python3pkg Date: Sun, 21 May 2017 13:54:49 -0700 Subject: [PATCH 01/16] Convert to Python3 --- PyFePA/fepa.py | 12 +++++----- PyFePA/fields.py | 42 +++++++++++++++++----------------- PyFePA/sdi.py | 6 ++--- PyFePA/serializer.py | 6 ++--- PyFePA/siamm.py | 8 +++---- PyFePA/test/build_fatturapa.py | 2 +- PyFePA/test/test_fields.py | 6 ++--- PyFePA/utils.py | 6 ++--- runit.py | 4 ++-- 9 files changed, 46 insertions(+), 46 deletions(-) diff --git a/PyFePA/fepa.py b/PyFePA/fepa.py index 3c38ab8..3d736b5 100644 --- a/PyFePA/fepa.py +++ b/PyFePA/fepa.py @@ -15,7 +15,7 @@ # ################################################################################################################### -from fields import * +from .fields import * import sys @@ -24,14 +24,14 @@ 'RF11', 'RF12', 'RF13', 'RF14', 'RF15', 'RF16', 'RF17', 'RF18', 'RF19') SU = ('SU', 'SM') SL = ('LS', 'LN') -TD = map(lambda td: 'TD{:0=2d}'.format(td), range(1, 6)) +TD = ['TD{:0=2d}'.format(td) for td in range(1, 6)] TR = ['RT01','RT01'] -TC = map(lambda tc: 'TC{:0=2d}'.format(tc), range(1,22)) -NT = map(lambda nt: 'NT{:0=2d}'.format(nt), range(1,7)) +TC = ['TC{:0=2d}'.format(tc) for tc in range(1,22)] +NT = ['NT{:0=2d}'.format(nt) for nt in range(1,7)] TCP = ('SC', 'PR', 'AB', 'AC') SM = ('SC', 'MG') TP = ('TP01', 'TP02', 'TP03') -MP = map(lambda mp: 'MP{:0=2d}'.format(mp), range(1,22)) +MP = ['MP{:0=2d}'.format(mp) for mp in range(1,22)] EI = ('I','D','S') @@ -63,7 +63,7 @@ def __getattribute__(self, item): def from_element(self, element): - for k, v in self.__class__.__dict__.items(): + for k, v in list(self.__class__.__dict__.items()): if isinstance(v,FieldType): tagg = [t for t in list(element) if str.lower(t.tag) == str.lower(k)] if len(tagg) == 1 or (v.multi and len(tagg) > 1): diff --git a/PyFePA/fields.py b/PyFePA/fields.py index a904ebb..1466716 100644 --- a/PyFePA/fields.py +++ b/PyFePA/fields.py @@ -29,11 +29,11 @@ class FieldType(object): multi = False def __init__(self, **kwargs): - self.required = kwargs['required'] if kwargs.has_key('required') else False - self.depend = kwargs['depend'] if kwargs.has_key('depend') else None - self.conflict = kwargs['conflict'] if kwargs.has_key('conflict') else None - self.code = kwargs['code'] if kwargs.has_key('code') else None - self.multi = kwargs['multi'] if kwargs.has_key('multi') else False + self.required = kwargs['required'] if 'required' in kwargs else False + self.depend = kwargs['depend'] if 'depend' in kwargs else None + self.conflict = kwargs['conflict'] if 'conflict' in kwargs else None + self.code = kwargs['code'] if 'code' in kwargs else None + self.multi = kwargs['multi'] if 'multi' in kwargs else False def validate(self, value): retval = False @@ -56,27 +56,27 @@ def validate(self, value): elif not (self.minlen and self.maxlen ): valid = True elif self.minlen and not self.maxlen : - valid = self.minlen <= len(unicode(value)) + valid = self.minlen <= len(str(value)) elif self.maxlen and not self.minlen: - valid = len(unicode(value)) <= self.maxlen + valid = len(str(value)) <= self.maxlen else: - valid = self.minlen <= len(unicode(value)) <= self.maxlen + valid = self.minlen <= len(str(value)) <= self.maxlen if valid: - return value if isinstance(value,(str,unicode)) else unicode(value) + return value if isinstance(value,str) else str(value) else: return valid def __init__(self, **kwargs): - self.minlen = kwargs['minlen'] if kwargs.has_key('minlen') else False - self.maxlen = kwargs['maxlen'] if kwargs.has_key('maxlen') else False + self.minlen = kwargs['minlen'] if 'minlen' in kwargs else False + self.maxlen = kwargs['maxlen'] if 'maxlen' in kwargs else False super(FieldString,self).__init__(**kwargs) @classmethod def tostring(cls,value): - return unicode(value) + return str(value) class FieldCostant(FieldType): @@ -87,20 +87,20 @@ class FieldCostant(FieldType): def validate(self, value): if super(FieldCostant,self).validate(value): return value - elif unicode(value) in self.cvalue: + elif str(value) in self.cvalue: return value else: return False def __init__(self, **kwargs): - self.cvalue = kwargs['cvalue'] if kwargs.has_key('cvalue') else None + self.cvalue = kwargs['cvalue'] if 'cvalue' in kwargs else None super(FieldCostant,self).__init__(**kwargs) @classmethod def tostring(cls,value): - return unicode(value) + return str(value) class FieldInteger(FieldType): @@ -120,8 +120,8 @@ def validate(self, value): def __init__(self, **kwargs): - self.minlen = kwargs['minlen'] if kwargs.has_key('minlen') else None - self.maxlen = kwargs['maxlen'] if kwargs.has_key('maxlen') else None + self.minlen = kwargs['minlen'] if 'minlen' in kwargs else None + self.maxlen = kwargs['maxlen'] if 'maxlen' in kwargs else None super(FieldInteger,self).__init__(**kwargs) @@ -143,13 +143,13 @@ def validate(self, value): elif self.minlen <= len('{:.2f}'.format(float(value))) <= self.maxlen: return float(value) except(ValueError, TypeError): - print 'DEBUG- ', value + print('DEBUG- ', value) return False def __init__(self, **kwargs): - self.minlen = kwargs['minlen'] if kwargs.has_key('minlen') else None - self.maxlen = kwargs['maxlen'] if kwargs.has_key('maxlen') else None + self.minlen = kwargs['minlen'] if 'minlen' in kwargs else None + self.maxlen = kwargs['maxlen'] if 'maxlen' in kwargs else None super(FieldDecimal,self).__init__(**kwargs) @@ -209,7 +209,7 @@ def validate(self, value): def __init__(self, **kwargs): - self.object_class = kwargs['object_class'] if kwargs.has_key('object_class') else False + self.object_class = kwargs['object_class'] if 'object_class' in kwargs else False super(FieldObject,self).__init__(**kwargs) @classmethod diff --git a/PyFePA/sdi.py b/PyFePA/sdi.py index 7aed53c..7a168ee 100644 --- a/PyFePA/sdi.py +++ b/PyFePA/sdi.py @@ -15,8 +15,8 @@ # ################################################################################################################### -from fields import * -from fepa import GenFePA +from .fields import * +from .fepa import GenFePA lxml = False @@ -134,4 +134,4 @@ class AttestazioneTrasmissioneFattura(GenFePA): test.DataOraRicezione = '2015-01-01' test.IdentificativoSdI = '12334' -print test \ No newline at end of file +print(test) \ No newline at end of file diff --git a/PyFePA/serializer.py b/PyFePA/serializer.py index 1c20f33..df765c6 100644 --- a/PyFePA/serializer.py +++ b/PyFePA/serializer.py @@ -38,7 +38,7 @@ class ValidateException(Exception): def validate(invoice_part): taglist = {} - for k, v in invoice_part.__class__.__dict__.items(): + for k, v in list(invoice_part.__class__.__dict__.items()): if isinstance(v, FieldType): value = invoice_part.__getattribute__(k) if value: @@ -49,7 +49,7 @@ def validate(invoice_part): 'conflict': v.conflict, 'required': v.required} # Risolve Dipendenze e Conflitti - for v in taglist.values(): + for v in list(taglist.values()): if v['value'] is not None and v['depend'] is not None: for d in v['depend']: if taglist[d]['value'] is None: @@ -98,7 +98,7 @@ def globalvalidation(fattura): raise ValidateException('Denominazione Azienda Mancante') for feb in fattura.FatturaElettronicaBody: if feb.DatiGenerali.DatiGeneraliDocumento.Data > datetime.date.today(): - print feb.DatiGenerali.DatiGeneraliDocumento.Data, '- TODAY -', datetime.date.today() + print(feb.DatiGenerali.DatiGeneraliDocumento.Data, '- TODAY -', datetime.date.today()) raise ValidateException('00403 - Data Fattura non puo essere nel futuro') for ln in feb.DatiBeniServizi.DettaglioLinee: if ln.Ritenuta and not feb.DatiGenerali.DatiGeneraliDocumento.DatiRitenuta: diff --git a/PyFePA/siamm.py b/PyFePA/siamm.py index 245c86d..a0bd65d 100644 --- a/PyFePA/siamm.py +++ b/PyFePA/siamm.py @@ -17,7 +17,7 @@ import datetime -from utils import piva +from .utils import piva lxml = False @@ -120,7 +120,7 @@ def _siam_serialize(value): intercettazioni = etree.Element('INTERCETTAZIONI') (etree.SubElement(intercettazioni, 'ID')).text = str(value['id']).upper() if 'id' in value else '1' - (etree.SubElement(intercettazioni, 'BENEFICIARIO')).text = unicode(value['beneficiario']) + (etree.SubElement(intercettazioni, 'BENEFICIARIO')).text = str(value['beneficiario']) (etree.SubElement(intercettazioni, 'TIPOPAGAMENTO')).text = value['tipopagamento'].upper() (etree.SubElement(intercettazioni, 'ENTEPAGANTE')).text = value['entepagante'].upper() (etree.SubElement(intercettazioni, 'DATAINIZIOPRESTAZIONE')).text = \ @@ -141,8 +141,8 @@ def _siam_serialize(value): (etree.SubElement(intercettazioni, 'NUMEROMODELLO37')).text = \ fillprot(value['numeromodello37']) if 'numeromodello37' in value else None (etree.SubElement(intercettazioni, 'TIPOINTERCETTAZIONE')).text = value['tipointercettazione'].upper() - (etree.SubElement(intercettazioni, 'NOMEMAGISTRATO')).text = unicode(value['nomemagistrato']).upper() - (etree.SubElement(intercettazioni, 'COGNOMEMAGISTRATO')).text = unicode(value['cognomemagistrato']).upper() + (etree.SubElement(intercettazioni, 'NOMEMAGISTRATO')).text = str(value['nomemagistrato']).upper() + (etree.SubElement(intercettazioni, 'COGNOMEMAGISTRATO')).text = str(value['cognomemagistrato']).upper() (etree.SubElement(intercettazioni, 'DATAEMISSIONEPROVV')).text = \ "{:%Y-%m-%dT%H:%M:%S}".format(value['dataemissioneprovv']) if 'dataemissioneprovv' in value \ and value['dataemissioneprovv'] != '' else '' diff --git a/PyFePA/test/build_fatturapa.py b/PyFePA/test/build_fatturapa.py index 6e9707d..15ee31b 100644 --- a/PyFePA/test/build_fatturapa.py +++ b/PyFePA/test/build_fatturapa.py @@ -221,4 +221,4 @@ def allegati(self): if __name__ == "__main__": fatturapa = FatturaPA() fpa = fatturapa.get_fatturapa() - print serializer(fpa,'xml') \ No newline at end of file + print(serializer(fpa,'xml')) \ No newline at end of file diff --git a/PyFePA/test/test_fields.py b/PyFePA/test/test_fields.py index 6fcc93e..d985440 100644 --- a/PyFePA/test/test_fields.py +++ b/PyFePA/test/test_fields.py @@ -38,10 +38,10 @@ def testFiledString(self): sf = fields.FieldString(required=True, minlen=1, maxlen=12) sfb64 = fields.FieldString(required=True, minlen=1) self.assertEqual(tstr, sf.validate(tstr)) - self.assertEqual(unicode(tdate), sf.validate(tdate)) + self.assertEqual(str(tdate), sf.validate(tdate)) self.assertEqual(False, sf.validate(tdatetime)) - self.assertEqual(unicode(tint), sf.validate(tint)) - self.assertEqual(unicode(tdec), sf.validate(tdec)) + self.assertEqual(str(tint), sf.validate(tint)) + self.assertEqual(str(tdec), sf.validate(tdec)) self.assertEqual(False, sf.validate(tobj)) self.assertEqual(tconst, sf.validate(tconst)) self.assertEqual(False, sf.validate('abcdefghilmnop')) diff --git a/PyFePA/utils.py b/PyFePA/utils.py index 7ad93be..67ed791 100644 --- a/PyFePA/utils.py +++ b/PyFePA/utils.py @@ -25,9 +25,9 @@ def piva(value): if (len(value) != 11) or not value.isdigit(): return False - value = map(int, value) - checksum = sum(map(lambda x: value[x], xrange(0, 10, 2))) - checksum += sum(map(lambda x: (2 * value[x]) - 9 if (2 * value[x]) > 9 else (2 * value[x]) , xrange(1, 10, 2))) + value = list(map(int, value)) + checksum = sum([value[x] for x in range(0, 10, 2)]) + checksum += sum([(2 * value[x]) - 9 if (2 * value[x]) > 9 else (2 * value[x]) for x in range(1, 10, 2)]) checksum = 10 - (checksum % 10) if checksum % 10 != 0 else 0 return value[10] == checksum diff --git a/runit.py b/runit.py index 0742aca..5c5dc75 100644 --- a/runit.py +++ b/runit.py @@ -34,7 +34,7 @@ with open(DPATH+'/PyFePA/test/IT01234567890_11001.xml', 'rt') as f: tree = ElementTree.parse(f) fe = serializer.deserialize(element=tree) - print serializer.serializer(fe,'xml') + print(serializer.serializer(fe,'xml')) testdata_list = [testdata,testdata,testdata] -print siamm.serialize(testdata_list) \ No newline at end of file +print(siamm.serialize(testdata_list)) \ No newline at end of file From 8fbde879fb57ad546fbffea8a1feac5a0ce4f9f0 Mon Sep 17 00:00:00 2001 From: Toni Magni Date: Tue, 24 Jul 2018 19:59:58 +0200 Subject: [PATCH 02/16] add dateutil requirement in setup.py --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 46df80b..16f6704 100644 --- a/setup.py +++ b/setup.py @@ -33,4 +33,5 @@ package_data = {'PyFePA' : files }, license= 'AGPLv3', classifiers = [], -) \ No newline at end of file + install_requires=['python-dateutil'], +) From aebd8eaac1176f2270ffb824ac62af3afae37c43 Mon Sep 17 00:00:00 2001 From: Toni Magni Date: Thu, 26 Jul 2018 11:30:18 +0200 Subject: [PATCH 03/16] Fix issue with verification of date from DatiGeneraliDocumento.Data --- PyFePA/serializer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PyFePA/serializer.py b/PyFePA/serializer.py index df765c6..633d383 100644 --- a/PyFePA/serializer.py +++ b/PyFePA/serializer.py @@ -97,7 +97,7 @@ def globalvalidation(fattura): and fattura.FatturaElettronicaHeader.CedentePrestatore.DatiAnagrafici.Anagrafica.Denominazione is None: raise ValidateException('Denominazione Azienda Mancante') for feb in fattura.FatturaElettronicaBody: - if feb.DatiGenerali.DatiGeneraliDocumento.Data > datetime.date.today(): + if feb.DatiGenerali.DatiGeneraliDocumento.Data > datetime.datetime.today(): print(feb.DatiGenerali.DatiGeneraliDocumento.Data, '- TODAY -', datetime.date.today()) raise ValidateException('00403 - Data Fattura non puo essere nel futuro') for ln in feb.DatiBeniServizi.DettaglioLinee: From d8c1ab352320d700f01f34ded8fc31b6ede67282 Mon Sep 17 00:00:00 2001 From: Toni Magni Date: Thu, 26 Jul 2018 14:20:59 +0200 Subject: [PATCH 04/16] Add official stylesheets to be able to produce html files. --- PyFePA/xsd/fatturaPA_v1.2.1.xsl | 3068 ++++++++++++++++++++++++ PyFePA/xsd/fatturaordinaria_v1.2.1.xsl | 3068 ++++++++++++++++++++++++ 2 files changed, 6136 insertions(+) create mode 100644 PyFePA/xsd/fatturaPA_v1.2.1.xsl create mode 100644 PyFePA/xsd/fatturaordinaria_v1.2.1.xsl diff --git a/PyFePA/xsd/fatturaPA_v1.2.1.xsl b/PyFePA/xsd/fatturaPA_v1.2.1.xsl new file mode 100644 index 0000000..8b5aef2 --- /dev/null +++ b/PyFePA/xsd/fatturaPA_v1.2.1.xsl @@ -0,0 +1,3068 @@ + + + + + + + + + + + + + + + + + Gennaio + + + Febbraio + + + Marzo + + + Aprile + + + Maggio + + + Giugno + + + Luglio + + + Agosto + + + Settembre + + + Ottobre + + + Novembre + + + Dicembre + + + Mese non riconosciuto + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ +

FATTURA ELETTRONICA

+ + +
+
+ Versione +
+ + + +
+

Dati relativi alla trasmissione

+
    + + + +
  • + Identificativo del trasmittente: + + + + +
  • +
    + +
  • + Progressivo di invio: + + + +
  • +
    + +
  • + Formato Trasmissione: + + + +
  • +
    + +
  • + Codice Amministrazione destinataria: + + + +
  • +
    + +
  • + Telefono del trasmittente: + + + +
  • +
    + +
  • + E-mail del trasmittente: + + + +
  • +
    + +
  • + Destinatario PEC: + + + +
  • +
    +
    +
+
+
+ + + + +
+

Dati del cedente / prestatore

+ + +

Dati anagrafici

+ +
    + + +
  • + Identificativo fiscale ai fini IVA: + + + + +
  • +
    + +
  • + Codice fiscale: + + + +
  • +
    + +
  • + Denominazione: + + + +
  • +
    + +
  • + Nome: + + + +
  • +
    + +
  • + Cognome: + + + +
  • +
    + +
  • + Titolo: + + + +
  • +
    + +
  • + Codice EORI: + + + +
  • +
    + +
  • + Albo professionale di appartenenza: + + + +
  • +
    + +
  • + Provincia di competenza dell'Albo: + + + +
  • +
    + +
  • + Numero iscrizione all'Albo: + + + +
  • +
    + +
  • + Data iscrizione all'Albo: + + + + + + +
  • +
    + +
  • + Regime fiscale: + + + + + + + + + + (ordinario) + + + (contribuenti minimi) + + + (nuove iniziative produttive) - Non più valido in quanto abrogato dalla legge di stabilità 2015 + + + (agricoltura e attività connesse e pesca) + + + (vendita sali e tabacchi) + + + (commercio fiammiferi) + + + (editoria) + + + (gestione servizi telefonia pubblica) + + + (rivendita documenti di trasporto pubblico e di sosta) + + + (intrattenimenti, giochi e altre attività di cui alla tariffa allegata al DPR 640/72) + + + (agenzie viaggi e turismo) + + + (agriturismo) + + + (vendite a domicilio) + + + (rivendita beni usati, oggetti d’arte, + d’antiquariato o da collezione) + + + (agenzie di vendite all’asta di oggetti d’arte, + antiquariato o da collezione) + + + (IVA per cassa P.A.) + + + (IVA per cassa - art. 32-bis, D.L. 83/2012) + + + (Regime forfettario) + + + (altro) + + + + + (!!! codice non previsto !!!) + + +
  • +
    +
    +
+
+ + +

Dati della sede

+
    + + +
  • + Indirizzo: + + + +
  • +
    + +
  • + Numero civico: + + + +
  • +
    + +
  • + CAP: + + + +
  • +
    + +
  • + Comune: + + + +
  • +
    + +
  • + Provincia: + + + +
  • +
    + +
  • + Nazione: + + + +
  • +
    +
    +
+
+ + +

Dati della stabile organizzazione

+
    + + +
  • + Indirizzo: + + + +
  • +
    + +
  • + Numero civico: + + + +
  • +
    + +
  • + CAP: + + + +
  • +
    + +
  • + Comune: + + + +
  • +
    + +
  • + Provincia: + + + +
  • +
    + +
  • + Nazione: + + + +
  • +
    +
    +
+
+ + +

Dati di iscrizione nel registro delle imprese

+ +
    + + +
  • + Provincia Ufficio Registro Imprese: + + + +
  • +
    + +
  • + Numero di iscrizione: + + + +
  • +
    + +
  • + Capitale sociale: + + + +
  • +
    + +
  • + Numero soci: + + + + + + + + + + (socio unico) + + + (più soci) + + + + + (!!! codice non previsto !!!) + + +
  • +
    + +
  • + Stato di liquidazione: + + + + + + + + + + (in liquidazione) + + + (non in liquidazione) + + + + + (!!! codice non previsto !!!) + + +
  • +
    +
    +
+
+ + + +

Recapiti

+
    + +
  • + Telefono: + + + +
  • +
    + +
  • + Fax: + + + +
  • +
    + +
  • + E-mail: + + + +
  • +
    +
+
+
+ + +

Riferimento amministrativo

+
    +
  • + Riferimento: + + + +
  • +
+
+
+
+ + + + +
+

Dati del rappresentante fiscale del cedente / prestatore

+ + +

Dati anagrafici

+ +
    + + +
  • + Identificativo fiscale ai fini IVA: + + + + +
  • +
    + +
  • + Codice fiscale: + + + +
  • +
    + +
  • + Denominazione: + + + +
  • +
    + +
  • + Nome: + + + +
  • +
    + +
  • + Cognome: + + + +
  • +
    + +
  • + Titolo onorifico: + + + +
  • +
    + +
  • + Codice EORI: + + + +
  • +
    +
    +
+
+ +
+
+ + + + +
+

Dati del cessionario / committente

+ + +

Dati anagrafici

+ +
    + + +
  • + Identificativo fiscale ai fini IVA: + + + + +
  • +
    + +
  • + Codice Fiscale: + + + +
  • +
    + +
  • + Denominazione: + + + +
  • +
    + +
  • + Nome: + + + +
  • +
    + +
  • + Cognome: + + + +
  • +
    + +
  • + Titolo onorifico: + + + +
  • +
    + +
  • + Codice EORI: + + + +
  • +
    +
    +
+
+ + + +

Dati della sede

+ +
    + + +
  • + Indirizzo: + + + +
  • +
    + +
  • + Numero civico: + + + +
  • +
    + +
  • + CAP: + + + +
  • +
    + +
  • + Comune: + + + +
  • +
    + +
  • + Provincia: + + + +
  • +
    + +
  • + Nazione: + + + +
  • +
    +
    +
+
+ + + +

Stabile organizzazione del cessionario / committente

+ +
    + + +
  • + Indirizzo: + + + +
  • +
    + +
  • + Numero civico: + + + +
  • +
    + +
  • + CAP: + + + +
  • +
    + +
  • + Comune: + + + +
  • +
    + +
  • + Provincia: + + + +
  • +
    + +
  • + Nazione: + + + +
  • +
    +
    +
+
+ + +
+

Dati del rappresentante fiscale del cessionario / committente

+ +
    + + +
  • + Identificativo fiscale ai fini IVA: + + + + +
  • +
    + +
  • + Denominazione: + + + +
  • +
    + +
  • + Nome: + + + +
  • +
    + +
  • + Cognome: + + + +
  • +
    +
    +
+
+
+ + +
+
+ + + + +
+ + +

Dati del terzo intermediario soggetto emittente

+ + +

Dati anagrafici

+ +
    + +
  • + Identificativo fiscale ai fini IVA: + + + + +
  • +
    + +
  • + Codice Fiscale: + + + +
  • +
    + +
  • + Denominazione: + + + +
  • +
    + +
  • + Nome: + + + +
  • +
    + +
  • + Cognome: + + + +
  • +
    + +
  • + Titolo onorifico: + + + +
  • +
    + +
  • + Codice EORI: + + + +
  • +
    +
+
+
+
+
+ + + + +
+

Soggetto emittente la fattura

+
    +
  • + Soggetto emittente: + + + + + + + + + (cessionario/committente) + + + (terzo) + + + + + (!!! codice non previsto !!!) + + +
  • +
+
+
+ + + +
+
+ + + + + + + + + + +

+ Numero documento nel lotto: + +

+
+ +
+
+ Versione +
+ + + +
+ + + + +
+

Dati generali del documento

+ +
    + +
  • + Tipologia documento: + + + + + + + + + + (fattura) + + + (acconto/anticipo su fattura) + + + (acconto/anticipo su parcella) + + + (nota di credito) + + + (nota di debito) + + + (parcella) + + + + + (!!! codice non previsto !!!) + + +
  • +
    + +
  • + Valuta importi: + + + +
  • +
    + +
  • + Data documento: + + + + + + +
  • +
    + +
  • + Numero documento: + + + +
  • +
    + +
  • + Importo totale documento: + + + +
  • +
    + +
  • + Arrotondamento su Importo totale documento: + + + +
  • +
    + + +
  • + Causale: + + + +
  • + +
    + +
  • + Art. 73 DPR 633/72: + + + +
  • +
    +
+ + + +
+ +

Ritenuta

+
    + +
  • + Tipologia ritenuta: + + + + + + + + + (ritenuta persone fisiche) + + + (ritenuta persone giuridiche) + + + + + (!!! codice non previsto !!!) + + +
  • +
    + +
  • + Importo ritenuta: + + + +
  • +
    + +
  • + Aliquota ritenuta (%): + + + +
  • +
    + +
  • + Causale di pagamento: + + + + + + + + (decodifica come da modello 770S) + +
  • +
    +
+
+
+
+ + + + +
+ +

Bollo

+
    + +
  • + Bollo virtuale: + + + +
  • +
    + +
  • + Importo bollo: + + + +
  • +
    +
+
+
+
+ + + + +
+

Cassa previdenziale

+ +
    + +
  • + Tipologia cassa previdenziale: + + + + + + + + + (Cassa Nazionale Previdenza e Assistenza Avvocati + e Procuratori legali) + + + (Cassa Previdenza Dottori Commercialisti) + + + (Cassa Previdenza e Assistenza Geometri) + + + (Cassa Nazionale Previdenza e Assistenza + Ingegneri e Architetti liberi profess.) + + + (Cassa Nazionale del Notariato) + + + (Cassa Nazionale Previdenza e Assistenza + Ragionieri e Periti commerciali) + + + (Ente Nazionale Assistenza Agenti e Rappresentanti + di Commercio-ENASARCO) + + + (Ente Nazionale Previdenza e Assistenza Consulenti + del Lavoro-ENPACL) + + + (Ente Nazionale Previdenza e Assistenza + Medici-ENPAM) + + + (Ente Nazionale Previdenza e Assistenza + Farmacisti-ENPAF) + + + (Ente Nazionale Previdenza e Assistenza + Veterinari-ENPAV) + + + (Ente Nazionale Previdenza e Assistenza Impiegati + dell'Agricoltura-ENPAIA) + + + (Fondo Previdenza Impiegati Imprese di Spedizione + e Agenzie Marittime) + + + (Istituto Nazionale Previdenza Giornalisti + Italiani-INPGI) + + + (Opera Nazionale Assistenza Orfani Sanitari + Italiani-ONAOSI) + + + (Cassa Autonoma Assistenza Integrativa + Giornalisti Italiani-CASAGIT) + + + (Ente Previdenza Periti Industriali e Periti + Industriali Laureati-EPPI) + + + (Ente Previdenza e Assistenza + Pluricategoriale-EPAP) + + + (Ente Nazionale Previdenza e Assistenza + Biologi-ENPAB) + + + (Ente Nazionale Previdenza e Assistenza + Professione Infermieristica-ENPAPI) + + + (Ente Nazionale Previdenza e Assistenza + Psicologi-ENPAP) + + + (INPS) + + + + + (!!! codice non previsto !!!) + + +
  • +
    + +
  • + Aliquota contributo cassa (%): + + + +
  • +
    + +
  • + Importo contributo cassa: + + + +
  • +
    + +
  • + Imponibile previdenziale: + + + +
  • +
    + +
  • + Aliquota IVA applicata: + + + +
  • +
    + +
  • + Contributo cassa soggetto a ritenuta: + + + +
  • +
    + +
  • + Tipologia di non imponibilità del contributo: + + + + + + + + + (escluse ex art. 15) + + + (non soggette) + + + (non imponibili) + + + (esenti) + + + (regime del margine / IVA non esposta in fattura) + + + (inversione contabile) + + + (IVA assolta in altro stato UE) + + + + + (!!! codice non previsto !!!) + + +
  • +
    + +
  • + Riferimento amministrativo / contabile: + + + +
  • +
    +
+
+
+
+ + + + +

Sconto/maggiorazione

+
+ +
    + +
  • + Tipologia: + + + + + + + + + + (sconto) + + + + (maggiorazione) + + + + (!!! codice non previsto !!!) + + +
  • +
    + +
  • + Percentuale: + + + +
  • +
    + +
  • + Importo: + + + +
  • +
    +
+
+
+
+ + +
+
+ + + + +
+

Dati dell'ordine di acquisto

+ + +
    + +
  • + Numero linea di fattura a cui si riferisce: + + + + , + + + + +
  • +
    + +
  • + Identificativo ordine di acquisto: + + + +
  • +
    + +
  • + Data ordine di acquisto: + + + + + + +
  • +
    + +
  • + Numero linea ordine di acquisto: + + + +
  • +
    + +
  • + Codice commessa/convenzione: + + + +
  • +
    + +
  • + Codice Unitario Progetto (CUP): + + + +
  • +
    + +
  • + Codice Identificativo Gara (CIG): + + + +
  • +
    +
+
+
+
+ + + + +
+

Dati del contratto

+ +
    + +
  • + Numero linea di fattura a cui si riferisce: + + + + , + + + + +
  • +
    + +
  • + Identificativo contratto: + + + +
  • +
    + +
  • + Data contratto: + + + + + + +
  • +
    + +
  • + Numero linea contratto: + + + +
  • +
    + +
  • + Codice commessa/convenzione: + + + +
  • +
    + +
  • + Codice Unitario Progetto (CUP): + + + +
  • +
    + +
  • + Codice Identificativo Gara (CIG): + + + +
  • +
    +
+
+
+
+ + + + +
+

Dati della convenzione

+ +
    + +
  • + Numero linea di fattura a cui si riferisce: + + + + , + + + + + +
  • +
    + +
  • + Identificativo convenzione: + + + +
  • +
    + +
  • + Data convenzione: + + + + + + +
  • +
    + +
  • + Numero linea convenzione: + + + +
  • +
    + +
  • + Codice commessa/convenzione: + + + +
  • +
    + +
  • + Codice Unitario Progetto (CUP): + + + +
  • +
    + +
  • + Codice Identificativo Gara (CIG): + + + +
  • +
    +
+
+
+
+ + + + +
+

Dati della ricezione

+ +
    + +
  • + Numero linea di fattura a cui si riferisce: + + + + , + + + + + +
  • +
    + +
  • + Identificativo ricezione: + + + +
  • +
    + +
  • + Data ricezione: + + + + + + +
  • +
    + +
  • + Numero linea ricezione: + + + +
  • +
    + +
  • + Codice commessa/convenzione: + + + +
  • +
    + +
  • + Codice Unitario Progetto (CUP): + + + +
  • +
    + +
  • + Codice Identificativo Gara (CIG): + + + +
  • +
    +
+
+
+
+ + + + +
+

Dati della fattura collegata

+ +
    + +
  • + Numero linea di fattura a cui si riferisce: + + + + , + + + + + +
  • +
    + +
  • + Identificativo fattura collegata: + + + +
  • +
    + +
  • + Data fattura collegata: + + + + + + +
  • +
    + +
  • + Numero linea fattura collegata: + + + +
  • +
    + +
  • + Codice commessa/convenzione: + + + +
  • +
    + +
  • + Codice Unitario Progetto (CUP): + + + +
  • +
    + +
  • + Codice Identificativo Gara (CIG): + + + +
  • +
    +
+
+
+
+ + + + +
+

Stato avanzamento lavori

+
    + +
  • + Numero fase avanzamento: + + + + , + + + + +
  • +
    +
+
+
+ + + + +
+

Dati del documento di trasporto

+ +
    + +
  • + Numero DDT: + + + +
  • +
    + +
  • + Data DDT: + + + + + + +
  • +
    + +
  • + Numero linea di fattura a cui si riferisce: + + + + , + + + + +
  • +
    +
+
+
+
+ + + + +
+

Dati relativi al trasporto

+ + +

Dati del vettore

+ +
    + + +
  • + Identificativo fiscale ai fini IVA: + + + + +
  • +
    + +
  • + Codice Fiscale: + + + +
  • +
    + +
  • + Denominazione: + + + +
  • +
    + +
  • + Nome: + + + +
  • +
    + +
  • + Cognome: + + + +
  • +
    + +
  • + Titolo onorifico: + + + +
  • +
    + +
  • + Codice EORI: + + + +
  • +
    + +
  • + Numero licenza di guida: + + + +
  • +
    +
    +
+
+ + +

Altri dati

+ +
    + + +
  • + Mezzo di trasporto: + + + +
  • +
    + +
  • + Causale trasporto: + + + +
  • +
    + +
  • + Numero colli trasportati: + + + +
  • +
    + +
  • + Descrizione beni trasportati: + + + +
  • +
    + +
  • + Unità di misura del peso merce: + + + +
  • +
    + +
  • + Peso lordo: + + + +
  • +
    + +
  • + Peso netto: + + + +
  • +
    + +
  • + Data e ora ritiro merce: + + + + + + +
  • +
    + +
  • + Data inizio trasporto: + + + + + + +
  • +
    + +
  • + Tipologia di resa: + + + + + (codifica secondo standard ICC) +
  • +
    + +
  • + Indirizzo di resa: + + + +
  • +
    + +
  • + Numero civico indirizzo di resa: + + + +
  • +
    + +
  • + CAP indirizzo di resa: + + + +
  • +
    + +
  • + Comune di resa: + + + +
  • +
    + +
  • + Provincia di resa: + + + +
  • +
    + +
  • + Nazione di resa: + + + +
  • +
    +
    +
+
+ +
+
+ + + + +
+

Dati relativi alla fattura principale

+
    + +
  • + Numero fattura principale: + + + +
  • +
    + +
  • + Data fattura principale: + + + + + + +
  • +
    +
+
+
+ + +
+
+ + + + +
+ + + +
+

Dati relativi alle linee di dettaglio della fornitura

+ + +
+ Nr. linea: + + + +
+ +
    + +
  • + Tipo cessione/prestazione: + + + + + + + + + (sconto) + + + (premio) + + + (abbuono) + + + (spesa accessoria) + + + (!!! codice non previsto !!!) + + +
  • +
    + +
  • +
    Codifica articolo
    + +
      + +
    • + Tipo: + + + +
    • +
      + +
    • + Valore: + + + +
    • +
      +
    +
    +
  • +
    + +
  • + Descrizione bene/servizio: + + + +
  • +
    + +
  • + Quantità: + + + +
  • +
    + +
  • + Unità di misura: + + + +
  • +
    + +
  • + Data inizio periodo di riferimento: + + + + + + +
  • +
    + +
  • + Data fine periodo di riferimento: + + + + + + +
  • +
    + +
  • + Valore unitario: + + + +
  • +
    + +
  • +
    Sconto/Maggiorazione
    + + +
      + +
    • + Tipo: + + + + + + + + + + (sconto) + + + + (maggiorazione) + + + + (!!! codice non previsto !!!) + + +
    • +
      + +
    • + Percentuale (%): + + + +
    • +
      + +
    • + Importo: + + + +
    • +
      +
    +
    +
  • +
    + +
  • + Valore totale: + + + +
  • +
    + +
  • + IVA (%): + + + +
  • +
    + +
  • + Soggetta a ritenuta: + + + +
  • +
    + +
  • + Natura operazione: + + + + + + + + + (esclusa ex art.15) + + + (non soggetta) + + + (non imponibile) + + + (esente) + + + (regime del margine / IVA non esposta in fattura) + + + (inversione contabile) + + + (IVA assolta in altro stato UE) + + + (!!! codice non previsto !!!) + + +
  • +
    + +
  • + Riferimento amministrativo/contabile: + + + +
  • +
    + +
  • +
    Altri dati gestionali
    +
      + + +
    • + Tipo dato: + + + +
    • +
      + +
    • + Valore testo: + + + +
    • +
      + +
    • + Valore numerico: + + + +
    • +
      + +
    • + Valore data: + + + + + + +
    • +
      +
      +
    +
  • +
    +
+
+
+
+ + + + +
+

Dati di riepilogo per aliquota IVA e natura

+ +
    + +
  • + Aliquota IVA (%): + + + +
  • +
    + +
  • + Natura operazioni: + + + + + + + + + (escluse ex art.15) + + + (non soggette) + + + (non imponibili) + + + (esenti) + + + (regime del margine / IVA non esposta in fattura) + + + (inversione contabile) + + + (IVA assolta in altro stato UE) + + + (!!! codice non previsto !!!) + + +
  • +
    + +
  • + Spese accessorie: + + + +
  • +
    + +
  • + Arrotondamento: + + + +
  • +
    + +
  • + Totale imponibile/importo: + + + +
  • +
    + +
  • + Totale imposta: + + + +
  • +
    + +
  • + Esigibilità IVA: + + + + + + + + + (esigibilità immediata) + + + (esigibilità differita) + + + (scissione dei pagamenti) + + + (!!! codice non previsto !!!) + + +
  • +
    + +
  • + Riferimento normativo: + + + +
  • +
    +
+
+
+
+ + +
+
+ + + + +
+

Dati Veicoli ex art. 38 dl 331/1993

+
    + + +
  • + Data prima immatricolazione / iscrizione PR: + + + + + + +
  • +
    + +
  • + Totale percorso: + + + +
  • +
    +
    +
+
+
+ + + + +
+

Dati relativi al pagamento

+
    + + +
  • + Condizioni di pagamento: + + + + + + + + + (pagamento a rate) + + + (pagamento completo) + + + (anticipo) + + + + + (!!! codice non previsto !!!) + + +
  • +
    + + +
    Dettaglio pagamento
    + + +
      + +
    • + Beneficiario del pagamento: + + + +
    • +
      + +
    • + Modalità: + + + + + + + + + (contanti) + + + (assegno) + + + (assegno circolare) + + + (contanti presso Tesoreria) + + + (bonifico) + + + (vaglia cambiario) + + + (bollettino bancario) + + + (carta di pagamento) + + + (RID) + + + (RID utenze) + + + (RID veloce) + + + (RIBA) + + + (MAV) + + + (quietanza erario) + + + (giroconto su conti di contabilità speciale) + + + (domiciliazione bancaria) + + + (domiciliazione postale) + + + (bollettino di c/c postale) + + + (SEPA Direct Debit) + + + (SEPA Direct Debit CORE) + + + (SEPA Direct Debit B2B) + + + (Trattenuta su somme già riscosse) + + + + + (!!! codice non previsto !!!) + + +
    • +
      + +
    • + Decorrenza termini di pagamento: + + + + + + +
    • +
      + +
    • + Termini di pagamento (in giorni): + + + +
    • +
      + +
    • + Data scadenza pagamento: + + + + + + +
    • +
      + +
    • + Importo: + + + +
    • +
      + +
    • + Codice Ufficio Postale: + + + +
    • +
      + +
    • + Cognome del quietanzante: + + + +
    • +
      + +
    • + Nome del quietanzante: + + + +
    • +
      + +
    • + CF del quietanzante: + + + +
    • +
      + +
    • + Titolo del quietanzante: + + + +
    • +
      + +
    • + Istituto finanziario: + + + +
    • +
      + +
    • + Codice IBAN: + + + +
    • +
      + +
    • + Codice ABI: + + + +
    • +
      + +
    • + Codice CAB: + + + +
    • +
      + +
    • + Codice BIC: + + + +
    • +
      + +
    • + Sconto per pagamento anticipato: + + + +
    • +
      + +
    • + Data limite per il pagamento anticipato: + + + + + + +
    • +
      + +
    • + Penale per ritardato pagamento: + + + +
    • +
      + +
    • + Data di decorrenza della penale: + + + + + + +
    • +
      + +
    • + Codice pagamento: + + + +
    • +
      +
    +
    +
    +
    +
+ +
+
+ + + + +
+

Dati relativi agli allegati

+ + +
    + +
  • + Nome dell'allegato: + + + +
  • +
    + +
  • + Algoritmo di compressione: + + + +
  • +
    + +
  • + Formato: + + + +
  • +
    + +
  • + Descrizione: + + + +
  • +
    +
+
+
+
+ + + +
+
+ + +
+
+
+ + +
+
\ No newline at end of file diff --git a/PyFePA/xsd/fatturaordinaria_v1.2.1.xsl b/PyFePA/xsd/fatturaordinaria_v1.2.1.xsl new file mode 100644 index 0000000..8958ea6 --- /dev/null +++ b/PyFePA/xsd/fatturaordinaria_v1.2.1.xsl @@ -0,0 +1,3068 @@ + + + + + + + + + + + + + + + + + Gennaio + + + Febbraio + + + Marzo + + + Aprile + + + Maggio + + + Giugno + + + Luglio + + + Agosto + + + Settembre + + + Ottobre + + + Novembre + + + Dicembre + + + Mese non riconosciuto + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ +

FATTURA ELETTRONICA

+ + +
+
+ Versione +
+ + + +
+

Dati relativi alla trasmissione

+
    + + + +
  • + Identificativo del trasmittente: + + + + +
  • +
    + +
  • + Progressivo di invio: + + + +
  • +
    + +
  • + Formato Trasmissione: + + + +
  • +
    + +
  • + Codice identificativo destinatario: + + + +
  • +
    + +
  • + Telefono del trasmittente: + + + +
  • +
    + +
  • + E-mail del trasmittente: + + + +
  • +
    + +
  • + Destinatario PEC: + + + +
  • +
    +
    +
+
+
+ + + + +
+

Dati del cedente / prestatore

+ + +

Dati anagrafici

+ +
    + + +
  • + Identificativo fiscale ai fini IVA: + + + + +
  • +
    + +
  • + Codice fiscale: + + + +
  • +
    + +
  • + Denominazione: + + + +
  • +
    + +
  • + Nome: + + + +
  • +
    + +
  • + Cognome: + + + +
  • +
    + +
  • + Titolo: + + + +
  • +
    + +
  • + Codice EORI: + + + +
  • +
    + +
  • + Albo professionale di appartenenza: + + + +
  • +
    + +
  • + Provincia di competenza dell'Albo: + + + +
  • +
    + +
  • + Numero iscrizione all'Albo: + + + +
  • +
    + +
  • + Data iscrizione all'Albo: + + + + + + +
  • +
    + +
  • + Regime fiscale: + + + + + + + + + + (ordinario) + + + (contribuenti minimi) + + + (nuove iniziative produttive) - Non più valido in quanto abrogato dalla legge di stabilità 2015 + + + (agricoltura e attività connesse e pesca) + + + (vendita sali e tabacchi) + + + (commercio fiammiferi) + + + (editoria) + + + (gestione servizi telefonia pubblica) + + + (rivendita documenti di trasporto pubblico e di sosta) + + + (intrattenimenti, giochi e altre attività di cui alla tariffa allegata al DPR 640/72) + + + (agenzie viaggi e turismo) + + + (agriturismo) + + + (vendite a domicilio) + + + (rivendita beni usati, oggetti d’arte, + d’antiquariato o da collezione) + + + (agenzie di vendite all’asta di oggetti d’arte, + antiquariato o da collezione) + + + (IVA per cassa P.A.) + + + (IVA per cassa - art. 32-bis, D.L. 83/2012) + + + (Regime forfettario) + + + (altro) + + + + + (!!! codice non previsto !!!) + + +
  • +
    +
    +
+
+ + +

Dati della sede

+
    + + +
  • + Indirizzo: + + + +
  • +
    + +
  • + Numero civico: + + + +
  • +
    + +
  • + CAP: + + + +
  • +
    + +
  • + Comune: + + + +
  • +
    + +
  • + Provincia: + + + +
  • +
    + +
  • + Nazione: + + + +
  • +
    +
    +
+
+ + +

Dati della stabile organizzazione

+
    + + +
  • + Indirizzo: + + + +
  • +
    + +
  • + Numero civico: + + + +
  • +
    + +
  • + CAP: + + + +
  • +
    + +
  • + Comune: + + + +
  • +
    + +
  • + Provincia: + + + +
  • +
    + +
  • + Nazione: + + + +
  • +
    +
    +
+
+ + +

Dati di iscrizione nel registro delle imprese

+ +
    + + +
  • + Provincia Ufficio Registro Imprese: + + + +
  • +
    + +
  • + Numero di iscrizione: + + + +
  • +
    + +
  • + Capitale sociale: + + + +
  • +
    + +
  • + Numero soci: + + + + + + + + + + (socio unico) + + + (più soci) + + + + + (!!! codice non previsto !!!) + + +
  • +
    + +
  • + Stato di liquidazione: + + + + + + + + + + (in liquidazione) + + + (non in liquidazione) + + + + + (!!! codice non previsto !!!) + + +
  • +
    +
    +
+
+ + + +

Recapiti

+
    + +
  • + Telefono: + + + +
  • +
    + +
  • + Fax: + + + +
  • +
    + +
  • + E-mail: + + + +
  • +
    +
+
+
+ + +

Riferimento amministrativo

+
    +
  • + Riferimento: + + + +
  • +
+
+
+
+ + + + +
+

Dati del rappresentante fiscale del cedente / prestatore

+ + +

Dati anagrafici

+ +
    + + +
  • + Identificativo fiscale ai fini IVA: + + + + +
  • +
    + +
  • + Codice fiscale: + + + +
  • +
    + +
  • + Denominazione: + + + +
  • +
    + +
  • + Nome: + + + +
  • +
    + +
  • + Cognome: + + + +
  • +
    + +
  • + Titolo onorifico: + + + +
  • +
    + +
  • + Codice EORI: + + + +
  • +
    +
    +
+
+ +
+
+ + + + +
+

Dati del cessionario / committente

+ + +

Dati anagrafici

+ +
    + + +
  • + Identificativo fiscale ai fini IVA: + + + + +
  • +
    + +
  • + Codice Fiscale: + + + +
  • +
    + +
  • + Denominazione: + + + +
  • +
    + +
  • + Nome: + + + +
  • +
    + +
  • + Cognome: + + + +
  • +
    + +
  • + Titolo onorifico: + + + +
  • +
    + +
  • + Codice EORI: + + + +
  • +
    +
    +
+
+ + + +

Dati della sede

+ +
    + + +
  • + Indirizzo: + + + +
  • +
    + +
  • + Numero civico: + + + +
  • +
    + +
  • + CAP: + + + +
  • +
    + +
  • + Comune: + + + +
  • +
    + +
  • + Provincia: + + + +
  • +
    + +
  • + Nazione: + + + +
  • +
    +
    +
+
+ + + +

Stabile organizzazione del cessionario / committente

+ +
    + + +
  • + Indirizzo: + + + +
  • +
    + +
  • + Numero civico: + + + +
  • +
    + +
  • + CAP: + + + +
  • +
    + +
  • + Comune: + + + +
  • +
    + +
  • + Provincia: + + + +
  • +
    + +
  • + Nazione: + + + +
  • +
    +
    +
+
+ + +
+

Dati del rappresentante fiscale del cessionario / committente

+ +
    + + +
  • + Identificativo fiscale ai fini IVA: + + + + +
  • +
    + +
  • + Denominazione: + + + +
  • +
    + +
  • + Nome: + + + +
  • +
    + +
  • + Cognome: + + + +
  • +
    +
    +
+
+
+ + +
+
+ + + + +
+ + +

Dati del terzo intermediario soggetto emittente

+ + +

Dati anagrafici

+ +
    + +
  • + Identificativo fiscale ai fini IVA: + + + + +
  • +
    + +
  • + Codice Fiscale: + + + +
  • +
    + +
  • + Denominazione: + + + +
  • +
    + +
  • + Nome: + + + +
  • +
    + +
  • + Cognome: + + + +
  • +
    + +
  • + Titolo onorifico: + + + +
  • +
    + +
  • + Codice EORI: + + + +
  • +
    +
+
+
+
+
+ + + + +
+

Soggetto emittente la fattura

+
    +
  • + Soggetto emittente: + + + + + + + + + (cessionario/committente) + + + (terzo) + + + + + (!!! codice non previsto !!!) + + +
  • +
+
+
+ + + +
+
+ + + + + + + + + + +

+ Numero documento nel lotto: + +

+
+ +
+
+ Versione +
+ + + +
+ + + + +
+

Dati generali del documento

+ +
    + +
  • + Tipologia documento: + + + + + + + + + + (fattura) + + + (acconto/anticipo su fattura) + + + (acconto/anticipo su parcella) + + + (nota di credito) + + + (nota di debito) + + + (parcella) + + + + + (!!! codice non previsto !!!) + + +
  • +
    + +
  • + Valuta importi: + + + +
  • +
    + +
  • + Data documento: + + + + + + +
  • +
    + +
  • + Numero documento: + + + +
  • +
    + +
  • + Importo totale documento: + + + +
  • +
    + +
  • + Arrotondamento su Importo totale documento: + + + +
  • +
    + + +
  • + Causale: + + + +
  • + +
    + +
  • + Art. 73 DPR 633/72: + + + +
  • +
    +
+ + + +
+ +

Ritenuta

+
    + +
  • + Tipologia ritenuta: + + + + + + + + + (ritenuta persone fisiche) + + + (ritenuta persone giuridiche) + + + + + (!!! codice non previsto !!!) + + +
  • +
    + +
  • + Importo ritenuta: + + + +
  • +
    + +
  • + Aliquota ritenuta (%): + + + +
  • +
    + +
  • + Causale di pagamento: + + + + + + + + (decodifica come da modello 770S) + +
  • +
    +
+
+
+
+ + + + +
+ +

Bollo

+
    + +
  • + Bollo virtuale: + + + +
  • +
    + +
  • + Importo bollo: + + + +
  • +
    +
+
+
+
+ + + + +
+

Cassa previdenziale

+ +
    + +
  • + Tipologia cassa previdenziale: + + + + + + + + + (Cassa Nazionale Previdenza e Assistenza Avvocati + e Procuratori legali) + + + (Cassa Previdenza Dottori Commercialisti) + + + (Cassa Previdenza e Assistenza Geometri) + + + (Cassa Nazionale Previdenza e Assistenza + Ingegneri e Architetti liberi profess.) + + + (Cassa Nazionale del Notariato) + + + (Cassa Nazionale Previdenza e Assistenza + Ragionieri e Periti commerciali) + + + (Ente Nazionale Assistenza Agenti e Rappresentanti + di Commercio-ENASARCO) + + + (Ente Nazionale Previdenza e Assistenza Consulenti + del Lavoro-ENPACL) + + + (Ente Nazionale Previdenza e Assistenza + Medici-ENPAM) + + + (Ente Nazionale Previdenza e Assistenza + Farmacisti-ENPAF) + + + (Ente Nazionale Previdenza e Assistenza + Veterinari-ENPAV) + + + (Ente Nazionale Previdenza e Assistenza Impiegati + dell'Agricoltura-ENPAIA) + + + (Fondo Previdenza Impiegati Imprese di Spedizione + e Agenzie Marittime) + + + (Istituto Nazionale Previdenza Giornalisti + Italiani-INPGI) + + + (Opera Nazionale Assistenza Orfani Sanitari + Italiani-ONAOSI) + + + (Cassa Autonoma Assistenza Integrativa + Giornalisti Italiani-CASAGIT) + + + (Ente Previdenza Periti Industriali e Periti + Industriali Laureati-EPPI) + + + (Ente Previdenza e Assistenza + Pluricategoriale-EPAP) + + + (Ente Nazionale Previdenza e Assistenza + Biologi-ENPAB) + + + (Ente Nazionale Previdenza e Assistenza + Professione Infermieristica-ENPAPI) + + + (Ente Nazionale Previdenza e Assistenza + Psicologi-ENPAP) + + + (INPS) + + + + + (!!! codice non previsto !!!) + + +
  • +
    + +
  • + Aliquota contributo cassa (%): + + + +
  • +
    + +
  • + Importo contributo cassa: + + + +
  • +
    + +
  • + Imponibile previdenziale: + + + +
  • +
    + +
  • + Aliquota IVA applicata: + + + +
  • +
    + +
  • + Contributo cassa soggetto a ritenuta: + + + +
  • +
    + +
  • + Tipologia di non imponibilità del contributo: + + + + + + + + + (escluse ex art. 15) + + + (non soggette) + + + (non imponibili) + + + (esenti) + + + (regime del margine / IVA non esposta in fattura) + + + (inversione contabile) + + + (IVA assolta in altro Stato UE) + + + + + (!!! codice non previsto !!!) + + +
  • +
    + +
  • + Riferimento amministrativo / contabile: + + + +
  • +
    +
+
+
+
+ + + + +

Sconto/maggiorazione

+
+ +
    + +
  • + Tipologia: + + + + + + + + + + (sconto) + + + + (maggiorazione) + + + + (!!! codice non previsto !!!) + + +
  • +
    + +
  • + Percentuale: + + + +
  • +
    + +
  • + Importo: + + + +
  • +
    +
+
+
+
+ + +
+
+ + + + +
+

Dati dell'ordine di acquisto

+ + +
    + +
  • + Numero linea di fattura a cui si riferisce: + + + + , + + + + +
  • +
    + +
  • + Identificativo ordine di acquisto: + + + +
  • +
    + +
  • + Data ordine di acquisto: + + + + + + +
  • +
    + +
  • + Numero linea ordine di acquisto: + + + +
  • +
    + +
  • + Codice commessa/convenzione: + + + +
  • +
    + +
  • + Codice Unitario Progetto (CUP): + + + +
  • +
    + +
  • + Codice Identificativo Gara (CIG): + + + +
  • +
    +
+
+
+
+ + + + +
+

Dati del contratto

+ +
    + +
  • + Numero linea di fattura a cui si riferisce: + + + + , + + + + +
  • +
    + +
  • + Identificativo contratto: + + + +
  • +
    + +
  • + Data contratto: + + + + + + +
  • +
    + +
  • + Numero linea contratto: + + + +
  • +
    + +
  • + Codice commessa/convenzione: + + + +
  • +
    + +
  • + Codice Unitario Progetto (CUP): + + + +
  • +
    + +
  • + Codice Identificativo Gara (CIG): + + + +
  • +
    +
+
+
+
+ + + + +
+

Dati della convenzione

+ +
    + +
  • + Numero linea di fattura a cui si riferisce: + + + + , + + + + + +
  • +
    + +
  • + Identificativo convenzione: + + + +
  • +
    + +
  • + Data convenzione: + + + + + + +
  • +
    + +
  • + Numero linea convenzione: + + + +
  • +
    + +
  • + Codice commessa/convenzione: + + + +
  • +
    + +
  • + Codice Unitario Progetto (CUP): + + + +
  • +
    + +
  • + Codice Identificativo Gara (CIG): + + + +
  • +
    +
+
+
+
+ + + + +
+

Dati della ricezione

+ +
    + +
  • + Numero linea di fattura a cui si riferisce: + + + + , + + + + + +
  • +
    + +
  • + Identificativo ricezione: + + + +
  • +
    + +
  • + Data ricezione: + + + + + + +
  • +
    + +
  • + Numero linea ricezione: + + + +
  • +
    + +
  • + Codice commessa/convenzione: + + + +
  • +
    + +
  • + Codice Unitario Progetto (CUP): + + + +
  • +
    + +
  • + Codice Identificativo Gara (CIG): + + + +
  • +
    +
+
+
+
+ + + + +
+

Dati della fattura collegata

+ +
    + +
  • + Numero linea di fattura a cui si riferisce: + + + + , + + + + + +
  • +
    + +
  • + Identificativo fattura collegata: + + + +
  • +
    + +
  • + Data fattura collegata: + + + + + + +
  • +
    + +
  • + Numero linea fattura collegata: + + + +
  • +
    + +
  • + Codice commessa/convenzione: + + + +
  • +
    + +
  • + Codice Unitario Progetto (CUP): + + + +
  • +
    + +
  • + Codice Identificativo Gara (CIG): + + + +
  • +
    +
+
+
+
+ + + + +
+

Stato avanzamento lavori

+
    + +
  • + Numero fase avanzamento: + + + + , + + + + +
  • +
    +
+
+
+ + + + +
+

Dati del documento di trasporto

+ +
    + +
  • + Numero DDT: + + + +
  • +
    + +
  • + Data DDT: + + + + + + +
  • +
    + +
  • + Numero linea di fattura a cui si riferisce: + + + + , + + + + +
  • +
    +
+
+
+
+ + + + +
+

Dati relativi al trasporto

+ + +

Dati del vettore

+ +
    + + +
  • + Identificativo fiscale ai fini IVA: + + + + +
  • +
    + +
  • + Codice Fiscale: + + + +
  • +
    + +
  • + Denominazione: + + + +
  • +
    + +
  • + Nome: + + + +
  • +
    + +
  • + Cognome: + + + +
  • +
    + +
  • + Titolo onorifico: + + + +
  • +
    + +
  • + Codice EORI: + + + +
  • +
    + +
  • + Numero licenza di guida: + + + +
  • +
    +
    +
+
+ + +

Altri dati

+ +
    + + +
  • + Mezzo di trasporto: + + + +
  • +
    + +
  • + Causale trasporto: + + + +
  • +
    + +
  • + Numero colli trasportati: + + + +
  • +
    + +
  • + Descrizione beni trasportati: + + + +
  • +
    + +
  • + Unità di misura del peso merce: + + + +
  • +
    + +
  • + Peso lordo: + + + +
  • +
    + +
  • + Peso netto: + + + +
  • +
    + +
  • + Data e ora ritiro merce: + + + + + + +
  • +
    + +
  • + Data inizio trasporto: + + + + + + +
  • +
    + +
  • + Tipologia di resa: + + + + + (codifica secondo standard ICC) +
  • +
    + +
  • + Indirizzo di resa: + + + +
  • +
    + +
  • + Numero civico indirizzo di resa: + + + +
  • +
    + +
  • + CAP indirizzo di resa: + + + +
  • +
    + +
  • + Comune di resa: + + + +
  • +
    + +
  • + Provincia di resa: + + + +
  • +
    + +
  • + Nazione di resa: + + + +
  • +
    +
    +
+
+ +
+
+ + + + +
+

Dati relativi alla fattura principale

+
    + +
  • + Numero fattura principale: + + + +
  • +
    + +
  • + Data fattura principale: + + + + + + +
  • +
    +
+
+
+ + +
+
+ + + + +
+ + + +
+

Dati relativi alle linee di dettaglio della fornitura

+ + +
+ Nr. linea: + + + +
+ +
    + +
  • + Tipo cessione/prestazione: + + + + + + + + + (sconto) + + + (premio) + + + (abbuono) + + + (spesa accessoria) + + + (!!! codice non previsto !!!) + + +
  • +
    + +
  • +
    Codifica articolo
    + +
      + +
    • + Tipo: + + + +
    • +
      + +
    • + Valore: + + + +
    • +
      +
    +
    +
  • +
    + +
  • + Descrizione bene/servizio: + + + +
  • +
    + +
  • + Quantità: + + + +
  • +
    + +
  • + Unità di misura: + + + +
  • +
    + +
  • + Data inizio periodo di riferimento: + + + + + + +
  • +
    + +
  • + Data fine periodo di riferimento: + + + + + + +
  • +
    + +
  • + Valore unitario: + + + +
  • +
    + +
  • +
    Sconto/Maggiorazione
    + + +
      + +
    • + Tipo: + + + + + + + + + + (sconto) + + + + (maggiorazione) + + + + (!!! codice non previsto !!!) + + +
    • +
      + +
    • + Percentuale (%): + + + +
    • +
      + +
    • + Importo: + + + +
    • +
      +
    +
    +
  • +
    + +
  • + Valore totale: + + + +
  • +
    + +
  • + IVA (%): + + + +
  • +
    + +
  • + Soggetta a ritenuta: + + + +
  • +
    + +
  • + Natura operazione: + + + + + + + + + (esclusa ex art.15) + + + (non soggetta) + + + (non imponibile) + + + (esente) + + + (regime del margine / IVA non esposta in fattura) + + + (inversione contabile) + + + (IVA assolta in altro Stato UE) + + + (!!! codice non previsto !!!) + + +
  • +
    + +
  • + Riferimento amministrativo/contabile: + + + +
  • +
    + +
  • +
    Altri dati gestionali
    +
      + + +
    • + Tipo dato: + + + +
    • +
      + +
    • + Valore testo: + + + +
    • +
      + +
    • + Valore numerico: + + + +
    • +
      + +
    • + Valore data: + + + + + + +
    • +
      +
      +
    +
  • +
    +
+
+
+
+ + + + +
+

Dati di riepilogo per aliquota IVA e natura

+ +
    + +
  • + Aliquota IVA (%): + + + +
  • +
    + +
  • + Natura operazioni: + + + + + + + + + (escluse ex art.15) + + + (non soggette) + + + (non imponibili) + + + (esenti) + + + (regime del margine / IVA non esposta in fattura) + + + (inversione contabile) + + + (IVA assolta in altro Stato UE) + + + (!!! codice non previsto !!!) + + +
  • +
    + +
  • + Spese accessorie: + + + +
  • +
    + +
  • + Arrotondamento: + + + +
  • +
    + +
  • + Totale imponibile/importo: + + + +
  • +
    + +
  • + Totale imposta: + + + +
  • +
    + +
  • + Esigibilità IVA: + + + + + + + + + (esigibilità immediata) + + + (esigibilità differita) + + + (scissione dei pagamenti) + + + (!!! codice non previsto !!!) + + +
  • +
    + +
  • + Riferimento normativo: + + + +
  • +
    +
+
+
+
+ + +
+
+ + + + +
+

Dati Veicoli ex art. 38 dl 331/1993

+
    + + +
  • + Data prima immatricolazione / iscrizione PR: + + + + + + +
  • +
    + +
  • + Totale percorso: + + + +
  • +
    +
    +
+
+
+ + + + +
+

Dati relativi al pagamento

+
    + + +
  • + Condizioni di pagamento: + + + + + + + + + (pagamento a rate) + + + (pagamento completo) + + + (anticipo) + + + + + (!!! codice non previsto !!!) + + +
  • +
    + + +
    Dettaglio pagamento
    + + +
      + +
    • + Beneficiario del pagamento: + + + +
    • +
      + +
    • + Modalità: + + + + + + + + + (contanti) + + + (assegno) + + + (assegno circolare) + + + (contanti presso Tesoreria) + + + (bonifico) + + + (vaglia cambiario) + + + (bollettino bancario) + + + (carta di pagamento) + + + (RID) + + + (RID utenze) + + + (RID veloce) + + + (RIBA) + + + (MAV) + + + (quietanza erario) + + + (giroconto su conti di contabilità speciale) + + + (domiciliazione bancaria) + + + (domiciliazione postale) + + + (bollettino di c/c postale) + + + (SEPA Direct Debit) + + + (SEPA Direct Debit CORE) + + + (SEPA Direct Debit B2B) + + + (Trattenuta su somme già riscosse) + + + + + (!!! codice non previsto !!!) + + +
    • +
      + +
    • + Decorrenza termini di pagamento: + + + + + + +
    • +
      + +
    • + Termini di pagamento (in giorni): + + + +
    • +
      + +
    • + Data scadenza pagamento: + + + + + + +
    • +
      + +
    • + Importo: + + + +
    • +
      + +
    • + Codice Ufficio Postale: + + + +
    • +
      + +
    • + Cognome del quietanzante: + + + +
    • +
      + +
    • + Nome del quietanzante: + + + +
    • +
      + +
    • + CF del quietanzante: + + + +
    • +
      + +
    • + Titolo del quietanzante: + + + +
    • +
      + +
    • + Istituto finanziario: + + + +
    • +
      + +
    • + Codice IBAN: + + + +
    • +
      + +
    • + Codice ABI: + + + +
    • +
      + +
    • + Codice CAB: + + + +
    • +
      + +
    • + Codice BIC: + + + +
    • +
      + +
    • + Sconto per pagamento anticipato: + + + +
    • +
      + +
    • + Data limite per il pagamento anticipato: + + + + + + +
    • +
      + +
    • + Penale per ritardato pagamento: + + + +
    • +
      + +
    • + Data di decorrenza della penale: + + + + + + +
    • +
      + +
    • + Codice pagamento: + + + +
    • +
      +
    +
    +
    +
    +
+ +
+
+ + + + +
+

Dati relativi agli allegati

+ + +
    + +
  • + Nome dell'allegato: + + + +
  • +
    + +
  • + Algoritmo di compressione: + + + +
  • +
    + +
  • + Formato: + + + +
  • +
    + +
  • + Descrizione: + + + +
  • +
    +
+
+
+
+ + + +
+
+ + +
+
+
+ + +
+
\ No newline at end of file From 2a4449024cd02eae0298c693144d068364929fea Mon Sep 17 00:00:00 2001 From: Toni Magni Date: Thu, 26 Jul 2018 14:21:31 +0200 Subject: [PATCH 05/16] Update to new specifications of "Natura" tag. --- PyFePA/fepa.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PyFePA/fepa.py b/PyFePA/fepa.py index 3d736b5..57d58d3 100644 --- a/PyFePA/fepa.py +++ b/PyFePA/fepa.py @@ -27,7 +27,7 @@ TD = ['TD{:0=2d}'.format(td) for td in range(1, 6)] TR = ['RT01','RT01'] TC = ['TC{:0=2d}'.format(tc) for tc in range(1,22)] -NT = ['NT{:0=2d}'.format(nt) for nt in range(1,7)] +NT = ['N{:0=1d}'.format(nt) for nt in range(1,8)] TCP = ('SC', 'PR', 'AB', 'AC') SM = ('SC', 'MG') TP = ('TP01', 'TP02', 'TP03') From 4afaf6e680237a9778544af2d6f081ed5baf10b5 Mon Sep 17 00:00:00 2001 From: Toni Magni Date: Thu, 26 Jul 2018 14:23:04 +0200 Subject: [PATCH 06/16] Fix a condition was throwing exceptions when storing floats to XML ElementTree.text element. --- PyFePA/serializer.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PyFePA/serializer.py b/PyFePA/serializer.py index 633d383..fa7fbd3 100644 --- a/PyFePA/serializer.py +++ b/PyFePA/serializer.py @@ -146,6 +146,8 @@ def serializexml(invoice_part,tagname): for t in taglist[k]['value']: fe.append(serializexml(t, taglist[k]['tag'])) elif taglist[k]['type'] == 'S' and taglist[k]['value'] is not None: + if type(taglist[k]['value']) != unicode: + taglist[k]['value'] = unicode(taglist[k]['value']) (ElementTree.SubElement(fe, taglist[k]['tag'])).text = taglist[k]['value'] elif taglist[k]['type'] == 'O' and taglist[k]['value'] is not None: fe.append(serializexml(taglist[k]['value'],taglist[k]['tag'])) From 1b683ae2f7c2340f10ff9d2e69855b2b920b541e Mon Sep 17 00:00:00 2001 From: Toni Magni Date: Thu, 26 Jul 2018 16:22:34 +0200 Subject: [PATCH 07/16] Implemented Decimal to properly format currency numbers, especially useful for 0 values, because floats do not print 0.0 as 0.00, as required by this standard. --- PyFePA/fields.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PyFePA/fields.py b/PyFePA/fields.py index 1466716..8596808 100644 --- a/PyFePA/fields.py +++ b/PyFePA/fields.py @@ -18,6 +18,7 @@ import datetime import importlib import dateutil.parser +from decimal import Decimal class FieldType(object): @@ -141,7 +142,7 @@ def validate(self, value): if super(FieldDecimal,self).validate(value): return value elif self.minlen <= len('{:.2f}'.format(float(value))) <= self.maxlen: - return float(value) + return Decimal(value).quantize(Decimal('.01')) except(ValueError, TypeError): print('DEBUG- ', value) return False @@ -155,7 +156,7 @@ def __init__(self, **kwargs): @classmethod def tostring(cls,value): - return '{:.2f}'.format(float(value)) + return unicode(Decimal(value).quantize(Decimal('.01'))) class FieldDate(FieldType): From ffb3a0a451de06aad69265b33ad8191c01679566 Mon Sep 17 00:00:00 2001 From: Toni Magni Date: Thu, 26 Jul 2018 16:23:01 +0200 Subject: [PATCH 08/16] Reverted incorrect datetime prior fix. --- PyFePA/serializer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PyFePA/serializer.py b/PyFePA/serializer.py index fa7fbd3..34eb8b5 100644 --- a/PyFePA/serializer.py +++ b/PyFePA/serializer.py @@ -97,7 +97,7 @@ def globalvalidation(fattura): and fattura.FatturaElettronicaHeader.CedentePrestatore.DatiAnagrafici.Anagrafica.Denominazione is None: raise ValidateException('Denominazione Azienda Mancante') for feb in fattura.FatturaElettronicaBody: - if feb.DatiGenerali.DatiGeneraliDocumento.Data > datetime.datetime.today(): + if feb.DatiGenerali.DatiGeneraliDocumento.Data > datetime.date.today(): print(feb.DatiGenerali.DatiGeneraliDocumento.Data, '- TODAY -', datetime.date.today()) raise ValidateException('00403 - Data Fattura non puo essere nel futuro') for ln in feb.DatiBeniServizi.DettaglioLinee: From 146fee25c5e9cc6423ad24b340a42e083a58011c Mon Sep 17 00:00:00 2001 From: Toni Magni Date: Wed, 10 Oct 2018 18:50:15 +0200 Subject: [PATCH 09/16] Bumped version; Fixes issue in fields.py to allow for unicode strings to be processed properly. --- MANIFEST | 11 +++++++++++ PyFePA/fields.py | 10 +++++----- setup.py | 2 +- 3 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 MANIFEST diff --git a/MANIFEST b/MANIFEST new file mode 100644 index 0000000..062211a --- /dev/null +++ b/MANIFEST @@ -0,0 +1,11 @@ +# file GENERATED by distutils, do NOT edit +setup.py +PyFePA/__init__.py +PyFePA/fepa.py +PyFePA/fields.py +PyFePA/sdi.py +PyFePA/serializer.py +PyFePA/siamm.py +PyFePA/utils.py +PyFePA/xsd/fatturapa_v1.2.xsd +PyFePA/xsd/xmldsig-core-schema.xsd diff --git a/PyFePA/fields.py b/PyFePA/fields.py index 8596808..ccb5d30 100644 --- a/PyFePA/fields.py +++ b/PyFePA/fields.py @@ -57,14 +57,14 @@ def validate(self, value): elif not (self.minlen and self.maxlen ): valid = True elif self.minlen and not self.maxlen : - valid = self.minlen <= len(str(value)) + valid = self.minlen <= len(unicode(value)) elif self.maxlen and not self.minlen: - valid = len(str(value)) <= self.maxlen + valid = len(unicode(value)) <= self.maxlen else: - valid = self.minlen <= len(str(value)) <= self.maxlen + valid = self.minlen <= len(unicode(value)) <= self.maxlen if valid: - return value if isinstance(value,str) else str(value) + return value if isinstance(value,unicode) else unicode(value) else: return valid @@ -77,7 +77,7 @@ def __init__(self, **kwargs): @classmethod def tostring(cls,value): - return str(value) + return unicode(value) class FieldCostant(FieldType): diff --git a/setup.py b/setup.py index 16f6704..904742c 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ setup( name = 'PyFePA', packages = ['PyFePA'], - version = '1.2.1b', + version = '1.2.2b', description = 'Python object of italian FatturaPA, serialize, deserialize and verify', author = 'Luigi Di Naro', author_email = 'Luigi.DiNaro@ktec.it', From 5f31ae1f5e50071fdc0e7889ce126a55f84d4d6f Mon Sep 17 00:00:00 2001 From: Toni Magni Date: Tue, 18 Dec 2018 20:19:46 -0500 Subject: [PATCH 10/16] Unicode fixed and minor English typo corrections. --- PyFePA/fields.py | 9 +++++---- PyFePA/serializer.py | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/PyFePA/fields.py b/PyFePA/fields.py index ccb5d30..273e44e 100644 --- a/PyFePA/fields.py +++ b/PyFePA/fields.py @@ -57,14 +57,15 @@ def validate(self, value): elif not (self.minlen and self.maxlen ): valid = True elif self.minlen and not self.maxlen : - valid = self.minlen <= len(unicode(value)) + valid = self.minlen <= len(value) elif self.maxlen and not self.minlen: - valid = len(unicode(value)) <= self.maxlen + valid = len(value) <= self.maxlen else: - valid = self.minlen <= len(unicode(value)) <= self.maxlen + valid = self.minlen <= len(value) <= self.maxlen + if valid: - return value if isinstance(value,unicode) else unicode(value) + return value if isinstance(value,unicode) else value.decode('utf8') else: return valid diff --git a/PyFePA/serializer.py b/PyFePA/serializer.py index 34eb8b5..cd4235d 100644 --- a/PyFePA/serializer.py +++ b/PyFePA/serializer.py @@ -57,11 +57,11 @@ def validate(invoice_part): elif v['value'] is not None and v['conflict'] is not None: for d in v['conflict']: if taglist[d]['value'] is not None: - raise ValidateException('{0} Conflict whit {1}'.format(v['tag'],v['conflict'])) + raise ValidateException('{0} Conflict with {1}'.format(v['tag'],v['conflict'])) elif v['value'] is None and v['conflict'] is not None and v['required']: for d in v['conflict']: if taglist[d]['value'] is None: - raise ValidateException('{0} or {1} mast be specify'.format(v['tag'],v['conflict'])) + raise ValidateException('{0} or {1} must be specified'.format(v['tag'],v['conflict'])) return taglist From 8056a82ee89b0299947fc5fd7073a3efc8669acd Mon Sep 17 00:00:00 2001 From: Toni Magni Date: Sun, 10 Feb 2019 21:22:07 -0500 Subject: [PATCH 11/16] Improve wording for output printed when an error occurs during validation. --- PyFePA/serializer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PyFePA/serializer.py b/PyFePA/serializer.py index cd4235d..1e8826f 100644 --- a/PyFePA/serializer.py +++ b/PyFePA/serializer.py @@ -57,11 +57,11 @@ def validate(invoice_part): elif v['value'] is not None and v['conflict'] is not None: for d in v['conflict']: if taglist[d]['value'] is not None: - raise ValidateException('{0} Conflict with {1}'.format(v['tag'],v['conflict'])) + raise ValidateException('Cannot specify both {0} and {1} at the same time'.format(v['tag'],v['conflict'])) elif v['value'] is None and v['conflict'] is not None and v['required']: for d in v['conflict']: if taglist[d]['value'] is None: - raise ValidateException('{0} or {1} must be specified'.format(v['tag'],v['conflict'])) + raise ValidateException('Must specify either {0} or {1} but not both at the same time'.format(v['tag'],v['conflict'])) return taglist From ea88af831967a2a62970e4fe68bc93d3b47d8f26 Mon Sep 17 00:00:00 2001 From: Toni Magni Date: Sun, 10 Feb 2019 22:02:06 -0500 Subject: [PATCH 12/16] Improve output on validation errors. --- PyFePA/serializer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PyFePA/serializer.py b/PyFePA/serializer.py index 1e8826f..aca8905 100644 --- a/PyFePA/serializer.py +++ b/PyFePA/serializer.py @@ -61,7 +61,7 @@ def validate(invoice_part): elif v['value'] is None and v['conflict'] is not None and v['required']: for d in v['conflict']: if taglist[d]['value'] is None: - raise ValidateException('Must specify either {0} or {1} but not both at the same time'.format(v['tag'],v['conflict'])) + raise ValidateException('Either {0} or {1} is missing. Alternatively they could both be specified, which is not allowed.'.format(v['tag'],v['conflict'])) return taglist From 1d15657fb04ce2ed83947899e71fd93edd40c495 Mon Sep 17 00:00:00 2001 From: Toni Magni Date: Wed, 26 Aug 2020 06:45:43 -0400 Subject: [PATCH 13/16] Add gitignore --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d456f47 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +*.pyc +dist/ +.vscode/ +*.egg-info/ +MANIFEST \ No newline at end of file From 681a6d47759037d1568f4655809b25d25e435df9 Mon Sep 17 00:00:00 2001 From: Toni Magni Date: Mon, 18 Jan 2021 12:07:26 -0500 Subject: [PATCH 14/16] Removing accidentally added MANIFEST. --- MANIFEST | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 MANIFEST diff --git a/MANIFEST b/MANIFEST deleted file mode 100644 index 062211a..0000000 --- a/MANIFEST +++ /dev/null @@ -1,11 +0,0 @@ -# file GENERATED by distutils, do NOT edit -setup.py -PyFePA/__init__.py -PyFePA/fepa.py -PyFePA/fields.py -PyFePA/sdi.py -PyFePA/serializer.py -PyFePA/siamm.py -PyFePA/utils.py -PyFePA/xsd/fatturapa_v1.2.xsd -PyFePA/xsd/xmldsig-core-schema.xsd From 5740f93d1d2713bd2039d89b25061d5bc7bbbb77 Mon Sep 17 00:00:00 2001 From: Toni Magni Date: Wed, 27 Jan 2021 16:14:04 -0500 Subject: [PATCH 15/16] 2to3 conversions to improve Python3 compatibility --- PyFePA/fields.py | 8 ++++---- PyFePA/serializer.py | 6 +++--- PyFePA/test/build_fatturapa.py | 2 +- runit.py | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/PyFePA/fields.py b/PyFePA/fields.py index 273e44e..a30324c 100644 --- a/PyFePA/fields.py +++ b/PyFePA/fields.py @@ -65,7 +65,7 @@ def validate(self, value): if valid: - return value if isinstance(value,unicode) else value.decode('utf8') + return value if isinstance(value,str) else value.decode('utf8') else: return valid @@ -78,7 +78,7 @@ def __init__(self, **kwargs): @classmethod def tostring(cls,value): - return unicode(value) + return str(value) class FieldCostant(FieldType): @@ -145,7 +145,7 @@ def validate(self, value): elif self.minlen <= len('{:.2f}'.format(float(value))) <= self.maxlen: return Decimal(value).quantize(Decimal('.01')) except(ValueError, TypeError): - print('DEBUG- ', value) + print(('DEBUG- ', value)) return False def __init__(self, **kwargs): @@ -157,7 +157,7 @@ def __init__(self, **kwargs): @classmethod def tostring(cls,value): - return unicode(Decimal(value).quantize(Decimal('.01'))) + return str(Decimal(value).quantize(Decimal('.01'))) class FieldDate(FieldType): diff --git a/PyFePA/serializer.py b/PyFePA/serializer.py index aca8905..d5647fc 100644 --- a/PyFePA/serializer.py +++ b/PyFePA/serializer.py @@ -98,7 +98,7 @@ def globalvalidation(fattura): raise ValidateException('Denominazione Azienda Mancante') for feb in fattura.FatturaElettronicaBody: if feb.DatiGenerali.DatiGeneraliDocumento.Data > datetime.date.today(): - print(feb.DatiGenerali.DatiGeneraliDocumento.Data, '- TODAY -', datetime.date.today()) + print((feb.DatiGenerali.DatiGeneraliDocumento.Data, '- TODAY -', datetime.date.today())) raise ValidateException('00403 - Data Fattura non puo essere nel futuro') for ln in feb.DatiBeniServizi.DettaglioLinee: if ln.Ritenuta and not feb.DatiGenerali.DatiGeneraliDocumento.DatiRitenuta: @@ -146,8 +146,8 @@ def serializexml(invoice_part,tagname): for t in taglist[k]['value']: fe.append(serializexml(t, taglist[k]['tag'])) elif taglist[k]['type'] == 'S' and taglist[k]['value'] is not None: - if type(taglist[k]['value']) != unicode: - taglist[k]['value'] = unicode(taglist[k]['value']) + if type(taglist[k]['value']) != str: + taglist[k]['value'] = str(taglist[k]['value']) (ElementTree.SubElement(fe, taglist[k]['tag'])).text = taglist[k]['value'] elif taglist[k]['type'] == 'O' and taglist[k]['value'] is not None: fe.append(serializexml(taglist[k]['value'],taglist[k]['tag'])) diff --git a/PyFePA/test/build_fatturapa.py b/PyFePA/test/build_fatturapa.py index 15ee31b..ae65f1f 100644 --- a/PyFePA/test/build_fatturapa.py +++ b/PyFePA/test/build_fatturapa.py @@ -221,4 +221,4 @@ def allegati(self): if __name__ == "__main__": fatturapa = FatturaPA() fpa = fatturapa.get_fatturapa() - print(serializer(fpa,'xml')) \ No newline at end of file + print((serializer(fpa,'xml'))) \ No newline at end of file diff --git a/runit.py b/runit.py index 5c5dc75..ff5d9ee 100644 --- a/runit.py +++ b/runit.py @@ -34,7 +34,7 @@ with open(DPATH+'/PyFePA/test/IT01234567890_11001.xml', 'rt') as f: tree = ElementTree.parse(f) fe = serializer.deserialize(element=tree) - print(serializer.serializer(fe,'xml')) + print((serializer.serializer(fe,'xml'))) testdata_list = [testdata,testdata,testdata] -print(siamm.serialize(testdata_list)) \ No newline at end of file +print((siamm.serialize(testdata_list))) \ No newline at end of file From 9f61f72acb070a0cead007071c06634883033e98 Mon Sep 17 00:00:00 2001 From: Toni Magni Date: Tue, 2 Feb 2021 08:22:57 -0500 Subject: [PATCH 16/16] Bumped version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 904742c..3f01bfe 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ setup( name = 'PyFePA', packages = ['PyFePA'], - version = '1.2.2b', + version = '1.2.3', description = 'Python object of italian FatturaPA, serialize, deserialize and verify', author = 'Luigi Di Naro', author_email = 'Luigi.DiNaro@ktec.it',