DBA Data[Home] [Help]

APPS.OKL_PROCESS_SALES_TAX_PVT SQL Statements

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

Line: 55

    SELECT  csi.install_location_id,
                -- csi.location_id
            csi.install_location_type_code
    FROM   csi_item_instances csi,
           okc_k_items cim,
           okc_k_lines_b   inst,
           okc_k_lines_b   ib,
           okc_line_styles_b lse
    WHERE  csi.instance_id = TO_NUMBER(cim.object1_id1)
    AND    cim.cle_id = ib.id
    AND    ib.cle_id = inst.id
    AND    inst.lse_id = lse.id
    AND    lse.lty_code = 'FREE_FORM2'
    AND    inst.cle_id = cp_fin_asset_id ;
Line: 72

    SELECT  ib.id  inst_item_id
    FROM    okc_k_lines_b   inst,
            okc_k_lines_b   ib
    WHERE   ib.cle_id = inst.id
    AND     inst.lse_id = 43
    AND     inst.cle_id = cp_fin_asset_id;
Line: 81

    SELECT object_id1_new
        FROM   okl_txl_itm_insts
        WHERE  kle_id = cp_kle_id;
Line: 87

        SELECT party_site_id
        FROM   hz_party_site_uses
        WHERE  party_site_use_id = cp_party_site_use_id;
Line: 93

    SELECT hzp.location_id
    FROM   HZ_PARTY_SITES HZP
    WHERE  HZP.PARTY_SITE_ID = cp_party_site_id;
Line: 99

    SELECT HZP.PARTY_SITE_ID
    FROM   HZ_PARTY_SITES HZP,
           HZ_PARTY_SITE_USES HZU
    WHERE  HZP.LOCATION_ID = cp_location_id
    AND    HZP.party_site_id  = HZU.PARTY_SITE_ID
    AND    HZU.SITE_USE_TYPE = 'INSTALL_AT'   ;
Line: 108

    SELECT /*a.CUST_ACCT_SITE_ID */
           b.site_use_id
    FROM   hz_cust_acct_sites_all a,
           hz_cust_site_uses_all  b,
           hz_party_sites      c
    WHERE  a.CUST_ACCT_SITE_ID = b.CUST_ACCT_SITE_ID
    AND    b.site_use_code     = 'SHIP_TO'
    AND    a.party_site_id     = c.party_site_id
    AND    a.cust_account_id   = cp_cust_acct_id
    AND    a.org_id            = NVL(TO_NUMBER(SUBSTRB(USERENV('CLIENT_INFO'),1,10)),-99)
    AND    c.party_site_id     = cp_inst_loc_id
    AND    c.location_id       = cp_loc_id;
Line: 410

    SELECT '1'
    FROM okl_tax_sources
    WHERE khr_id = p_chr_id
    AND entity_code = G_ASSETS_ENTITY_CODE
    AND event_class_code = G_ALC_EVENT_CODE
    AND alc_serialized_yn IN ('Y', 'L')
    AND rownum = 1;
Line: 488

   |        okl_tax_sources_pub.update_tax_sources()
   |
   | PARAMETERS
   |      p_source_trx_id              -- Source Transaction Identifier
   |
   | KNOWN ISSUES
   |
   | NOTES
   |
   |
   | MODIFICATION HISTORY
   | Date          Author     Description of Changes
   | 11-APR-07    RRAVIKIR      Created
   |
   *=======================================================================*/
    PROCEDURE validate_tax_code(
      p_api_version                   IN  NUMBER,
      p_init_msg_list                 IN  VARCHAR2 DEFAULT OKL_API.G_FALSE,
      x_return_status                 OUT NOCOPY VARCHAR2,
      x_msg_count                     OUT NOCOPY NUMBER,
      x_msg_data                      OUT NOCOPY VARCHAR2,
      p_trx_date                      IN  DATE,
      p_tbc_code                      IN  VARCHAR2 DEFAULT NULL,
      p_ufc_code                      IN  VARCHAR2 DEFAULT NULL,
      p_pc_code                       IN  VARCHAR2 DEFAULT NULL,
      x_valid_code                    OUT NOCOPY VARCHAR2) IS

      -- Local variables
      l_api_name                      CONSTANT VARCHAR2(30) := 'validate_tax_code';
Line: 523

      SELECT '1'
      FROM      zx_fc_business_categories_v
      WHERE classification_code = cp_tbc_code
          AND   effective_from  <= cp_trx_date
          AND  (effective_to >= cp_trx_date OR effective_to is NULL);
Line: 530

      SELECT '1'
      FROM      zx_fc_user_defined_v
          WHERE classification_code = cp_ufc_code
      AND   effective_from  <= cp_trx_date
          AND   (effective_to >= cp_trx_date OR effective_to is NULL);
Line: 537

      SELECT '1'
      FROM      zx_fc_product_categories_v
      WHERE classification_code = cp_pc_code
          AND   effective_from  <= cp_trx_date
          AND   (effective_to >= cp_trx_date OR effective_to is NULL);
Line: 720

    SELECT tax_rate_id,
           tax_rate_code,
           tax_exemption_id,
           tax_rate,
           tax_date,
           line_amt,
           internal_organization_id,
           application_id,
           entity_code,
           event_class_code,
           event_type_code,
           trx_id,
           trx_line_id,
           trx_level_type,
           trx_line_number,
           tax_line_number,
           tax_regime_id,
           tax_regime_code,
           tax_id,
           tax,
           tax_status_id,
           tax_status_code,
           tax_apportionment_line_number,
           legal_entity_id,
           trx_number,
           trx_date,
           tax_jurisdiction_id,
           tax_jurisdiction_code,
           tax_type_code,
           tax_currency_code,
           taxable_amt_tax_curr,
           trx_currency_code,
           minimum_accountable_unit,
           precision,
           currency_conversion_type,
           currency_conversion_rate,
           currency_conversion_date,
           tax_determine_date,
           taxable_amt,
           tax_amt
    FROM zx_detail_tax_lines_gt
    WHERE trx_id = cp_trx_id
    AND   application_id = G_OKL_APPLICATION_ID
    AND   trx_level_type = G_TRX_LEVEL_TYPE
    AND   entity_code = cp_entity_code
    AND   event_class_code = cp_event_class_code;
Line: 769

    SELECT id
    FROM   okl_tax_sources
    WHERE  trx_id = cp_trx_id
    AND    trx_line_id = cp_trx_line_id;
Line: 796

              'INSERT INTO OKL_TAX_TRX_DETAILS');
Line: 799

    l_tax_lines_tbl.DELETE;
Line: 877

          l_tax_lines_tbl(i).program_update_date          := null;
Line: 896

          l_tax_lines_tbl(i).last_updated_by              := G_USER_ID;
Line: 897

          l_tax_lines_tbl(i).last_update_date             := SYSDATE;
Line: 898

          l_tax_lines_tbl(i).last_update_login            := G_LOGIN_ID;
Line: 914

          INSERT INTO okl_tax_trx_details VALUES l_tax_lines_tbl(indx);
Line: 987

   |        okl_tax_sources_pub.update_tax_sources()
   |
   | PARAMETERS
   |      p_asset_id              -- Asset Identifier
   |
   | KNOWN ISSUES
   |
   | NOTES
   |
   |
   | MODIFICATION HISTORY
   | Date          Author     Description of Changes
   | 26-Jul-07    RRAVIKIR      Created
   |
   *=======================================================================*/
    PROCEDURE populate_ser_split_total_tax(
      p_api_version                   IN  NUMBER,
      p_init_msg_list                 IN  VARCHAR2 DEFAULT OKL_API.G_FALSE,
      x_return_status                 OUT NOCOPY VARCHAR2,
      x_msg_count                     OUT NOCOPY NUMBER,
      x_msg_data                      OUT NOCOPY VARCHAR2,
      p_asset_id                      IN  NUMBER,
      p_serialized_asset              IN  VARCHAR2) IS

      -- Local variables
      l_api_name                      CONSTANT VARCHAR2(30) := 'populate_ser_split_total_tax';
Line: 1025

      SELECT id
      FROM okl_tax_sources
      WHERE kle_id = cp_kle_id
      AND sty_id = cp_sty_id
      AND tax_call_type_code = G_UPFRONT_TAX
      AND tax_line_status_code = G_ACTIVE_STATUS
      AND entity_code = G_CONTRACTS_ENTITY_CODE
      AND event_class_code = G_BOOKING_EVENT_CLASS_CODE;
Line: 1035

      SELECT SUM(total_tax)
      FROM okl_tax_sources
      WHERE kle_id = cp_kle_id
      AND sty_id = cp_sty_id
      AND tax_call_type_code = G_UPFRONT_TAX
      AND tax_line_status_code = G_ACTIVE_STATUS
      AND entity_code = G_CONTRACTS_ENTITY_CODE
      AND event_class_code = G_BOOKING_EVENT_CLASS_CODE;
Line: 1045

      SELECT SUM(assessable_value)
      FROM okl_tax_sources
      WHERE kle_id = cp_kle_id
      AND sty_id = cp_sty_id
      AND tax_call_type_code = G_UPFRONT_TAX
      AND tax_line_status_code = G_ACTIVE_STATUS
      AND entity_code = G_CONTRACTS_ENTITY_CODE
      AND event_class_code = G_BOOKING_EVENT_CLASS_CODE;
Line: 1055

      SELECT DISTINCT sty_id
      FROM okl_tax_sources
      WHERE kle_id = cp_kle_id
      AND tax_call_type_code = G_UPFRONT_TAX
      AND tax_line_status_code = G_ACTIVE_STATUS
      AND entity_code = G_CONTRACTS_ENTITY_CODE
      AND event_class_code = G_BOOKING_EVENT_CLASS_CODE;
Line: 1118

              'Calling okl_tax_sources_pub.update_tax_sources for updating Total Tax for all Lines in Tax Sources');
Line: 1121

        okl_tax_sources_pub.update_tax_sources(p_api_version     => p_api_version
                                              ,p_init_msg_list   => p_init_msg_list
                                              ,x_return_status   => l_return_status
                                              ,x_msg_count       => x_msg_count
                                              ,x_msg_data        => x_msg_data
                                              ,p_txsv_tbl        => l_txsv_tbl
                                              ,x_txsv_tbl        => lx_txsv_tbl);
Line: 1245

   |        okl_tax_sources_pub.update_tax_sources()
   |
   | PARAMETERS
   |      p_source_trx_id              -- Source Transaction Identifier
   |
   | KNOWN ISSUES
   |
   | NOTES
   |
   |
   | MODIFICATION HISTORY
   | Date          Author     Description of Changes
   | 11-APR-07    RRAVIKIR      Created
   |
   *=======================================================================*/
    PROCEDURE populate_alc_total_tax(
      p_api_version                   IN  NUMBER,
      p_init_msg_list                 IN  VARCHAR2 DEFAULT OKL_API.G_FALSE,
      x_return_status                 OUT NOCOPY VARCHAR2,
      x_msg_count                     OUT NOCOPY NUMBER,
      x_msg_data                      OUT NOCOPY VARCHAR2,
      p_asset_id                      IN  NUMBER,
      p_request_id                    IN  NUMBER,
      p_serialized_asset              IN  VARCHAR2 DEFAULT NULL) IS

      -- Local variables
      l_api_name                      CONSTANT VARCHAR2(30) := 'populate_alc_total_tax';
Line: 1283

      SELECT id
      FROM okl_tax_sources
      WHERE trx_id IN (SELECT id
                       FROM okl_trx_assets
                       WHERE req_asset_id = cp_request_id)
      AND kle_id = cp_kle_id
      AND tax_call_type_code = G_UPFRONT_TAX
      AND tax_line_status_code = G_ACTIVE_STATUS
      AND entity_code = G_ASSETS_ENTITY_CODE
      AND event_class_code = G_ALC_EVENT_CODE;
Line: 1295

      SELECT id
      FROM okl_tax_sources
      WHERE trx_id IN (SELECT id
                       FROM okl_trx_assets
                       WHERE req_asset_id = cp_request_id)
      AND kle_id = cp_kle_id
      AND sty_id = cp_sty_id
      AND tax_call_type_code = G_UPFRONT_TAX
      AND tax_line_status_code = G_INACTIVE_STATUS
      AND entity_code = G_ASSETS_ENTITY_CODE
      AND event_class_code = G_ALC_EVENT_CODE;
Line: 1308

      SELECT SUM(total_tax)
      FROM okl_tax_sources
      WHERE trx_id IN (SELECT id
                       FROM okl_trx_assets
                       WHERE req_asset_id = cp_request_id)
      AND kle_id = cp_kle_id
      AND sty_id = cp_sty_id
      AND tax_call_type_code = G_UPFRONT_TAX
      AND tax_line_status_code = G_INACTIVE_STATUS
      AND entity_code = G_ASSETS_ENTITY_CODE
      AND event_class_code = G_ALC_EVENT_CODE;
Line: 1321

      SELECT SUM(total_tax)
      FROM okl_tax_sources
      WHERE trx_id IN (SELECT id
                       FROM okl_trx_assets
                       WHERE req_asset_id = cp_request_id)
      AND tax_call_type_code = G_UPFRONT_TAX
      AND tax_line_status_code = G_ACTIVE_STATUS
      AND entity_code = G_ASSETS_ENTITY_CODE
      AND event_class_code = G_ALC_EVENT_CODE;
Line: 1332

      SELECT DISTINCT sty_id
      FROM okl_tax_sources
      WHERE trx_id IN (SELECT id
                       FROM okl_trx_assets
                       WHERE req_asset_id = cp_request_id)
      AND kle_id = cp_kle_id
      AND tax_call_type_code = G_UPFRONT_TAX
      AND tax_line_status_code = G_INACTIVE_STATUS
      AND entity_code = G_ASSETS_ENTITY_CODE
      AND event_class_code = G_ALC_EVENT_CODE;
Line: 1415

              'Calling okl_tax_sources_pub.update_tax_sources for updating Total Tax for all Lines in Tax Sources');
Line: 1418

        okl_tax_sources_pub.update_tax_sources(p_api_version     => p_api_version
                                              ,p_init_msg_list   => p_init_msg_list
                                              ,x_return_status   => l_return_status
                                              ,x_msg_count       => x_msg_count
                                              ,x_msg_data        => x_msg_data
                                              ,p_txsv_tbl        => l_txsv_tbl
                                              ,x_txsv_tbl        => lx_txsv_tbl);
Line: 1532

   | PRIVATE PROCEDURE update_tax_sources_total
   |
   | DESCRIPTION
   |    This procedure fetches the tax amount from ZX_LINES and updates
   |    the tax sources
   |
   | CALLED FROM
   |        process_contract_reversal_tax()
   |        process_quote_tax()
   |        process_asset_loc_tax()
   |        process_booking_upfront_tax()
   |        process_quoting_upfront_tax()
   |        process_tax_determ_override()
   |        process_tax_details_override()
   |        process_rebook_upfront_tax()
   |
   | CALLS PROCEDURES/FUNCTIONS
   |        okl_tax_sources_pub.update_tax_sources()
   |        populate_alc_total_tax()
   |
   | PARAMETERS
   |      p_source_trx_id              -- Source Transaction Identifier
   |
   | KNOWN ISSUES
   |
   | NOTES
   |
   |
   | MODIFICATION HISTORY
   | Date          Author     Description of Changes
   | 11-APR-07    RRAVIKIR      Created
   |
   *=======================================================================*/
    PROCEDURE update_tax_sources_total(
      p_api_version                   IN  NUMBER,
      p_init_msg_list                 IN  VARCHAR2 DEFAULT OKL_API.G_FALSE,
      x_return_status                 OUT NOCOPY VARCHAR2,
      x_msg_count                     OUT NOCOPY NUMBER,
      x_msg_data                      OUT NOCOPY VARCHAR2,
      p_source_trx_id                 IN  NUMBER,
      p_source_trx_name               IN  VARCHAR2 DEFAULT NULL,
      p_serialized_asset              IN  VARCHAR2 DEFAULT NULL) IS

      -- Local variables
      l_api_name                      CONSTANT VARCHAR2(30) := 'update_tax_sources_total';
Line: 1587

      SELECT id, trx_line_id,application_id, event_class_code, entity_code,
             trx_level_type
      FROM okl_tax_sources
      WHERE trx_id = cp_trx_id
      AND tax_call_type_code = G_UPFRONT_TAX
      AND tax_line_status_code = G_INACTIVE_STATUS
      AND adjusted_doc_trx_id IS NOT NULL;
Line: 1596

      SELECT id, trx_line_id,application_id, event_class_code, entity_code,
             trx_level_type
      FROM okl_tax_sources
      WHERE trx_id = cp_trx_id
      AND tax_call_type_code = G_UPFRONT_TAX
      AND tax_line_status_code = G_ACTIVE_STATUS;
Line: 1604

      SELECT id, trx_line_id,application_id, event_class_code, entity_code,
             trx_level_type
      FROM okl_tax_sources
      WHERE trx_id = cp_trx_id
      AND tax_call_type_code = G_TAX_SCHEDULE
      AND tax_line_status_code = G_ACTIVE_STATUS;
Line: 1612

      SELECT id, trx_line_id,application_id, event_class_code, entity_code,
             trx_level_type
      FROM okl_tax_sources
      WHERE trx_id = cp_trx_id
      AND tax_call_type_code = G_INVOICE_TAX
      AND tax_line_status_code = G_ACTIVE_STATUS;
Line: 1622

      SELECT  SUM(tax_amt) total_tax
      FROM    zx_lines
      WHERE   trx_id = cp_trx_id
      AND     trx_line_id = cp_trx_line_id
      AND     application_id = cp_application_id
      AND     event_class_code = cp_event_class_code
      AND     entity_code = cp_entity_code
      AND     trx_level_type = cp_trx_level_type
      AND     nvl(cancel_flag, 'N') <> 'Y';
