Пример #1
0
def payment_list_summary(party_ids: List[int], supplier_ids: List[int],
                         start_date: str, end_date: str) -> List:
    """
    Return a 2D list of all pdf elements for payment list Report
    """

    table_header = ("Days", "Total Amount", "Total Pending Amount")

    hr_line = create_pdf.create_horizontal_line()

    master_elements = [create_pdf.create_h1("Payment List Summary"), hr_line]

    for party_id in party_ids:
        top_elements = []
        elements = []
        party_name = retrieve_indivijual.get_party_name_by_id(party_id)
        h2text = "Party Name: " + party_name
        top_elements.append(create_pdf.create_h2(h2text))
        top_elements.append(hr_line)
        filter_suppliers = efficiency.filter_out_supplier(
            party_id, supplier_ids)
        for supplier_id in filter_suppliers:
            add_table = True
            pl_summary_data = retrieve_register_entry.get_payment_list_summary_data(
                supplier_id, party_id, start_date, end_date)
            if len(pl_summary_data) == 0:
                add_table = False
            if add_table:
                table_data = [table_header]
                supplier_name = retrieve_indivijual.get_supplier_name_by_id(
                    supplier_id)
                add_text = "Supplier Name: " + supplier_name
                elements.append(create_pdf.create_h3(add_text))
                pl_summary_insert = [(" ", ) + x for x in pl_summary_data]
                temp = pl_summary_insert[0]
                pl_summary_insert[0] = ("Below 40", temp[1], temp[2])
                pl_summary_insert[1] = ("40-70", temp[1], temp[2])
                pl_summary_insert[2] = ("Above 70", temp[1], temp[2])
                table_data = table_data + pl_summary_insert + total_bottom_column(
                    pl_summary_insert)
                table = create_pdf.create_table(table_data)
                create_pdf.add_table_border(table)
                create_pdf.add_alt_color(table, len(table_data))
                create_pdf.add_padded_header_footer_columns(
                    table, len(table_data))
                create_pdf.add_days_colour(table, table_data)
                create_pdf.add_table_font(table, "Courier")
                elements.append(table)

        if len(elements) != 0:
            master_elements = master_elements + top_elements + elements
            master_elements.append(create_pdf.new_page())

    return master_elements
def khata_report(party_ids: List[int], supplier_ids: List[int],
                 start_date: str, end_date: str) -> List:
    """
    Return a 2D list of all pdf elements for Khata Report
    """

    table_header = ("Bill No.", "Bill Date", "Bill Amt", "Status", "Memo No.",
                    "Memo Amt", "Memo Date", "M.Type", "Chk. Amt")

    hr_line = create_pdf.create_horizontal_line()

    master_elements = [create_pdf.create_h1("Khata Report"), hr_line]

    for party_id in party_ids:
        top_elements = []
        elements = []
        party_name = retrieve_indivijual.get_party_name_by_id(party_id)
        h2text = "Party Name: " + party_name
        top_elements.append(create_pdf.create_h2(h2text))
        top_elements.append(hr_line)
        filter_suppliers = efficiency.filter_out_supplier(
            party_id, supplier_ids)
        for supplier_id in filter_suppliers:
            add_table = True
            khata_data = retrieve_register_entry.get_khata_data_by_date(
                supplier_id, party_id, start_date, end_date)
            if len(khata_data) == 0:
                add_table = False
            part_no_bill = retrieve_partial_payment.get_partial_payment(
                supplier_id, party_id)
            table_data = [table_header] + khata_data + total_bottom_column(
                khata_data, part_no_bill)
            table = create_pdf.create_table(table_data)
            create_pdf.add_table_border(table)
            create_pdf.add_alt_color(table, len(table_data))
            create_pdf.add_padded_header_footer_columns(table, len(table_data))
            create_pdf.add_footer(table, len(table_data))
            create_pdf.add_status_colour(table, table_data, 3)
            create_pdf.add_table_font(table, "Courier")
            if add_table:
                supplier_name = retrieve_indivijual.get_supplier_name_by_id(
                    supplier_id)
                add_text = "Supplier Name: " + supplier_name
                elements.append(create_pdf.create_h3(add_text))
                elements.append(table)
        if len(elements) != 0:
            master_elements = master_elements + top_elements + elements
            master_elements.append(create_pdf.new_page())

    return master_elements
Пример #3
0
def supplier_register(party_ids: List[int], supplier_ids: List[int],
                      start_date: str, end_date: str) -> List:
    """
    Returns a 2D list of all pdf elements for supplier register
    """

    table_header = ("Bill Number", "Bill Amount", "Pending Amount",
                    "Bill Date", "Status")

    hr_line = create_pdf.create_horizontal_line()

    master_elements = [create_pdf.create_h1("Supplier Register"), hr_line]

    for supplier_id in supplier_ids:
        top_elements = []
        elements = []
        supplier_name = retrieve_indivijual.get_supplier_name_by_id(
            supplier_id)
        h2text = "Supplier Name: " + supplier_name
        top_elements.append(create_pdf.create_h2(h2text))
        top_elements.append(hr_line)
        filter_parties = efficiency.filter_out_parties(supplier_id, party_ids)
        for party_id in filter_parties:
            add_table = True
            register_data = retrieve_register_entry.get_supplier_register_data(
                supplier_id, party_id, start_date, end_date)
            if len(register_data) == 0:
                add_table = False
            part_no_bill = retrieve_partial_payment.get_partial_payment(
                supplier_id, party_id)
            table_data = [table_header] + register_data + total_bottom_column(
                register_data, part_no_bill)
            table = create_pdf.create_table(table_data)
            create_pdf.add_table_border(table)
            create_pdf.add_alt_color(table, len(table_data))
            create_pdf.add_padded_header_footer_columns(table, len(table_data))
            create_pdf.add_footer(table, len(table_data))
            create_pdf.add_status_colour(table, table_data, 4)
            create_pdf.add_table_font(table, "Courier")
            if add_table:
                party_name = retrieve_indivijual.get_party_name_by_id(party_id)
                add_text = "Party Name: " + party_name
                elements.append(create_pdf.create_h3(add_text))
                elements.append(table)
        if len(elements) != 0:
            master_elements = master_elements + top_elements + elements
            master_elements.append(create_pdf.new_page())

    return master_elements