def __FillNonSumWithChildren(self, child_element):
        child_tag = lxml_functions.GetTag(child_element)
        grandchildren = lxml_functions.GetSubElements(child_element)

        for grandchild_element in grandchildren:
            data = False
            grandchild_tag = lxml_functions.GetTag(grandchild_element)

            if child_tag == "Podatak203":
                if grandchild_tag == "Vrijednost":
                    data = pandas_functions.SumColumnInFrame(
                        data_settings.IRA_EU_taxable_base, self.IRA_EU)
                elif grandchild_tag == "Porez":
                    data = pandas_functions.SumColumnInFrame(
                        data_settings.IRA_EU_taxable_tax, self.IRA_EU)

            elif child_tag == "Podatak207":
                if grandchild_tag == "Vrijednost":
                    data = pandas_functions.SumColumnInFrame(
                        data_settings.URA_EU_DC_tax_base, self.URA_EU_DC)
                elif grandchild_tag == "Porez":
                    data = pandas_functions.SumColumnInFrame(
                        data_settings.URA_EU_DC_total, self.URA_EU_DC)

            elif child_tag == "Podatak303":
                if grandchild_tag == "Vrijednost":
                    data = 4 * pandas_functions.SumColumnInFrame(
                        data_settings.URA_EU_DOM_refundable, self.URA_EU_DOM)
                elif grandchild_tag == "Porez":
                    data = pandas_functions.SumColumnInFrame(
                        data_settings.URA_EU_DOM_refundable, self.URA_EU_DOM)

            elif child_tag == "Podatak307":
                if grandchild_tag == "Vrijednost":
                    data = pandas_functions.SumColumnInFrame(
                        data_settings.URA_EU_DC_tax_base, self.URA_EU_DC)
                elif grandchild_tag == "Porez":
                    data = pandas_functions.SumColumnInFrame(
                        data_settings.URA_EU_DC_total, self.URA_EU_DC)

            elif child_tag == "Podatak314":
                if grandchild_tag == "Vrijednost":
                    data = 4 * pandas_functions.SumColumnInFrame(
                        data_settings.URA_EU_UVOZ_total, self.URA_EU_UVOZ)
                elif grandchild_tag == "Porez":
                    data = pandas_functions.SumColumnInFrame(
                        data_settings.URA_EU_UVOZ_total, self.URA_EU_UVOZ)

            if (data != False):
                lxml_functions.SetElementText(grandchild_element, data)
예제 #2
0
    def __FillOutDeliveryNumber(self, delivery_batch, number):
        delivery_element = self.__ExtractDeliveryElement()
        all_children = lxml_functions.GetAllSubElements(delivery_element)

        customer_id = pandas_functions.GetFirstValueFromColumnFromFrame(
            data_settings.IRA_EU_customer_id, delivery_batch)

        for child_element in all_children:
            data = False
            child_tag = lxml_functions.GetTag(child_element)

            if child_tag == "RedBr":
                data = number

            elif child_tag == "KodDrzave":
                data = pandas_functions.GetValueFromColumnFromFrameIfColumnHasValue(
                    data_settings.customers_country, self.customers,
                    data_settings.customers_tax_number, customer_id)

            elif child_tag == "PDVID":
                data = customer_id

            elif child_tag == "I1":
                data = pandas_functions.SumColumnInFrame(
                    data_settings.IRA_EU_goods_sold, delivery_batch)

            elif child_tag == "I4":
                data = pandas_functions.SumColumnInFrame(
                    data_settings.IRA_EU_services_sold, delivery_batch)

            if (data != False):
                lxml_functions.SetElementText(child_element, data)

        return delivery_element
    def __FillSumChildless(self, body_element, child_element):
        data = False
        child_tag = lxml_functions.GetTag(child_element)

        if child_tag == "Podatak100":
            data = lxml_functions.GetSumOfSubElementsWithTagPatternOfElement(
                "Podatak1", body_element)

        if (data != False):
            lxml_functions.SetElementText(child_element, data)
