AR_RECEIVABLE_APPLICATIONS APP,
AR_CASH_RECEIPTS CR,
AR_PAYMENT_SCHEDULES PS_INV,
HZ_CUST_ACCOUNTS CUST,
HZ_PARTIES PARTY,
RA_CUSTOMER_TRX CT,
RA_CUST_TRX_TYPES CTT,
RA_CUSTOMER_TRX_LINES CTL,
RA_BATCH_SOURCES BS,
HZ_CUST_SITE_USES SU,
AR_CONS_INV CI,
AR_LOOKUPS L_CLASS,
AR_RECEIVABLES_TRX ART
WHERE APP.DISPLAY = 'Y'
AND APP.CASH_RECEIPT_ID = CR.CASH_RECEIPT_ID
AND CT.CUSTOMER_TRX_ID(+) = PS_INV.CUSTOMER_TRX_ID
AND BS.BATCH_SOURCE_ID(+) = CT.BATCH_SOURCE_ID
AND CTT.CUST_TRX_TYPE_ID(+) = PS_INV.CUST_TRX_TYPE_ID
AND CUST.CUST_ACCOUNT_ID(+) = PS_INV.CUSTOMER_ID
AND CUST.PARTY_ID = PARTY.PARTY_ID(+)
AND SU.SITE_USE_ID(+) = PS_INV.CUSTOMER_SITE_USE_ID
AND CTL.CUSTOMER_TRX_LINE_ID(+) = APP.APPLIED_CUSTOMER_TRX_LINE_ID
AND PS_INV.CLASS = L_CLASS.LOOKUP_CODE
AND L_CLASS.LOOKUP_TYPE = 'INV/CM'
AND CI.CONS_INV_ID(+) = PS_INV.CONS_INV_ID
AND APP.APPLIED_PAYMENT_SCHEDULE_ID = PS_INV.PAYMENT_SCHEDULE_ID
AND ART.RECEIVABLES_TRX_ID(+) = APP.RECEIVABLES_TRX_ID;
来源:oschina
链接:https://my.oschina.net/u/4374628/blog/3740333