コード例 #1
0
    def __ExtractDeliveryElement(self):
        body_children = lxml_functions.GetAllSubElements(self.body_root)
        for element in body_children:
            if element.tag == "Isporuka":
                delivery_element = copy.deepcopy(element)

        return delivery_element
コード例 #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
コード例 #3
0
    def __ExtractInvoiceElement(self):
        body_children = lxml_functions.GetAllSubElements(self.body_root)
        for element in body_children:
            if element.tag == "Racun":
                invoice_element = copy.deepcopy(element)

        return invoice_element
コード例 #4
0
    def __ExtractCustomerElement(self):
        body_children = lxml_functions.GetAllSubElements(self.body_root)
        for element in body_children:
            if element.tag == "Kupac":
                customer_element = copy.deepcopy(element)
                customer_element.remove(customer_element[-1])

        return customer_element
コード例 #5
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
コード例 #6
0
 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)
コード例 #7
0
    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