예제 #4
0
    def __FillOutCustomerNumber(self, invoice_batch, number):
        customer_element = self.__ExtractCustomerElement()
        children = lxml_functions.GetSubElements(customer_element)

        invoices_element = self.__FillOutInvoices(invoice_batch)
        lxml_functions.AddChildElementToElement(invoices_element,
                                                customer_element)

        customer_name = pandas_functions.GetFirstValueFromColumnFromFrame(
            data_settings.invoices_customer_name, invoice_batch)

        for child_element in children:
            data = False
            child_tag = lxml_functions.GetTag(child_element)

            if child_tag == "K1":
                data = number

            elif child_tag == "K2":
                data = 1

            elif child_tag == "K3":
                number = pandas_functions.GetValueFromColumnFromFrameIfColumnHasValue(
                    data_settings.customers_tax_number, self.customers,
                    data_settings.customers_name, customer_name)
                data = transform_data.AddLeadingZerosToStringUntilLength(
                    number, 11)

            elif child_tag == "K4":
                data = customer_name

            elif child_tag == "K5":
                data = lxml_functions.GetSumOfAllSubElementsWithTagPatternOfElement(
                    "R6", invoices_element)

            elif child_tag == "K6":
                data = lxml_functions.GetSumOfAllSubElementsWithTagPatternOfElement(
                    "R7", invoices_element)

            elif child_tag == "K7":
                data = lxml_functions.GetSumOfAllSubElementsWithTagPatternOfElement(
                    "R8", invoices_element)

            elif child_tag == "K8":
                data = lxml_functions.GetSumOfAllSubElementsWithTagPatternOfElement(
                    "R9", invoices_element)

            elif child_tag == "K9":
                data = lxml_functions.GetSumOfAllSubElementsWithTagPatternOfElement(
                    "R10", invoices_element)

            if (data != False):
                lxml_functions.SetElementText(child_element, data)

        return customer_element
    def __FillSumWithChildren(self, body_element, child_element):
        child_tag = lxml_functions.GetTag(child_element)
        grandchildren = lxml_functions.GetSubElements(child_element)

        for grandchild_element in grandchildren:
            data = False
            grandchild_tag = lxml_functions.GetTag(grandchild_element)

            if child_tag == "Podatak200":
                pattern_elements = lxml_functions.GetSubElementsWithTagPattern(
                    body_element, "Podatak2")
                sum = 0.0

                if grandchild_tag == "Vrijednost":
                    for pattern_element in pattern_elements:
                        sum += lxml_functions.GetSumOfSubElementsWithTagPatternOfElement(
                            "Vrijednost", pattern_element)
                    data = sum
                elif grandchild_tag == "Porez":
                    for pattern_element in pattern_elements:
                        sum += lxml_functions.GetSumOfSubElementsWithTagPatternOfElement(
                            "Porez", pattern_element)
                    data = sum

            elif child_tag == "Podatak300":
                pattern_elements = lxml_functions.GetSubElementsWithTagPattern(
                    body_element, "Podatak3")
                sum = 0.0

                if grandchild_tag == "Vrijednost":
                    for pattern_element in pattern_elements:
                        sum += lxml_functions.GetSumOfSubElementsWithTagPatternOfElement(
                            "Vrijednost", pattern_element)
                    data = sum
                elif grandchild_tag == "Porez":
                    for pattern_element in pattern_elements:
                        sum += lxml_functions.GetSumOfSubElementsWithTagPatternOfElement(
                            "Porez", pattern_element)
                    data = sum

            if (data != False):
                lxml_functions.SetElementText(grandchild_element, data)
 def __FillOutMetadata(self):
   for child_element in self.metadata_root:
     data = False
     child_tag = lxml_functions.GetTag(child_element)
     
     if child_tag == "Autor":
       data = report_settings.Autor
       
     elif child_tag == "Datum":
       data = self.GetIsoFormatDateTimeNow()
       
     elif child_tag == "Identifikator":
       data = self.GetUUID4()
     
     if (data != False):
       lxml_functions.SetElementText(child_element, data)
