You are on page 1of 7

SELECTSUBSTRB(party.

party_name,1,150)
,cust_acct.account_number
,su.LOCATION
,ps.trx_number
,ps.trx_date
,(SELECTDISTINCT(rctlgdv.code_combination_id)
FROMra_customer_trx_lines_allrctla
,RA_CUST_TRX_LINE_GL_DIST_Vrctlgdv
WHEREct.customer_trx_id=rctlgdv.customer_trx_id
ANDct.customer_trx_id=rctla.customer_trx_id
ANDrctla.customer_trx_line_id=rctlgdv.customer_trx_line_id
ANDrctla.set_of_books_id=rctlgdv.set_of_books_id
ANDrctlgdv.code_combination_id=
(SELECTDISTINCT(gcc.code_combination_id)
FROMgl_code_combinationsgcc
WHEREgcc.code_combination_id=
rctlgdv.code_combination_id
ANDgcc.enabled_flag='Y'
ANDNVL(gcc.end_date_active,SYSDATE)>=SYSDATE
ANDgcc.segment3='12120'))
GL_COMBO_CODE_ID
,ps.customer_id
,ps.customer_site_use_id
,ps.customer_trx_id
,ps.CLASS
,ps.status
,ct.purchase_order
,ct.previous_customer_trx_id
,ps.due_date
,ps.amount_due_original
,ps.amount_due_remaining
,hl.address1
,hl.address2
,hl.address3
,hl.address4
,hl.city
,hl.state
,hl.postal_code
FROMra_customer_trx_allct
,hz_cust_site_uses_allsu
,hz_cust_accountscust_acct
,hz_partiesparty
,hz_cust_acct_sites_allhcasa
,ar_payment_schedules_allps
,hz_party_siteshps
,hz_locationshl
WHEREps.customer_id=cust_acct.cust_account_id
ANDcust_acct.party_id=party.party_id
ANDps.customer_site_use_id=su.site_use_id
ANDps.customer_trx_id=ct.customer_trx_id
ANDps.status='OP'
ANDcust_acct.cust_account_id=hcasa.cust_account_id
ANDsu.cust_acct_site_id=hcasa.cust_acct_site_id
ANDhcasa.party_site_id=hps.party_site_id
ANDhps.location_id=hl.location_id
ANDcust_acct.account_numberLIKE'3375'

---/u311/oracle/fimstestappl/ar/11.5.0/forms/US/ARXTWMAI.fmx
/var/www/apps/conversion/tmp/scratch_7/326838372.doc
1 3/3/2006 8:58:00 PM

/var/www/apps/conversion/tmp/scratch_7/326838372.doc
2 3/3/2006 8:58:00 PM

SELECT SUBSTRB(party.party_name, 1, 150)


,cust_acct.account_number
,su.LOCATION
,ps.trx_number
,ps.trx_date
,(SELECT DISTINCT(rctlgdv.code_combination_id)
FROM ra_customer_trx_lines_all rctla
, RA_CUST_TRX_LINE_GL_DIST_V rctlgdv
WHERE ct.customer_trx_id
= rctlgdv.customer_trx_id
AND ct.customer_trx_id
= rctla.customer_trx_id
AND rctla.customer_trx_line_id = rctlgdv.customer_trx_line_id
AND rctla.set_of_books_id
= rctlgdv.set_of_books_id
AND rctlgdv.code_combination_id =
(SELECT DISTINCT(gcc.code_combination_id)
FROM gl_code_combinations gcc
WHERE gcc.code_combination_id
= rctlgdv.code_combination_id
AND gcc.enabled_flag
= 'Y'
AND NVL(gcc.end_date_active, SYSDATE) >= SYSDATE
AND gcc.segment3
= '12120') ) GL_COMBO_CODE_ID
,ps.customer_id
,ps.customer_site_use_id
,ps.customer_trx_id
,ps.CLASS
,ps.status
,ct.purchase_order
,ct.previous_customer_trx_id
,ps.due_date
,ps.amount_due_original
,ps.amount_due_remaining
,hl.address1
,hl.address2
,hl.address3
,hl.address4
,hl.city
,hl.state
,hl.postal_code
FROM ra_customer_trx_all
ct
, hz_cust_site_uses_all su
, hz_cust_accounts
cust_acct
, hz_parties
party
, hz_cust_acct_sites_all hcasa
, ar_payment_schedules_all ps
, hz_party_sites
hps
, hz_locations
hl
WHERE ps.customer_id
= cust_acct.cust_account_id
AND cust_acct.party_id
= party.party_id
AND ps.customer_site_use_id = su.site_use_id
AND ps.customer_trx_id
= ct.customer_trx_id
AND ps.status
= 'OP'
/var/www/apps/conversion/tmp/scratch_7/326838372.doc
3 3/3/2006 8:58:00 PM

AND cust_acct.cust_account_id = hcasa.cust_account_id


AND su.cust_acct_site_id
= hcasa.cust_acct_site_id
AND hcasa.party_site_id
= hps.party_site_id
AND hps.location_id
= hl.location_id

/var/www/apps/conversion/tmp/scratch_7/326838372.doc
4 3/3/2006 8:58:00 PM

