コード例 #1
0
 def ConstructReport(self):
   self.__FillOutMetadata()
   lxml_functions.AddChildElementToElement(self.metadata_root, self.wrapper_root)
   
   self.__FillOutHeader()
   lxml_functions.AddChildElementToElement(self.header_root, self.wrapper_root)
   
   body_element = self.CreateAndFillOutBody()
   lxml_functions.AddChildElementToElement(body_element, self.wrapper_root)
コード例 #2
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
コード例 #3
0
    def __FillOutInvoices(self, invoice_batch):
        invoices_element = lxml_functions.CreateElement("Racuni")

        invoice_counter = 1
        for index, invoice in invoice_batch.iterrows():
            invoice_element = self.__FillOutInvoiceNumber(
                invoice, invoice_counter)

            lxml_functions.AddChildElementToElement(invoice_element,
                                                    invoices_element)

            invoice_counter += 1

        return invoices_element
コード例 #4
0
    def __FillOutDeliveries(self):
        deliveries_element = lxml_functions.CreateElement("Isporuke")

        delivery_counter = 1
        while (not self.IRA_EU.empty):
            customer_id = pandas_functions.GetFirstValueFromColumnFromFrame(
                data_settings.IRA_EU_customer_id, self.IRA_EU)

            delivery_batch, self.IRA_EU = pandas_functions.SplitFrameAlongColumnWithValue(
                self.IRA_EU, data_settings.IRA_EU_customer_id, customer_id)

            delivery_element = self.__FillOutDeliveryNumber(
                delivery_batch, delivery_counter)
            lxml_functions.AddChildElementToElement(delivery_element,
                                                    deliveries_element)

            delivery_counter += 1

        return deliveries_element
コード例 #5
0
    def __FillOutCustomers(self):
        customers_element = lxml_functions.CreateElement("Kupci")

        customer_counter = 1
        while (pandas_functions.IsFrameNotEmpty(self.invoices)):
            customer_name = pandas_functions.GetFirstValueFromColumnFromFrame(
                data_settings.invoices_customer_name, self.invoices)

            invoice_batch, self.invoices = pandas_functions.SplitFrameAlongColumnWithValue(
                self.invoices, data_settings.invoices_customer_name,
                customer_name)

            customer_element = self.__FillOutCustomerNumber(
                invoice_batch, customer_counter)
            lxml_functions.AddChildElementToElement(customer_element,
                                                    customers_element)

            customer_counter += 1

        return customers_element