Пример #1
0
 def parseSummary(self, xmlSummary: Element) -> InvoiceSummary:
     summary = InvoiceSummary()
     summary.totalLines = 0
     summary.totalNetAmount = xmlExtractText(xmlSummary, 'RAZEM_NETTO')
     summary.totalTaxableBasis = xmlExtractText(xmlSummary, 'RAZEM_NETTO')
     summary.totalTaxAmount = xmlExtractText(xmlSummary, 'RAZEM_VAT')
     summary.totalGrossAmount = xmlExtractText(xmlSummary, 'RAZEM_BRUTTO')
     summary.grossAmountInWords = ""
     summary.taxSummary = None
     return summary
Пример #2
0
 def parseHeader(self, element):
     header = InvoiceHeader()
     header.number = xmlExtractText(element, 'cbc:ID')
     header.invoiceDate = xmlExtractDate(element, 'cbc:IssueDate')
     header.salesDate = xmlExtractDate(element, 'cbc:DueDate')
     header.currency = xmlExtractText(element, 'cbc:DocumentCurrencyCode')
     header.paymentDueDate = xmlExtractDate(element, 'cbc:DueDate')
     header.paymentTerms = ""
     header.documentFunctionCode = ""
     return header
Пример #3
0
 def parseHeader(self, xmlHeader: Element) -> InvoiceHeader:
     header = InvoiceHeader()
     header.number = xmlExtractText(xmlHeader, 'NUMER_PELNY')
     header.invoiceDate = xmlExtractDate(xmlHeader, 'DATA_WYSTAWIENIA')
     header.salesDate = xmlExtractDate(xmlHeader, 'DATA_OPERACJI')
     header.currency = xmlExtractText(xmlHeader, 'SYMBOL')
     payment_xml = xmlHeader.getElementsByTagName("PLATNOSC")[0]
     header.paymentDueDate = xmlExtractDate(payment_xml, 'TERMIN')
     header.paymentTerms = xmlExtractText(payment_xml, 'FORMA')
     header.documentFunctionCode = ""
     return header
Пример #4
0
 def parseHeader(self, xmlHeader: Element) -> InvoiceHeader:
     header = InvoiceHeader()
     header.number = xmlExtractText(xmlHeader, 'InvoiceNumber')
     header.invoiceDate = xmlExtractDate(xmlHeader, 'InvoiceDate')
     header.salesDate = xmlExtractDate(xmlHeader, 'SalesDate')
     header.currency = xmlExtractText(xmlHeader, 'InvoiceCurrency')
     header.paymentDueDate = xmlExtractDate(xmlHeader,
                                            'InvoicePaymentDueDate')
     header.paymentTerms = xmlExtractText(xmlHeader, 'InvoicePaymentTerms')
     header.documentFunctionCode = xmlExtractText(xmlHeader,
                                                  'DocumentFunctionCode')
     return header
Пример #5
0
 def parseParty(self, xmlParty: Element) -> InvoiceParty:
     party = InvoiceParty()
     party.taxId = xmlExtractText(xmlParty, 'TaxID')
     party.accountNumber = xmlExtractText(xmlParty, 'AccountNumber')
     party.name = xmlExtractText(xmlParty, 'Name')
     party.streetAndNumber = xmlExtractText(xmlParty, 'StreetAndNumber')
     party.cityName = xmlExtractText(xmlParty, 'CityName')
     party.postalCode = xmlExtractText(xmlParty, 'PostalCode')
     party.country = xmlExtractText(xmlParty, 'Country')
     return party
Пример #6
0
 def parseParty(self, xmlParty: Element) -> InvoiceParty:
     party = InvoiceParty()
     party.taxId = xmlExtractText(xmlParty, 'NIP')
     party.accountNumber = xmlExtractTextOrEmpty(xmlParty,
                                                 'NUMER_KONTA_BANKOWEGO')
     party.name = xmlExtractText(xmlParty, 'NAZWA')
     party.streetAndNumber = xmlExtractText(xmlParty, 'ULICA')
     party.cityName = xmlExtractText(xmlParty, 'MIASTO')
     party.postalCode = xmlExtractText(xmlParty, 'KOD_POCZTOWY')
     party.country = xmlExtractText(xmlParty, 'KRAJ')
     return party
Пример #7
0
 def parseTaxSummary(self, xmlTaxSummary: Element) -> InvoiceTaxSummary:
     tax_summary = InvoiceTaxSummary()
     tax_summary.taxRate = xmlExtractText(xmlTaxSummary, 'TaxRate')
     tax_summary.taxCategoryCode = xmlExtractText(xmlTaxSummary,
                                                  'TaxCategoryCode')
     tax_summary.taxAmount = xmlExtractText(xmlTaxSummary, 'TaxAmount')
     tax_summary.taxableBasis = xmlExtractText(xmlTaxSummary,
                                               'TaxableBasis')
     tax_summary.taxableAmount = xmlExtractText(xmlTaxSummary,
                                                'TaxableAmount')
     tax_summary.grossAmount = xmlExtractText(xmlTaxSummary, 'GrossAmount')
     return tax_summary
