DBA Data[Home] [Help]

APPS.ZX_AP_ACTG_POPULATE_PKG SQL Statements

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

Line: 139

PROCEDURE update_zx_rep_detail_t(
           P_COUNT IN BINARY_INTEGER);
Line: 142

PROCEDURE update_rep_actg_t(p_count IN NUMBER);
Line: 144

PROCEDURE update_additional_info(
          P_TRL_GLOBAL_VARIABLES_REC  IN OUT NOCOPY ZX_EXTRACT_PKG.TRL_GLOBAL_VARIABLES_REC_TYPE,
           P_MRC_SOB_TYPE IN VARCHAR2) IS

 l_count number;
Line: 154

 SELECT zx_dtl.DETAIL_TAX_LINE_ID,
        zx_dtl.APPLICATION_ID,
        zx_dtl.INTERNAL_ORGANIZATION_ID,
        zx_dtl.TRX_ID,
        zx_dtl.TRX_LINE_ID ,
        zx_dtl.TAX_LINE_ID ,
        zx_dtl.TRX_LINE_TYPE,
        zx_dtl.TRX_LINE_CLASS,
        zx_dtl.BILL_FROM_PARTY_TAX_PROF_ID,
        zx_dtl.BILL_FROM_SITE_TAX_PROF_ID,
        zx_dtl.SHIP_TO_SITE_TAX_PROF_ID,
        zx_dtl.SHIP_FROM_SITE_TAX_PROF_ID,
        zx_dtl.SHIP_TO_PARTY_TAX_PROF_ID,
        zx_dtl.SHIP_FROM_PARTY_TAX_PROF_ID,
        zx_dtl.BILL_FROM_PARTY_ID,
        zx_dtl.BILL_FROM_PARTY_SITE_ID,
        zx_dtl.HISTORICAL_FLAG,
        ZX_ACTG.ACTG_SOURCE_ID,
        ZX_ACTG.ACTG_HEADER_ID,
        ZX_ACTG.ACTG_EVENT_ID,
   --     ZX_ACTG.ACTG_ENTITY_ID,
        ZX_ACTG.ACTG_LINE_CCID
 FROM  zx_rep_trx_detail_t zx_dtl,
       zx_rep_actg_ext_t zx_actg
 WHERE zx_dtl.request_id = c_request_id
   AND zx_dtl.extract_source_ledger = 'AP'
   AND zx_dtl.detail_tax_line_id = zx_actg.detail_tax_line_id;
Line: 190

        FND_LOG.STRING(g_level_procedure, 'ZX.TRL.ZX_AP_ACTG_POPULATE_PKG.update_additional_info.BEGIN',
                                      'update_additional_info(+)');
Line: 225

        FND_LOG.STRING(g_level_procedure, 'ZX.TRL.ZX_AP_ACTG_POPULATE_PKG.update_additional_info',
                                      'Rows fetched by rep_detail_cursor :'||to_char(l_count));
Line: 243

             FND_LOG.STRING(g_level_procedure, 'ZX.TRL.ZX_AP_ACTG_POPULATE_PKG.update_additional_info',
                                      ' GT_BILL_FROM_PTY_TAX_PROF_ID(i) :'||to_char(GT_DETAIL_TAX_LINE_ID(i)));
Line: 284

        update_zx_rep_detail_t(l_count);
Line: 285

           UPDATE_REP_ACTG_T(l_count);
Line: 288

        FND_LOG.STRING(g_level_procedure, 'ZX.TRL.ZX_AP_ACTG_POPULATE_PKG.update_additional_info.END',
                                      'update_additional_info(-)');
Line: 300

                     'ZX.TRL.ZX_AP_ACTG_POPULATE_PKG.update_additional_info',
                      g_error_buffer);
Line: 306

END update_additional_info;
Line: 323

    SELECT party_id
      FROM zx_party_tax_profile
     WHERE PARTY_TAX_PROFILE_ID = c_bill_from_ptp_id
       AND party_type_code = 'THIRD_PARTY';
Line: 330

    SELECT party_id
      FROM zx_party_tax_profile
     WHERE PARTY_TAX_PROFILE_ID = c_bill_from_stp_id
       AND party_type_code = 'THIRD_PARTY_SITE';
Line: 338

    SELECT party_tax_profile_id
      FROM zx_party_tax_profile
     WHERE party_id = c_bill_from_party_id
       AND party_type_code = 'THIRD_PARTY';
