SQL应收帐款帐龄报表(AR_Aging_Reporting)

本文深入解析了在R12版本中如何使用SQL语句查询财务报表的关键指标,包括客户编号、客户名称、发票编号、科目组合代码及描述、应付款剩余金额、不同逾期天数的应付款金额划分等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

--适用于R12版本
 
select hca.account_number "Customer_Num",
       hp.party_name "Customer_Name",
       rct.trx_number "Invoice_Num",
       fnd_flex_ext.get_segs('SQLGL', 'GL#', 50370, gcc.code_combination_id) "CCID_Account", --取科目组合代码
       gl_flexfields_pkg.get_concat_description(50370,
                                                gcc.code_combination_id) "Account_Desc", --取科目组合描述
  /*     xla_oa_functions_pkg.get_ccid_description(50370,
                                                 gcc.CODE_COMBINATION_ID) "Account_Desc1", --同上一个功能相同,取科目组合描述   */                                      
       aps.amount_due_remaining "Due_Amount_Remaining",
       case
         when (sysdate - aps.due_date) / 30 <= 1 then
          aps.amount_due_remaining
       end "1-30(Days)",
       case
         when (sysdate - aps.due_date) / 30 > 1 and
              (sysdate - aps.due_date) / 30 <= 3 then
          aps.amount_due_remaining
       end "31-90(Days)",
       case
         when (sysdate - aps.due_date) / 30 > 3 and
              (sysdate - aps.due_date) / 30 <= 6 then
          aps.amount_due_remaining
       end "91-180(Days)",
       case
         when (sysdate - aps.due_date) / 30 > 6 and
              (sysdate - aps.due_date) / 30 <= 12 then
          aps.amount_due_remaining
       end "181-360(Days)",
       case
         when (sysdate - aps.due_date) / 30 > 12 and
              (sysdate - aps.due_date) / 30 <= 24 then
          aps.amount_due_remaining
       end "1-2(Years)",
       case
         when (sysdate - aps.due_date) / 30 > 24 and
              (sysdate - aps.due_date) / 30 <= 36 then
          aps.amount_due_remaining
       end "2-3(Years)",
       case
         when (sysdate - aps.due_date) / 30 > 36 and
              (sysdate - aps.due_date) / 30 <= 48 then
          aps.amount_due_remaining
       end "3-4(Years)",
       case
         when (sysdate - aps.due_date) / 30 > 48 and
              (sysdate - aps.due_date) / 30 <= 60 then
          aps.amount_due_remaining
       end "4-5(Years)",
       case
         when (sysdate - aps.due_date) / 30 > 60 then
          aps.amount_due_remaining
       end "5+(Years)"
  from ar_payment_schedules_all     aps,
       hz_cust_accounts             hca,
       hz_parties                   hp,
       ra_cust_trx_line_gl_dist_all rctg,
       gl_code_combinations         gcc,
       ra_customer_trx_all          rct
 where aps.org_id = 275
   and aps.status = 'OP'
   and hca.cust_account_id = aps.customer_id
   and hca.party_id = hp.party_id
   and rctg.customer_trx_id = aps.customer_trx_id
   and gcc.code_combination_id = rctg.code_combination_id
   and rctg.account_class = 'REC'
   and rct.customer_trx_id = rctg.customer_trx_id
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值