Sunday, 20 November 2011

AP_INVOICE_DATA and GL

/* Formatted on 1/8/2012 2:06:22 PM (QP5 v5.115.810.9015) */
  SELECT   x.code_combination_id, x.concatenated_segments
    FROM   (  SELECT  -- SUM (x.amount),
                       gcc.code_combination_id,
                       gcc.concatenated_segments,
                       SUM (aida.amount) amount
                FROM   ap_invoice_distributions_all aida,
                       ap_invoices_all aia,
                       gl_code_combinations_kfv gcc
               WHERE   aida.dist_code_combination_id = gcc.code_combination_id
                       AND aia.invoice_id = aida.invoice_id
                       AND aia.org_id = 90
                       AND aida.accounting_date < '01-apr-2011'
            GROUP BY   gcc.code_combination_id, gcc.concatenated_segments
            UNION ALL
              SELECT   gcc.code_combination_id,
                       gcc.concatenated_segments,
                       SUM (aia.invoice_amount)
                FROM   gl_code_combinations_kfv gcc, ap_invoices_all aia
               WHERE   aia.accts_pay_code_combination_id =
                          gcc.code_combination_id
                       AND aia.org_id = 90
                       AND aia.gl_date < '01-apr-2011'
            GROUP BY   gcc.code_combination_id, gcc.concatenated_segments) x
GROUP BY   x.code_combination_id, x.concatenated_segments
ORDER BY   x.concatenated_segments

1 comment:

  1. 25% OFF on Oracle Apps R12 Financials Self Paced Course along with 11 Additional Add On Courses (321 Session Videos of 120 Hours Recordings). Our Top Trending Course with 1700 Enrolled Udemy Students

    Please Check https://www.oracleappstechnical.com for details

    ReplyDelete