Line: 345

    SELECT party_tax_profile_id
      FROM zx_party_tax_profile
     WHERE party_id = c_bill_from_site_id
       AND party_type_code = 'THIRD_PARTY_SITE';
Line: 352

    SELECT SEGMENT1,
           VAT_REGISTRATION_NUM,
           NUM_1099,
           VENDOR_NAME,
           VENDOR_NAME_ALT,
           STANDARD_INDUSTRY_CLASS
     FROM ap_suppliers
    WHERE party_id = c_bill_from_party_id;
Line: 363

    SELECT CITY,
           COUNTY,
           STATE,
           PROVINCE,
           ADDRESS_LINE1,
           ADDRESS_LINE2,
           ADDRESS_LINE3,
           ADDRESS_LINES_ALT,
           COUNTRY,
           ZIP,
      --     VENDOR_ID,
       --    VENDOR_SITE_ID,
        --   TAX_REPORTING_SITE_FLAG,
           GLOBAL_ATTRIBUTE17,
           VENDOR_SITE_CODE_ALT,
           VENDOR_SITE_CODE
     FROM ap_supplier_sites_all
    WHERE party_site_id = c_bill_from_site_id;
Line: 543

     SELECT discount_distribution_method,
            disc_is_inv_less_tax_flag,
            liability_post_lookup_code
       FROM ap_system_parameters_all
      WHERE org_id = c_org_id;
Line: 550

                  SELECT
                         ael.code_combination_id
                    FROM zx_rec_nrec_dist zx_dist,
                         xla_distribution_links lnk,
                         xla_ae_lines              ael
                   WHERE zx_dist.trx_id = c_trx_id
                     AND lnk.application_id = 200
                     AND lnk.source_distribution_type = 'AP_INVOICE_DISTRIBUTIONS'
                     AND lnk.source_distribution_id_num_1 = zx_dist.trx_line_dist_id
                     AND lnk.ae_header_id   = ael.ae_header_id
                     AND lnk.ae_line_num    = ael.ae_line_num
                     AND lnk.event_id       = c_event_id
                     AND lnk.ae_header_id   = c_ae_header_id
                     AND rownum =1;
Line: 570

                  SELECT
                         ael.code_combination_id
                    FROM zx_rec_nrec_dist zx_dist,
                         xla_distribution_links lnk,
                         xla_ae_lines              ael
                   WHERE zx_dist.trx_id = c_trx_id
                     AND zx_dist.trx_line_id = c_trx_line_id
                     AND lnk.application_id = 200
                     AND lnk.source_distribution_type = 'AP_INVOICE_DISTRIBUTIONS'
                     AND lnk.source_distribution_id_num_1 = zx_dist.trx_line_dist_id
                     AND lnk.ae_header_id   = ael.ae_header_id
                     AND lnk.ae_line_num    = ael.ae_line_num
                     AND lnk.event_id       = c_event_id
                     AND lnk.ae_header_id   = c_ae_header_id
                     AND rownum =1;
Line: 591

                  SELECT
                         ael.code_combination_id
                    FROM zx_rec_nrec_dist zx_dist,
                         xla_distribution_links lnk,
                         xla_ae_lines            ael
                   WHERE zx_dist.trx_id = c_trx_id
                     AND zx_dist.trx_line_id = c_trx_line_id
                     AND lnk.application_id = 200
                     AND lnk.source_distribution_type = 'AP_INVOICE_DISTRIBUTIONS'
                     AND lnk.source_distribution_id_num_1 = zx_dist.trx_line_dist_id
                     AND lnk.ae_header_id   = ael.ae_header_id
                     AND lnk.ae_line_num    = ael.ae_line_num
                     AND lnk.event_id       = c_event_id
                     AND lnk.ae_header_id   = c_ae_header_id
                     AND rownum =1;
Line: 610

                  SELECT
                         ael.code_combination_id
                    FROM zx_rec_nrec_dist zx_dist,
                         xla_distribution_links lnk,
                         xla_ae_lines              ael
                   WHERE zx_dist.trx_id = c_trx_id
                     AND lnk.application_id = 200
                     AND lnk.source_distribution_type = 'AP_INVOICE_DISTRIBUTIONS'
                     AND lnk.tax_rec_nrec_dist_ref_id = zx_dist.rec_nrec_tax_dist_id
                     AND lnk.ae_header_id   = ael.ae_header_id
                     AND lnk.ae_line_num    = ael.ae_line_num
                     AND lnk.event_id       = c_event_id
                     AND lnk.ae_header_id   = c_ae_header_id
                     AND rownum =1;