Line: 1635

      SELECT  SUM(tax_amt) total_tax
      FROM    zx_detail_tax_lines_gt
      WHERE   trx_id = cp_trx_id
      AND     trx_line_id = cp_trx_line_id
      AND     application_id = cp_application_id
      AND     event_class_code = cp_event_class_code
      AND     entity_code = cp_entity_code
      AND     trx_level_type = cp_trx_level_type
      AND     nvl(cancel_flag, 'N') <> 'Y';
Line: 1646

      SELECT id, trx_line_id,application_id, event_class_code, entity_code,
             trx_level_type
      FROM okl_tax_sources
      WHERE trx_id = cp_trx_id
      AND tax_call_type_code = G_UPFRONT_TAX
      AND tax_line_status_code = G_INACTIVE_STATUS;
Line: 1655

          FND_LOG.STRING(G_DEBUG_LEVEL_PROCEDURE,'OKL_PROCESS_SALES_TAX_PVT.update_tax_sources_total','Begin(+)');
Line: 1660

        FND_LOG.STRING(G_DEBUG_LEVEL_STATEMENT,'OKL_PROCESS_SALES_TAX_PVT.update_tax_sources_total.',
                'p_init_msg_list :'||p_init_msg_list);
Line: 1662

        FND_LOG.STRING(G_DEBUG_LEVEL_STATEMENT,'OKL_PROCESS_SALES_TAX_PVT.update_tax_sources_total.',
                'p_source_trx_id :'||p_source_trx_id);
Line: 1664

        FND_LOG.STRING(G_DEBUG_LEVEL_STATEMENT,'OKL_PROCESS_SALES_TAX_PVT.update_tax_sources_total.',
                'p_source_trx_name :'||p_source_trx_name);
Line: 1666

        FND_LOG.STRING(G_DEBUG_LEVEL_STATEMENT,'OKL_PROCESS_SALES_TAX_PVT.update_tax_sources_total.',
                'p_serialized_asset :'||p_serialized_asset);
Line: 1815

          FND_LOG.STRING(G_DEBUG_LEVEL_STATEMENT,'OKL_PROCESS_SALES_TAX_PVT.update_tax_sources_total',
              'Calling okl_tax_sources_pub.update_tax_sources for updating Total Tax for all Lines in Tax Sources');
Line: 1819

        okl_tax_sources_pub.update_tax_sources(p_api_version     => p_api_version
                                              ,p_init_msg_list   => p_init_msg_list
                                              ,x_return_status   => l_return_status
                                              ,x_msg_count       => x_msg_count
                                              ,x_msg_data        => x_msg_data
                                              ,p_txsv_tbl        => l_txsv_tbl
                                              ,x_txsv_tbl        => lx_txsv_tbl);
Line: 1828

          FND_LOG.STRING(G_DEBUG_LEVEL_STATEMENT,'OKL_PROCESS_SALES_TAX_PVT.update_tax_sources_total',
             'Return Status' || l_return_status);
Line: 1843

        FND_LOG.STRING(G_DEBUG_LEVEL_PROCEDURE,'OKL_PROCESS_SALES_TAX_PVT.update_tax_sources_total ','End(-)');
Line: 1875

           FND_LOG.STRING(G_DEBUG_LEVEL_EXCEPTION,'OKL_PROCESS_SALES_TAX_PVT.update_tax_sources_total ',
                    'EXCEPTION :'||'OKL_API.G_EXCEPTION_ERROR');
Line: 1908

           FND_LOG.STRING(G_DEBUG_LEVEL_EXCEPTION,'OKL_PROCESS_SALES_TAX_PVT.update_tax_sources_total ',
                    'EXCEPTION :'||'OKL_API.G_EXCEPTION_UNEXPECTED_ERROR');
Line: 1941

           FND_LOG.STRING(G_DEBUG_LEVEL_EXCEPTION,'OKL_PROCESS_SALES_TAX_PVT.update_tax_sources_total ',
                    'EXCEPTION :'||sqlerrm);
Line: 1954

    END update_tax_sources_total;
Line: 2004

    SELECT id, trx_line_id,application_id, event_class_code, entity_code,
           trx_level_type
    FROM okl_tax_sources
    WHERE trx_id = cp_trx_id
    AND tax_call_type_code = G_UPFRONT_TAX
    AND tax_line_status_code = G_ACTIVE_STATUS;
Line: 2038

            'Calling okl_tax_sources_pub.update_tax_sources for making Tax Sources Reportable');
Line: 2041

      okl_tax_sources_pub.update_tax_sources(p_api_version     => p_api_version
                                            ,p_init_msg_list   => p_init_msg_list
                                            ,x_return_status   => l_return_status
                                            ,x_msg_count       => x_msg_count
                                            ,x_msg_data        => x_msg_data
                                            ,p_txsv_tbl        => l_txsv_tbl
                                            ,x_txsv_tbl        => lx_txsv_tbl);
Line: 2335

    SELECT tax_determine_date,
           tax_rate_id,
           tax_rate_code,
           taxable_amt,
           tax_exemption_id,
           tax_rate,
           tax_amt,
           tax_date,
           line_amt,
           internal_organization_id,
           application_id,
           entity_code,
           event_class_code,
           event_type_code ,
           trx_id,
           trx_line_id,
           trx_level_type,
           trx_line_number,
           tax_line_number ,
           tax_regime_id ,
           tax_regime_code ,
           tax_id,
           tax,
           tax_status_id,
           tax_status_code,
           tax_apportionment_line_number,
           legal_entity_id,
           trx_number,
           trx_date,
           tax_jurisdiction_id,
           tax_jurisdiction_code,
           tax_type_code,
           tax_currency_code ,
           taxable_amt_tax_curr,
           trx_currency_code,
           minimum_accountable_unit,
           precision,
           currency_conversion_type,
           currency_conversion_rate,
           currency_conversion_date
    FROM okl_tax_trx_details
    WHERE trx_id = p_trx_id
    AND   trx_line_id = p_trx_line_id
    AND   application_id = p_application_id
    AND   trx_level_type = p_trx_level_type
    AND   entity_code = p_entity_code
    AND   event_class_code = p_event_class_code;
Line: 2409

              'INSERT INTO zx_detail_tax_lines_gt');
Line: 2413

      INSERT INTO zx_detail_tax_lines_gt(
           tax_line_id,
           tax_determine_date,
           tax_rate_id,
           tax_rate_code,
           taxable_amt,
           tax_exemption_id,
           tax_rate,
           tax_amt,
           tax_date,
           line_amt,
           internal_organization_id,
           application_id,
           entity_code,
           event_class_code,
           event_type_code ,
           trx_id,
           trx_line_id,
           trx_level_type,
           trx_line_number,
           tax_line_number ,
           tax_regime_id ,
           tax_regime_code ,
           tax_id,
           tax,
           tax_status_id,
           tax_status_code,
           tax_apportionment_line_number,
           legal_entity_id,
           trx_number,
           trx_date,
           tax_jurisdiction_id,
           tax_jurisdiction_code,
           tax_type_code,
           tax_currency_code ,
           taxable_amt_tax_curr,
           trx_currency_code,
           minimum_accountable_unit,
           precision,
           currency_conversion_type,
           currency_conversion_rate,
           currency_conversion_date,
           created_by,
           creation_date,
           last_updated_by,
           last_update_date,
           last_update_login,
           object_version_number) VALUES
           (
           zx_lines_s.nextval,
           l_get_tax_data_rec.tax_determine_date,
           l_get_tax_data_rec.tax_rate_id,
           l_get_tax_data_rec.tax_rate_code,
           l_get_tax_data_rec.taxable_amt,
           l_get_tax_data_rec.tax_exemption_id,
           l_get_tax_data_rec.tax_rate,
           l_get_tax_data_rec.tax_amt,
           l_get_tax_data_rec.tax_date,
           l_get_tax_data_rec.line_amt,
           l_get_tax_data_rec.internal_organization_id,
           l_get_tax_data_rec.application_id,
           l_get_tax_data_rec.entity_code,
           l_get_tax_data_rec.event_class_code,
           l_get_tax_data_rec.event_type_code ,
           l_get_tax_data_rec.trx_id,
           l_get_tax_data_rec.trx_line_id,
           l_get_tax_data_rec.trx_level_type,
           l_get_tax_data_rec.trx_line_number,
           l_get_tax_data_rec.tax_line_number ,
           l_get_tax_data_rec.tax_regime_id ,
           l_get_tax_data_rec.tax_regime_code ,
           l_get_tax_data_rec.tax_id,
           l_get_tax_data_rec.tax,
           l_get_tax_data_rec.tax_status_id,
           l_get_tax_data_rec.tax_status_code,
           l_get_tax_data_rec.tax_apportionment_line_number,
           l_get_tax_data_rec.legal_entity_id,
           l_get_tax_data_rec.trx_number,
           l_get_tax_data_rec.trx_date,
           l_get_tax_data_rec.tax_jurisdiction_id,
           l_get_tax_data_rec.tax_jurisdiction_code,
           l_get_tax_data_rec.tax_type_code,
           l_get_tax_data_rec.tax_currency_code,
           l_get_tax_data_rec.taxable_amt_tax_curr,
           l_get_tax_data_rec.trx_currency_code,
           l_get_tax_data_rec.minimum_accountable_unit,
           l_get_tax_data_rec.precision,
           l_get_tax_data_rec.currency_conversion_type,
           l_get_tax_data_rec.currency_conversion_rate,
           l_get_tax_data_rec.currency_conversion_date,
           G_USER_ID,
           SYSDATE,
           G_USER_ID,
           SYSDATE,
           G_LOGIN_ID,
           1);
Line: 2569

 |     OKL_TAX_SOURCES_PUB.update_tax_sources()
 |
 |
 | PARAMETERS
 |      p_source_trx_id                 -- Source transaction ID
 |      p_source_trx_name       -- Source transaction Name
 |      p_source_table          -- Source table
 |
 | KNOWN ISSUES
 |
 | NOTES
 |
 |
 | MODIFICATION HISTORY
 | Date                  Author            Description of Changes
 | 11-APR-07            RRAVIKIR           Created
 |
 *=======================================================================*/
 PROCEDURE process_contract_reversal_tax(
        p_api_version                   IN  NUMBER,
    p_init_msg_list                     IN  VARCHAR2 DEFAULT OKC_API.G_FALSE,
    x_return_status                     OUT NOCOPY VARCHAR2,
    x_msg_count                         OUT NOCOPY NUMBER,
    x_msg_data                          OUT NOCOPY VARCHAR2,
    p_source_trx_id                                     IN  NUMBER,
    p_source_trx_name               IN  VARCHAR2,
    p_source_table                  IN  VARCHAR2) IS

    ------------- Reverse contract -------------------------
    --p_source_trx_id           ---> okl_trx_assets.id
    --p_source_trx_name     ---> 'Reverse'
    --p_source_table        ---> 'OKL_TRX_CONTRACTS'
    --------------------------------------------------
    -- Local variables
        l_return_status                 VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
Line: 2628

        SELECT id, khr_id, kle_id, asset_number, trx_id, trx_line_id, entity_code,
               event_class_code, trx_level_type, tax_call_type_code, sty_id,
               trx_business_category, tax_line_status_code, sel_id, reported_yn,
               line_name, application_id, tax_reporting_flag, default_taxation_country,
               product_category, user_defined_fisc_class, line_intended_use,
               tax_classification_code, inventory_item_id, bill_to_cust_acct_id,
               org_id, legal_entity_id, line_amt, assessable_value, total_tax,
               product_type, product_fisc_classification, trx_date, provnl_tax_determination_date,
               try_id, ship_to_location_id, ship_to_party_site_id, ship_to_party_id,
               bill_to_party_site_id, bill_to_location_id, bill_to_party_id,
               ship_to_cust_acct_site_use_id, bill_to_cust_acct_site_use_id,
               trx_currency_code, currency_conversion_date, currency_conversion_rate,
               currency_conversion_type
        FROM   okl_tax_sources
        WHERE  khr_id = cp_khr_id
        AND    tax_call_type_code = G_UPFRONT_TAX
        AND    tax_line_status_code = G_ACTIVE_STATUS;
Line: 2647

        SELECT a.try_id, a.khr_id, a.legal_entity_id, a.date_transaction_occurred
        FROM   okl_trx_contracts a, okl_trx_types_tl b
        WHERE  a.id = cp_trx_id
        AND    a.try_id = b.id
        AND    b.name = cp_trx_type_name
    AND    language = 'US';
Line: 2696

        l_newtaxsourcesrev_tbl.DELETE;
Line: 2697

        l_tax_src_tbl.DELETE;
Line: 2701

              l_prevtaxsourcesbk_tbl.delete;
Line: 2753

                          l_newtaxsourcesrev_tbl(i).program_update_date              := null;
Line: 2773

                          l_newtaxsourcesrev_tbl(i).last_updated_by               := G_USER_ID;
Line: 2774

                          l_newtaxsourcesrev_tbl(i).last_update_date              := SYSDATE;
Line: 2775

                          l_newtaxsourcesrev_tbl(i).last_update_login             := G_LOGIN_ID;
Line: 2845

          UPDATE okl_tax_sources SET tax_line_status_code = G_INACTIVE_STATUS WHERE id = l_tax_src_tbl(i);
Line: 2876

          INSERT INTO okl_tax_sources VALUES l_newtaxsourcesrev_tbl(indx);
Line: 2944

          'Calling "update_tax_sources_total" for updating Total Tax for all Lines in Tax Sources');
Line: 2947

      update_tax_sources_total(p_api_version    => p_api_version,
                               p_init_msg_list  => p_init_msg_list,
                               x_return_status  => l_return_status,
                               x_msg_count      => x_msg_count,
                               x_msg_data       => x_msg_data,
                               p_source_trx_id  => p_source_trx_id);
Line: 3099

    SELECT
           b.site_use_id,
           c.party_site_id,
           c.party_id,
           c.location_id
    FROM   hz_cust_acct_sites_all a,
           hz_cust_site_uses_all  b,
           hz_party_sites      c
    WHERE
           a.cust_acct_site_id = b.cust_acct_site_id
    AND    b.site_use_code     = 'SHIP_TO'
    AND    b.site_use_id       =  cp_site_use_id -- asaanka changed for bug # 6612165
    AND    a.party_site_id     = c.party_site_id
    AND    a.cust_account_id   = p_cust_acct_id;
Line: 3116

    SELECT
           c.party_site_id,
           c.party_id,
           c.location_id,
           b.site_use_id
    FROM   hz_cust_acct_sites_all a,
           hz_cust_site_uses_all  b,
           hz_party_sites      c
    WHERE
           a.cust_acct_site_id = b.cust_acct_site_id
    AND    b.site_use_code     = 'BILL_TO'
    AND    b.site_use_id       = (SELECT DECODE(okcl.bill_to_site_use_id, null, okch.bill_to_site_use_id, okcl.bill_to_site_use_id)
                                  FROM okc_k_headers_all_b okch, okc_k_lines_v okcl
                                  WHERE okcl.dnz_chr_id = okch.id
                                  AND okcl.id = p_fin_asset_id)
    AND    a.party_site_id     = c.party_site_id
    AND    a.cust_account_id   = p_cust_acct_id;
Line: 3136

    SELECT
           c.party_site_id,
           c.party_id,
           c.location_id,
           b.site_use_id
    FROM   hz_cust_acct_sites_all a,
           hz_cust_site_uses_all  b,
           hz_party_sites      c
    WHERE
           a.cust_acct_site_id = b.cust_acct_site_id
    AND    b.site_use_code     = 'BILL_TO'
    AND    b.site_use_id       = (SELECT bill_to_site_use_id
                                  FROM okc_k_headers_all_b
                                  WHERE id = p_khr_id)
    AND    a.party_site_id     = c.party_site_id
    AND    a.cust_account_id   = p_cust_acct_id;
Line: 3375

    SELECT      result_code tbc_code,
            try_id,
            sty_id ,
            book_class_code,
            tax_country_code,
                        'Y' select_yn      -- All TBCs returned by this cursor are selected initially
    FROM    okl_tax_attr_definitions
    WHERE   (try_id = cp_try_id OR try_id IS NULL)
    AND     RESULT_TYPE_CODE = 'TBC_CODE'
    AND     NVL(expire_flag, 'N') = 'N';
Line: 3387

    TYPE tbcdefs_selected_tbl_type IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
Line: 3392

    l_tbcdefs_selected_tbl      tbcdefs_selected_tbl_type;
Line: 3399

    selected_count                      NUMBER;
Line: 3401

    l_selected_tbc_pos          NUMBER;
Line: 3445

                   'j '||j||' l_tbcdefs_tbl(j).select_yn '||l_tbcdefs_tbl(j).select_yn );
Line: 3448

                  IF l_tbcdefs_tbl(j).select_yn = 'Y' THEN
            IF i = 1 THEN   -- stream type
                          IF p_sty_id IS NULL THEN
                                IF l_tbcdefs_tbl(j).sty_id IS NULL THEN
                                   tbc_set_count := tbc_set_count + 1;
Line: 3454

                                   l_tbcdefs_tbl(j).select_yn := 'N';
Line: 3460

                                  l_tbcdefs_tbl(j).select_yn := 'N';
Line: 3469

                                  l_tbcdefs_tbl(j).select_yn := 'N';
Line: 3475

                                  l_tbcdefs_tbl(j).select_yn := 'N';
Line: 3483

                  l_tbcdefs_selected_tbl(k) := j;
Line: 3485

                                  l_tbcdefs_tbl(j).select_yn := 'N';
