def METHOD_NAME(filters=None):
    sales_invoice = frappe.qb.DocType("Sales Invoice")
    e_invoice_log = frappe.qb.DocType("e-Invoice Log")
    settings = frappe.get_cached_doc("GST Settings")
    e_invoice_applicability_date = get_e_invoice_applicability_date(filters, settings)
    if not settings.enable_e_invoice or not e_invoice_applicability_date:
        return []
    conditions = e_invoice_conditions(filters, e_invoice_applicability_date)
    query = (
        frappe.qb.from_(sales_invoice)
        .left_join(e_invoice_log)
        .on(sales_invoice.irn == e_invoice_log.irn)
        .select(
            sales_invoice.posting_date,
            sales_invoice.einvoice_status,
            sales_invoice.customer,
            Case().when(sales_invoice.is_return == 1, "Y").else_("N").as_("is_return"),
            sales_invoice.base_grand_total,
            sales_invoice.name.as_("sales_invoice"),
            sales_invoice.irn,
            sales_invoice.company,
            e_invoice_log.acknowledgement_number,
            e_invoice_log.acknowledged_on,
        )
        .where(
            sales_invoice.posting_date[
                filters.get("from_date") : filters.get("to_date")
            ]
        )
        .where(sales_invoice.company == filters.get("company"))
        .where(conditions)
    )
    if filters.get("status"):
        query = query.where(sales_invoice.einvoice_status == filters.get("status"))
    if filters.get("customer"):
        query = query.where(sales_invoice.customer == filters.get("customer"))
    if filters.get("exceptions") == "e-Invoice Not Generated":
        query = query.where(((sales_invoice.irn == "") | (sales_invoice.irn.isnull())))
    if filters.get("exceptions") != "Invoice Cancelled but not e-Invoice":
        query = query.where(sales_invoice.docstatus == 1)
    else:
        # invoice is cancelled but irn is not cancelled
        query = query.where(sales_invoice.docstatus == 2).where(
            (sales_invoice.irn != "") & (sales_invoice.irn.notnull())
        )
        valid_irns = frappe.get_all(
            "Sales Invoice",
            pluck="irn",
            filters={
                "docstatus": 1,
                "company": filters.get("company"),
                # logical optimization
                "posting_date": [">=", filters.get("from_date")],
                "irn": ["is", "set"],
            },
        )
        if valid_irns:
            query = query.where(sales_invoice.irn.notin(valid_irns))
    return query.run(as_dict=True)