Line: 627

                  SELECT
                         ael.code_combination_id
                    FROM zx_rec_nrec_dist zx_dist,
                         xla_distribution_links lnk,
                         xla_ae_lines              ael
                   WHERE zx_dist.trx_id = c_trx_id
                     AND zx_dist.tax_line_id = c_tax_line_id
                     AND lnk.application_id = 200
                     AND lnk.source_distribution_type = 'AP_INVOICE_DISTRIBUTIONS'
                     AND lnk.tax_rec_nrec_dist_ref_id = zx_dist.rec_nrec_tax_dist_id
                     AND lnk.ae_header_id   = ael.ae_header_id
                     AND lnk.ae_line_num    = ael.ae_line_num
                     AND lnk.event_id       = c_event_id
                     AND lnk.ae_header_id   = c_ae_header_id
                     AND rownum =1;
Line: 649

                 SELECT
                         ael.code_combination_id
                    FROM zx_rec_nrec_dist zx_dist,
                         xla_distribution_links lnk,
                         xla_ae_lines              ael
                   WHERE zx_dist.trx_id = c_trx_id
                     AND zx_dist.tax_line_id = c_tax_line_id
                     AND zx_dist.REC_NREC_TAX_DIST_ID = c_tax_line_dist_id
                     AND lnk.application_id = 200
                     AND lnk.source_distribution_type = 'AP_INVOICE_DISTRIBUTIONS'
                     AND lnk.tax_rec_nrec_dist_ref_id = zx_dist.rec_nrec_tax_dist_id
                     AND lnk.ae_header_id   = ael.ae_header_id
                     AND lnk.ae_line_num    = ael.ae_line_num
                     AND lnk.event_id       = c_event_id
                     AND lnk.ae_header_id   = c_ae_header_id
                     AND rownum =1;
Line: 695

  L_SQL_STATEMENT1 := ' SELECT '||P_BALANCING_SEGMENT ||
                      ' FROM GL_CODE_COMBINATIONS '||
                      ' WHERE CODE_COMBINATION_ID = :L_CCID ';
Line: 699

  L_SQL_STATEMENT2 := ' SELECT '||P_ACCOUNTING_SEGMENT ||
                      ' FROM GL_CODE_COMBINATIONS '||
                      ' WHERE CODE_COMBINATION_ID = :L_CCID ';
Line: 978

        SELECT sum(lnk.DOC_ROUNDING_ENTERED_AMT), sum(lnk.DOC_ROUNDING_ACCTD_AMT)
         FROM zx_rec_nrec_dist zx_dist,
              xla_distribution_links lnk,
              xla_ae_headers         aeh,
              xla_ae_lines           ael
        WHERE zx_dist.trx_id = c_trx_id
          AND lnk.application_id = 200
          AND lnk.source_distribution_type = 'AP_INVOICE_DISTRIBUTIONS'
          AND lnk.source_distribution_id_num_1 = zx_dist.trx_line_id
          AND lnk.ae_header_id   = c_ae_header_id
          AND lnk.event_id = c_event_id
          AND lnk.ae_line_num    = ael.ae_line_num
          AND lnk.ae_header_id   = ael.ae_header_id
          AND aeh.ae_header_id   = ael.ae_header_id
          AND aeh.ledger_id = c_ledger_id;
Line: 996

        SELECT sum(lnk.DOC_ROUNDING_ENTERED_AMT), sum(lnk.DOC_ROUNDING_ACCTD_AMT)
         FROM zx_rec_nrec_dist zx_dist,
              xla_distribution_links lnk,
              xla_ae_headers         aeh,
              xla_ae_lines              ael
        WHERE zx_dist.trx_id = c_trx_id
          AND lnk.application_id = 200
          AND lnk.source_distribution_type = 'AP_INVOICE_DISTRIBUTIONS'
          AND lnk.tax_rec_nrec_dist_ref_id = zx_dist.rec_nrec_tax_dist_id
          AND lnk.ae_header_id   = c_ae_header_id
          AND lnk.event_id = c_event_id
          AND lnk.ae_line_num    = ael.ae_line_num
          AND aeh.ae_header_id   = ael.ae_header_id
          AND aeh.ledger_id = c_ledger_id;
