SELECT acra.cash_receipt_id,
acra.receipt_number,
acra.receipt_date,
acra.amount,
(SELECT a.account_number
FROM hz_cust_accounts_all a, hz_parties b
WHERE a.party_id = b.party_id
AND a.cust_account_id = apsa.customer_id)
customer_number,
(SELECT b.party_name
FROM hz_cust_accounts_all a, hz_parties b
WHERE a.party_id = b.party_id
AND a.cust_account_id = apsa.customer_id)
customer_name,
(SELECT location
FROM hz_cust_site_uses_all
WHERE site_use_id = acra.customer_site_use_id)
trx_bill_location,
acra.status,
acra.type,
acra.comments,
apsa.payment_schedule_id,
apsa.amount_due_original,
apsa.amount_due_remaining,
apsa.class,
apsa.customer_id,
apsa.customer_site_use_id,
apsa.amount_applied,
apsa.acctd_amount_due_remaining
FROM ar_cash_receipts_all acra, ar_payment_schedules_all apsa
WHERE acra.cash_receipt_id = apsa.cash_receipt_id
AND apsa.status = 'OP'
AND apsa.class = 'PMT'
AND amount_applied = 0
AND acra.org_id = :p_org_id
AND acra.status = 'UNAPP'
acra.receipt_number,
acra.receipt_date,
acra.amount,
(SELECT a.account_number
FROM hz_cust_accounts_all a, hz_parties b
WHERE a.party_id = b.party_id
AND a.cust_account_id = apsa.customer_id)
customer_number,
(SELECT b.party_name
FROM hz_cust_accounts_all a, hz_parties b
WHERE a.party_id = b.party_id
AND a.cust_account_id = apsa.customer_id)
customer_name,
(SELECT location
FROM hz_cust_site_uses_all
WHERE site_use_id = acra.customer_site_use_id)
trx_bill_location,
acra.status,
acra.type,
acra.comments,
apsa.payment_schedule_id,
apsa.amount_due_original,
apsa.amount_due_remaining,
apsa.class,
apsa.customer_id,
apsa.customer_site_use_id,
apsa.amount_applied,
apsa.acctd_amount_due_remaining
FROM ar_cash_receipts_all acra, ar_payment_schedules_all apsa
WHERE acra.cash_receipt_id = apsa.cash_receipt_id
AND apsa.status = 'OP'
AND apsa.class = 'PMT'
AND amount_applied = 0
AND acra.org_id = :p_org_id
AND acra.status = 'UNAPP'
No comments:
Post a Comment