Line: 3490

                  l_tbcdefs_selected_tbl(k) := j;
Line: 3492

                                  l_tbcdefs_tbl(j).select_yn := 'N';
Line: 3503

                         'l_tbcdefs_tbl(j).select_yn '||l_tbcdefs_tbl(j).select_yn);
Line: 3536

        l_tbc_code := l_tbcdefs_tbl(l_tbcdefs_selected_tbl(1)).tbc_code;
Line: 3540

            selected_count := tbc_set_count;
Line: 3544

                     'l_tbcdefs_selected_tbl.count '||l_tbcdefs_selected_tbl.count );
Line: 3551

                      'i '||i||' selected_count '||selected_count );
Line: 3556

                  l_det_null_tbl.DELETE;
Line: 3558

                  IF selected_count > 1 THEN
                    FOR k IN l_tbcdefs_selected_tbl.FIRST .. l_tbcdefs_selected_tbl.LAST LOOP  -- finally selected indexes
                          -- At this point all the selecetd TBCs will either have Null determinant
              -- value or determinant value matching with the calling transaction
                      IF (G_DEBUG_LEVEL_STATEMENT >= G_DEBUG_CURRENT_RUNTIME_LEVEL) THEN
                            FND_LOG.STRING(G_DEBUG_LEVEL_STATEMENT,'OKL_PROCESS_SALES_TAX_PVT.get_tbc_code.',   'k '||k);
Line: 3567

                            IF l_tbcdefs_tbl(l_tbcdefs_selected_tbl(k)).try_id IS NULL THEN
                                  l_det_null_tbl(j) := l_tbcdefs_selected_tbl(k);
Line: 3572

                                  l_selected_tbc_pos := l_tbcdefs_selected_tbl(k);
Line: 3583

                                  IF det_match_cnt = selected_count THEN --k THEN
                                    NULL; -- all records have matching values, do nothing
Line: 3586

                                    NULL; -- keep all records selected. Don't exclude yet.
Line: 3588

                                    selected_count := 1;
Line: 3589

                                  ELSE -- more than one but less than total selected  records have matching values
                                    FOR p IN l_det_null_tbl.FIRST .. l_det_null_tbl.LAST LOOP
                                          l_tbcdefs_tbl(l_det_null_tbl(p)).select_yn := 'N';
Line: 3592

                                          selected_count := selected_count - 1;
Line: 3604

                                  IF l_tbcdefs_tbl(l_tbcdefs_selected_tbl(k)).select_yn = 'Y' THEN -- if still selected
                                    IF l_tbcdefs_tbl(l_tbcdefs_selected_tbl(k)).sty_id IS NULL THEN
                                      l_det_null_tbl(j) := l_tbcdefs_selected_tbl(k);
Line: 3610

                                          l_selected_tbc_pos := l_tbcdefs_selected_tbl(k);
Line: 3622

                                    IF det_match_cnt = selected_count THEN --k THEN
                                          NULL; -- all records have matching values, do nothing
Line: 3625

                                          NULL; -- keep all records selected. Don't exclude yet.
Line: 3627

                                          selected_count := 1;
Line: 3628

                                    ELSE -- more than one but less than total selected  records have matching values
                                          FOR p IN l_det_null_tbl.FIRST .. l_det_null_tbl.LAST LOOP
                                            l_tbcdefs_tbl(l_det_null_tbl(p)).select_yn := 'N';
Line: 3631

                                            selected_count := selected_count - 1;
Line: 3644

                                  IF l_tbcdefs_tbl(l_tbcdefs_selected_tbl(k)).select_yn = 'Y' THEN -- if still selected
                                    IF l_tbcdefs_tbl(l_tbcdefs_selected_tbl(k)).book_class_code IS NULL THEN
                                      l_det_null_tbl(j) := l_tbcdefs_selected_tbl(k);
Line: 3650

                                          l_selected_tbc_pos := l_tbcdefs_selected_tbl(k);
Line: 3662

                                    IF det_match_cnt = selected_count THEN --k THEN
                                          NULL; -- all records have matching values, do nothing
Line: 3665

                                          NULL; -- keep all records selected. Don't exclude yet.
Line: 3667

                                          selected_count := 1;
Line: 3668

                                    ELSE -- more than one but less than total selected  records have matching values
                                          FOR p IN l_det_null_tbl.FIRST .. l_det_null_tbl.LAST LOOP
                                            l_tbcdefs_tbl(l_det_null_tbl(p)).select_yn := 'N';
Line: 3671

                                            selected_count := selected_count - 1;
Line: 3684

                                  IF l_tbcdefs_tbl(l_tbcdefs_selected_tbl(k)).select_yn = 'Y' THEN -- if still selected
                                    IF l_tbcdefs_tbl(l_tbcdefs_selected_tbl(k)).tax_country_code IS NULL THEN
                                      l_det_null_tbl(j) := l_tbcdefs_selected_tbl(k);
Line: 3690

                                          l_selected_tbc_pos := l_tbcdefs_selected_tbl(k);
Line: 3702

                                    IF det_match_cnt = selected_count THEN --k THEN
                                          NULL; -- all records have matching values, do nothing
Line: 3705

                                          NULL; -- keep all records selected. Don't exclude yet.
Line: 3707

                                          selected_count := 1;
Line: 3708

                                    ELSE -- more than one but less than total selected  records have matching values
                                          FOR p IN l_det_null_tbl.FIRST .. l_det_null_tbl.LAST LOOP
                                            l_tbcdefs_tbl(l_det_null_tbl(p)).select_yn := 'N';
Line: 3711

                                            selected_count := selected_count - 1;
Line: 3718

                  ELSIF selected_count = 1 THEN
                    EXIT;
Line: 3725

                                'selected_count outside 2nd loop '||selected_count);
Line: 3728

        IF selected_count = 1 THEN
                  l_tbc_code := l_tbcdefs_tbl(l_selected_tbc_pos).tbc_code;
Line: 3730

            ELSIF selected_count > 1 THEN  -- still more than one TBCs are selected
                  l_tbc_code := NULL;
Line: 3849

    SELECT      result_code pc_code,
            sty_id,
            purchase_option_code,
            int_disclosed_code,
            title_trnsfr_code,
            sale_lease_back_code,
            lease_purchased_code,
            tax_country_code,
                        'Y' select_yn      -- All PCs returned by this cursor are selected initially
    FROM    okl_tax_attr_definitions
    WHERE   (sty_id = p_sty_id OR sty_id IS NULL)
    AND     result_type_code = 'PC_CODE'
    AND     NVL(expire_flag, 'N') = 'N';
Line: 3864

    TYPE pcdefs_selected_tbl_type IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
Line: 3869

    l_pcdefs_selected_tbl       pcdefs_selected_tbl_type;
Line: 3876

    selected_count                      NUMBER;
Line: 3878

    l_selected_pc_pos           NUMBER;
Line: 3927

                   'j '||j||' l_pcdefs_tbl(j).select_yn '||l_pcdefs_tbl(j).select_yn );
Line: 3930

                  IF l_pcdefs_tbl(j).select_yn = 'Y' THEN
                    IF i = 1 THEN -- purchase option
                      IF p_purchase_option_code IS NULL THEN
                            IF l_pcdefs_tbl(j).purchase_option_code IS NULL THEN
                                  pc_set_count := pc_set_count + 1;
Line: 3936

                                  l_pcdefs_tbl(j).select_yn := 'N';
Line: 3942

                                  l_pcdefs_tbl(j).select_yn := 'N';
Line: 3951

                                  l_pcdefs_tbl(j).select_yn := 'N';
Line: 3962

                                  l_pcdefs_tbl(j).select_yn := 'N';
Line: 3973

                                  l_pcdefs_tbl(j).select_yn := 'N';
Line: 3984

                                  l_pcdefs_tbl(j).select_yn := 'N';
Line: 3994

                  l_pcdefs_selected_tbl(k) := j;
Line: 3996

                                  l_pcdefs_tbl(j).select_yn := 'N';
Line: 4001

                  l_pcdefs_selected_tbl(k) := j;
Line: 4003

                                  l_pcdefs_tbl(j).select_yn := 'N';
Line: 4014

                         'l_pcdefs_tbl(j).select_yn '||l_pcdefs_tbl(j).select_yn);
Line: 4050

        l_pc_code := l_pcdefs_tbl(l_pcdefs_selected_tbl(1)).pc_code;
Line: 4054

            selected_count := pc_set_count;
Line: 4058

                     'l_pcdefs_selected_tbl.count '||l_pcdefs_selected_tbl.count );
Line: 4065

                      'i '||i||' selected_count '||selected_count );
Line: 4070

                  l_det_null_tbl.DELETE;
Line: 4072

                  IF selected_count > 1 THEN
                    FOR k IN l_pcdefs_selected_tbl.FIRST .. l_pcdefs_selected_tbl.LAST LOOP  -- finally selected indexes
                                        -- At this point all the selecetd PCs will either have Null determinant value or determinant value matching with the calling transaction
                      IF (G_DEBUG_LEVEL_STATEMENT >= G_DEBUG_CURRENT_RUNTIME_LEVEL) THEN
                            FND_LOG.STRING(G_DEBUG_LEVEL_STATEMENT,'OKL_PROCESS_SALES_TAX_PVT.get_pc_code.',    'k '||k);
Line: 4080

                            IF l_pcdefs_tbl(l_pcdefs_selected_tbl(k)).sty_id IS NULL THEN
                              l_det_null_tbl(j) := l_pcdefs_selected_tbl(k);
Line: 4085

                                  l_selected_pc_pos := l_pcdefs_selected_tbl(k);
Line: 4096

                              IF det_match_cnt = selected_count THEN --k THEN
                                    NULL; -- all records have matching values, do nothing
Line: 4099

                                    NULL; -- keep all records selected. Don't exclude yet.
Line: 4101

                                    selected_count := 1;
Line: 4102

                              ELSE -- more than one but less than total selected  records have matching values
                                    FOR p IN l_det_null_tbl.FIRST .. l_det_null_tbl.LAST LOOP
                                      l_pcdefs_tbl(l_det_null_tbl(p)).select_yn := 'N';
Line: 4105

                                      selected_count := selected_count - 1;
Line: 4117

                                  IF l_pcdefs_tbl(l_pcdefs_selected_tbl(k)).select_yn = 'Y' THEN -- if still selected
                                    IF l_pcdefs_tbl(l_pcdefs_selected_tbl(k)).purchase_option_code IS NULL THEN
                                          l_det_null_tbl(j) := l_pcdefs_selected_tbl(k);
Line: 4123

                                          l_selected_pc_pos := l_pcdefs_selected_tbl(k);
Line: 4135

                                        IF det_match_cnt = selected_count THEN --k THEN
                                          NULL; -- all records have matching values, do nothing
Line: 4138

                                          NULL; -- keep all records selected. Don't exclude yet.
Line: 4140

                                          selected_count := 1;
Line: 4141

                                        ELSE -- more than one but less than total selected  records have matching values
                                          FOR p IN l_det_null_tbl.FIRST .. l_det_null_tbl.LAST LOOP
                                                l_pcdefs_tbl(l_det_null_tbl(p)).select_yn := 'N';
Line: 4144

                                                selected_count := selected_count - 1;
Line: 4154

                                  IF l_pcdefs_tbl(l_pcdefs_selected_tbl(k)).select_yn = 'Y' THEN -- if still selected
                                    IF l_pcdefs_tbl(l_pcdefs_selected_tbl(k)).int_disclosed_code = 'N' THEN
                                          l_det_null_tbl(j) := l_pcdefs_selected_tbl(k);
Line: 4160

                                          l_selected_pc_pos := l_pcdefs_selected_tbl(k);
Line: 4172

                                        IF det_match_cnt = selected_count THEN --k THEN
                                          NULL; -- all records have matching values, do nothing
Line: 4175

                                          NULL; -- keep all records selected. Don't exclude yet.
Line: 4177

                                          selected_count := 1;
Line: 4178

                                        ELSE -- more than one but less than total selected  records have matching values
                                          FOR p IN l_det_null_tbl.FIRST .. l_det_null_tbl.LAST LOOP
                                                l_pcdefs_tbl(l_det_null_tbl(p)).select_yn := 'N';
Line: 4181

                                                selected_count := selected_count - 1;
Line: 4191

                                  IF l_pcdefs_tbl(l_pcdefs_selected_tbl(k)).select_yn = 'Y' THEN -- if still selected
                                    IF l_pcdefs_tbl(l_pcdefs_selected_tbl(k)).title_trnsfr_code = 'N' THEN
                                          l_det_null_tbl(j) := l_pcdefs_selected_tbl(k);
Line: 4197

                                          l_selected_pc_pos := l_pcdefs_selected_tbl(k);
Line: 4209

                                    IF det_match_cnt = selected_count THEN --k THEN
                                          NULL; -- all records have matching values, do nothing
Line: 4212

                                          NULL; -- keep all records selected. Don't exclude yet.
Line: 4214

                                          selected_count := 1;
Line: 4215

                                    ELSE -- more than one but less than total selected  records have matching values
                                          FOR p IN l_det_null_tbl.FIRST .. l_det_null_tbl.LAST LOOP
                                            l_pcdefs_tbl(l_det_null_tbl(p)).select_yn := 'N';
Line: 4218

                                            selected_count := selected_count - 1;
Line: 4228

                                  IF l_pcdefs_tbl(l_pcdefs_selected_tbl(k)).select_yn = 'Y' THEN -- if still selected
                                    IF l_pcdefs_tbl(l_pcdefs_selected_tbl(k)).sale_lease_back_code = 'N' THEN
                                          l_det_null_tbl(j) := l_pcdefs_selected_tbl(k);
Line: 4234

                                          l_selected_pc_pos := l_pcdefs_selected_tbl(k);
Line: 4246

                                        IF det_match_cnt = selected_count THEN --k THEN
                                          NULL; -- all records have matching values, do nothing
Line: 4249

                                          NULL; -- keep all records selected. Don't exclude yet.
Line: 4251

                                          selected_count := 1;
Line: 4252

                                        ELSE -- more than one but less than total selected  records have matching values
                                          FOR p IN l_det_null_tbl.FIRST .. l_det_null_tbl.LAST LOOP
                                                l_pcdefs_tbl(l_det_null_tbl(p)).select_yn := 'N';
Line: 4255

                                                selected_count := selected_count - 1;
Line: 4265

                                  IF l_pcdefs_tbl(l_pcdefs_selected_tbl(k)).select_yn = 'Y' THEN -- if still selected
                                    IF l_pcdefs_tbl(l_pcdefs_selected_tbl(k)).lease_purchased_code = 'N' THEN
                                          l_det_null_tbl(j) := l_pcdefs_selected_tbl(k);
Line: 4271

                                          l_selected_pc_pos := l_pcdefs_selected_tbl(k);
Line: 4283

                                        IF det_match_cnt = selected_count THEN --k THEN
                                          NULL; -- all records have matching values, do nothing
Line: 4286

                                          NULL; -- keep all records selected. Don't exclude yet.
Line: 4288

                                          selected_count := 1;
Line: 4289

                                        ELSE -- more than one but less than total selected  records have matching values
                                          FOR p IN l_det_null_tbl.FIRST .. l_det_null_tbl.LAST LOOP
                                                l_pcdefs_tbl(l_det_null_tbl(p)).select_yn := 'N';
Line: 4292

                                                selected_count := selected_count - 1;
Line: 4305

                                  IF l_pcdefs_tbl(l_pcdefs_selected_tbl(k)).select_yn = 'Y' THEN -- if still selected
                                    IF l_pcdefs_tbl(l_pcdefs_selected_tbl(k)).tax_country_code IS NULL THEN
                                          l_det_null_tbl(j) := l_pcdefs_selected_tbl(k);
Line: 4311

                                          l_selected_pc_pos := l_pcdefs_selected_tbl(k);
Line: 4323

                                        IF det_match_cnt = selected_count THEN --k THEN
                                          NULL; -- all records have matching values, do nothing
Line: 4326

                                          NULL; -- keep all records selected. Don't exclude yet.
Line: 4328

                                          selected_count := 1;
Line: 4329

                                        ELSE -- more than one but less than total selected  records have matching values
                                          FOR p IN l_det_null_tbl.FIRST .. l_det_null_tbl.LAST LOOP
                                                l_pcdefs_tbl(l_det_null_tbl(p)).select_yn := 'N';
Line: 4332

                                                selected_count := selected_count - 1;
Line: 4340

                  ELSIF selected_count = 1 THEN
                    EXIT;
Line: 4347

                                'selected_count outside 2nd loop '||selected_count);
Line: 4350

            IF selected_count = 1 THEN
                  l_pc_code := l_pcdefs_tbl(l_selected_pc_pos).pc_code;
Line: 4352

            ELSIF selected_count > 1 THEN  -- still more than one PCs are selected
                  l_pc_code := NULL;
Line: 4488

    SELECT      result_code ufc_code,
            try_id,
            sty_id ,
                        purchase_option_code,
                        equip_usage_code,
                        vendor_site_id,
                        age_of_equip_from,
                        age_of_equip_to,
                        pdt_id,
                        int_disclosed_code ,
                        title_trnsfr_code,
                        sale_lease_back_code,
                        lease_purchased_code,
            term_quote_type_code,
            term_quote_reason_code,
            tax_country_code,
                        'Y' select_yn      -- all ufcs returned by this cursor are selected initially
    FROM    okl_tax_attr_definitions
    WHERE   (try_id = cp_try_id OR try_id IS NULL)
    AND     RESULT_TYPE_CODE = 'UFC_CODE'
    AND     NVL(expire_flag, 'N') = 'N';
Line: 4512

    TYPE ufcdefs_selected_tbl_type IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