Line: 1016

        SELECT sum(lnk.DOC_ROUNDING_ENTERED_AMT), sum(lnk.DOC_ROUNDING_ACCTD_AMT)
         FROM zx_rec_nrec_dist zx_dist,
              xla_distribution_links lnk,
              xla_ae_headers         aeh,
              xla_ae_lines              ael
        WHERE zx_dist.trx_id = c_trx_id
          AND zx_dist.trx_line_id = c_trx_line_id
          AND lnk.application_id = 200
          AND lnk.source_distribution_type = 'AP_INVOICE_DISTRIBUTIONS'
          AND lnk.source_distribution_id_num_1 = zx_dist.trx_line_id
          AND lnk.ae_header_id   = c_ae_header_id
          AND lnk.event_id       = c_event_id
          AND lnk.ae_line_num    = ael.ae_line_num
          AND aeh.ae_header_id   = ael.ae_header_id
          AND aeh.ledger_id      = c_ledger_id;
Line: 1035

        SELECT sum(lnk.DOC_ROUNDING_ENTERED_AMT), sum(lnk.DOC_ROUNDING_ACCTD_AMT)
         FROM zx_rec_nrec_dist zx_dist,
              xla_distribution_links lnk,
              xla_ae_headers         aeh,
              xla_ae_lines              ael
        WHERE zx_dist.trx_id = c_trx_id
          AND zx_dist.tax_line_id = c_tax_line_id
          AND lnk.application_id = 200
          AND lnk.source_distribution_type = 'AP_INVOICE_DISTRIBUTIONS'
          AND lnk.tax_rec_nrec_dist_ref_id = zx_dist.rec_nrec_tax_dist_id
          AND lnk.ae_header_id   = c_ae_header_id
          AND lnk.event_id       = c_event_id
          AND lnk.ae_line_num    = ael.ae_line_num
          AND aeh.ae_header_id   = ael.ae_header_id
          AND aeh.ledger_id      = c_ledger_id;
Line: 1058

        SELECT sum(lnk.DOC_ROUNDING_ENTERED_AMT), sum(lnk.DOC_ROUNDING_ACCTD_AMT)
         FROM zx_rec_nrec_dist zx_dist,
              xla_distribution_links lnk,
              xla_ae_headers         aeh,
              xla_ae_lines              ael
        WHERE zx_dist.trx_id = c_trx_id
          AND zx_dist.tax_line_id = c_tax_line_id
          AND zx_dist.rec_nrec_tax_dist_id = c_tax_dist_id
          AND lnk.application_id = 200
          AND lnk.source_distribution_type = 'AP_INVOICE_DISTRIBUTIONS'
          AND lnk.tax_rec_nrec_dist_ref_id = zx_dist.rec_nrec_tax_dist_id
          AND lnk.ae_header_id   = c_ae_header_id
          AND lnk.event_id       = c_event_id
          AND lnk.ae_line_num    = ael.ae_line_num
          AND aeh.ae_header_id   = ael.ae_header_id
          AND aeh.ledger_id      = c_ledger_id;
Line: 1078

        SELECT sum(lnk.DOC_ROUNDING_ENTERED_AMT), sum(lnk.DOC_ROUNDING_ACCTD_AMT)
         FROM zx_rec_nrec_dist zx_dist,
              xla_distribution_links lnk,
              xla_ae_headers         aeh,
              xla_ae_lines              ael
        WHERE zx_dist.trx_id = c_trx_id
          AND zx_dist.trx_line_id  = c_trx_line_id
    --      AND zx_dist.trx_line_dist_id  = c_trx_line_dist_id
          AND lnk.application_id = 200
          AND lnk.source_distribution_type = 'AP_INVOICE_DISTRIBUTIONS'
          AND lnk.source_distribution_id_num_1 = zx_dist.trx_line_dist_id
          AND lnk.ae_header_id   = c_ae_header_id
          AND lnk.event_id = c_event_id
          AND lnk.ae_line_num    = ael.ae_line_num
          AND aeh.ae_header_id   = ael.ae_header_id
          AND aeh.ledger_id      = c_ledger_id;
