Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1851192
  • 博文数量: 334
  • 博客积分: 11301
  • 博客等级: 上将
  • 技术积分: 3452
  • 用 户 组: 普通用户
  • 注册时间: 2006-10-18 10:19
个人简介

路虽弥,不行不至;事虽少,不做不成。

文章分类

全部博文(334)

文章存档

2013年(4)

2012年(19)

2011年(27)

2010年(71)

2009年(45)

2008年(15)

2007年(84)

2006年(69)

分类: Oracle

2012-12-06 09:52:21

--适用于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
阅读(3409) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~