Line: 4517

    l_ufcdefs_selected_tbl      ufcdefs_selected_tbl_type;
Line: 4524

    selected_count                      NUMBER;
Line: 4526

    l_selected_ufc_pos          NUMBER;
Line: 4592

                       'j '||j||' l_ufcdefs_tbl(j).select_yn '||l_ufcdefs_tbl(j).select_yn );
Line: 4595

                  IF l_ufcdefs_tbl(j).select_yn = 'Y' THEN
                        IF i = 1 THEN   -- stream type
                          IF p_sty_id IS NULL THEN
                IF l_ufcdefs_tbl(j).sty_id IS NULL THEN
                  ufc_set_count := ufc_set_count + 1;
Line: 4601

                  l_ufcdefs_tbl(j).select_yn := 'N';
Line: 4607

                          l_ufcdefs_tbl(j).select_yn := 'N';
Line: 4616

                  l_ufcdefs_tbl(j).select_yn := 'N';
Line: 4623

                          l_ufcdefs_tbl(j).select_yn := 'N';
Line: 4632

                  l_ufcdefs_tbl(j).select_yn := 'N';
Line: 4639

                          l_ufcdefs_tbl(j).select_yn := 'N';
Line: 4648

                  l_ufcdefs_tbl(j).select_yn := 'N';
Line: 4654

                          l_ufcdefs_tbl(j).select_yn := 'N';
Line: 4663

                  l_ufcdefs_tbl(j).select_yn := 'N';
Line: 4669

                          l_ufcdefs_tbl(j).select_yn := 'N';
Line: 4678

                  l_ufcdefs_tbl(j).select_yn := 'N';
Line: 4684

                          l_ufcdefs_tbl(j).select_yn := 'N';
Line: 4693

                  l_ufcdefs_tbl(j).select_yn := 'N';
Line: 4702

                          l_ufcdefs_tbl(j).select_yn := 'N';
Line: 4711

                  l_ufcdefs_tbl(j).select_yn := 'N';
Line: 4717

                          l_ufcdefs_tbl(j).select_yn := 'N';
Line: 4726

                  l_ufcdefs_tbl(j).select_yn := 'N';
Line: 4737

                  l_ufcdefs_tbl(j).select_yn := 'N';
Line: 4748

                  l_ufcdefs_tbl(j).select_yn := 'N';
Line: 4759

                  l_ufcdefs_tbl(j).select_yn := 'N';
Line: 4769

                  l_ufcdefs_selected_tbl(k) := j;
Line: 4771

                  l_ufcdefs_tbl(j).select_yn := 'N';
Line: 4777

                                  l_ufcdefs_selected_tbl(k) := j;
Line: 4779

                  l_ufcdefs_tbl(j).select_yn := 'N';
Line: 4785

                               'k '||k||' l_ufcdefs_selected_tbl(k) '||l_ufcdefs_selected_tbl(k));
Line: 4794

                          'l_ufcdefs_tbl(j).select_yn '||l_ufcdefs_tbl(j).select_yn);
Line: 4834

        l_ufc_code := l_ufcdefs_tbl(l_ufcdefs_selected_tbl(1)).ufc_code;
Line: 4840

        selected_count := ufc_set_count;
Line: 4844

                          'l_ufcdefs_selected_tbl.count '||l_ufcdefs_selected_tbl.count );
Line: 4851

                          'i '||i||' selected_count '||selected_count );
Line: 4856

          l_det_null_tbl.DELETE;
Line: 4858

          IF selected_count > 1 THEN
                FOR k IN l_ufcdefs_selected_tbl.FIRST .. l_ufcdefs_selected_tbl.LAST LOOP  -- finally selected indexes
                  -- At this point all the selecetd ufcs will either have Null determinant value or determinant value matching with the calling transaction
              IF (G_DEBUG_LEVEL_STATEMENT >= G_DEBUG_CURRENT_RUNTIME_LEVEL) THEN
                        FND_LOG.STRING(G_DEBUG_LEVEL_STATEMENT,'OKL_PROCESS_SALES_TAX_PVT.get_ufc_code.','k '||k);
Line: 4866

                            IF l_ufcdefs_tbl(l_ufcdefs_selected_tbl(k)).try_id IS NULL THEN

                          l_det_null_tbl(j) := l_ufcdefs_selected_tbl(k);
Line: 4872

                          l_selected_ufc_pos := l_ufcdefs_selected_tbl(k);
Line: 4883

                          IF det_match_cnt = selected_count THEN --k THEN
                                NULL; -- all records have matching values, do nothing
Line: 4886

                                NULL; -- keep all records selected. Don't exclude yet.
Line: 4888

                                selected_count := 1;
Line: 4889

                          ELSE -- more than one but less than total selected  records have matching values
                                FOR p IN l_det_null_tbl.FIRST .. l_det_null_tbl.LAST LOOP
                                  l_ufcdefs_tbl(l_det_null_tbl(p)).select_yn := 'N';
Line: 4892

                                  selected_count := selected_count - 1;
Line: 4904

                  IF l_ufcdefs_tbl(l_ufcdefs_selected_tbl(k)).select_yn = 'Y' THEN -- if still selected
                    IF l_ufcdefs_tbl(l_ufcdefs_selected_tbl(k)).sty_id IS NULL THEN
                                  l_det_null_tbl(j) := l_ufcdefs_selected_tbl(k);
Line: 4910

                                  l_selected_ufc_pos := l_ufcdefs_selected_tbl(k);
Line: 4922

                                IF det_match_cnt = selected_count THEN --k THEN
                                  NULL; -- all records have matching values, do nothing
Line: 4925

                                  NULL; -- keep all records selected. Don't exclude yet.
Line: 4927

                                  selected_count := 1;
Line: 4928

                                ELSE -- more than one but less than total selected  records have matching values
                                  FOR p IN l_det_null_tbl.FIRST .. l_det_null_tbl.LAST LOOP
                                    l_ufcdefs_tbl(l_det_null_tbl(p)).select_yn := 'N';
Line: 4931

                                    selected_count := selected_count - 1;
Line: 4944

                  IF l_ufcdefs_tbl(l_ufcdefs_selected_tbl(k)).select_yn = 'Y' THEN -- if still selected
                    IF l_ufcdefs_tbl(l_ufcdefs_selected_tbl(k)).term_quote_type_code IS NULL THEN
                                  l_det_null_tbl(j) := l_ufcdefs_selected_tbl(k);
Line: 4950

                                  l_selected_ufc_pos := l_ufcdefs_selected_tbl(k);
Line: 4962

                                IF det_match_cnt = selected_count THEN --k THEN
                                  NULL; -- all records have matching values, do nothing
Line: 4965

                                  NULL; -- keep all records selected. Don't exclude yet.
Line: 4967

                                  selected_count := 1;
Line: 4968

                                ELSE -- more than one but less than total selected  records have matching values
                                  FOR p IN l_det_null_tbl.FIRST .. l_det_null_tbl.LAST LOOP
                                    l_ufcdefs_tbl(l_det_null_tbl(p)).select_yn := 'N';
Line: 4971

                                    selected_count := selected_count - 1;
Line: 4984

                  IF l_ufcdefs_tbl(l_ufcdefs_selected_tbl(k)).select_yn = 'Y' THEN -- if still selected
                    IF l_ufcdefs_tbl(l_ufcdefs_selected_tbl(k)).term_quote_reason_code IS NULL THEN
                                  l_det_null_tbl(j) := l_ufcdefs_selected_tbl(k);
Line: 4990

                                  l_selected_ufc_pos := l_ufcdefs_selected_tbl(k);
Line: 5002

                                IF det_match_cnt = selected_count THEN --k THEN
                                  NULL; -- all records have matching values, do nothing
Line: 5005

                                  NULL; -- keep all records selected. Don't exclude yet.
Line: 5007

                                  selected_count := 1;
Line: 5008

                                ELSE -- more than one but less than total selected  records have matching values
                                  FOR p IN l_det_null_tbl.FIRST .. l_det_null_tbl.LAST LOOP
                                    l_ufcdefs_tbl(l_det_null_tbl(p)).select_yn := 'N';
Line: 5011

                                    selected_count := selected_count - 1;
Line: 5024

                  IF l_ufcdefs_tbl(l_ufcdefs_selected_tbl(k)).select_yn = 'Y' THEN -- if still selected
                    IF l_ufcdefs_tbl(l_ufcdefs_selected_tbl(k)).purchase_option_code IS NULL THEN
                                  l_det_null_tbl(j) := l_ufcdefs_selected_tbl(k);
Line: 5030

                                  l_selected_ufc_pos := l_ufcdefs_selected_tbl(k);
Line: 5042

                                IF det_match_cnt = selected_count THEN --k THEN
                                  NULL; -- all records have matching values, do nothing
Line: 5045

                                  NULL; -- keep all records selected. Don't exclude yet.
Line: 5047

                                  selected_count := 1;
Line: 5048

                                ELSE -- more than one but less than total selected  records have matching values
                                  FOR p IN l_det_null_tbl.FIRST .. l_det_null_tbl.LAST LOOP
                                    l_ufcdefs_tbl(l_det_null_tbl(p)).select_yn := 'N';
Line: 5051

                                    selected_count := selected_count - 1;
Line: 5064

                  IF l_ufcdefs_tbl(l_ufcdefs_selected_tbl(k)).select_yn = 'Y' THEN -- if still selected
                    IF l_ufcdefs_tbl(l_ufcdefs_selected_tbl(k)).equip_usage_code IS NULL THEN
                                  l_det_null_tbl(j) := l_ufcdefs_selected_tbl(k);
Line: 5070

                                  l_selected_ufc_pos := l_ufcdefs_selected_tbl(k);
Line: 5082

                                IF det_match_cnt = selected_count THEN --k THEN
                                  NULL; -- all records have matching values, do nothing
Line: 5085

                                  NULL; -- keep all records selected. Don't exclude yet.
Line: 5087

                                  selected_count := 1;
Line: 5088

                                ELSE -- more than one but less than total selected  records have matching values
                                  FOR p IN l_det_null_tbl.FIRST .. l_det_null_tbl.LAST LOOP
                                    l_ufcdefs_tbl(l_det_null_tbl(p)).select_yn := 'N';
Line: 5091

                                    selected_count := selected_count - 1;
Line: 5104

                  IF l_ufcdefs_tbl(l_ufcdefs_selected_tbl(k)).select_yn = 'Y' THEN -- if still selected
                    IF l_ufcdefs_tbl(l_ufcdefs_selected_tbl(k)).vendor_site_id IS NULL THEN
                                  l_det_null_tbl(j) := l_ufcdefs_selected_tbl(k);
Line: 5110

                                  l_selected_ufc_pos := l_ufcdefs_selected_tbl(k);
Line: 5122

                                IF det_match_cnt = selected_count THEN --k THEN
                                  NULL; -- all records have matching values, do nothing
Line: 5125

                                  NULL; -- keep all records selected. Don't exclude yet.
Line: 5127

                                  selected_count := 1;
Line: 5128

                                ELSE -- more than one but less than total selected  records have matching values
                                  FOR p IN l_det_null_tbl.FIRST .. l_det_null_tbl.LAST LOOP
                                    l_ufcdefs_tbl(l_det_null_tbl(p)).select_yn := 'N';
Line: 5131

                                    selected_count := selected_count - 1;
Line: 5144

                  IF l_ufcdefs_tbl(l_ufcdefs_selected_tbl(k)).select_yn = 'Y' THEN -- if still selected
                        IF  (l_ufcdefs_tbl(l_ufcdefs_selected_tbl(k)).age_of_equip_from IS NULL AND
                                                 l_ufcdefs_tbl(l_ufcdefs_selected_tbl(k)).age_of_equip_to IS NULL)  THEN
                                  l_det_null_tbl(j) := l_ufcdefs_selected_tbl(k);
Line: 5151

                                  l_selected_ufc_pos := l_ufcdefs_selected_tbl(k);
Line: 5163

                                IF det_match_cnt = selected_count THEN --k THEN
                                  NULL; -- all records have matching values, do nothing
Line: 5166

                                  NULL; -- keep all records selected. Don't exclude yet.
Line: 5168

                                  selected_count := 1;
Line: 5169

                                ELSE -- more than one but less than total selected  records have matching values
                                  FOR p IN l_det_null_tbl.FIRST .. l_det_null_tbl.LAST LOOP
                                    l_ufcdefs_tbl(l_det_null_tbl(p)).select_yn := 'N';
Line: 5172

                                    selected_count := selected_count - 1;
Line: 5185

                  IF l_ufcdefs_tbl(l_ufcdefs_selected_tbl(k)).select_yn = 'Y' THEN -- if still selected
                    IF l_ufcdefs_tbl(l_ufcdefs_selected_tbl(k)).pdt_id IS NULL THEN
                                  l_det_null_tbl(j) := l_ufcdefs_selected_tbl(k);
Line: 5191

                                  l_selected_ufc_pos := l_ufcdefs_selected_tbl(k);
Line: 5203

                                IF det_match_cnt = selected_count THEN --k THEN
                                  NULL; -- all records have matching values, do nothing
Line: 5206

                                  NULL; -- keep all records selected. Don't exclude yet.
Line: 5208

                                  selected_count := 1;
Line: 5209

                                ELSE -- more than one but less than total selected  records have matching values
                                  FOR p IN l_det_null_tbl.FIRST .. l_det_null_tbl.LAST LOOP
                                    l_ufcdefs_tbl(l_det_null_tbl(p)).select_yn := 'N';
Line: 5212

                                    selected_count := selected_count - 1;
Line: 5225

                  IF l_ufcdefs_tbl(l_ufcdefs_selected_tbl(k)).select_yn = 'Y' THEN -- if still selected
                    IF l_ufcdefs_tbl(l_ufcdefs_selected_tbl(k)).int_disclosed_code = 'N' THEN
                                  l_det_null_tbl(j) := l_ufcdefs_selected_tbl(k);
Line: 5231

                                  l_selected_ufc_pos := l_ufcdefs_selected_tbl(k);
Line: 5243

                                IF det_match_cnt = selected_count THEN --k THEN
                                  NULL; -- all records have matching values, do nothing
Line: 5246

                                  NULL; -- keep all records selected. Don't exclude yet.
Line: 5248

                                  selected_count := 1;
Line: 5249

                                ELSE -- more than one but less than total selected  records have matching values
                                  FOR p IN l_det_null_tbl.FIRST .. l_det_null_tbl.LAST LOOP
                                    l_ufcdefs_tbl(l_det_null_tbl(p)).select_yn := 'N';
Line: 5252

                                    selected_count := selected_count - 1;
Line: 5265

                  IF l_ufcdefs_tbl(l_ufcdefs_selected_tbl(k)).select_yn = 'Y' THEN -- if still selected
                    IF l_ufcdefs_tbl(l_ufcdefs_selected_tbl(k)).title_trnsfr_code = 'N' THEN
                                  l_det_null_tbl(j) := l_ufcdefs_selected_tbl(k);
Line: 5271

                                  l_selected_ufc_pos := l_ufcdefs_selected_tbl(k);
Line: 5283

                                IF det_match_cnt = selected_count THEN --k THEN
                                  NULL; -- all records have matching values, do nothing
Line: 5286

                                  NULL; -- keep all records selected. Don't exclude yet.
Line: 5288

                                  selected_count := 1;
Line: 5289

                                ELSE -- more than one but less than total selected  records have matching values
                                  FOR p IN l_det_null_tbl.FIRST .. l_det_null_tbl.LAST LOOP
                                    l_ufcdefs_tbl(l_det_null_tbl(p)).select_yn := 'N';
Line: 5292

                                    selected_count := selected_count - 1;
Line: 5305

                  IF l_ufcdefs_tbl(l_ufcdefs_selected_tbl(k)).select_yn = 'Y' THEN -- if still selected
                    IF l_ufcdefs_tbl(l_ufcdefs_selected_tbl(k)).sale_lease_back_code = 'N' THEN
                                  l_det_null_tbl(j) := l_ufcdefs_selected_tbl(k);
Line: 5311

                                  l_selected_ufc_pos := l_ufcdefs_selected_tbl(k);
Line: 5323

                                IF det_match_cnt = selected_count THEN --k THEN
                                  NULL; -- all records have matching values, do nothing
Line: 5326

                                  NULL; -- keep all records selected. Don't exclude yet.
Line: 5328

                                  selected_count := 1;
Line: 5329

                                ELSE -- more than one but less than total selected  records have matching values
                                  FOR p IN l_det_null_tbl.FIRST .. l_det_null_tbl.LAST LOOP
                                    l_ufcdefs_tbl(l_det_null_tbl(p)).select_yn := 'N';
Line: 5332

                                    selected_count := selected_count - 1;
Line: 5345

                  IF l_ufcdefs_tbl(l_ufcdefs_selected_tbl(k)).select_yn = 'Y' THEN -- if still selected
                    IF l_ufcdefs_tbl(l_ufcdefs_selected_tbl(k)).lease_purchased_code = 'N' THEN
                                  l_det_null_tbl(j) := l_ufcdefs_selected_tbl(k);
Line: 5351

                                  l_selected_ufc_pos := l_ufcdefs_selected_tbl(k);
Line: 5363

                                IF det_match_cnt = selected_count THEN --k THEN
                                  NULL; -- all records have matching values, do nothing
Line: 5366

                                  NULL; -- keep all records selected. Don't exclude yet.
Line: 5368

                                  selected_count := 1;
Line: 5369

                                ELSE -- more than one but less than total selected  records have matching values
                                  FOR p IN l_det_null_tbl.FIRST .. l_det_null_tbl.LAST LOOP
                                    l_ufcdefs_tbl(l_det_null_tbl(p)).select_yn := 'N';
Line: 5372

                                    selected_count := selected_count - 1;