Line: 1169

  SELECT sum(aphd.amount), -- discount amount (entered)
         sum(aphd.paid_base_amount) -- discount amount (accounted)
    FROM ap_invoice_distributions_all aid,
         ap_invoices_all ai,
         ap_invoice_payments_all aip,
         ap_payment_hist_dists aphd,
         ap_payment_history_all aph
   WHERE aid.invoice_id = ai.invoice_id
     AND aid.invoice_id = aip.invoice_id
     AND aid.distribution_line_number
                IN (SELECT distribution_line_number
                      FROM ap_invoice_distributions_all
                     WHERE invoice_id = p_trx_id
                       AND line_type_lookup_code = 'ITEM')
     AND aip.invoice_payment_id = aphd.invoice_payment_id
     AND aphd.PAY_DIST_LOOKUP_CODE = 'DISCOUNT'
     AND aphd.invoice_distribution_id = aid.invoice_distribution_id
     AND nvl(aph.historical_flag, 'N') = 'N'
     AND aph.check_id = aip.check_id
 UNION
  SELECT xal.entered_dr - xal.entered_cr ,
                -- discount entered amount (replace this with new xla colum names)
         xal.accounted_dr -xal.entered_cr
                -- discount entered amount (replace this with new xla colum names)
    FROM ap_invoice_distributions_all aid,
         ap_invoices_all ai,
         ap_invoice_payments_all aip,
         ap_payment_history_all aph,
         xla_ae_lines    xal
   WHERE aid.invoice_id = ai.invoice_id
     AND aid.invoice_id = aip.invoice_id
     AND aid.distribution_line_number
                IN (SELECT distribution_line_number
                      FROM ap_invoice_distributions_all
                     WHERE invoice_id = p_trx_id
                       AND line_type_lookup_code = 'ITEM')
     AND aip.invoice_payment_id = xal.Upg_Tax_Reference_ID3
     AND aid.old_dist_line_number = xal.Upg_Tax_Reference_ID2
     AND xal.accounting_class_code = 'DISCOUNT'
     AND aph.check_id = aip.check_id
     AND nvl(aph.historical_flag, 'N') = 'Y';
Line: 1212

    SELECT sum(aphd.amount), -- discount amount (entered)
           sum(aphd.paid_base_amount) -- discount amount (accounted)
      FROM ap_invoice_distributions_all aid,
           ap_invoices_all ai,
           ap_invoice_payments_all aip,
           ap_payment_hist_dists aphd,
           ap_payment_history_all aph
     WHERE aid.invoice_id = ai.invoice_id
       AND aid.invoice_id = aip.invoice_id
       AND aid.distribution_line_number
                  IN (SELECT distribution_line_number
                        FROM ap_invoice_distributions_all
                       WHERE invoice_id = p_trx_id
                         AND line_type_lookup_code = 'TAX')
       AND aip.invoice_payment_id = aphd.invoice_payment_id
       AND aphd.PAY_DIST_LOOKUP_CODE = 'DISCOUNT'
       AND aphd.invoice_distribution_id = aid.invoice_distribution_id
       AND nvl(aph.historical_flag, 'N') = 'N'
       AND aph.check_id = aip.check_id
   UNION
    SELECT xal.entered_dr - xal.entered_cr ,
                  -- discount entered amount (replace this with new xla colum names)
           xal.accounted_dr -xal.entered_cr
                  -- discount entered amount (replace this with new xla colum names)
      FROM ap_invoice_distributions_all aid,
           ap_invoices_all ai,
           ap_invoice_payments_all aip,
           ap_payment_history_all aph,
           xla_ae_lines    xal
     WHERE aid.invoice_id = ai.invoice_id
       AND aid.invoice_id = aip.invoice_id
       AND aid.distribution_line_number
                  IN (SELECT distribution_line_number
                        FROM ap_invoice_distributions_all
                       WHERE invoice_id = p_trx_id
                         AND line_type_lookup_code = 'TAX')
       AND aip.invoice_payment_id = xal.Upg_Tax_Reference_ID3
       AND aid.old_dist_line_number = xal.Upg_Tax_Reference_ID2
       AND xal.accounting_class_code = 'DISCOUNT'
       AND aph.check_id = aip.check_id
       AND nvl(aph.historical_flag, 'N') = 'Y';
Line: 1255

    SELECT sum(aphd.amount), -- discount amount (entered)
           sum(aphd.paid_base_amount) -- discount amount (accounted)
      FROM ap_invoice_distributions_all aid,
           ap_invoices_all ai,
           ap_invoice_payments_all aip,
           ap_payment_hist_dists aphd,
           ap_payment_history_all aph
     WHERE aid.invoice_id = ai.invoice_id
       AND aid.invoice_id = aip.invoice_id