select distinct
substr(hp.party_name,1,150) party_name
, hca.account_number
, hcsua.location
, apsa.trx_number
, apsa.trx_date
, rctta.gl_id_rec
, apsa.customer_id
, apsa.customer_site_use_id
, apsa.customer_trx_id
, apsa.class
, apsa.status
, rcta.purchase_order
, rcta.previous_customer_trx_id
, apsa.due_date
, apsa.amount_due_original
, apsa.amount_due_remaining
-, hps.location_id
, hl.address1
, hl.address2
, hl.address3
, hl.address4
, hl.city
, hl.state
, hl.postal_code
from hz_parties
hp
, hz_cust_accounts
hca
, hz_cust_acct_sites_all
hcasa
, hz_cust_site_uses_all
hcsua
, ar_payment_schedules_all
apsa
, ra_cust_trx_types_all
rctta
, ra_customer_trx_all
rcta
, hz_party_sites
hps
, hz_locations
hl
where hp.party_id = hca.party_id
and hca.cust_account_id
= hcasa.cust_account_id
and hcasa.cust_acct_site_id
= hcsua.cust_acct_site_id
and apsa.customer_id
= hca.cust_account_id
and rctta.CUST_TRX_TYPE_ID
= apsa.cust_trx_type_id
and rcta.customer_trx_id
= apsa.customer_trx_id
and hps.party_id
= hp.party_id
and hl.location_id
= hps.location_id
and apsa.status
= 'OP'

/var/www/apps/conversion/tmp/scratch_7/326838372.doc
5 3/3/2006 8:58:00 PM

--- new production -CREATEORREPLACEVIEWXXSA_AR_CUST_INVOICE_V


(CUSTOMER_NAME,CUSTOMER_NUMBER,LOCATION_ID,INVOICE_NUMBER,INVOICE_DATE,
GL_COMBO_CODE_ID,CUSTOMER_ID,CUSTOMER_SITE_USE_ID,CUSTOMER_TRX_ID,CLASS,
STATUS,PURCHASE_ORDER_NO,PREVIOUS_CUSTOMER_TRX_ID,DUE_DATE,AMOUNT_DUE,
AMOUNT_DUE_REMAINING,ADDRESS1,ADDRESS2,ADDRESS3,ADDRESS4,
CITY,STATE,POSTAL_CODE)
AS
SELECTDISTINCT
SUBSTR(hp.party_name,1,150)party_name
,hca.account_number
,hcsua.LOCATION
,apsa.trx_number
,apsa.trx_date
,rctta.gl_id_rec
,apsa.customer_id
,apsa.customer_site_use_id
,apsa.customer_trx_id
,apsa.CLASS
,apsa.status
,rcta.purchase_order
,rcta.previous_customer_trx_id
,apsa.due_date
,apsa.amount_due_original
,apsa.amount_due_remaining
,hl.address1
,hl.address2
,hl.address3
,hl.address4
,hl.city
,hl.state
,hl.postal_code
FROMhz_partieshp
,hz_cust_accountshca
,hz_cust_acct_sites_allhcasa
,hz_cust_site_uses_allhcsua
,ar_payment_schedules_allapsa
,ra_cust_trx_types_allrctta
,ra_customer_trx_allrcta
,hz_party_siteshps
,hz_locationshl
WHEREhp.party_id=hca.party_id
ANDhca.cust_account_id=hcasa.cust_account_id
ANDhcasa.cust_acct_site_id=hcsua.cust_acct_site_id
ANDapsa.customer_id=hca.cust_account_id
ANDrctta.CUST_TRX_TYPE_ID=apsa.cust_trx_type_id
ANDrcta.customer_trx_id=apsa.customer_trx_id
ANDhps.party_id=hp.party_id
ANDhl.location_id=hps.location_id
ANDapsa.status='OP'
UNION
SELECTSUBSTRB(party.party_name,1,150)
,cust_acct.account_numberCUSTNO
,su.LOCATION
,NULL
,NULL
,NULL
,NULL
/var/www/apps/conversion/tmp/scratch_7/326838372.doc
6 3/3/2006 8:58:00 PM

,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,hl.address1
,hl.address2
,hl.address3
,hl.address4
,hl.city
,hl.state
,hl.postal_code
FROMhz_cust_site_uses_allsu
,hz_cust_accountscust_acct
,hz_partiesparty
,hz_cust_acct_sites_allhcasa
,hz_party_siteshps
,hz_locationshl
WHEREcust_acct.party_id=party.party_id
ANDparty.party_id=hps.party_id
ANDcust_acct.cust_account_id=hcasa.cust_account_id
ANDsu.cust_acct_site_id=hcasa.cust_acct_site_id
ANDhcasa.party_site_id=hps.party_site_id
ANDhps.location_id=hl.location_id
ANDsu.primary_flag='Y'
ANDsu.status='A'
ANDsu.site_use_code='BILL_TO'
ORDERBY1,2,3,4

/var/www/apps/conversion/tmp/scratch_7/326838372.doc
7 3/3/2006 8:58:00 PM

You might also like