Line: 5385

                  IF l_ufcdefs_tbl(l_ufcdefs_selected_tbl(k)).select_yn = 'Y' THEN -- if still selected
                    IF l_ufcdefs_tbl(l_ufcdefs_selected_tbl(k)).tax_country_code IS NULL THEN
                                  l_det_null_tbl(j) := l_ufcdefs_selected_tbl(k);
Line: 5391

                                  l_selected_ufc_pos := l_ufcdefs_selected_tbl(k);
Line: 5403

                                IF det_match_cnt = selected_count THEN --k THEN
                                  NULL; -- all records have matching values, do nothing
Line: 5406

                                  NULL; -- keep all records selected. Don't exclude yet.
Line: 5408

                                  selected_count := 1;
Line: 5409

                                ELSE -- more than one but less than total selected  records have matching values
                                  FOR p IN l_det_null_tbl.FIRST .. l_det_null_tbl.LAST LOOP
                                    l_ufcdefs_tbl(l_det_null_tbl(p)).select_yn := 'N';
Line: 5412

                                    selected_count := selected_count - 1;
Line: 5419

          ELSIF selected_count = 1 THEN
                EXIT;
Line: 5426

                                                    'selected_count outside 2nd loop '||selected_count);
Line: 5429

        IF selected_count = 1 THEN
                  l_ufc_code := l_ufcdefs_tbl(l_selected_ufc_pos).ufc_code;
Line: 5431

                ELSIF selected_count > 1 THEN  -- still more than one ufcs are selected
          l_ufc_code := NULL;
Line: 5615

    SELECT set_of_books_id
    FROM   ar_system_parameters_all
    WHERE  org_id = cp_org_id;
Line: 6099

        px_tax_sources_tbl(p_tax_call_cnt).program_update_date    := null;
Line: 6119

        px_tax_sources_tbl(p_tax_call_cnt).last_updated_by       := G_USER_ID;
Line: 6120

        px_tax_sources_tbl(p_tax_call_cnt).last_update_date      := SYSDATE;
Line: 6121

        px_tax_sources_tbl(p_tax_call_cnt).last_update_login     := G_LOGIN_ID;
Line: 6403

    SELECT set_of_books_id
    FROM   ar_system_parameters_all
    WHERE  org_id = cp_org_id;
Line: 6731

  SELECT a.id, a.code, a.stream_type_purpose, b.meaning
  FROM   okl_strm_type_b a, fnd_lookups b
  WHERE  a.stream_type_purpose = 'FEE_PAYMENT'
  AND    a.billable_yn = 'Y'
  AND    a.stream_type_purpose = b.lookup_code
  AND    b.lookup_type = 'OKL_STREAM_TYPE_PURPOSE'
  AND    b.enabled_flag = 'Y'
  AND    upper(a.code) like decode(cp_sty_code, NULL, a.code, '%', a.code, upper(cp_sty_code)||'%');
Line: 6742

  SELECT id
  FROM   okl_st_gen_tmpt_sets
  WHERE  org_id = cp_org_id
  --asawanka bug fix 4659674 start
  AND    product_type = 'FINANCIAL';
Line: 6751

  SELECT id
  FROM   okl_st_gen_templates
  WHERE  gts_id = cp_gts_id
  AND    tmpt_status = G_ACTIVE_STATUS;
Line: 6758

  SELECT primary_sty_id
  FROM   okl_st_gen_tmpt_lns
  WHERE  gtt_id = cp_gtt_id
  AND    primary_yn = 'Y';
Line: 6806

   FOR l_strmtype_rec IN l_strmtype_csr(p_sty_code) LOOP -- All/User selected billable stream types of purpose 'FEE_PAYMENT'
        l_strm_type_cnt := l_strm_type_cnt + 1;
Line: 7060

    SELECT cust_acct_id, bill_to_site_use_id, currency_code, org_id,
           conversion_type, conversion_rate, conversion_rate_date, start_date
    FROM   okc_k_headers_b
    WHERE  id = cp_khr_id;
Line: 7067

    SELECT precision, minimum_accountable_unit
    FROM   fnd_currencies
    WHERE  currency_code = cp_currency_code
        AND    enabled_flag = 'Y'
    AND    NVL(start_date_active, sysdate) <= sysdate
    AND    NVL(end_date_active, sysdate) >= sysdate;
Line: 7076

    SELECT cust_trx_type_id
        FROM   ra_cust_trx_types_all
        WHERE  name = 'Invoice-OKL';
Line: 7082

    SELECT pdt_id, deal_type
    FROM   okl_k_headers
    WHERE  id = cp_khr_id;
Line: 7737

    SELECT name
    FROM   OKC_K_LINES_v
    WHERE  id = cp_fin_asset_id;
Line: 7743

    SELECT id
    FROM   okc_k_lines_b
    WHERE  cle_id   = cp_fin_asset_id
    AND    lse_id = 34 ; -- model line LSE ID
Line: 7750

    SELECT object1_id1  --is fk to po_vendors.vendor_id
        FROM   okc_k_party_roles_b
    WHERE  cle_id = cp_line_id  --fee/service top line id for fee and service, model line id for asset line
    AND    rle_code = 'OKL_VENDOR';
Line: 7757

    SELECT vendor_site_id
    FROM   po_vendor_sites
    WHERE  vendor_id = cp_vendor_id
    AND    primary_pay_site_flag = 'Y';
Line: 8147

   SELECT  a.dnz_khr_id, a.start_date, a.end_date, a.try_id, a.legal_entity_id, a.org_id
   FROM    okl_trx_requests a, okl_trx_types_tl b
   WHERE   a.id = cp_trx_id
   AND     a.try_id = b.id
   AND     b.name = cp_trx_type_name
   AND     language = 'US';
Line: 8160

   SELECT strm.khr_id,
          strm.kle_id, -- can be null for K level streams
          lse.lty_code,
          NULL asset_number,
          NULL trx_id,
          NULL trx_line_id,
          NULL entity_code,
          NULL event_class_code,
          NULL trx_level_type,
          NULL adjusted_doc_entity_code,
          NULL adjusted_doc_event_class_code,
          NULL adjusted_doc_trx_id,
          NULL adjusted_doc_trx_line_id,
          NULL adjusted_doc_trx_level_type,
          NULL adjusted_doc_number,
          NULL adjusted_doc_date,
          G_TAX_SCHEDULE tax_call_type_code,
          strm.sty_id stream_type_id,
          NULL trx_business_category,
          'ACTIVE' tax_line_status_code,
          selm.id sel_id,
          'N' reported_yn,
          typ.code Stream_Type,
          typ.billable_yn Billable,
          strm.id stream_id,
          strm.transaction_number,
          selm.amount,
          selm.stream_element_date stream_element_date,
          NULL tax_sources_id,
          NULL asset_line_id,
          NULL ship_to_siteuseid,
          NULL inventory_item_id
    FROM  okl_strm_type_b typ,
          okl_streams strm,
          okl_strm_elements selm,
          okc_k_lines_b lines,
          okc_line_styles_b lse
    WHERE  strm.sty_id = typ.id
    AND    strm.id = selm.stm_id
    AND    typ.billable_yn = 'Y'
    AND    strm.say_code ='CURR'
    AND    strm.active_yn = 'Y'
    AND    strm.purpose_code IS NULL
    AND    strm.khr_id = cp_contract_id
    AND    selm.stream_element_date BETWEEN cp_date_from AND cp_date_to
    AND    strm.kle_id = lines.id(+)
    AND    lines.lse_id = lse.id (+)
    AND    lse.lty_code (+) <> 'INSURANCE'
    AND  NOT EXISTS -- tax lines don't exist in AR ( This condition is added to pick up stream elements billed under
                    -- old solution : date_billed may not be null but billing may not have been run completely, so tax
                    -- may not have been calculated in AR
         (SELECT NULL
          FROM  okl_bpd_tld_ar_lines_v cnsld
          WHERE cnsld.sel_id = selm.id)
    ORDER  BY  strm.kle_id, strm.sty_id;
Line: 8220

    SELECT strm.khr_id,
           strm.kle_id, -- can be null for K level streams
           strm.sty_id stream_type_id,
           selm.id sel_id,
           selm.stream_element_date stream_element_date,
           cnsld.customer_trx_id,
           cnsld.customer_trx_line_id,
           selm.amount --SECHAWLA 22-APR-08 6975983 : added
     FROM  okl_strm_type_b typ,
           okl_streams strm,
           okl_strm_elements selm,
           okc_k_lines_b lines,
           okc_line_styles_b lse,
           okl_bpd_tld_ar_lines_v cnsld
    WHERE  strm.sty_id = typ.id
    AND    strm.id = selm.stm_id
    AND    typ.billable_yn = 'Y'
    AND    strm.say_code ='CURR'
    AND    strm.active_yn = 'Y'
    AND    strm.purpose_code IS NULL
    AND    strm.khr_id = cp_contract_id
    AND    selm.stream_element_date BETWEEN cp_date_from AND cp_date_to
    AND    selm.date_billed IS NOT NULL  -- pick billed stream elements
    AND    strm.kle_id = lines.id(+)
    AND    lines.lse_id = lse.id (+)
    AND    lse.lty_code (+) <> 'INSURANCE'
    AND    cnsld.sel_id = selm.id
    AND    cnsld.khr_id = strm.khr_id;
Line: 8252

    SELECT hdr.id trx_id, det.id trx_line_id
    FROM   okl_trx_ar_invoices_b hdr, okl_txl_ar_inv_lns_b line, okl_txd_ar_ln_dtls_b det
    WHERE  det.sel_id = cp_sel_id
    AND    det.sty_id = cp_sty_id
    AND    det.til_id_details = line.id
    AND    line.tai_id = hdr.id;
Line: 8261

    SELECT DISTINCT strm.kle_id fin_asset_id -- is DISTINCT req ? can an asset line have more than one stream types ?
    FROM   okl_strm_type_b typ,
           okl_streams strm,
           okc_k_lines_b lines,
           okc_line_styles_b sty
    WHERE  strm.sty_id = typ.id
    AND    typ.billable_yn = 'Y'
    AND    strm.say_code ='CURR'
    AND    strm.active_yn = 'Y'
    AND    strm.purpose_code IS NULL
    AND    strm.khr_id = CP_KHR_ID
    AND    strm.kle_id = lines.id
    AND    lines.lse_id = sty.id
    AND    sty.lty_code = 'FREE_FORM1';
Line: 8278

    SELECT name, lse_id
    FROM   OKC_K_LINES_v
    WHERE  id = cp_fin_asset_id;
Line: 8284

    SELECT typ.code Stream_Type,
           strm.id stream_id,
           strm.kle_id line_id,
                   strm.sty_id stream_type_id,
           sty.lty_code
    FROM   okl_strm_type_b typ,
           okl_streams strm,
           okc_k_lines_b lines,
           okc_line_styles_b sty
    WHERE  strm.sty_id = typ.id
    AND    typ.billable_yn = 'Y'
    AND    strm.say_code ='CURR'
    AND    strm.active_yn = 'Y'
    AND    strm.purpose_code IS NULL
    AND    strm.khr_id = cp_khr_id
    AND    strm.kle_id = lines.id(+)
    AND    lines.lse_id = sty.id (+)
    AND    sty.lty_code (+) <> 'INSURANCE';
Line: 8305

    SELECT cim.object1_id1
    FROM   okc_k_lines_b cle, okc_line_styles_b lse, okc_k_items cim
    WHERE  cle.lse_id = lse.id
    AND    lse.lty_code = cp_line_type
    AND    cim.cle_id = cle.id
    AND    cle.id = cp_fee_serviced_asset_line_id;
Line: 8314

        SELECT cim_model.object1_id1,
           cim_model.object1_id2
    FROM   okc_k_items cim_model,
           okc_k_lines_b cleb_model,
           okc_line_styles_b lseb_model
    WHERE  cim_model.cle_id    = cleb_model.id
    AND    cleb_model.cle_id   = cp_fin_asset_id
    AND    lseb_model.id       = cleb_model.lse_id
    AND    lseb_model.lty_code = 'ITEM';
Line: 8326

    SELECT *
    FROM   okl_tax_trx_details
    WHERE  txs_id = cp_txs_id;
Line: 8332

    SELECT object1_id1  --is fk to po_vendors.vendor_id
        FROM   okc_k_party_roles_b
    WHERE  cle_id = cp_line_id  --fee/service top line id for fee and service, model line id for asset line
    AND    rle_code = 'OKL_VENDOR';
Line: 8339

    SELECT vendor_site_id
    FROM   po_vendor_sites
    WHERE  vendor_id = cp_vendor_id
    AND    primary_pay_site_flag = 'Y';
Line: 8347

    SELECT SUM(zx.tax_amt)  tax_amt
    FROM zx_lines zx
    WHERE zx.trx_id                     = cp_trx_id
    AND   zx.trx_line_id                = cp_trx_line_id
    AND   zx.entity_code                = G_AR_ENTITY_CODE
    AND   zx.event_class_code           = G_INVOICE_EVENT_CLASS_CODE
    AND   zx.application_id             = G_AR_APPLICATION_ID;
Line: 8357

    SELECT zx.line_amt,
           zx.taxable_amt,
           zx.trx_date,
           zx.tax_determine_date,
           zx.trx_currency_code,
           zx.currency_conversion_type,
           zx.currency_conversion_rate,
           zx.currency_conversion_date,
           zxdet.product_category,
           zxdet.trx_business_category,
           zxdet.product_fisc_classification,
           zxdet.user_defined_fisc_class,
           zxdet.product_type,
           zxdet.internal_organization_id,
           zxdet.input_tax_classification_code,
           zx.legal_entity_id,
           zxdet.line_intended_use
    FROM   zx_lines zx,
           zx_lines_det_factors zxdet
    WHERE  zx.trx_line_id                = cp_trx_line_id
    AND    zx.trx_id                     = cp_trx_id
    AND    zx.internal_organization_id   = MO_GLOBAL.get_current_org_id
    AND    zx.entity_code                = G_AR_ENTITY_CODE
    AND    zx.event_class_code           = G_INVOICE_EVENT_CLASS_CODE
    AND    zx.application_id             = G_AR_APPLICATION_ID
    AND    zx.trx_line_id                = zxdet.trx_line_id
    AND    zx.trx_id                     = zxdet.trx_id
    AND    zx.internal_organization_id   = zxdet.internal_organization_id
    AND    zx.entity_code                = zxdet.entity_code
    AND    zx.event_class_code           = zxdet.event_class_code
    AND    zx.application_id             = zxdet.application_id
    AND    ROWNUM = 1;
Line: 8392

    SELECT zx.tax_rate_id,
           zx.tax_rate_code,
           zx.tax_exemption_id,
           zx.tax_rate,
           zx.tax_date,
           zx.line_amt,
           zx.internal_organization_id,
           zx.application_id,
           zx.entity_code,
           zx.event_class_code,
           zx.event_type_code,
           zx.trx_id,
           zx.trx_line_id,
           zx.trx_level_type,
           zx.trx_line_number,
           zx.tax_line_number,
           zx.tax_regime_id,
           zx.tax_regime_code,
           zx.tax_id,
           zx.tax,
           zx.tax_status_id,
           zx.tax_status_code,
           zx.tax_apportionment_line_number,
           zx.legal_entity_id,
           zx.trx_number,
           zx.trx_date,
           zx.tax_jurisdiction_id,
           zx.tax_jurisdiction_code,
           zx.tax_type_code,
           zx.tax_currency_code,
           zx.taxable_amt_tax_curr,
           zx.trx_currency_code,
           zx.minimum_accountable_unit,
           zx.precision,
           zx.currency_conversion_type,
           zx.currency_conversion_rate,
           zx.currency_conversion_date,
           zx.tax_determine_date,
           zx.taxable_amt,
           zx.tax_amt,
           zxdet.product_category,
           zxdet.trx_business_category,
           zxdet.product_fisc_classification,
           zxdet.user_defined_fisc_class,
           zxdet.product_type
    FROM zx_lines zx,
         zx_lines_det_factors zxdet
    WHERE  zx.trx_id                     = cp_trx_id
    AND    zx.trx_line_id                = cp_trx_line_id
    AND    zx.internal_organization_id   = MO_GLOBAL.get_current_org_id
    AND    zx.entity_code                = G_AR_ENTITY_CODE
    AND    zx.event_class_code           = G_INVOICE_EVENT_CLASS_CODE
    AND    zx.application_id             = G_AR_APPLICATION_ID
    AND    zx.trx_line_id                = zxdet.trx_line_id
    AND    zx.trx_id                     = zxdet.trx_id
    AND    zx.internal_organization_id   = zxdet.internal_organization_id
    AND    zx.entity_code                = zxdet.entity_code
    AND    zx.event_class_code           = zxdet.event_class_code
    AND    zx.application_id             = zxdet.application_id;
Line: 8702

    l_bill_ts_tx_src_tbl.DELETE;
Line: 8705

      l_k_billed_streams_tbl.DELETE;
Line: 8715

        l_tax_sources_tbl.DELETE;
Line: 8716

                l_tax_trx_details_tbl.DELETE;
Line: 8804

                  l_tax_sources_tbl(k).program_update_date              := null;
Line: 8824

                  l_tax_sources_tbl(k).last_updated_by               := G_USER_ID;
Line: 8825

                  l_tax_sources_tbl(k).last_update_date              := SYSDATE;
Line: 8826

                  l_tax_sources_tbl(k).last_update_login             := G_LOGIN_ID;
Line: 8922

                l_tax_trx_details_tbl(i).program_update_date          := null;
Line: 8941

                l_tax_trx_details_tbl(i).last_updated_by              := G_USER_ID;