--       AND aid.distribution_line_number
       AND aid.invoice_distribution_id = p_trx_line_id
       AND aip.invoice_payment_id = aphd.invoice_payment_id
       AND aphd.PAY_DIST_LOOKUP_CODE = 'DISCOUNT'
       AND aphd.invoice_distribution_id = aid.invoice_distribution_id
       AND nvl(aph.historical_flag, 'N') = 'N'
       AND aph.check_id = aip.check_id
   UNION
       SELECT xal.entered_dr - xal.entered_cr ,
                     -- discount entered amount (replace this with new xla colum names)
              xal.accounted_dr -xal.entered_cr
                     -- discount entered amount (replace this with new xla colum names)
         FROM ap_invoice_distributions_all aid,
              ap_invoices_all ai,
              ap_invoice_payments_all aip,
              ap_payment_history_all aph,
              xla_ae_lines    xal
        WHERE aid.invoice_id = ai.invoice_id
          AND aid.invoice_id = aip.invoice_id
--          AND aid.distribution_line_number
          AND aid.invoice_distribution_id = p_trx_line_id
          AND aip.invoice_payment_id = xal.Upg_Tax_Reference_ID3
          AND aid.old_dist_line_number = xal.Upg_Tax_Reference_ID2
          AND xal.accounting_class_code = 'DISCOUNT'
          AND aph.check_id = aip.check_id
          AND nvl(aph.historical_flag, 'N') = 'Y';
Line: 1293

    SELECT sum(aphd.amount), -- discount amount (entered)
           sum(aphd.paid_base_amount) -- discount amount (accounted)
      FROM ap_invoice_distributions_all aid,
           ap_invoices_all ai,
           ap_invoice_payments_all aip,
           ap_payment_hist_dists aphd,
           ap_payment_history_all aph
     WHERE aid.invoice_id = ai.invoice_id
       AND aid.invoice_id = aip.invoice_id
--      AND aid.distribution_line_number
       AND aid.invoice_distribution_id = p_tax_line_id
       AND aip.invoice_payment_id = aphd.invoice_payment_id
       AND aphd.PAY_DIST_LOOKUP_CODE = 'DISCOUNT'
       AND aphd.invoice_distribution_id = aid.invoice_distribution_id
       AND nvl(aph.historical_flag, 'N') = 'N'
       AND aph.check_id = aip.check_id
   UNION
       SELECT xal.entered_dr - xal.entered_cr ,
                     -- discount entered amount (replace this with new xla colum names)
              xal.accounted_dr -xal.entered_cr
                     -- discount entered amount (replace this with new xla colum names)
         FROM ap_invoice_distributions_all aid,
              ap_invoices_all ai,
              ap_invoice_payments_all aip,
              ap_payment_history_all aph,
              xla_ae_lines    xal
        WHERE aid.invoice_id = ai.invoice_id
          AND aid.invoice_id = aip.invoice_id
--          AND aid.distribution_line_number
          AND aid.invoice_distribution_id = p_tax_line_id
          AND aip.invoice_payment_id = xal.Upg_Tax_Reference_ID3
          AND aid.old_dist_line_number = xal.Upg_Tax_Reference_ID2
          AND xal.accounting_class_code = 'DISCOUNT'
          AND aph.check_id = aip.check_id
          AND nvl(aph.historical_flag, 'N') = 'Y';
Line: 1331

    SELECT sum(aphd.amount), -- discount amount (entered)
           sum(aphd.paid_base_amount) -- discount amount (accounted)
      FROM ap_invoice_distributions_all aid,
           ap_invoices_all ai,
           ap_invoice_payments_all aip,
           ap_payment_hist_dists aphd,
           ap_payment_history_all aph
     WHERE aid.invoice_id = ai.invoice_id
       AND aid.invoice_id = aip.invoice_id
--       AND aid.distribution_line_number
       AND aid.invoice_distribution_id = p_trx_line_id
       AND aip.invoice_payment_id = aphd.invoice_payment_id
       AND aphd.PAY_DIST_LOOKUP_CODE = 'DISCOUNT'
       AND aphd.invoice_distribution_id = aid.invoice_distribution_id
       AND nvl(aph.historical_flag, 'N') = 'N'
       AND aph.check_id = aip.check_id
   UNION
       SELECT xal.entered_dr - xal.entered_cr ,
                     -- discount entered amount (replace this with new xla colum names)
              xal.accounted_dr -xal.entered_cr
                     -- discount entered amount (replace this with new xla colum names)
         FROM ap_invoice_distributions_all aid,
              ap_invoices_all ai,
              ap_invoice_payments_all aip,
              ap_payment_history_all aph,
              xla_ae_lines    xal
        WHERE aid.invoice_id = ai.invoice_id
          AND aid.invoice_id = aip.invoice_id