Пример #8
0
 def parseParty(self, xmlParty: Element) -> InvoiceParty:
     party = InvoiceParty()
     xml_ident = xmlParty.getElementsByTagName("cac:PartyIdentification")[0]
     party.taxId = xmlExtractText(xml_ident, 'cbc:ID')
     party.accountNumber = ""
     xml_party_name = xmlParty.getElementsByTagName("cac:PartyName")[0]
     party.name = xmlExtractText(xml_party_name, 'cbc:Name')
     xml_address = xmlParty.getElementsByTagName("cac:PostalAddress")[0]
     party.streetAndNumber = xmlExtractText(xml_address, 'cbc:StreetName')
     party.cityName = xmlExtractText(xml_address, 'cbc:CityName')
     party.postalCode = xmlExtractText(xml_address, 'cbc:PostalZone')
     party.country = xmlExtractText(xml_address, 'cbc:IdentificationCode')
     return party
Пример #9
0
 def parseSummary(self, xmlSummary: Element) -> InvoiceSummary:
     summary = InvoiceSummary()
     summary.totalLines = xmlExtractText(xmlSummary, 'TotalLines')
     summary.totalNetAmount = xmlExtractText(xmlSummary, 'TotalNetAmount')
     summary.totalTaxableBasis = xmlExtractText(xmlSummary,
                                                'TotalTaxableBasis')
     summary.totalTaxAmount = xmlExtractText(xmlSummary, 'TotalTaxAmount')
     summary.totalGrossAmount = xmlExtractText(xmlSummary,
                                               'TotalGrossAmount')
     summary.grossAmountInWords = xmlExtractText(xmlSummary,
                                                 'GrossAmountInWords')
     summary.taxSummary = self.parseTaxSummary(
         xmlSummary.getElementsByTagName("Tax-Summary-Line")[0])
     return summary
Пример #10
0
 def parseLine(self, xmlLine: Element) -> InvoiceLine:
     line = InvoiceLine()
     line.LineNumber = xmlExtractText(xmlLine, 'LineNumber')
     line.EAN = xmlExtractText(xmlLine, 'EAN')
     line.BuyerItemCode = xmlExtractText(xmlLine, 'BuyerItemCode')
     line.SupplierItemCode = xmlExtractText(xmlLine, 'SupplierItemCode')
     line.ItemDescription = xmlExtractText(xmlLine, 'ItemDescription')
     line.ItemType = xmlExtractText(xmlLine, 'ItemType')
     line.InvoiceQuantity = xmlExtractText(xmlLine, "InvoiceQuantity")
     line.UnitOfMeasure = xmlExtractText(xmlLine, "UnitOfMeasure")
     line.InvoiceUnitPacksize = xmlExtractText(xmlLine,
                                               "InvoiceUnitPacksize")
     line.PackItemUnitOfMeasure = xmlExtractText(xmlLine,
                                                 "PackItemUnitOfMeasure")
     line.InvoiceUnitNetPrice = xmlExtractText(xmlLine,
                                               "InvoiceUnitNetPrice")
     line.TaxRate = xmlExtractText(xmlLine, "TaxRate")
     line.TaxCategoryCode = xmlExtractText(xmlLine, "TaxCategoryCode")
     line.ReferenceType = xmlExtractText(xmlLine, "ReferenceType")
     line.ReferenceNumber = xmlExtractText(xmlLine, "ReferenceNumber")
     line.TaxAmount = xmlExtractText(xmlLine, "TaxAmount")
     line.NetAmount = xmlExtractText(xmlLine, "NetAmount")
     return line
Пример #11
0
 def parseLine(self, xmlLine: Element) -> InvoiceLine:
     line = InvoiceLine()
     line.LineNumber = xmlExtractText(xmlLine, 'LP')
     line.EAN = xmlExtractText(xmlLine, 'EAN')
     line.BuyerItemCode = xmlExtractText(xmlLine, 'KOD')
     line.SupplierItemCode = xmlExtractText(xmlLine, 'NUMER_KATALOGOWY')
     line.ItemDescription = xmlExtractText(xmlLine, 'NAZWA')
     line.ItemType = ""
     line.InvoiceQuantity = xmlExtractText(xmlLine, "ILOSC")
     line.UnitOfMeasure = xmlExtractText(xmlLine, "JM")
     line.InvoiceUnitPacksize = xmlExtractText(xmlLine, "ILOSC")
     line.PackItemUnitOfMeasure = xmlExtractText(xmlLine, "JM")
     line.InvoiceUnitNetPrice = xmlExtractText(xmlLine, "PO_RABACIE_PLN")
     line.TaxRate = xmlExtractText(xmlLine, "STAWKA")
     line.TaxCategoryCode = xmlExtractText(xmlLine, "FLAGA")
     line.ReferenceType = ""
     line.ReferenceNumber = ""
     line.NetAmount = xmlExtractText(xmlLine, "WARTOSC_NETTO")
     grossAmount = xmlExtractText(xmlLine, "WARTOSC_BRUTTO")
     tax = str(round(float(grossAmount) - float(line.NetAmount), 2))
     line.TaxAmount = tax
     return line