Line: 8942

                l_tax_trx_details_tbl(i).last_update_date             := SYSDATE;
Line: 8943

                l_tax_trx_details_tbl(i).last_update_login            := G_LOGIN_ID;
Line: 8960

                                          'before Insert into okl_tax_sources ');
Line: 8968

        INSERT INTO okl_tax_sources VALUES l_tax_sources_tbl(indx);
Line: 8990

                                          'before Insert into okl_tax_trx_details ');
Line: 8998

          INSERT INTO okl_tax_trx_details VALUES l_tax_trx_details_tbl(indx);
Line: 9047

        l_finassets_tbl.DELETE;
Line: 9100

        l_kstreamtypes_tbl.DELETE;
Line: 9111

          lx_tax_codes_tbl.DELETE;
Line: 9307

      l_tax_sources_tbl.DELETE;
Line: 9310

        l_contract_streams_tbl.DELETE;
Line: 9446

                      l_tax_sources_tbl(k).program_update_date              := null;
Line: 9466

                      l_tax_sources_tbl(k).last_updated_by               := G_USER_ID;
Line: 9467

                      l_tax_sources_tbl(k).last_update_date              := SYSDATE;
Line: 9468

                      l_tax_sources_tbl(k).last_update_login             := G_LOGIN_ID;
Line: 9568

                                                                                 'before Insert into okl_tax_sources ');
Line: 9576

          INSERT INTO okl_tax_sources VALUES l_tax_sources_tbl(indx);
Line: 9638

             'Calling "update_tax_sources_total" .. ');
Line: 9641

      update_tax_sources_total(p_api_version    => p_api_version,
                               p_init_msg_list  => p_init_msg_list,
                               x_return_status  => x_return_status,
                               x_msg_count      => x_msg_count,
                               x_msg_data       => x_msg_data,
                               p_source_trx_id  => p_source_trx_id,
                               p_source_trx_name => p_source_trx_name  );
Line: 9950

        SELECT khr_id, date_effective_from, early_termination_yn, qtp_code,
           legal_entity_id, qrs_code
        FROM   okl_trx_quotes_b
        WHERE  id = cp_qte_id;
Line: 9957

        SELECT id
        FROM   okl_tax_sources
        WHERE  trx_id = cp_trx_id;
Line: 9963

        SELECT ID
        FROM   okl_tax_trx_details
        WHERE  txs_id = cp_txs_id;
Line: 9969

        SELECT txl.id, txl.sty_id, txl.kle_id,
           txl.qlt_code, txl.amount, txl.try_id, cle.name
        FROM   okl_txl_quote_lines_b txl, okc_k_lines_v cle
        WHERE  qte_id = cp_qte_id
        AND    qlt_code NOT IN ('AMCFIA', 'AMCTAX', 'AMYOUB', 'AMCSDD')
    AND    txl.kle_id = cle.id (+);
Line: 9982

        SELECT name, lse_id
        FROM   okc_k_lines_v
        WHERE  id = cp_line_id;
Line: 9988

        SELECT cim_model.object1_id1,
           cim_model.object1_id2
    FROM   okc_k_items cim_model,
           okc_k_lines_b cleb_model,
           okc_line_styles_b lseb_model
    WHERE  cim_model.cle_id    = cleb_model.id
    AND    cleb_model.cle_id   = cp_fin_asset_id
    AND    lseb_model.id       = cleb_model.lse_id
    AND    lseb_model.lty_code = 'ITEM';
Line: 10000

        SELECT fma_id
        FROM   okl_tax_basis_override
        WHERE  try_id = cp_try_id
        AND    org_id = MO_GLOBAL.get_current_org_id;
Line: 10007

    SELECT name
    FROM   okl_formulae_b
    WHERE  id = cp_fma_id;
Line: 10135

      l_prevtaxsrc_tbl.DELETE;
Line: 10141

                                  'Deleteing prev tax source transactions for this quote ');
Line: 10145

        l_prevtaxtrxdet_tbl.DELETE;
Line: 10158

              DELETE FROM OKL_TAX_TRX_DETAILS WHERE id = l_prevtaxtrxdet_tbl(i);
Line: 10180

                                  'Deleted from okl_tax_trx_details...  ');
Line: 10185

            DELETE FROM OKL_TAX_SOURCES WHERE id = l_prevtaxsrc_tbl(i);
Line: 10206

                                  'Deleted from okl_tax_sources...  ');
Line: 10307

      l_txlquotelines_tbl.DELETE;
Line: 10308

      l_tax_sources_tbl.DELETE;
Line: 10608

          INSERT INTO okl_tax_sources VALUES lx_tax_sources_tbl(indx);
Line: 10630

                                       'Insert into okl_tax_sources ');
Line: 10670

             'Calling "update_tax_sources_total" .. ');
Line: 10673

    update_tax_sources_total(p_api_version    => p_api_version,
                             p_init_msg_list  => p_init_msg_list,
                             x_return_status  => x_return_status,
                             x_msg_count      => x_msg_count,
                             x_msg_data       => x_msg_data,
                             p_source_trx_id  => p_source_trx_id,
                             p_source_trx_name => p_source_trx_name  );
Line: 10863

 |     OKL_TAX_SOURCES_PUB.update_tax_sources()
 |     get_k_hdr_tax_params()
 |     get_asset_tax_params()
 |     get_location_party_ids()
 |     get_ufc_code()
 |     OKL_TAX_INTERFACE_PVT.calculate_tax()
 |
 |
 | PARAMETERS
 |      p_source_trx_id                 -- Source transaction ID
 |      p_source_trx_name       -- Source transaction Name
 |      p_source_table          -- Source table
 |      p_tax_call_type         -- Tax call type (Values - 'ESTIMATED'/ 'ACTUAL')
 |      p_serialized_asset      -- Serialized Asset (Values - 'Y'/'N')
 |      p_request_id            -- Id of OKL_trx_Requests
 |      p_alc_final_call        -- Determines if the asset location change final
 |                                 call is being made for the serialized asset
 |                                 (Values - null/'N'/'Y')
 |
 | KNOWN ISSUES
 |
 | NOTES
 |
 |
 | MODIFICATION HISTORY
 | Date                  Author            Description of Changes
 | 08-APR-05            SECHAWLA           Created
 |
 *=======================================================================*/
  PROCEDURE process_asset_loc_tax(
        p_api_version                   IN  NUMBER,
    p_init_msg_list                     IN  VARCHAR2 DEFAULT OKC_API.G_FALSE,
    x_return_status                     OUT NOCOPY VARCHAR2,
    x_msg_count                         OUT NOCOPY NUMBER,
    x_msg_data                          OUT NOCOPY VARCHAR2,
    p_source_trx_id                                     IN  NUMBER,
    p_source_trx_name               IN  VARCHAR2,
    p_source_table                  IN  VARCHAR2,
    p_tax_call_type                 IN  VARCHAR2,
    p_serialized_asset              IN  VARCHAR2,
    p_request_id                    IN  NUMBER,
    p_alc_final_call                IN  VARCHAR2) IS

     -------------Asset Location Change --------------
    --p_source_trx_id           ---> okl_trx_assets.id
    --p_source_trx_name     ---> 'Asset Relocation'  (changed from Internal Asset Creation to Asset Relocation)
    --p_source_table        ---> 'OKL_TRX_ASSETS'
    --p_tax_call_type       ---> Tax call type
    --p_serialized_asset    ---> Serialized Asset (Y/N)
    --p_request_id          ---> Id of OKL_trx_Requests
    --------------------------------------------------
        l_return_status                 VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
Line: 10918

        SELECT a.try_id, a.date_trans_occurred, a.legal_entity_id
        FROM   okl_trx_assets a , okl_trx_types_tl b
        WHERE  a.id = cp_trx_id
        AND    a.try_id = b.id
        AND    b.name = cp_trx_type_name
    AND    language = 'US';
Line: 10927

        SELECT kle_id, -- Id of INST_ITEM line
               OBJECT_ID1_NEW, -- ID of okx_party_site_uses_v
                   DNZ_CLE_ID  -- id of FREE_FORM1
        FROM   okl_txl_itm_insts
        WHERE  tas_id = cp_id;
Line: 10936

        SELECT location_id, party_site_id
        FROM   okx_party_site_uses_v
        WHERE  id1 = cp_id1
        AND    site_use_type = 'INSTALL_AT';
Line: 10945

        SELECT id, org_id, entity_code, event_class_code
        FROM   okl_tax_sources
        WHERE  khr_id = cp_khr_id
        AND    kle_id = cp_kle_id
        AND    tax_call_type_code = G_UPFRONT_TAX
        AND    tax_line_status_code = G_ACTIVE_STATUS
    AND    application_id = G_OKL_APPLICATION_ID
    AND    trx_level_type = G_TRX_LEVEL_TYPE
        AND    adjusted_doc_trx_id IS NULL
    AND    adjusted_doc_trx_line_id IS NULL;
Line: 10958

        SELECT chr_id, name
        FROM   okc_k_lines_v
        WHERE  id = cp_kle_id;
Line: 10964

        SELECT typ.code Stream_Type,
           strm.id stream_id,
           strm.kle_id line_id,
                   strm.sty_id stream_type_id
    FROM   okl_strm_type_b typ,
           okl_streams strm
    WHERE  strm.sty_id = typ.id
    AND    typ.billable_yn = 'Y'
    AND    strm.say_code ='CURR'
    AND    strm.active_yn = 'Y'
    AND    strm.purpose_code IS NULL
    AND    strm.khr_id = cp_khr_id
    AND    strm.kle_id = cp_kle_id;
Line: 10980

    SELECT sum(amount)
        FROM   okl_strm_elements
        WHERE  stm_id = cp_stm_id;
Line: 10986

        SELECT fma_id
        FROM   okl_tax_basis_override
        WHERE  try_id = cp_try_id
        AND    org_id = MO_GLOBAL.get_current_org_id;
Line: 10993

        SELECT cim_model.object1_id1,
           cim_model.object1_id2
    FROM   okc_k_items cim_model,
           okc_k_lines_b cleb_model,
           okc_line_styles_b lseb_model
    WHERE  cim_model.cle_id    = cleb_model.id
    AND    cleb_model.cle_id   = cp_fin_asset_id
    AND    lseb_model.id       = cleb_model.lse_id
    AND    lseb_model.lty_code = 'ITEM';
Line: 11005

    SELECT name
    FROM   okl_formulae_b
    WHERE  id = cp_fma_id;
Line: 11010

    SELECT entity_code, event_class_code
    FROM okl_tax_sources
    WHERE application_id = cp_app_id
    AND trx_id = cp_trx_id
    AND trx_level_type = G_TRX_LEVEL_TYPE
        AND tax_call_type_code = G_UPFRONT_TAX
        AND tax_line_status_code = G_ACTIVE_STATUS
    AND entity_code = G_ASSETS_ENTITY_CODE
    AND event_class_code = G_ALC_EVENT_CODE
    AND ROWNUM = 1;
Line: 11022

    SELECT  count(*)
    FROM    okc_k_lines_v okcl,
            okc_line_styles_v lse
    WHERE   okcl.cle_id = p_parent_line_id
    AND     okcl.lse_id = lse.id
    AND     lse.lty_code = 'FREE_FORM2';
Line: 11030

    SELECT  count(*)
    FROM   okl_strm_type_b typ,
           okl_streams strm
    WHERE  strm.sty_id = typ.id
    AND    typ.billable_yn = 'Y'
    AND    strm.say_code ='CURR'
    AND    strm.active_yn = 'Y'
    AND    strm.purpose_code IS NULL
    AND    strm.khr_id = cp_khr_id
    AND    strm.kle_id = cp_kle_id;
Line: 11046

    SELECT b.site_use_id,
           c.party_site_id,
           c.party_id,
           c.location_id
    FROM   hz_cust_acct_sites_all a,
           hz_cust_site_uses_all  b,
           hz_party_sites      c
    WHERE  a.CUST_ACCT_SITE_ID = b.CUST_ACCT_SITE_ID
    AND    b.site_use_code     = 'SHIP_TO'
    AND    a.party_site_id     = c.party_site_id
    AND    a.cust_account_id   = cp_cust_acct_id
    AND    a.org_id            = MO_GLOBAL.get_current_org_id
    AND    c.party_site_id     = cp_inst_loc_id
    AND    c.location_id       = cp_loc_id;
Line: 11251

            l_tax_src_tbl.DELETE;
Line: 11278

              UPDATE OKL_TAX_SOURCES SET TAX_LINE_STATUS_CODE = G_INACTIVE_STATUS WHERE id = l_tax_src_tbl(i);
Line: 11307

                          'Updated existing tax lines status to INACIVE');
Line: 11735

            INSERT INTO okl_tax_sources VALUES lx_tax_sources_tbl(indx);
Line: 11758

                          ' inserted into okl_tax_sources ' );
Line: 11814

             'Calling "update_tax_sources_total" .. ');
Line: 11817

      update_tax_sources_total(p_api_version      => p_api_version,
                               p_init_msg_list    => p_init_msg_list,
                               x_return_status    => x_return_status,
                               x_msg_count        => x_msg_count,
                               x_msg_data         => x_msg_data,
                               p_source_trx_id    => p_source_trx_id,
                               p_source_trx_name  => p_source_trx_name,
                               p_serialized_asset => p_serialized_asset);
Line: 12114

 |     OKL_TAX_SOURCES_PUB.update_tax_sources()
 |
 |
 | PARAMETERS
 |      p_source_trx_id                 -- Source transaction ID
 |      p_source_trx_name       -- Source transaction Name
 |      p_source_table          -- Source table
 |
 | KNOWN ISSUES
 |
 | NOTES
 |
 |
 | MODIFICATION HISTORY
 | Date                  Author            Description of Changes
 | 08-APR-05            SECHAWLA           Created
 |
 *=======================================================================*/
  PROCEDURE process_split_asset_tax(
        p_api_version                   IN  NUMBER,
    p_init_msg_list                     IN  VARCHAR2 DEFAULT OKC_API.G_FALSE,
    x_return_status                     OUT NOCOPY VARCHAR2,
    x_msg_count                         OUT NOCOPY NUMBER,
    x_msg_data                          OUT NOCOPY VARCHAR2,
    p_source_trx_id                                     IN  NUMBER,
    p_source_trx_name               IN  VARCHAR2,
    p_source_table                  IN  VARCHAR2) IS

    -------------Split Asset -------------------------
    --p_source_trx_id           ---> okl_trx_assets.id
    --p_source_trx_name     ---> 'Split Asset'
    --p_source_table        ---> 'OKL_TRX_ASSETS'
    --------------------------------------------------

        -- validate source trx id
        CURSOR l_trxassets_csr(cp_trx_id IN NUMBER, cp_trx_type_name IN VARCHAR2) IS
        SELECT a.try_id, a.date_trans_occurred
        FROM   okl_trx_assets a, okl_trx_types_tl b
        WHERE  a.id = cp_trx_id
        AND    a.try_id = b.id
        AND    b.name = cp_trx_type_name
    AND    language = 'US';
Line: 12159

        SELECT txl.id, okc.cle_id kle_id, -- financial asset to be split
               txl.dnz_khr_id,
               txl.asset_number,
               txl.current_units
        FROM   okl_txl_assets_b txl,
           okc_k_lines_b okc
        WHERE  txl.tas_id = cp_id
    AND    txl.kle_id = okc.id
    AND    txl.dnz_khr_id = okc.dnz_chr_id;
Line: 12171

        SELECT txd.id, okc.cle_id target_kle_id, txd.asset_number, txd.split_percent, txd.quantity
        FROM   okl_txd_assets_b txd,
           okc_k_lines_b okc
        WHERE  tal_id = cp_id
    AND    txd.target_kle_id = okc.id;
Line: 12182

        SELECT id, khr_id, kle_id, asset_number, trx_id, trx_line_id, entity_code, event_class_code,
               trx_level_type, tax_call_type_code, sty_id, trx_business_category, reported_yn,
           sel_id, line_name, application_id, tax_reporting_flag, default_taxation_country,
           product_category, user_defined_fisc_class, line_intended_use,
           tax_classification_code, inventory_item_id, bill_to_cust_acct_id, legal_entity_id,
                   line_amt, assessable_value, total_tax, product_type,
           product_fisc_classification, trx_date, provnl_tax_determination_date,
           try_id, ship_to_location_id, ship_to_party_site_id, ship_to_party_id,
           bill_to_party_site_id, bill_to_location_id, bill_to_party_id,
           ship_to_cust_acct_site_use_id, bill_to_cust_acct_site_use_id,
           trx_currency_code, currency_conversion_type, currency_conversion_rate,
           currency_conversion_date, org_id, alc_serialized_yn
        FROM   okl_tax_sources
        WHERE  khr_id = cp_khr_id
        AND    kle_id = cp_kle_id
        AND    tax_call_type_code = G_UPFRONT_TAX
        AND    tax_line_status_code = G_ACTIVE_STATUS
        AND    ADJUSTED_DOC_TRX_ID IS NULL
        AND    ADJUSTED_DOC_TRX_LINE_ID IS NULL;
Line: 12204

    SELECT *
    FROM   okl_tax_trx_details
    WHERE  txs_id = cp_txs_id;
Line: 12210

        SELECT dnz_chr_id, name
        FROM   okc_k_lines_v
        WHERE  id = cp_kle_id;
Line: 12215

    SELECT cust_trx_type_id
        FROM   ra_cust_trx_types_all
        WHERE  name = 'Invoice-OKL';
Line: 12220

    SELECT precision, minimum_accountable_unit
    FROM   fnd_currencies
    WHERE  currency_code = cp_currency_code
        AND    enabled_flag = 'Y'
    AND    NVL(start_date_active, sysdate) <= sysdate
    AND    NVL(end_date_active, sysdate) >= sysdate;