--          AND aid.distribution_line_number
          AND aid.invoice_distribution_id = p_trx_line_id
          AND aip.invoice_payment_id = xal.Upg_Tax_Reference_ID3
          AND aid.old_dist_line_number = xal.Upg_Tax_Reference_ID2
          AND xal.accounting_class_code = 'DISCOUNT'
          AND aph.check_id = aip.check_id
          AND nvl(aph.historical_flag, 'N') = 'Y';
Line: 1369

    SELECT sum(aphd.amount), -- discount amount (entered)
           sum(aphd.paid_base_amount) -- discount amount (accounted)
      FROM ap_invoice_distributions_all aid,
           ap_invoices_all ai,
           ap_invoice_payments_all aip,
           ap_payment_hist_dists aphd,
           ap_payment_history_all aph
     WHERE aid.invoice_id = ai.invoice_id
       AND aid.invoice_id = aip.invoice_id
--       AND aid.distribution_line_number
       AND aid.invoice_distribution_id = p_tax_line_id
       AND aip.invoice_payment_id = aphd.invoice_payment_id
       AND aphd.PAY_DIST_LOOKUP_CODE = 'DISCOUNT'
       AND aphd.invoice_distribution_id = aid.invoice_distribution_id
       AND nvl(aph.historical_flag, 'N') = 'N'
       AND aph.check_id = aip.check_id
   UNION
       SELECT xal.entered_dr - xal.entered_cr ,
                     -- discount entered amount (replace this with new xla colum names)
              xal.accounted_dr -xal.entered_cr
                     -- discount entered amount (replace this with new xla colum names)
         FROM ap_invoice_distributions_all aid,
              ap_invoices_all ai,
              ap_invoice_payments_all aip,
              ap_payment_history_all aph,
              xla_ae_lines    xal
        WHERE aid.invoice_id = ai.invoice_id
          AND aid.invoice_id = aip.invoice_id
--          AND aid.distribution_line_number
          AND aid.invoice_distribution_id = p_tax_line_id
          AND aip.invoice_payment_id = xal.Upg_Tax_Reference_ID3
          AND aid.old_dist_line_number = xal.Upg_Tax_Reference_ID2
          AND xal.accounting_class_code = 'DISCOUNT'
          AND aph.check_id = aip.check_id
          AND nvl(aph.historical_flag, 'N') = 'Y';
Line: 1568

PROCEDURE update_zx_rep_detail_t(
  P_COUNT IN BINARY_INTEGER)
 IS

BEGIN

    IF (g_level_procedure >= g_current_runtime_level ) THEN
        FND_LOG.STRING(g_level_procedure, 'ZX.TRL.ZX_AP_ACTG_POPULATE_PKG.update_zx_rep_detail_t.BEGIN',
                                      'update_zx_rep_detail_t(+)');
