Tuesday, 25 October 2011

AR_HEADERS_QOERY

select * from ja_in_ra_customer_trx_lines
select * from JA_IN_RA_CUSTOMER_TRX where set_of_books_id=5
and trunc(creation_date) BETWEEN '01-APR-2011' AND '31-MAY-2011'
select distinct ra.CUSTOMER_ID ,ra.CUSTOMER_NUMBER, rcta.customer_trx_id H_TRX_HEADER_ID,
       bat.name H_BATCH_SOURCE, 
       rcta.trx_number H_TRX_NUMBER,
       --jai.TRX_NUMBER,
       decode(typ.TYPE,'INV','Invoice','CM','Credit Memo','DM','Debit Memo','DEP','Deposit','CB','Chargeback')
        H_INVOICE_CLASS,      
       rcta.invoice_currency_code,
       ra.customer_name h_bill_to_customer,      
       typ.name H_TRX_TYPE,
       (SELECT name
          FROM hr_operating_units
         WHERE organization_id = rct.org_id) H_ORIG_REFERENCE,
       rcta.trx_date H_INVOICE_DATE,
       ter.name H_TERMS_CODE,      
       rct.gl_date H_GL_DATE,
       (SELECT location
          FROM hz_cust_site_uses_all
         WHERE site_use_id = rcta.bill_to_site_use_id) H_BILL_TO_SITE,
       rcta.exchange_date,
       rcta.exchange_rate,
       rcta.exchange_rate_type,
       (SELECT organization_name
    from org_organization_definitions
    where organization_id = jai.organization_id) H_ORGANIZATION,
(SELECT description
   from hr_locations_all
   where location_id = jai.location_id )H_LOCATION,
      rcta.attribute5
from  ra_customer_trx_lines_all rctl,
      ra_cust_trx_line_gl_dist_all rct,
      ra_customer_trx_all rcta,
      ar_batch_sources_all bat,
      ja_in_ra_customer_trx jai,
      ra_cust_trx_types_ALL typ,
      fnd_lookups fnd,
      ra_customers ra,
      ra_terms ter
where rctl.customer_trx_line_id=rct.customer_trx_line_id
and   rctl.customer_trx_id=rcta.customer_trx_id
and   rcta.customer_trx_id=rct.customer_trx_id
AND   rcta.customer_trx_id = jai.customer_trx_id(+)
AND   rcta.batch_source_id = bat.batch_source_id(+)
AND rcta.BILL_TO_CUSTOMER_ID = ra.CUSTOMER_ID(+)
and   rcta.CUST_TRX_TYPE_ID = typ.CUST_TRX_TYPE_ID
and rcta.term_id = ter.term_id(+)
AND   typ.TYPE = fnd.LOOKUP_CODE
--AND   fnd.LOOKUP_TYPE = 'JEBE_AR_OF_TRANS_TYPE'
AND TRUNC(rcta.TRX_DATE) BETWEEN '01-AUG-2011' AND '13-AUG-2011'
AND rcta.SET_OF_BOOKS_ID = 5
order by 1

AND CT.CUST_TRX_TYPE_ID = CTT.CUST_TRX_TYPE_ID
            AND CTT.TYPE <> 'BR'
Select * from fnd_lookups where LOOKUP_TYPE = 'JEBE_AR_OF_TRANS_TYPE'

No comments:

Post a Comment