119: , RACTRL.CUSTOMER_TRX_ID RECEIVABLES_INVOICE_ID
120: , KHR.contract_number
121: , TXD.KHR_ID CONTRACT_ID
122: , SUM(nvl(ad.amount_cr,0))- SUM(nvl(ad.amount_dr,0)) AMOUNT_APPLIED
123: , max(greatest(TRUNC((FND_DATE.canonical_to_date(NVL(rul_hld.rule_information1,AR_PAY.DUE_DATE)))),TRUNC(AR_PAY.DUE_DATE))) DUE_DATE
124: , TRUNC(CRA.RECEIPT_DATE) RECEIPT_DATE
125: ,max('AR-INVOICE') invoice_flag
126: FROM AR_RECEIVABLE_APPLICATIONS_ALL AR_REC
127: , AR_PAYMENT_SCHEDULES_ALL AR_PAY
165: and NVL(sty_exm.late_policy_exempt_yn, 'N') = 'Y')
166: and khr.id = rul_hld.dnz_chr_id
167: and rgp.id = rul_hld.rgp_id
168: and rul_hld.rule_information_category = 'LAHUDT'
169: and TRUNC(NVL(FND_DATE.canonical_to_date(NVL(rul_hld.rule_information1,sysdate)), sysdate - 1)) < trunc(sysdate)
170: and ((TRUNC((FND_DATE.canonical_to_date(rul_hld.rule_information1))) IS NOT NULL
171: AND TRUNC((FND_DATE.canonical_to_date(rul_hld.rule_information1))) < TRUNC(CRA.RECEIPT_DATE))
172: OR TRUNC(CRA.RECEIPT_DATE) IS NULL
173: OR rul_hld.rule_information1 IS NULL)
166: and khr.id = rul_hld.dnz_chr_id
167: and rgp.id = rul_hld.rgp_id
168: and rul_hld.rule_information_category = 'LAHUDT'
169: and TRUNC(NVL(FND_DATE.canonical_to_date(NVL(rul_hld.rule_information1,sysdate)), sysdate - 1)) < trunc(sysdate)
170: and ((TRUNC((FND_DATE.canonical_to_date(rul_hld.rule_information1))) IS NOT NULL
171: AND TRUNC((FND_DATE.canonical_to_date(rul_hld.rule_information1))) < TRUNC(CRA.RECEIPT_DATE))
172: OR TRUNC(CRA.RECEIPT_DATE) IS NULL
173: OR rul_hld.rule_information1 IS NULL)
174: and not exists (SELECT 1
167: and rgp.id = rul_hld.rgp_id
168: and rul_hld.rule_information_category = 'LAHUDT'
169: and TRUNC(NVL(FND_DATE.canonical_to_date(NVL(rul_hld.rule_information1,sysdate)), sysdate - 1)) < trunc(sysdate)
170: and ((TRUNC((FND_DATE.canonical_to_date(rul_hld.rule_information1))) IS NOT NULL
171: AND TRUNC((FND_DATE.canonical_to_date(rul_hld.rule_information1))) < TRUNC(CRA.RECEIPT_DATE))
172: OR TRUNC(CRA.RECEIPT_DATE) IS NULL
173: OR rul_hld.rule_information1 IS NULL)
174: and not exists (SELECT 1
175: FROM okl_cnsld_ar_strms_b lsm
192: , RACTRL.CUSTOMER_TRX_ID RECEIVABLES_INVOICE_ID
193: , KHR.contract_number
194: , TXD.KHR_ID CONTRACT_ID
195: , SUM(nvl(ad.amount_cr,0))- SUM(nvl(ad.amount_dr,0)) AMOUNT_APPLIED
196: , max(greatest(TRUNC((FND_DATE.canonical_to_date(NVL(rul_hld.rule_information1,AR_PAY.DUE_DATE)))),TRUNC(AR_PAY.DUE_DATE))) DUE_DATE
197: , TRUNC(CRA.RECEIPT_DATE) RECEIPT_DATE
198: ,max('AR-INVOICE') invoice_flag
199: FROM AR_RECEIVABLE_APPLICATIONS_ALL AR_REC
200: , AR_PAYMENT_SCHEDULES_ALL AR_PAY
240: and NVL(sty_exm.late_policy_exempt_yn, 'N') = 'Y')
241: and khr.id = rul_hld.dnz_chr_id
242: and rgp.id = rul_hld.rgp_id
243: and rul_hld.rule_information_category = 'LAHUDT'
244: and TRUNC(NVL(FND_DATE.canonical_to_date(NVL(rul_hld.rule_information1,sysdate)), sysdate - 1)) < trunc(sysdate)
245: and ((TRUNC((FND_DATE.canonical_to_date(rul_hld.rule_information1))) IS NOT NULL
246: AND TRUNC((FND_DATE.canonical_to_date(rul_hld.rule_information1))) < TRUNC(CRA.RECEIPT_DATE))
247: OR TRUNC(CRA.RECEIPT_DATE) IS NULL
248: OR rul_hld.rule_information1 IS NULL)
241: and khr.id = rul_hld.dnz_chr_id
242: and rgp.id = rul_hld.rgp_id
243: and rul_hld.rule_information_category = 'LAHUDT'
244: and TRUNC(NVL(FND_DATE.canonical_to_date(NVL(rul_hld.rule_information1,sysdate)), sysdate - 1)) < trunc(sysdate)
245: and ((TRUNC((FND_DATE.canonical_to_date(rul_hld.rule_information1))) IS NOT NULL
246: AND TRUNC((FND_DATE.canonical_to_date(rul_hld.rule_information1))) < TRUNC(CRA.RECEIPT_DATE))
247: OR TRUNC(CRA.RECEIPT_DATE) IS NULL
248: OR rul_hld.rule_information1 IS NULL)
249: and not exists (SELECT 1
242: and rgp.id = rul_hld.rgp_id
243: and rul_hld.rule_information_category = 'LAHUDT'
244: and TRUNC(NVL(FND_DATE.canonical_to_date(NVL(rul_hld.rule_information1,sysdate)), sysdate - 1)) < trunc(sysdate)
245: and ((TRUNC((FND_DATE.canonical_to_date(rul_hld.rule_information1))) IS NOT NULL
246: AND TRUNC((FND_DATE.canonical_to_date(rul_hld.rule_information1))) < TRUNC(CRA.RECEIPT_DATE))
247: OR TRUNC(CRA.RECEIPT_DATE) IS NULL
248: OR rul_hld.rule_information1 IS NULL)
249: and not exists (SELECT 1
250: FROM okl_cnsld_ar_strms_b lsm
277: , CNSLD.RECEIVABLES_INVOICE_ID RECEIVABLES_INVOICE_ID
278: , KHR.contract_number
279: , CNSLD.KHR_ID CONTRACT_ID
280: , sum(NVL(AR_REC.AMOUNT_APPLIED,0)) AMOUNT_APPLIED
281: , max(greatest(TRUNC((FND_DATE.canonical_to_date(NVL(rul_hld.rule_information1,AR_PAY.DUE_DATE)))),TRUNC(AR_PAY.DUE_DATE))) DUE_DATE
282: , TRUNC(CRA.RECEIPT_DATE) RECEIPT_DATE
283: , max('CONS-INVOICE') invoice_flag
284: FROM AR_RECEIVABLE_APPLICATIONS_ALL AR_REC
285: , AR_PAYMENT_SCHEDULES_ALL AR_PAY
321: and NVL(sty_exm.late_policy_exempt_yn, 'N') = 'Y')
322: and khr.id = rul_hld.dnz_chr_id
323: and rgp.id = rul_hld.rgp_id
324: and rul_hld.rule_information_category = 'LAHUDT'
325: and TRUNC(NVL(FND_DATE.canonical_to_date(NVL(rul_hld.rule_information1,sysdate)), sysdate - 1)) < trunc(sysdate)
326: and ((TRUNC((FND_DATE.canonical_to_date(rul_hld.rule_information1))) IS NOT NULL
327: AND TRUNC((FND_DATE.canonical_to_date(rul_hld.rule_information1))) < TRUNC(CRA.RECEIPT_DATE))
328: OR TRUNC(CRA.RECEIPT_DATE) IS NULL
329: OR rul_hld.rule_information1 IS NULL)
322: and khr.id = rul_hld.dnz_chr_id
323: and rgp.id = rul_hld.rgp_id
324: and rul_hld.rule_information_category = 'LAHUDT'
325: and TRUNC(NVL(FND_DATE.canonical_to_date(NVL(rul_hld.rule_information1,sysdate)), sysdate - 1)) < trunc(sysdate)
326: and ((TRUNC((FND_DATE.canonical_to_date(rul_hld.rule_information1))) IS NOT NULL
327: AND TRUNC((FND_DATE.canonical_to_date(rul_hld.rule_information1))) < TRUNC(CRA.RECEIPT_DATE))
328: OR TRUNC(CRA.RECEIPT_DATE) IS NULL
329: OR rul_hld.rule_information1 IS NULL)
330: group by LTE.name
323: and rgp.id = rul_hld.rgp_id
324: and rul_hld.rule_information_category = 'LAHUDT'
325: and TRUNC(NVL(FND_DATE.canonical_to_date(NVL(rul_hld.rule_information1,sysdate)), sysdate - 1)) < trunc(sysdate)
326: and ((TRUNC((FND_DATE.canonical_to_date(rul_hld.rule_information1))) IS NOT NULL
327: AND TRUNC((FND_DATE.canonical_to_date(rul_hld.rule_information1))) < TRUNC(CRA.RECEIPT_DATE))
328: OR TRUNC(CRA.RECEIPT_DATE) IS NULL
329: OR rul_hld.rule_information1 IS NULL)
330: group by LTE.name
331: , KHR.currency_code