SELECT hou.name operating_unit,
hp.party_name customer_name,
hca.account_number customer_number,
hca.cust_account_id customer_id,
hps.party_site_number site_number,
hcsua.site_use_code,
hcsua.location,
hl.address1,
hl.address2,
hl.city,
hl.state,
hcsua.tax_reference,
hcsua.tax_code,
rm.name pay_method,
rm.start_date pay_method_start,
rm.end_date pay_method_end,
crm.start_date cust_pay_method_start,
crm.end_date cust_pay_method_end
FROM hz_locations hl,
hz_party_sites hps,
hz_cust_site_uses_all hcsua,
hr_operating_units hou,
hz_cust_acct_sites_all hcasa,
hz_cust_accounts hca,
hz_parties hp,
ra_cust_receipt_methods crm,
ar_receipt_methods rm
WHERE hl.location_id = hps.location_id
AND hps.party_site_id = hcasa.party_site_id
AND hps.party_id = hp.party_id
AND hcsua.cust_acct_site_id = hcasa.cust_acct_site_id
AND hou.organization_id = hcasa.org_id
AND hcasa.cust_account_id = hca.cust_account_id
AND hca.party_id = hp.party_id
AND hp.status = ‘A’
AND hca.status = ‘A’
AND hcasa.status = ‘A’
AND hcsua.status = ‘A’
AND hps.status = ‘A’
AND rm.receipt_method_id = crm.receipt_method_id
AND crm.customer_id = hca.cust_account_id
AND crm.site_use_id = hcsua.site_use_id
AND TRUNC (SYSDATE) BETWEEN TRUNC (NVL (rm.start_date, SYSDATE))
AND TRUNC (NVL (rm.end_date, SYSDATE))
AND TRUNC (SYSDATE) BETWEEN TRUNC (NVL (crm.start_date, SYSDATE))
AND TRUNC (NVL (crm.end_date, SYSDATE))
ORDER BY 1,2,6,7,14
hp.party_name customer_name,
hca.account_number customer_number,
hca.cust_account_id customer_id,
hps.party_site_number site_number,
hcsua.site_use_code,
hcsua.location,
hl.address1,
hl.address2,
hl.city,
hl.state,
hcsua.tax_reference,
hcsua.tax_code,
rm.name pay_method,
rm.start_date pay_method_start,
rm.end_date pay_method_end,
crm.start_date cust_pay_method_start,
crm.end_date cust_pay_method_end
FROM hz_locations hl,
hz_party_sites hps,
hz_cust_site_uses_all hcsua,
hr_operating_units hou,
hz_cust_acct_sites_all hcasa,
hz_cust_accounts hca,
hz_parties hp,
ra_cust_receipt_methods crm,
ar_receipt_methods rm
WHERE hl.location_id = hps.location_id
AND hps.party_site_id = hcasa.party_site_id
AND hps.party_id = hp.party_id
AND hcsua.cust_acct_site_id = hcasa.cust_acct_site_id
AND hou.organization_id = hcasa.org_id
AND hcasa.cust_account_id = hca.cust_account_id
AND hca.party_id = hp.party_id
AND hp.status = ‘A’
AND hca.status = ‘A’
AND hcasa.status = ‘A’
AND hcsua.status = ‘A’
AND hps.status = ‘A’
AND rm.receipt_method_id = crm.receipt_method_id
AND crm.customer_id = hca.cust_account_id
AND crm.site_use_id = hcsua.site_use_id
AND TRUNC (SYSDATE) BETWEEN TRUNC (NVL (rm.start_date, SYSDATE))
AND TRUNC (NVL (rm.end_date, SYSDATE))
AND TRUNC (SYSDATE) BETWEEN TRUNC (NVL (crm.start_date, SYSDATE))
AND TRUNC (NVL (crm.end_date, SYSDATE))
ORDER BY 1,2,6,7,14
No comments :
Post a Comment