Tuesday, 25 October 2011

AR Invoice Tax

/* Formatted on 09-08-2011 16:32:56 (QP5 v5.115.810.9015) */
SELECT   DISTINCT
         (SELECT   name
            FROM   hr_operating_units
           WHERE   organization_id = rctl.org_id AND set_of_books_id = 5)
            Operating_unit,
         jai.customer_trx_id T_TAX_HEADER_ID,
         jai.CUSTOMER_TRX_ID,
         jai.trx_number T_TRX_NUMBER,
         jline.line_number T_LINE_NUMBER,
         taxline.tax_line_no T_TAX_LINE_NO,
         tax.tax_name T_TAX_NAME,
         tax.TAX_TYPE  ,
         taxline.PRECEDENCE_1,
         taxline.PRECEDENCE_2,
         taxline.PRECEDENCE_3,
         taxline.PRECEDENCE_4,
         taxline.PRECEDENCE_5,
         taxline.tax_amount T_AMOUNT
  FROM   ra_customer_trx_lines_all rctl,
         ra_cust_trx_line_gl_dist_all rct,
         ra_customer_trx_all rcta,
         ja_in_ra_customer_trx jai,
         ja_in_ra_customer_trx_lines jline,
         ja_in_ra_cust_trx_tax_lines taxline,
         ja_in_tax_codes tax
 WHERE       rctl.customer_trx_line_id = rct.customer_trx_line_id
         AND rct.customer_trx_id = rcta.customer_trx_id
         AND rcta.customer_trx_id = jai.customer_trx_id(+)
         AND jai.customer_trx_id = jline.customer_trx_id
         AND taxline.link_to_cust_trx_line_id = rctl.customer_trx_line_id
         AND taxline.tax_id = tax.tax_id
         AND TRUNC (rcta.TRX_DATE) BETWEEN '01-AUG-2011' AND '13-AUG-2011'
         --AND rctl.LINE_TYPE = 'TAX'
         AND rcta.SET_OF_BOOKS_ID = 5
        

No comments:

Post a Comment