예제 #7
0
    def __FillOutInvoiceNumber(self, invoice, number):
        invoice_element = self.__ExtractInvoiceElement()
        all_children = lxml_functions.GetAllSubElements(invoice_element)

        for child_element in all_children:
            data = False
            child_tag = lxml_functions.GetTag(child_element)

            if child_tag == "R1":
                data = number

            elif child_tag == "R2":
                data = invoice[u'Invoice Nr']

            elif child_tag == "R3":
                data = invoice[u'Posting date']

            elif child_tag == "R4":
                data = invoice[u'Due Date']

            elif child_tag == "R5":
                data = self.__GetPaymentDelay(invoice[u'Due Date'])

            elif child_tag == "R6":
                data = invoice[data_settings.invoices_amount] / (
                    1.0 + report_settings.tax_rate)

            elif child_tag == "R7":
                data = invoice[data_settings.invoices_amount] - invoice[
                    data_settings.invoices_amount] / (1.0 +
                                                      report_settings.tax_rate)

            elif child_tag == "R8":
                data = invoice[data_settings.invoices_amount]

            elif child_tag == "R9":
                data = invoice[data_settings.invoices_amount] - invoice[
                    data_settings.invoices_open_amount]

            elif child_tag == "R10":
                data = invoice[data_settings.invoices_open_amount]

            if (data != False):
                lxml_functions.SetElementText(child_element, data)

        return invoice_element
    def __FillNonSumChildless(self, child_element):
        data = False
        child_tag = lxml_functions.GetTag(child_element)

        if child_tag == "Podatak103":
            data = pandas_functions.SumColumnInFrame(
                data_settings.IRA_EU_goods_sold, self.IRA_EU)

        elif child_tag == "Podatak104":
            data = pandas_functions.SumColumnInFrame(
                data_settings.IRA_EU_services_sold, self.IRA_EU)

        elif child_tag == "Podatak109":
            data = pandas_functions.SumColumnInFrame(
                data_settings.IRA_EU_exports, self.IRA_EU)

        if (data != False):
            lxml_functions.SetElementText(child_element, data)
 def __FillOutHeader(self):
   all_children = lxml_functions.GetAllSubElements(self.header_root)
   for child_element in all_children:
     data = False
     child_tag = lxml_functions.GetTag(child_element)
     
     if child_tag == "DatumOd":
       data = report_settings.DatumOd
       
     elif child_tag == "DatumDo":
       data = report_settings.DatumDo
       
     elif child_tag == "OIB":
       data = report_settings.OIB
       
     elif child_tag == "Naziv":
       data = report_settings.Naziv
       
     elif child_tag == "Mjesto":
       data = report_settings.Mjesto
       
     elif child_tag == "Ulica":
       data = report_settings.Ulica
       
     elif child_tag == "Broj":
       data = report_settings.Broj
       
     elif child_tag == "Ime":
       data = report_settings.Ime
       
     elif child_tag == "Prezime":
       data = report_settings.Prezime
       
     elif child_tag == "Ispostava":
       data = report_settings.Ispostava
       
     elif child_tag == "NaDan":
       data = report_settings.NaDan
       
     elif child_tag == "NisuNaplaceniDo":
       data = report_settings.NisuNaplaceniDo
     
     if (data != False):
       lxml_functions.SetElementText(child_element, data)
예제 #10
0
    def CreateAndFillOutBody(self):
        body_element = self.__ExtractBodyElement()
        children = lxml_functions.GetSubElements(body_element)

        customers_element = self.__FillOutCustomers()
        lxml_functions.InsertChildElementIntoElementAtIndex(
            customers_element, body_element, 0)

        for child_element in children:
            data = False
            child_tag = lxml_functions.GetTag(child_element)

            if child_tag == "UkupanIznosRacunaObrasca":
                data = lxml_functions.GetSumOfAllSubElementsWithTagPatternOfElement(
                    "K5", customers_element)

            elif child_tag == "UkupanIznosPdvObrasca":
                data = lxml_functions.GetSumOfAllSubElementsWithTagPatternOfElement(
                    "K6", customers_element)

            elif child_tag == "UkupanIznosRacunaSPdvObrasca":
                data = lxml_functions.GetSumOfAllSubElementsWithTagPatternOfElement(
                    "K7", customers_element)

            elif child_tag == "UkupniPlaceniIznosRacunaObrasca":
                data = lxml_functions.GetSumOfAllSubElementsWithTagPatternOfElement(
                    "K8", customers_element)

            elif child_tag == "NeplaceniIznosRacunaObrasca":
                data = lxml_functions.GetSumOfAllSubElementsWithTagPatternOfElement(
                    "K9", customers_element)

            elif child_tag == "OPZUkupanIznosRacunaSPdv":
                data = 0.0

            elif child_tag == "OPZUkupanIznosPdv":
                data = 0.0

            if (data != False):
                lxml_functions.SetElementText(child_element, data)

        return body_element
    def CreateAndFillOutBody(self):
        body_element = self.__ExtractBodyElement()
        all_children = lxml_functions.GetAllSubElements(body_element)

        deliveries_element = self.__FillOutDeliveries()
        lxml_functions.InsertChildElementIntoElementAtIndex(
            deliveries_element, body_element, 0)

        for child_element in all_children:
            data = False
            child_tag = lxml_functions.GetTag(child_element)

            if child_tag == "I1":
                data = lxml_functions.GetSumOfAllSubElementsWithTagPatternOfElement(
                    "I1", deliveries_element)

            if (data != False):
                lxml_functions.SetElementText(child_element, data)

        return body_element