AR Bill To and Ship To Customer Scripts
-----------------------------------------------------------------------------------------------------------------------------
AR Bill To Customer Query
SELECT rct.customer_trx_id,
rct.bill_to_customer_id,
rct.bill_to_site_use_id,
bill_party.party_name bill_customer,
bill_cus.account_number customer_number,
hcs_bill.location,
hl_bill.address1,
hl_bill.address2,
hl_bill.city
||', '
||hl_bill.state
||' '
||hl_bill.postal_code
||' '
||hl_bill.country
FROM ra_customer_trx_all rct,
hz_cust_accounts bill_cus,
hz_parties bill_party,
HZ_CUST_SITE_USES_ALL hcs_bill,
HZ_CUST_ACCT_SITES_ALL hca_bill,
hz_party_sites hps_bill,
hz_locations hl_bill
WHERE customer_trx_id =79364
AND rct.bill_to_customer_id =bill_cus.cust_account_id
AND bill_party.party_id =bill_cus.party_id
AND rct.bill_to_site_use_id =hcs_bill.site_use_id
AND hcs_bill.site_use_code ='BILL_TO'
AND hca_bill.cust_acct_site_id=hcs_bill.cust_acct_site_id
AND hps_bill.party_site_id =hca_bill.party_site_id
AND hl_bill.location_id =hps_bill.location_id;
AR Ship To Customer Query
SELECT rct.customer_trx_id,
rct.ship_to_customer_id,
rct.ship_to_site_use_id,
ship_party.party_name bill_customer,
ship_cus.account_number customer_number,
hcs_ship.location,
hl_ship.address1,
hl_ship.address2,
hl_ship.city
||', '
||hl_ship.state
||' '
||hl_ship.postal_code
||' '
||hl_ship.country
FROM ra_customer_trx_all rct,
hz_cust_accounts ship_cus,
hz_parties ship_party,
HZ_CUST_SITE_USES_ALL hcs_ship,
HZ_CUST_ACCT_SITES_ALL hca_ship,
hz_party_sites hps_ship,
hz_locations hl_ship
WHERE customer_trx_id =79364
AND rct.ship_to_customer_id =ship_cus.cust_account_id
AND ship_party.party_id =ship_cus.party_id
AND rct.ship_to_site_use_id =hcs_ship.site_use_id
AND hcs_ship.site_use_code ='SHIP_TO'
AND hca_ship.cust_acct_site_id=hcs_ship.cust_acct_site_id
AND hps_ship.party_site_id =hca_ship.party_site_id
AND hl_ship.location_id =hps_ship.location_id;
-----------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------
AR Bill To Customer Query
SELECT rct.customer_trx_id,
rct.bill_to_customer_id,
rct.bill_to_site_use_id,
bill_party.party_name bill_customer,
bill_cus.account_number customer_number,
hcs_bill.location,
hl_bill.address1,
hl_bill.address2,
hl_bill.city
||', '
||hl_bill.state
||' '
||hl_bill.postal_code
||' '
||hl_bill.country
FROM ra_customer_trx_all rct,
hz_cust_accounts bill_cus,
hz_parties bill_party,
HZ_CUST_SITE_USES_ALL hcs_bill,
HZ_CUST_ACCT_SITES_ALL hca_bill,
hz_party_sites hps_bill,
hz_locations hl_bill
WHERE customer_trx_id =79364
AND rct.bill_to_customer_id =bill_cus.cust_account_id
AND bill_party.party_id =bill_cus.party_id
AND rct.bill_to_site_use_id =hcs_bill.site_use_id
AND hcs_bill.site_use_code ='BILL_TO'
AND hca_bill.cust_acct_site_id=hcs_bill.cust_acct_site_id
AND hps_bill.party_site_id =hca_bill.party_site_id
AND hl_bill.location_id =hps_bill.location_id;
AR Ship To Customer Query
SELECT rct.customer_trx_id,
rct.ship_to_customer_id,
rct.ship_to_site_use_id,
ship_party.party_name bill_customer,
ship_cus.account_number customer_number,
hcs_ship.location,
hl_ship.address1,
hl_ship.address2,
hl_ship.city
||', '
||hl_ship.state
||' '
||hl_ship.postal_code
||' '
||hl_ship.country
FROM ra_customer_trx_all rct,
hz_cust_accounts ship_cus,
hz_parties ship_party,
HZ_CUST_SITE_USES_ALL hcs_ship,
HZ_CUST_ACCT_SITES_ALL hca_ship,
hz_party_sites hps_ship,
hz_locations hl_ship
WHERE customer_trx_id =79364
AND rct.ship_to_customer_id =ship_cus.cust_account_id
AND ship_party.party_id =ship_cus.party_id
AND rct.ship_to_site_use_id =hcs_ship.site_use_id
AND hcs_ship.site_use_code ='SHIP_TO'
AND hca_ship.cust_acct_site_id=hcs_ship.cust_acct_site_id
AND hps_ship.party_site_id =hca_ship.party_site_id
AND hl_ship.location_id =hps_ship.location_id;
-----------------------------------------------------------------------------------------------------------------------------
Comments
Post a Comment