Thursday 26 December 2013

AR Customers, no receipt methods

-- CUSTOMER DETAILS NO RECEIPT METHODS
SELECT       hp.party_name
       , hca.account_number act_no
       , hca.cust_account_id
       , hca.party_id
       , DECODE(hca.status, 'I', 'Inactive', 'A', 'Active', 'Other') hdr
       , '##'
       , hca.creation_date hdr_creation_date
       , fu_header.description hdr_created_by
       , hca.last_update_date hdr_updated
       , fu_hdr_upd.description hdr_updated_by
       , '###'
       , hcsua.org_id
       , hps.party_site_number site_num
       , hcsua.cust_acct_site_id
       , hcsua.location
       , hcsua.site_use_code
       , hcsua.primary_flag
       , DECODE(hcasa.status, 'I', 'Inactive', 'A', 'Active', 'Other') site
       , '####'
       , hcsua.creation_date site_creation_date
       , fu_site.description site_created_by
       , hcsua.last_update_date site_updated
       , fu_site_upd.description site_updated_by
       , '#####'
       , hl.address1
       , hl.address2
       , hl.address3
       , hl.address4
       , hl.city
       , hl.state
       , hl.postal_code
    FROM apps.hz_parties hp
       , ar.hz_party_sites hps
       , ar.hz_locations hl
       , apps.hz_cust_accounts hca
       , apps.hz_cust_acct_sites_all hcasa
       , apps.hz_cust_site_uses_all hcsua
       , applsys.fnd_user fu_header
       , applsys.fnd_user fu_hdr_upd
       , applsys.fnd_user fu_site
       , applsys.fnd_user fu_site_upd
   WHERE hp.party_id = hca.party_id
     AND hp.party_id = hps.party_id
     AND hcasa.party_site_id = hps.party_site_id
     AND hca.cust_account_id = hcasa.cust_account_id
     AND hcasa.cust_acct_site_id = hcsua.cust_acct_site_id
     AND hca.created_by = fu_header.user_id
     AND hca.last_updated_by = fu_hdr_upd.user_id
     AND hcsua.created_by = fu_site.user_id
     AND hcsua.last_updated_by = fu_site_upd.user_id
     AND hps.location_id = hl.location_id
     AND hl.location_id = 123
--     AND hcasa.org_id = 123
--     AND hca.cust_account_id = 123
--     AND hcsua.cust_acct_site_id = 123
--     AND hp.party_name = 'BILLY BOBBY'
--     AND hcsua.cust_acct_site_id IN(123)
--     AND hca.account_number = 123
--     AND hca.cust_account_id = 123
ORDER BY hcsua.org_id
       , hp.party_name;

No comments:

Post a Comment