DBA Data[Home] [Help]

APPS.AP_ACCOUNTING_UTILITIES_PKG SQL Statements

The following lines contain the word 'select', 'insert', 'update' or 'delete':

Line: 53

   SELECT sum(nvl(ael.accounted_cr,0) - nvl(ael.accounted_dr,0))
     FROM AP_INVOICE_DISTRIBUTIONS aid,
          AP_ENCUMBRANCE_LINES ael,
          financials_system_parameters fsp
    WHERE aid.po_distribution_id = P_po_distribution_id
      AND aid.invoice_distribution_id = ael.invoice_distribution_id
      AND ( ( p_start_gl_date is not null
              and p_start_gl_date <= ael.accounting_date ) or
            ( p_start_gl_date is null ) )
      AND ( (p_end_gl_date is not null
             and  p_end_gl_date >= ael.accounting_date ) or
            (p_end_gl_date is null ) )
      AND ael.encumbrance_line_type not in ('IPV', 'ERV', 'QV')
      AND ( (ael.ae_header_id is null and
             aid.encumbered_flag = 'Y' and
             FSP.purch_encumbrance_type_id <> FSP.inv_encumbrance_type_id) or
            (ael.ae_header_id is not null and
             FSP.purch_encumbrance_type_id = FSP.inv_encumbrance_type_id and
             'Y' = ( select gl_transfer_flag
                     from ap_ae_headers aeh
                     where aeh.ae_header_id = ael.ae_header_id ) )
          )
      AND  nvl(aid.org_id,-1) =  nvl(fsp.org_id,-1)
      AND  ael.encumbrance_type_id =  fsp.purch_encumbrance_type_id;
Line: 83

   SELECT sum (nvl(nvl(aid.base_amount,aid.amount),0) -
               nvl(aid.base_invoice_price_variance ,0) -
               nvl(aid.exchange_rate_variance,0) -
               nvl(aid.base_quantity_variance,0))
     FROM   ap_invoice_distributions aid,
            po_distributions pd,
            financials_system_parameters fs
    where aid.po_distribution_id = p_po_distribution_id
      and aid.po_distribution_id = pd.po_distribution_id
      and nvl(aid.org_id,-1) = nvl(fs.org_id,-1)
      and fs.inv_encumbrance_type_id <> fs.purch_encumbrance_type_id
      and NVL(PD.accrue_on_receipt_flag,'N') = 'N'
      AND AID.po_distribution_id is not null
      AND nvl(aid.match_status_flag, 'N') = 'A'
      AND nvl(aid.encumbered_flag, 'N') = 'Y'
      AND (aid.accrual_posted_flag = 'Y' or aid.cash_posted_flag = 'Y')
      AND (( p_start_gl_date is not null and p_start_gl_date <= aid.accounting_date) or (p_start_gl_date is null))
      AND ((p_end_gl_date is not null and p_end_gl_date >= aid.accounting_date) or (p_end_gl_date is null))
      AND NOT EXISTS (SELECT 'release 11.5 encumbrance'
                        from ap_encumbrance_lines_all ael
                       where ael.invoice_distribution_id = aid.invoice_distribution_id);