oracle 编制应收账款账龄报告,包括客户名称、账号和5个时段[已关闭]

kxxlusnw  于 2023-06-22  发布在  Oracle
关注(0)|答案(1)|浏览(90)

已关闭,此问题需要更focused。目前不接受答复。
**想改善这个问题吗?**更新问题,使其仅通过editing this post关注一个问题。

16小时前关门了。
Improve this question
我需要在Oracle Fusion中开发一个AR Aging报告bip报告,该报告将包含以下列-

Customer Name |Account Name |Invoice Number |Current |1-30 past due | 31-60 past due |61-90 past due    |>90 past due   |Total

你能为这个场景推荐一个SQL查询吗?
期望SQL查询在oracle融合中开发AR老化bip报告。

vptzau2j

vptzau2j1#

因为问题中没有具体提到。我编写的查询假设AR发票数据存储在AR_INVOICES_ALL表中,并且客户和帐户信息从HZ_PARTIES表中检索。

SELECT
    c.CUSTOMER_NAME,
    a.ACCOUNT_NAME,
    i.INVOICE_NUMBER,
    CASE
        WHEN i.DUE_DATE >= TRUNC(SYSDATE) THEN i.INVOICE_AMOUNT
        ELSE 0
    END AS CURRENT,
    CASE
        WHEN i.DUE_DATE < TRUNC(SYSDATE) AND i.DUE_DATE >= TRUNC(SYSDATE) - 30 THEN i.INVOICE_AMOUNT
        ELSE 0
    END AS "1-30 PAST DUE",
    CASE
        WHEN i.DUE_DATE < TRUNC(SYSDATE) - 30 AND i.DUE_DATE >= TRUNC(SYSDATE) - 60 THEN i.INVOICE_AMOUNT
        ELSE 0
    END AS "31-60 PAST DUE",
    CASE
        WHEN i.DUE_DATE < TRUNC(SYSDATE) - 60 AND i.DUE_DATE >= TRUNC(SYSDATE) - 90 THEN i.INVOICE_AMOUNT
        ELSE 0
    END AS "61-90 PAST DUE",
    CASE
        WHEN i.DUE_DATE < TRUNC(SYSDATE) - 90 THEN i.INVOICE_AMOUNT
        ELSE 0
    END AS ">90 PAST DUE",
    i.INVOICE_AMOUNT AS TOTAL
FROM
    AR_INVOICES_ALL i
    JOIN HZ_PARTIES c ON i.CUSTOMER_ID = c.PARTY_ID
    JOIN HZ_PARTIES a ON i.ACCOUNT_ID = a.PARTY_ID
WHERE
    i.INVOICE_TYPE = 'Invoice'
    AND i.INVOICE_STATUS = 'Approved'
ORDER BY
    c.CUSTOMER_NAME, i.INVOICE_NUMBER;

相关问题