Professional Documents
Culture Documents
Aging 1
Aging 1
Aging 1
account_number
, hzp.party_name account_name
, term.name terms
, rctt.name trans_type
, ps.trx_number
, ps.trx_date
, ps.due_date
, ps.amount_due_original
, ps.amount_due_remaining
, CASE
WHEN CEIL(TRUNC (SYSDATE) - TRUNC (ps.due_date)) 90 THEN
ps.amount_due_remaining
ELSE NULL
END greater_than_90
FROM ar_payment_schedules_all ps
, hz_cust_accounts hca
, hz_parties hzp
, ra_customer_trx_all rct
, ra_cust_trx_types_all rctt
, ra_terms term
WHERE hca.cust_account_id = ps.customer_id
AND hca.party_id = hzp.party_id
AND ps.customer_trx_id = rct.customer_trx_id
AND rct.cust_trx_type_id = rctt.cust_trx_type_id (+)
AND ps.status = 'OP'
AND ps.class != 'PMT'
AND ps.amount_due_remaining != 0
AND ps.term_id = term.term_id (+)
ORDER BY hzp.party_name
;、、a
aaaaaaaa
SELECT hca.account_number
, hzp.party_name account_name
, NULL terms
, ‘Payment’ trans_type
, cr.receipt_number trx_number
, ps.trx_date trx_date
, ps.trx_date due_date
, ps.amount_on_account amount_due_original
, ps.amount_on_account amt_due_remaining
, CEIL ( TO_DATE (TO_CHAR (:p_as_of_date, ‘DD-MON-RRRR’), ‘DD-MON-RRRR’) – TRUNC
( ps.trx_date ) ) past_due_days
FROM ar_payment_schedules_all ps
, ar_cash_receipts_all cr
, hz_cust_accounts hca
, hz_parties hzp
WHERE hca.cust_account_id = ps.customer_id
AND hca.party_id = hzp.party_id
–AND cr.currency_code = ‘USD’
AND cr.cash_receipt_id = ps.cash_receipt_id
AND ps.class = ‘PMT’
AND ps.amount_on_account != 0
AND ps.gl_date TO_DATE (TO_CHAR (:p_as_of_date, ‘DD-MON-RRRR’), ‘DD-MON-RRRR’);
````````
12221