Line: 1580

      UPDATE zx_rep_trx_detail_t SET
             REP_CONTEXT_ID            =     G_REP_CONTEXT_ID,
             BILLING_TP_NUMBER         =     GT_BILLING_TP_NUMBER(i),
             BILLING_TP_TAX_REG_NUM    =     GT_BILLING_TP_TAX_REG_NUM(i),
             BILLING_TP_TAXPAYER_ID    =     GT_BILLING_TP_TAXPAYER_ID(i),
             BILLING_TP_SITE_NAME      =     GT_BILLING_TP_SITE_NAME(i),
             BILLING_TP_SITE_NAME_ALT  =     GT_BILLING_TP_SITE_NAME_ALT(i),
             BILLING_TP_NAME           =     GT_BILLING_TP_NAME(i),
             BILLING_TP_NAME_ALT       =     GT_BILLING_TP_NAME_ALT(i),
             BILLING_TP_SIC_CODE       =     GT_BILLING_TP_SIC_CODE(i),
             BILLING_TP_CITY           =     GT_BILLING_TP_CITY(i),
             BILLING_TP_COUNTY         =     GT_BILLING_TP_COUNTY(i),
             BILLING_TP_STATE          =     GT_BILLING_TP_STATE(i),
             BILLING_TP_PROVINCE       =     GT_BILLING_TP_PROVINCE(i),
             BILLING_TP_ADDRESS1       =     GT_BILLING_TP_ADDRESS1(i),
             BILLING_TP_ADDRESS2       =     GT_BILLING_TP_ADDRESS2(i),
             BILLING_TP_ADDRESS3       =     GT_BILLING_TP_ADDRESS3(i),
             BILLING_TP_ADDRESS_LINES_ALT =  GT_BILLING_TP_ADDR_LINES_ALT(i),
             BILLING_TP_COUNTRY        =     GT_BILLING_TP_COUNTRY(i),
             BILLING_TP_POSTAL_CODE    =     GT_BILLING_TP_POSTAL_CODE(i),
             GDF_PO_VENDOR_SITE_ATT17  =     GT_GDF_PO_VENDOR_SITE_ATT17(i),
             TRX_CLASS_MNG             =     GT_TRX_CLASS_MNG(i),
             TAX_RATE_CODE_REG_TYPE_MNG  =   GT_TAX_RATE_CODE_REG_TYPE_MNG(i),
             TAXABLE_DISC_AMT          =     GT_TAXABLE_DISC_AMT(i),
             TAXABLE_DISC_AMT_FUNCL_CURR =   GT_TAXABLE_DISC_AMT_FUNCL_CURR(i),
             TAX_DISC_AMT              =     GT_TAX_DISC_AMT(i),
             TAX_DISC_AMT_FUNCL_CURR     =   GT_TAX_DISC_AMT_FUNCL_CURR(i)
      WHERE  DETAIL_TAX_LINE_ID = GT_DETAIL_TAX_LINE_ID(i);
Line: 1610

        FND_LOG.STRING(g_level_procedure, 'ZX.TRL.ZX_AP_ACTG_POPULATE_PKG.update_zx_rep_detail_t.END',
                                      'update_zx_rep_detail_t(-)');
Line: 1622

                     'ZX.TRL.ZX_AP_ACTG_POPULATE_PKG.update_zx_rep_detail_t',
                      g_error_buffer);
Line: 1627

END update_zx_rep_detail_t;
Line: 1629

PROCEDURE update_rep_actg_t(p_count IN NUMBER) IS
i number;
Line: 1634

        FND_LOG.STRING(g_level_procedure, 'ZX.TRL.ZX_AR_ACTG_POPULATE_PKG.UPDATE_REP_ACTG_T.BEGIN',
                                      'ZX_AR_ACTG_POPULATE_PKG: UPDATE_REP_ACTG_T(+)');
Line: 1639

UPDATE zx_rep_actg_ext_t SET
       TRX_ARAP_BALANCING_SEGMENT    =  GT_TRX_ARAP_BALANCING_SEGMENT(i),
       TRX_ARAP_NATURAL_ACCOUNT      =  GT_TRX_ARAP_NATURAL_ACCOUNT(i),
       TRX_TAXABLE_BALANCING_SEGMENT = GT_TRX_TAXABLE_BAL_SEG(i),
       TRX_TAXABLE_NATURAL_ACCOUNT   =  GT_TRX_TAXABLE_NATURAL_ACCOUNT(i),
       TRX_TAX_BALANCING_SEGMENT     =  GT_TRX_TAX_BALANCING_SEGMENT(i),
       TRX_TAX_NATURAL_ACCOUNT       =  GT_TRX_TAX_NATURAL_ACCOUNT(i)
   WHERE DETAIL_TAX_LINE_ID = GT_DETAIL_TAX_LINE_ID(i);
Line: 1649

        FND_LOG.STRING(g_level_procedure, 'ZX.TRL.ZX_AR_ACTG_POPULATE_PKG.UPDATE_REP_ACTG__T.END',
                                      'ZX_AR_ACTG_POPULATE_PKG: UPDATE_REP_ACTG_T(-)');
Line: 1662

                     'ZX.TRL.ZX_AR_ACTG_POPULATE_PKG.UPDATE_REP_ACTG_T',
                      g_error_buffer);
Line: 1668

END UPDATE_REP_ACTG_T;
Line: 1813

    SELECT meaning, description
      FROM fnd_lookups
     WHERE lookup_type = c_lookup_type
       AND lookup_code = c_lookup_code;