Line: 12377

    l_tax_sources_tbl.DELETE;
Line: 12378

    l_tax_src_tbl.DELETE;
Line: 12459

          l_tax_sources_tbl(k).program_update_date           := NULL;
Line: 12479

          l_tax_sources_tbl(k).last_updated_by               := G_USER_ID;
Line: 12480

          l_tax_sources_tbl(k).last_update_date              := SYSDATE;
Line: 12481

          l_tax_sources_tbl(k).last_update_login             := G_LOGIN_ID;
Line: 12519

          UPDATE okl_tax_sources SET tax_line_status_code = G_INACTIVE_STATUS WHERE id = l_tax_src_tbl(i);
Line: 12548

                  ' Insert Adjusting tax sources  - Start');
Line: 12555

          INSERT INTO okl_tax_sources VALUES l_tax_sources_tbl(indx);
Line: 12576

                  ' Insert Adjusting tax sources  - End');
Line: 12619

          'Calling "update_tax_sources_total" for updating Total Tax for all Lines in Tax Sources');
Line: 12622

      update_tax_sources_total(p_api_version     => p_api_version,
                               p_init_msg_list   => p_init_msg_list,
                               x_return_status   => x_return_status,
                               x_msg_count       => x_msg_count,
                               x_msg_data        => x_msg_data,
                               p_source_trx_id   => p_source_trx_id,
                               p_source_trx_name => p_source_trx_name);
Line: 12680

      l_new_tax_sources_tbl.DELETE;
Line: 12771

              l_new_tax_sources_tbl(new_tax_count).program_update_date           := NULL;
Line: 12791

              l_new_tax_sources_tbl(new_tax_count).last_updated_by               := G_USER_ID;
Line: 12792

              l_new_tax_sources_tbl(new_tax_count).last_update_date              := SYSDATE;
Line: 12793

              l_new_tax_sources_tbl(new_tax_count).last_update_login             := G_LOGIN_ID;
Line: 12864

                  ' Insert Split asset tax sources  - Start');
Line: 12871

            INSERT INTO okl_tax_sources VALUES l_new_tax_sources_tbl(indx);
Line: 12892

                  ' Insert Split asset tax sources  - End');
Line: 12934

             'Calling "update_tax_sources_total" .. ');
Line: 12937

      update_tax_sources_total(p_api_version    => p_api_version,
                               p_init_msg_list  => p_init_msg_list,
                               x_return_status  => x_return_status,
                               x_msg_count      => x_msg_count,
                               x_msg_data       => x_msg_data,
                               p_source_trx_id  => p_source_trx_id);
Line: 13166

        SELECT a.try_id, a.khr_id, a.legal_entity_id
        FROM   okl_trx_contracts a , okl_trx_types_tl b
        WHERE  a.id = cp_trx_id
        AND    a.try_id = b.id
        AND    b.name = cp_trx_type_name
    AND    language = 'US';
Line: 13177

        SELECT a.khr_id_new, a.legal_entity_id
        FROM   okl_trx_contracts a , okl_trx_types_tl b
        WHERE  a.id = cp_trx_id
        AND    a.try_id = b.id
        AND    b.name = cp_trx_type_name
    AND    language = 'US';
Line: 13185

    SELECT id
        FROM   okl_trx_types_v
        WHERE  NAME = 'Booking';
Line: 13190

    SELECT org_id, application_id, entity_code, event_class_code
    FROM   okl_tax_sources
    WHERE  khr_id = cp_khr_id
    AND    tax_call_type_code = G_UPFRONT_TAX
    AND    tax_line_status_code = G_ACTIVE_STATUS
    AND    application_id = G_OKL_APPLICATION_ID
    AND    trx_id = cp_trx_id
    AND    trx_level_type = G_TRX_LEVEL_TYPE
    AND    ROWNUM = 1;
Line: 13201

    SELECT id
    FROM   okl_tax_sources
    WHERE  khr_id = cp_khr_id
    AND    tax_call_type_code = G_UPFRONT_TAX
    AND    tax_line_status_code = G_ACTIVE_STATUS
    AND    application_id = G_OKL_APPLICATION_ID
    AND    trx_id = cp_trx_id
    AND    trx_level_type = G_TRX_LEVEL_TYPE;
Line: 13214

    SELECT id
    FROM   okl_tax_sources
    WHERE  khr_id = cp_khr_id
    AND    tax_call_type_code = G_UPFRONT_TAX
    AND    tax_line_status_code = G_ACTIVE_STATUS
    AND    application_id = G_OKL_APPLICATION_ID
    AND    trx_level_type = G_TRX_LEVEL_TYPE;
Line: 13224

    SELECT cle.id  fin_asset_id, cle.name asset_number
    FROM   okc_k_lines_v cle
    WHERE  cle.chr_id = cp_chr_id
    AND    cle.lse_id = 33
    AND    sts_code NOT IN ('ABANDONED', 'EXPIRED', 'REVERSED', 'TERMINATED');
Line: 13232

        SELECT  rgpb.cle_id  line_id,
                        styb.id  stream_type_id,
                        styb.CODE stream_type_code,
                        sum(nvl((rulb2.RULE_INFORMATION3 * rulb2.RULE_INFORMATION6),0) + nvl(rulb2.RULE_INFORMATION8,0)) line_amt
        FROM
                okc_rule_groups_b rgpb,
                okc_rules_b       rulb,
                okc_rules_b       rulb2,
                okl_strm_type_b   styb
    WHERE   rgpb.dnz_chr_id = cp_chr_id
        AND    rgpb.chr_id     = cp_chr_id
        AND    rgpb.cle_id IS NULL
        AND    rgpb.rgd_code   = 'LALEVL'
        AND    rulb.rgp_id     = rgpb.id
        AND    rulb.rule_information_category  = 'LASLH'
        AND    rulb.dnz_chr_id                 = cp_chr_id
        AND    styb.id                         = rulb.object1_id1
        AND    rulb2.object2_id1               = rulb.id
        AND    rulb2.rgp_id                    = rgpb.id
        AND    rulb2.rule_information_category = 'LASLL'
        GROUP BY rgpb.cle_id, styb.id, styb.CODE, rulb2.RULE_INFORMATION6
    UNION
        SELECT  rgpb.cle_id  line_id,
                        styb.id                 stream_type_id,
                        styb.CODE               stream_type_code,
                    sum(nvl((rulb2.RULE_INFORMATION3 * rulb2.RULE_INFORMATION6),0) + nvl(rulb2.RULE_INFORMATION8,0)) line_amt
        FROM    okc_k_lines_b       cleb,
                okc_rule_groups_b rgpb,
                okc_rules_b       rulb,
            okc_rules_b       rulb2,
            okl_strm_type_b   styb
        WHERE   rgpb.dnz_chr_id = cp_chr_id
        AND     rgpb.chr_id    IS NULL
        AND     rgpb.cle_id  = cleb.id
        AND     cleb.dnz_chr_id = cp_chr_id
        AND     cleb.lse_id     = 33
    AND     cleb.sts_code NOT IN ('ABANDONED', 'EXPIRED', 'REVERSED', 'TERMINATED')
        AND     rgpb.rgd_code   = 'LALEVL'
        AND     rulb.rgp_id     = rgpb.id
        AND     rulb.rule_information_category  = 'LASLH'
        AND     rulb.dnz_chr_id                 = cp_chr_id
        AND     styb.id                         = rulb.object1_id1
        AND     rulb2.object2_id1               = rulb.id
        AND     rulb2.rgp_id                    = rgpb.id
        AND     rulb2.rule_information_category = 'LASLL'
    GROUP BY rgpb.cle_id, styb.id, styb.CODE, rulb2.RULE_INFORMATION6;
Line: 13281

        SELECT cim_model.object1_id1,
           cim_model.object1_id2
    FROM   okc_k_items cim_model,
           okc_k_lines_b cleb_model,
           okc_line_styles_b lseb_model
    WHERE  cim_model.cle_id    = cleb_model.id
    AND    cleb_model.cle_id   = cp_fin_asset_id
    AND    lseb_model.id       = cleb_model.lse_id
    AND    lseb_model.lty_code = 'ITEM';
Line: 13293

        SELECT fma_id
        FROM   okl_tax_basis_override
        WHERE  try_id = cp_try_id
        AND    org_id = MO_GLOBAL.get_current_org_id;
Line: 13300

    SELECT name
    FROM   Okl_formulae_b
    WHERE  id = cp_fma_id;
Line: 13360

    l_delete_data                   BOOLEAN := FALSE;
Line: 13463

        l_prev_tax_source_tbl.DELETE;
Line: 13466

          l_delete_data := TRUE;
Line: 13469

              DELETE FROM OKL_TAX_SOURCES WHERE id = l_prev_tax_source_tbl(i);
Line: 13494

      IF (l_delete_data) THEN

        l_transaction_rec.internal_organization_id := l_internal_organization_id;
Line: 13506

              'OKL_TAX_INTERFACE_PVT.update_document');
Line: 13509

        OKL_TAX_INTERFACE_PVT.update_document(p_api_version     => p_api_version,
                                              p_init_msg_list   => p_init_msg_list,
                                              x_return_status   => x_return_status,
                                              x_msg_count       => x_msg_count,
                                              x_msg_data        => x_msg_data,
                                              p_transaction_rec => l_transaction_rec);
Line: 13650

        l_finassets_tbl.DELETE;
Line: 13821

        l_k_asset_pymnts_tbl.DELETE;
Line: 14546

            INSERT INTO okl_tax_sources VALUES lx_tax_sources_tbl(indx);
Line: 14569

                                       'Insert into okl_tax_sources ');
Line: 14609

             'Calling "update_tax_sources_total" .. ');
Line: 14612

      update_tax_sources_total(p_api_version    => p_api_version,
                               p_init_msg_list  => p_init_msg_list,
                               x_return_status  => x_return_status,
                               x_msg_count      => x_msg_count,
                               x_msg_data       => x_msg_data,
                               p_source_trx_id  => p_source_trx_id);
Line: 14961

 |     update_tax_sources_total()
 |     okl_tax_sources_pub.update_tax_sources()
 |     process_final_upfront_tax()
 |
 |
 | PARAMETERS
 |      p_source_trx_id                 -- Source transaction ID
 |      p_source_trx_name       -- Source transaction Name
 |      p_source_table          -- Source table
 |
 | KNOWN ISSUES
 |
 | NOTES
 |
 |
 | MODIFICATION HISTORY
 | Date           Author        Description of Changes
 | 08-APR-05      SECHAWLA        Created
 | 29-NOV-05      SECHAWLA        4772640 Modified to merge Rebook trx type setups
 |                                into 'Booking' trx type
 |
 *=======================================================================*/
  PROCEDURE process_rebook_upfront_tax(
        p_api_version                   IN  NUMBER,
    p_init_msg_list                     IN  VARCHAR2 DEFAULT OKC_API.G_FALSE,
    x_return_status                     OUT NOCOPY VARCHAR2,
    x_msg_count                         OUT NOCOPY NUMBER,
    x_msg_data                          OUT NOCOPY VARCHAR2,
    p_source_trx_id                                     IN  NUMBER,
    p_source_trx_name               IN  VARCHAR2,
    p_source_table                  IN  VARCHAR2) IS

     -------------Rebook --------------
    --p_source_trx_id           ---> okl_trx_contracts.id
    --p_source_trx_name     ---> 'Rebook'
    --p_source_table        ---> 'OKL_TRX_CONTRACTS'
    --------------------------------------------------

        l_return_status                 VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
Line: 15005

        SELECT a.try_id, a.khr_id, a.khr_id_new, a.date_transaction_occurred
        FROM   okl_trx_contracts a , okl_trx_types_tl b
        WHERE  a.id = cp_trx_id
        AND    a.try_id = b.id
        AND    b.name = cp_trx_type_name
    AND    language = 'US';
Line: 15016

        SELECT id, khr_id, kle_id, asset_number, trx_id, trx_line_id, entity_code,
               event_class_code, trx_level_type, tax_call_type_code, sty_id,
               trx_business_category, tax_line_status_code, sel_id, reported_yn,
               line_name, application_id, tax_reporting_flag, default_taxation_country,
               product_category, user_defined_fisc_class, line_intended_use,
               tax_classification_code, inventory_item_id, bill_to_cust_acct_id,
               org_id, legal_entity_id, line_amt, assessable_value, total_tax,
               product_type, product_fisc_classification, trx_date, provnl_tax_determination_date,
               try_id, ship_to_location_id, ship_to_party_site_id, ship_to_party_id,
               bill_to_party_site_id, bill_to_location_id, bill_to_party_id,
               ship_to_cust_acct_site_use_id, bill_to_cust_acct_site_use_id,
               trx_currency_code, currency_conversion_date, currency_conversion_rate,
               currency_conversion_type
        FROM   okl_tax_sources
        WHERE  khr_id = cp_khr_id
        AND    tax_call_type_code = G_UPFRONT_TAX
        AND    tax_line_status_code = G_ACTIVE_STATUS
    AND    application_id = G_OKL_APPLICATION_ID
    AND    trx_level_type = G_TRX_LEVEL_TYPE
        AND    ADJUSTED_DOC_TRX_ID IS NULL
        AND    ADJUSTED_DOC_TRX_LINE_ID IS NULL;
Line: 15039

    SELECT id, kle_id
    FROM okl_tax_sources
    WHERE trx_id = cp_trx_id
    AND   khr_id = cp_khr_id
    AND   tax_call_type_code = G_UPFRONT_TAX
    AND   tax_line_status_code = G_ACTIVE_STATUS;
Line: 15047

    SELECT orig_system_id1
    FROM   okc_k_lines_b
    WHERE  id = cp_kle_id;
Line: 15052

    SELECT id
    FROM   okc_k_lines_b
    WHERE  orig_system_id1 = cp_orig_system_id;
Line: 15131

        l_tax_sources_tbl.DELETE;
Line: 15132

        l_tax_src_tbl.DELETE;
Line: 15136

          l_prevtaxsources_tbl.DELETE;
Line: 15182

                  l_tax_sources_tbl(i).program_update_date           := NULL;
Line: 15202

                  l_tax_sources_tbl(i).last_updated_by               := G_USER_ID;
Line: 15203

                  l_tax_sources_tbl(i).last_update_date              := SYSDATE;
Line: 15204

                  l_tax_sources_tbl(i).last_update_login             := G_LOGIN_ID;
Line: 15271

          UPDATE OKL_TAX_SOURCES SET TAX_LINE_STATUS_CODE = G_INACTIVE_STATUS WHERE id = l_tax_src_tbl(i);
Line: 15304

          INSERT INTO okl_tax_sources VALUES l_tax_sources_tbl(indx);
Line: 15363

          'Calling "update_tax_sources_total" for updating Total Tax for all Lines in Tax Sources');
Line: 15366

      update_tax_sources_total(p_api_version      => p_api_version,
                               p_init_msg_list    => p_init_msg_list,
                               x_return_status    => x_return_status,
                               x_msg_count        => x_msg_count,
                               x_msg_data         => x_msg_data,
                               p_source_trx_id    => p_source_trx_id,
                               p_source_trx_name  => p_source_trx_name);
Line: 15444

           'Calling okl_tax_sources_pub.update_tax_sources for synching back original contract info for all Lines in Tax Sources');
Line: 15447

      okl_tax_sources_pub.update_tax_sources(p_api_version     => p_api_version
                                            ,p_init_msg_list   => p_init_msg_list
                                            ,x_return_status   => x_return_status
                                            ,x_msg_count       => x_msg_count
                                            ,x_msg_data        => x_msg_data
                                            ,p_txsv_tbl        => l_txsv_tbl
                                            ,x_txsv_tbl        => lx_txsv_tbl);
Line: 15673

        SELECT expected_start_date, product_id, interest_disclosed,
               transfer_of_title, sale_and_lease_back, purchase_of_lease, usage_category,
               age_of_equipment, parent_object_code , parent_object_id, legal_entity_id
        FROM   okl_lease_quotes_b
        WHERE  id = cp_trx_id;
Line: 15681

        SELECT id
        FROM   okl_trx_types_tl
        WHERE  name = 'Sales Quote'
    AND    language = 'US';
Line: 15688

        SELECT lop.currency_code, lop.cust_acct_id, lop.prospect_id,  --> (party id)
           lop.org_id, lsq.expected_start_date, lop.currency_conversion_type,
           lop.currency_conversion_rate, lop.currency_conversion_date, lsq.line_intended_use,
           pdt.name
        FROM   okl_lease_opportunities_b lop, okl_lease_quotes_b lsq, okl_products pdt
        WHERE  lsq.parent_object_id = lop.id
    AND    lsq.parent_object_code = 'LEASEOPP'
    AND    lsq.product_id = pdt.id
    AND    lsq.id = cp_id;
Line: 15700

        SELECT lap.currency_code, lap.cust_acct_id, lap.prospect_id, --> (party id)
           lap.org_id, lsq.expected_start_date, lap.currency_conversion_type,
           lap.currency_conversion_rate, lap.currency_conversion_date, lsq.line_intended_use,
           pdt.name
        FROM   okl_lease_applications_b lap, okl_lease_quotes_b lsq, okl_products pdt
        WHERE  lsq.parent_object_id = lap.id
    AND    lsq.parent_object_code = 'LEASEAPP'
    AND    lsq.primary_quote = 'Y'
    AND    lsq.product_id = pdt.id
    AND    lsq.id = cp_id;
Line: 15714

    SELECT id
    FROM   okl_tax_sources
    WHERE  tax_call_type_code = G_UPFRONT_TAX
    AND    trx_id = cp_trx_id;
Line: 15721

        SELECT ID
        FROM   okl_tax_trx_details
        WHERE  txs_id = cp_txs_id;
Line: 15727

    SELECT AST.ID  asset_id, asset_number, install_site_id
    FROM   OKL_ASSETS_B AST
    WHERE  AST.PARENT_OBJECT_CODE = 'LEASEQUOTE'
    AND    AST.PARENT_OBJECT_ID = cp_quote_id;
Line: 15734

    SELECT inv_item_id, supplier_id
    FROM   okl_asset_components_b
    WHERE  asset_id = cp_asset_id
    AND    primary_component = 'Y';
Line: 15741

        SELECT cfo.source_id ,  ast.asset_number, caf.sty_id,
           sum(nvl((cfl.amount * cfl.number_of_periods),0) + nvl(cfl.stub_amount,0)) taxable_basis
        FROM   OKL_ASSETS_B ast, okl_cash_flow_objects cfo, okl_cash_flows caf, okl_cash_flow_levels cfl
        WHERE  AST.PARENT_OBJECT_CODE = 'LEASEQUOTE'
        AND    AST.PARENT_OBJECT_ID = cp_quote_id
        AND    ast.id = cfo.source_id
        AND    cfo.oty_code = 'QUOTED_ASSET'
        AND    cfo.source_table = 'OKL_ASSETS_B'
        AND    cfo.id = caf.cfo_id
        AND    caf.cft_code = 'PAYMENT_SCHEDULE'
        AND    caf.sts_code IN ('CURRENT', 'WORK')
        AND    caf.id = cfl.caf_id
        GROUP BY cfo.source_id ,  ast.asset_number, caf.sty_id
    UNION
    SELECT cfo.source_id ,  null, caf.sty_id,
           sum(nvl((cfl.amount * cfl.number_of_periods),0) + nvl(cfl.stub_amount,0)) taxable_basis
        FROM   okl_cash_flow_objects cfo, okl_cash_flows caf, okl_cash_flow_levels cfl
        WHERE  cfo.oty_code = 'LEASE_QUOTE'
        AND    cfo.source_table = 'OKL_LEASE_QUOTES_B'
        AND    cfo.source_id = cp_quote_id
        AND    cfo.id = caf.cfo_id
        AND    caf.cft_code = 'PAYMENT_SCHEDULE'
        AND    caf.sts_code IN ('CURRENT', 'WORK')
        AND    caf.id = cfl.caf_id
        GROUP BY cfo.source_id ,  null, caf.sty_id;
Line: 15769

    SELECT
           b.site_use_id,
           c.party_site_id,
           c.party_id,
           c.location_id
    FROM   hz_cust_acct_sites_all a,
           hz_cust_site_uses_all  b,
           hz_party_sites      c,
           hz_parties d
    WHERE
           a.cust_acct_site_id = b.cust_acct_site_id
    AND    b.site_use_code     = 'BILL_TO'
    AND    d.party_id          = cp_party_id
    AND    a.party_site_id     = c.party_site_id
    AND    c.party_id          = d.party_id;
Line: 15787

    SELECT
           b.site_use_id,
           c.party_site_id,
           c.party_id,
           c.location_id
    FROM   hz_cust_acct_sites_all a,
           hz_cust_site_uses_all  b,
           hz_party_sites      c,
           hz_parties d
    WHERE
           a.cust_acct_site_id = b.cust_acct_site_id
    AND    b.site_use_code     = 'SHIP_TO'
    AND    d.party_id          = cp_party_id
    AND    a.party_site_id     = c.party_site_id
    AND    c.party_id          = d.party_id;
Line: 15805

        SELECT fma_id
        FROM   okl_tax_basis_override
        WHERE  try_id = cp_try_id
        AND    org_id = MO_GLOBAL.get_current_org_id;
Line: 15812

    SELECT name
    FROM   Okl_formulae_b
    WHERE  id = cp_fma_id;
Line: 15818

    SELECT cust_trx_type_id
        FROM   ra_cust_trx_types_all
        WHERE  name = 'Invoice-OKL';
Line: 15824

    SELECT precision, minimum_accountable_unit
    FROM   fnd_currencies
    WHERE  currency_code = cp_currency_code
        AND    enabled_flag = 'Y'
    AND    NVL(start_date_active, sysdate) <= sysdate
    AND    NVL(end_date_active, sysdate) >= sysdate;
Line: 15833

    SELECT vendor_site_id
    FROM   po_vendor_sites
    WHERE  vendor_id = cp_vendor_id
    AND    primary_pay_site_flag = 'Y';
Line: 15841

    SELECT hzp.location_id
    FROM   HZ_PARTY_SITES hzp, hz_party_site_uses hsu
    WHERE  hsu.PARTY_SITE_USE_ID = cp_party_site_id
    AND    hzp.party_Site_id = hsu.party_site_id;
Line: 15848

    SELECT b.site_use_id, c.party_site_id, c.party_id, c.location_id
    FROM   hz_cust_acct_sites_all a,
           hz_cust_site_uses_all  b,
           hz_party_sites      c
    WHERE  a.cust_acct_site_id = b.cust_acct_site_id
    AND    b.site_use_code     = 'SHIP_TO'
    AND    a.party_site_id     = c.party_site_id
    AND    a.cust_account_id   = cp_cust_acct_id
    AND    a.org_id            = MO_GLOBAL.get_current_org_id
    AND    c.party_site_id     = cp_inst_loc_id
    AND    c.location_id       = cp_loc_id;
Line: 16002

          l_prevtaxsources_tbl.DELETE;
Line: 16006

        l_prevtaxtrxdet_tbl.DELETE;
Line: 16021

              DELETE FROM OKL_TAX_TRX_DETAILS WHERE id = l_prevtaxtrxdet_tbl(i);
Line: 16043

            DELETE FROM OKL_TAX_SOURCES WHERE id = l_prevtaxsources_tbl(i);
Line: 16063

                                'Deleted prev tax sources and lines for this sales quote ' );
Line: 16220

      l_quoteassets_tbl.DELETE;
Line: 16301

      l_q_asset_cashflows_tbl.DELETE;
Line: 17031

          INSERT INTO okl_tax_sources VALUES lx_tax_sources_tbl(indx);
Line: 17053

                        'Insert into okl_tax_sources ');
Line: 17093

             'Calling "update_tax_sources_total" .. ');
Line: 17096

    update_tax_sources_total(p_api_version    => p_api_version,
                             p_init_msg_list  => p_init_msg_list,
                             x_return_status  => x_return_status,
                             x_msg_count      => x_msg_count,
                             x_msg_data       => x_msg_data,
                             p_source_trx_id  => p_source_trx_id,
                             p_source_trx_name => p_source_trx_name  );
Line: 17491

      SELECT  tax_upfront_yn, tax_invoice_yn
      FROM    OKL_SYSTEM_PARAMS_ALL
      WHERE   org_id = cp_org_id;
Line: 17496

      SELECT rul.rule_information5
      FROM okc_rules_b rul,
           okc_rule_groups_b rgp,
           okl_trx_requests trx
      WHERE rgp.dnz_chr_id = trx.dnz_khr_id
      AND   rul.rgp_id = rgp.id
      AND   rgp.rgd_code = 'LAHDTX'
      AND   rul.rule_information_category = 'LASTPR'
      AND   trx.id = cp_trx_id
      AND   trx.request_type_code = 'TAX_SCHEDULES';
Line: 17982

 |    This procedure is called by update tax common components for setting the
 |    tax security context before invoking Tax Determinant Lov's
 |
 | CALLED FROM                                  Tax Common components
 |
 |
 | CALLS PROCEDURES/FUNCTIONS
 |     OKL_TAX_INTERFACE_PVT.set_tax_security_context
 |
 |
 | PARAMETERS
 |      p_internal_org_id               -- Operatng Unit Identifier
 |      p_legal_entity_id       -- Legal Entity Identifier
 |      p_transaction_date      -- Transaction Date
 |
 | KNOWN ISSUES
 |
 | NOTES
 |
 |
 | MODIFICATION HISTORY
 | Date          Author     Description of Changes
 | 24-JAN-07    RRAVIKIR      Created
 *=======================================================================*/
  PROCEDURE set_tax_security_context(
    p_api_version                       IN  NUMBER,
    p_init_msg_list                     IN  VARCHAR2 DEFAULT OKL_API.G_FALSE,
    x_return_status                     OUT NOCOPY VARCHAR2,
    x_msg_count                         OUT NOCOPY NUMBER,
    x_msg_data                          OUT NOCOPY VARCHAR2,
    p_internal_org_id                           IN  NUMBER,
    p_legal_entity_id               IN  NUMBER,
    p_transaction_date              IN  DATE) IS

    l_api_version            CONSTANT NUMBER := 1;
Line: 18227

    SELECT org_id, trx_line_id, application_id, event_class_code,
           entity_code, trx_level_type, khr_id, product_category, user_defined_fisc_class,
           trx_business_category, line_intended_use, alc_serialized_yn
    FROM  okl_tax_sources
    WHERE id = cp_tax_sources_id;
Line: 18236

    SELECT  SUM(zx_lines.tax_amt) total_tax
    FROM    zx_lines
    WHERE   trx_id = cp_trx_id
    AND     trx_line_id = cp_trx_line_id
    AND     application_id = cp_application_id
    AND     event_class_code = cp_event_class_code
    AND     entity_code = cp_entity_code
    AND     trx_level_type = cp_trx_level_type
    AND     nvl(cancel_flag, 'N') <> 'Y';
Line: 18337

              'Calling okl_tax_sources_pub.update_tax_sources for Updating Tax determinants');
Line: 18340

      okl_tax_sources_pub.update_tax_sources(p_api_version     => p_api_version
                                            ,p_init_msg_list   => p_init_msg_list
                                            ,x_return_status   => l_return_status
                                            ,x_msg_count       => x_msg_count
                                            ,x_msg_data        => x_msg_data
                                            ,p_txsv_rec        => l_txsv_rec
                                            ,x_txsv_rec        => lx_txsv_rec);
Line: 18414

            'Calling "update_tax_sources_total" for updating Total Tax for all Lines in Tax Sources');
Line: 18418

          update_tax_sources_total(p_api_version    => p_api_version,
                                   p_init_msg_list  => p_init_msg_list,
                                   x_return_status  => l_return_status,
                                   x_msg_count      => x_msg_count,
                                   x_msg_data       => x_msg_data,
                                   p_source_trx_id  => p_trx_id,
                                   p_source_trx_name => 'Asset Relocation');
Line: 18433

          update_tax_sources_total(p_api_version    => p_api_version,
                                   p_init_msg_list  => p_init_msg_list,
                                   x_return_status  => l_return_status,
                                   x_msg_count      => x_msg_count,
                                   x_msg_data       => x_msg_data,
                                   p_source_trx_id  => p_trx_id);
Line: 18482

              'Calling okl_tax_sources_pub.update_tax_sources for updating Total Tax for current line in Tax Sources');
Line: 18485

        okl_tax_sources_pub.update_tax_sources(p_api_version     => p_api_version
                                              ,p_init_msg_list   => p_init_msg_list
                                              ,x_return_status   => l_return_status
                                              ,x_msg_count       => x_msg_count
                                              ,x_msg_data        => x_msg_data
                                              ,p_txsv_rec        => l_txsv_rec
                                              ,x_txsv_rec        => lx_txsv_rec);
Line: 18801

          'Calling "update_tax_sources_total" for updating Total Tax for all Lines in Tax Sources');
Line: 18804

    update_tax_sources_total(p_api_version    => p_api_version,
                             p_init_msg_list  => p_init_msg_list,
                             x_return_status  => l_return_status,
                             x_msg_count      => x_msg_count,
                             x_msg_data       => x_msg_data,
                             p_source_trx_id  => p_trx_id);
Line: 18934

          SELECT hdr.id hdr_id, hdr.khr_id, hdr.date_invoiced, hdr.try_id try_id,
             hdr.qte_id, hdr.ibt_id , hdr.legal_entity_id, line.id line_id, line.kle_id,
             line.isl_id, det.sty_id, det.amount
      FROM   okl_trx_ar_invoices_b hdr, okl_txl_ar_inv_lns_b line,
             okl_txd_ar_ln_dtls_b det
      WHERE  det.id = cp_det_line_id
      AND    det.til_id_details = line.id
      AND    line.tai_id = hdr.id;
Line: 18945

      SELECT qtp_code, qrs_code, early_termination_yn
      FROM   okl_trx_quotes_b
      WHERE  id = cp_qte_id;
Line: 18951

      SELECT stream_type_purpose
      FROM   okl_strm_type_b
      WHERE  id = cp_sty_id;
Line: 18957

      SELECT lse.lty_code
          FROM   okc_k_lines_b line, okc_line_styles_b lse
          WHERE  line.lse_id = lse.id
          AND    line.id = cp_kle_id;
Line: 18964

          SELECT name
          FROM   okc_k_lines_v
          WHERE  id = cp_line_id;
Line: 18970

      SELECT cim.object1_id1
      FROM   okc_k_lines_b cle, okc_line_styles_b lse, okc_k_items cim
      WHERE  cle.lse_id = lse.id
      AND    lse.lty_code = cp_line_type
      AND    cim.cle_id = cle.id
      AND    cle.id = cp_fee_serviced_asset_line_id;
Line: 18979

      SELECT inventory_item_id, ship_from_org_id, ship_to_org_id
      FROM   oe_order_lines_all
      WHERE  line_id = cp_line_id;
Line: 18985

      SELECT cim_model.object1_id1,
             cim_model.object1_id2
      FROM   okc_k_items cim_model,
             okc_k_lines_b cleb_model,
             okc_line_styles_b lseb_model
      WHERE  cim_model.cle_id    = cleb_model.id
      AND    cleb_model.cle_id   = cp_fin_asset_id
      AND    lseb_model.id       = cleb_model.lse_id
      AND    lseb_model.lty_code = 'ITEM';
Line: 18996

      SELECT set_of_books_id
      FROM   ar_system_parameters_all
      WHERE  org_id = cp_org_id;
Line: 19002

      SELECT fma_id
      FROM   okl_tax_basis_override
      WHERE  try_id = cp_try_id
      AND    org_id = MO_GLOBAL.get_current_org_id;
Line: 19009

      SELECT name
      FROM   okl_formulae_b
      WHERE  id = cp_fma_id;
Line: 19015

          SELECT hdr.id hdr_id, line.khr_id, hdr.date_invoiced, hdr.try_id try_id,
             hdr.qte_id, hdr.legal_entity_id, line.id line_id, line.kle_id,
             line.sty_id, line.amount, hdr.ipvs_id
      FROM   okl_trx_ap_invoices_b hdr, okl_txl_ap_inv_lns_b line
      WHERE  line.id = cp_line_id
      AND    line.tap_id = hdr.id;
Line: 19023

      SELECT vendor_id
      FROM   po_vendor_sites
      WHERE  vendor_site_id = cp_vendor_site_id;
Line: 20619

    SELECT classification_name
    FROM zx_fc_intended_use_v
    WHERE classification_code = p_intend_use_code;
Line: 20737

    SELECT id, org_id, application_id, entity_code, event_class_code
    FROM okl_tax_sources
    WHERE trx_id = cp_trx_id
    AND application_id = G_OKL_APPLICATION_ID
    AND TAX_CALL_TYPE_CODE = G_UPFRONT_TAX
    AND TAX_LINE_STATUS_CODE = G_ACTIVE_STATUS;
Line: 20745

    SELECT id, org_id, entity_code, event_class_code
    FROM okl_tax_sources
    WHERE trx_id = cp_trx_id
    AND TAX_CALL_TYPE_CODE = G_UPFRONT_TAX
    AND TAX_LINE_STATUS_CODE = G_ACTIVE_STATUS;
Line: 20752

    SELECT '1'
    FROM   okl_trx_contracts a , okl_trx_types_tl b
    WHERE  a.id = cp_trx_id
    AND    a.try_id = b.id
    AND    b.name = cp_trx_type_name
    AND    language = 'US';
Line: 20760

    SELECT '1'
    FROM   okl_trx_contracts_all a , okl_trx_types_tl b
    WHERE  a.id = cp_trx_id
    AND    a.try_id = b.id
    AND    b.name = cp_trx_type_name
    AND    language = 'US';
Line: 20846

          UPDATE okl_tax_sources SET tax_line_status_code = G_CANCELLED_STATUS
          WHERE id = l_taxsources_prbk_rec.id;
Line: 20871

      IF (i > 1 AND p_source_trx_name = 'Rebook') THEN -- Update Tax Sources

        IF (G_DEBUG_LEVEL_STATEMENT >= G_DEBUG_CURRENT_RUNTIME_LEVEL) THEN
          FND_LOG.STRING(G_DEBUG_LEVEL_STATEMENT,'OKL_PROCESS_SALES_TAX_PVT.cancel_document_tax.',
               'Calling OKL_TAX_SOURCES_PUB.update_tax_sources ');
Line: 20878

        OKL_TAX_SOURCES_PUB.update_tax_sources(p_api_version     => p_api_version
                                              ,p_init_msg_list   => p_init_msg_list
                                              ,x_return_status   => l_return_status
                                              ,x_msg_count       => x_msg_count
                                              ,x_msg_data        => x_msg_data
                                              ,p_txsv_tbl        => l_txsv_tbl
                                              ,x_txsv_tbl        => lx_txsv_tbl);
Line: 20910

        OKL_TAX_INTERFACE_PVT.update_document(p_api_version     => p_api_version,
                                              p_init_msg_list   => p_init_msg_list,
                                              x_return_status   => l_return_status,
                                              x_msg_count       => x_msg_count,
                                              x_msg_data        => x_msg_data,
                                              p_transaction_rec => l_transaction_rec);
Line: 20928

      END IF; -- Update Tax Sources