The following lines contain the word 'select', 'insert', 'update' or 'delete':
| PUBLIC PROCEDURE delete_quote_tax_fee
|
| DESCRIPTION
| This procedure deletes the fee created as part of tax creation,
| if the upfront tax treatment is modified from 'CAPITALIZED'/'FINANCED' to
\ 'BILLED'.
|
| CALLED FROM Sales component
|
|
| CALLS PROCEDURES/FUNCTIONS
|
|
| PARAMETERS
| p_quote_id -- Quote Identifier
|
| KNOWN ISSUES
|
| NOTES
|
|
| MODIFICATION HISTORY
| Date Author Description of Changes
| 03-OCT-07 RRAVIKIR Created
|
*=======================================================================*/
PROCEDURE delete_quote_tax_fee(p_api_version IN NUMBER,
p_init_msg_list IN VARCHAR2,
x_return_status OUT NOCOPY VARCHAR2,
x_msg_count OUT NOCOPY NUMBER,
x_msg_data OUT NOCOPY VARCHAR2,
p_quote_id IN NUMBER) IS
l_program_name CONSTANT VARCHAR2(30) := 'delete_quote_tax_fee';
SELECT upfront_tax_treatment
FROM okl_lease_quotes_b
WHERE id = cp_quote_id;
SELECT id
FROM okl_fees_b
WHERE parent_object_id = cp_quote_id
AND parent_object_code = 'LEASEQUOTE'
AND fee_purpose_code = 'SALESTAX';
IF (l_fee_id IS NOT NULL) THEN -- Tax fee exist, delete it
OKL_LEASE_QUOTE_FEE_PVT.delete_fee ( p_api_version => p_api_version
,p_init_msg_list => p_init_msg_list
,p_transaction_control => 'T'
,p_fee_id => l_fee_id
,x_return_status => l_return_status
,x_msg_count => x_msg_count
,x_msg_data => x_msg_data );
END delete_quote_tax_fee;
SELECT NVL(tax_upfront_yn,'N')
FROM OKL_SYSTEM_PARAMS;
select pricing_method
into lv_source_pricing_type
from okl_lease_quotes_b
where id = p_source_quote_id;
select product_id, expected_start_date
into ln_source_pdt_id, ld_source_exp_date
from okl_lease_quotes_b
where id = p_source_quote_id;
SELECT cf.id caf_id
FROM OKL_CASH_FLOWS cf,
OKL_CASH_FLOW_OBJECTS cfo
WHERE cf.cfo_id = cfo.id
AND cfo.source_table = 'OKL_LEASE_QUOTES_B'
AND cfo.source_id = p_quote_id;
SELECT fqy_code, number_of_periods,
stub_days, start_date
FROM OKL_CASH_FLOW_LEVELS
WHERE caf_id = p_caf_id
ORDER BY start_date;
SELECT '1'
FROM okl_lease_quotes_b
WHERE reference_number = p_lease_qte_rec.reference_number
AND id <> NVL(p_lease_qte_rec.id, -9999);
SELECT TRUNC(valid_from)
FROM okl_lease_opportunities_b
WHERE id = p_lease_qte_rec.parent_object_id;
SELECT TRUNC(valid_from)
FROM okl_lease_applications_b
WHERE id = p_lease_qte_rec.parent_object_id;
SELECT
structured_pricing
,line_level_pricing
,lease_rate_factor
,target_rate_type
,target_rate
,target_amount
,target_frequency
,target_arrears_yn
,target_periods
,rate_card_id
,rate_template_id
,lease_rate_factor
INTO
x_quote_rec.structured_pricing
,x_quote_rec.line_level_pricing
,x_quote_rec.lease_rate_factor
,x_quote_rec.target_rate_type
,x_quote_rec.target_rate
,x_quote_rec.target_amount
,x_quote_rec.target_frequency
,x_quote_rec.target_arrears_yn
,x_quote_rec.target_periods
,x_quote_rec.rate_card_id
,x_quote_rec.rate_template_id
,x_quote_rec.lease_rate_factor
FROM okl_lease_quotes_v
WHERE id = p_source_quote_id;
SELECT
iir,
booking_yield,
pirr,
airr,
sub_iir,
sub_booking_yield,
sub_pirr,
sub_airr
INTO
x_quote_rec.iir
,x_quote_rec.booking_yield
,x_quote_rec.pirr
,x_quote_rec.airr
,x_quote_rec.sub_iir
,x_quote_rec.sub_booking_yield
,x_quote_rec.sub_pirr
,x_quote_rec.sub_airr
FROM okl_lease_quotes_v
WHERE id = p_source_quote_id;
SELECT
attribute_category
,attribute1
,attribute2
,attribute3
,attribute4
,attribute5
,attribute6
,attribute7
,attribute8
,attribute9
,attribute10
,attribute11
,attribute12
,attribute13
,attribute14
,attribute15
,reference_number
,object_version_number
,parent_object_id
,parent_object_code
,valid_from
,valid_to
,customer_bookclass
,customer_taxowner
,expected_start_date
,expected_funding_date
,expected_delivery_date
,pricing_method
,term
,product_id
,end_of_term_option_id
,usage_category
,usage_industry_class
,usage_industry_code
,usage_amount
,usage_location_id
,property_tax_applicable
,property_tax_billing_type
,upfront_tax_treatment
,upfront_tax_stream_type
,transfer_of_title
,age_of_equipment
,purchase_of_lease
,sale_and_lease_back
,interest_disclosed
,target_rate_type
,target_rate
,target_amount
,target_frequency
,target_arrears_yn
,target_periods
,structured_pricing
,line_level_pricing
,lease_rate_factor
,rate_card_id
,rate_template_id
,iir
,booking_yield
,pirr
,airr
,sub_iir
,sub_booking_yield
,sub_pirr
,sub_airr
,primary_quote
,legal_entity_id
,short_description
,description
,comments
INTO
x_quote_rec.attribute_category
,x_quote_rec.attribute1
,x_quote_rec.attribute2
,x_quote_rec.attribute3
,x_quote_rec.attribute4
,x_quote_rec.attribute5
,x_quote_rec.attribute6
,x_quote_rec.attribute7
,x_quote_rec.attribute8
,x_quote_rec.attribute9
,x_quote_rec.attribute10
,x_quote_rec.attribute11
,x_quote_rec.attribute12
,x_quote_rec.attribute13
,x_quote_rec.attribute14
,x_quote_rec.attribute15
,x_quote_rec.reference_number
,x_quote_rec.object_version_number
,x_quote_rec.parent_object_id
,x_quote_rec.parent_object_code
,x_quote_rec.valid_from
,x_quote_rec.valid_to
,x_quote_rec.customer_bookclass
,x_quote_rec.customer_taxowner
,x_quote_rec.expected_start_date
,x_quote_rec.expected_funding_date
,x_quote_rec.expected_delivery_date
,x_quote_rec.pricing_method
,x_quote_rec.term
,x_quote_rec.product_id
,x_quote_rec.end_of_term_option_id
,x_quote_rec.usage_category
,x_quote_rec.usage_industry_class
,x_quote_rec.usage_industry_code
,x_quote_rec.usage_amount
,x_quote_rec.usage_location_id
,x_quote_rec.property_tax_applicable
,x_quote_rec.property_tax_billing_type
,x_quote_rec.upfront_tax_treatment
,x_quote_rec.upfront_tax_stream_type
,x_quote_rec.transfer_of_title
,x_quote_rec.age_of_equipment
,x_quote_rec.purchase_of_lease
,x_quote_rec.sale_and_lease_back
,x_quote_rec.interest_disclosed
,x_quote_rec.target_rate_type
,x_quote_rec.target_rate
,x_quote_rec.target_amount
,x_quote_rec.target_frequency
,x_quote_rec.target_arrears_yn
,x_quote_rec.target_periods
,x_quote_rec.structured_pricing
,x_quote_rec.line_level_pricing
,x_quote_rec.lease_rate_factor
,x_quote_rec.rate_card_id
,x_quote_rec.rate_template_id
,x_quote_rec.iir
,x_quote_rec.booking_yield
,x_quote_rec.pirr
,x_quote_rec.airr
,x_quote_rec.sub_iir
,x_quote_rec.sub_booking_yield
,x_quote_rec.sub_pirr
,x_quote_rec.sub_airr
,x_quote_rec.primary_quote
,x_quote_rec.legal_entity_id
,x_quote_rec.short_description
,x_quote_rec.description
,x_quote_rec.comments
FROM okl_lease_quotes_v
WHERE id = p_quote_id;
SELECT id
FROM OKL_ASSETS_B
WHERE PARENT_OBJECT_ID = p_quote_id
AND PARENT_OBJECT_CODE = 'LEASEQUOTE';
SELECT id
FROM OKL_FEES_B
WHERE PARENT_OBJECT_ID = p_quote_id
AND PARENT_OBJECT_CODE = 'LEASEQUOTE';
SELECT id
FROM OKL_SERVICES_B
WHERE PARENT_OBJECT_ID = p_quote_id
AND PARENT_OBJECT_CODE = 'LEASEQUOTE';
SELECT id
FROM OKL_INSURANCE_ESTIMATES_B
WHERE LEASE_QUOTE_ID = p_quote_id;
OKL_LEASE_QUOTE_ASSET_PVT.delete_asset (
p_api_version => p_api_version
,p_init_msg_list => 'T'
,p_transaction_control => 'T'
,p_asset_id => l_get_assets.id
,x_return_status => x_return_status
,x_msg_count => x_msg_count
,x_msg_data => x_msg_data );
OKL_LEASE_QUOTE_FEE_PVT.delete_fee (
p_api_version => p_api_version
,p_init_msg_list => 'T'
,p_transaction_control => 'T'
,p_fee_id => l_get_fees.id
,x_return_status => x_return_status
,x_msg_count => x_msg_count
,x_msg_data => x_msg_data );
OKL_LEASE_QUOTE_SERVICE_PVT.delete_service (
p_api_version => p_api_version
,p_init_msg_list => 'T'
,p_transaction_control => 'T'
,p_service_id => l_get_services.id
,x_return_status => x_return_status
,x_msg_count => x_msg_count
,x_msg_data => x_msg_data );
OKL_LEASE_QUOTE_INS_PVT.delete_insurance_estimate (
p_api_version => p_api_version
,p_init_msg_list => 'T'
,p_transaction_control => 'T'
,p_insurance_estimate_id => l_get_ins_estimates.id
,x_return_status => x_return_status
,x_msg_count => x_msg_count
,x_msg_data => x_msg_data );
okl_lsq_pvt.insert_row(
p_api_version => G_API_VERSION
,p_init_msg_list => G_FALSE
,x_return_status => l_return_status
,x_msg_count => x_msg_count
,x_msg_data => x_msg_data
,p_lsqv_rec => l_lease_qte_rec
,x_lsqv_rec => x_lease_qte_rec );
PROCEDURE update_lease_qte (p_api_version IN NUMBER,
p_init_msg_list IN VARCHAR2,
p_transaction_control IN VARCHAR2,
p_lease_qte_rec IN lease_qte_rec_type,
x_lease_qte_rec OUT NOCOPY lease_qte_rec_type,
x_return_status OUT NOCOPY VARCHAR2,
x_msg_count OUT NOCOPY NUMBER,
x_msg_data OUT NOCOPY VARCHAR2) IS
l_return_status VARCHAR2(1);
l_program_name CONSTANT VARCHAR2(30) := 'update_lease_qte';
SELECT 'Y'
FROM okl_lease_quotes_b
WHERE status = 'CR-DECLINED'
AND parent_object_code = 'LEASEAPP'
AND PARENT_OBJECT_ID = p_lap_id;
SELECT APPLICATION_STATUS LAP_STATUS
FROM OKL_LEASE_APPLICATIONS_B
WHERE ID = cp_lap_id;
SELECT object_version_number, parent_object_code, status, parent_object_id
, nvl(primary_quote, 'N') -- -- 7033915
INTO l_lease_qte_rec.object_version_number,
l_lease_qte_rec.parent_object_code,
lv_status,
ln_parent_object_id
,l_primary_quote -- 7033915
FROM okl_lease_quotes_v
WHERE id = l_lease_qte_rec.id;
okl_lsq_pvt.update_row(p_api_version => G_API_VERSION
,p_init_msg_list => G_FALSE
,x_return_status => l_return_status
,x_msg_count => x_msg_count
,x_msg_data => x_msg_data
,p_lsqv_rec => l_lease_qte_rec
,x_lsqv_rec => x_lease_qte_rec );
SELECT application_status
INTO lv_leaseapp_status
FROM okl_lease_applications_b
where id = ln_parent_object_id;
,p_transaction_reason => 'UPDATE_APPROVED_QUOTE'
,x_return_status => l_return_status
,x_msg_count => x_msg_count
,x_msg_data => x_msg_data);
,p_transaction_reason => 'UPDATE_LEASE_APP'
,p_quote_id => l_lease_qte_rec.id
,x_return_status => l_return_status
,x_msg_count => x_msg_count
,x_msg_data => x_msg_data);
delete_quote_tax_fee( p_api_version => p_api_version
,p_init_msg_list => G_TRUE
,x_return_status => l_return_status
,x_msg_count => x_msg_count
,x_msg_data => x_msg_data
,p_quote_id => l_lease_qte_rec.id);
END update_lease_qte;
SELECT
id
,attribute_category
,attribute1
,attribute2
,attribute3
,attribute4
,attribute5
,attribute6
,attribute7
,attribute8
,attribute9
,attribute10
,attribute11
,attribute12
,attribute13
,attribute14
,attribute15
,object_version_number
,reference_number
,valid_from
,expected_start_date
,org_id
,inv_org_id
,prospect_id
,prospect_address_id
,cust_acct_id
,currency_code
,currency_conversion_type
,currency_conversion_rate
,currency_conversion_date
,program_agreement_id
,master_lease_id
,sales_rep_id
,sales_territory_id
,supplier_id
,delivery_date
,funding_date
,property_tax_applicable
,property_tax_billing_type
,upfront_tax_treatment
,install_site_id
,usage_category
,usage_industry_class
,usage_industry_code
,usage_amount
,usage_location_id
,originating_vendor_id
,short_description
,description
,comments
INTO
x_leaseopp_rec.id
,x_leaseopp_rec.attribute_category
,x_leaseopp_rec.attribute1
,x_leaseopp_rec.attribute2
,x_leaseopp_rec.attribute3
,x_leaseopp_rec.attribute4
,x_leaseopp_rec.attribute5
,x_leaseopp_rec.attribute6
,x_leaseopp_rec.attribute7
,x_leaseopp_rec.attribute8
,x_leaseopp_rec.attribute9
,x_leaseopp_rec.attribute10
,x_leaseopp_rec.attribute11
,x_leaseopp_rec.attribute12
,x_leaseopp_rec.attribute13
,x_leaseopp_rec.attribute14
,x_leaseopp_rec.attribute15
,x_leaseopp_rec.object_version_number
,x_leaseopp_rec.reference_number
,x_leaseopp_rec.valid_from
,x_leaseopp_rec.expected_start_date
,x_leaseopp_rec.org_id
,x_leaseopp_rec.inv_org_id
,x_leaseopp_rec.prospect_id
,x_leaseopp_rec.prospect_address_id
,x_leaseopp_rec.cust_acct_id
,x_leaseopp_rec.currency_code
,x_leaseopp_rec.currency_conversion_type
,x_leaseopp_rec.currency_conversion_rate
,x_leaseopp_rec.currency_conversion_date
,x_leaseopp_rec.program_agreement_id
,x_leaseopp_rec.master_lease_id
,x_leaseopp_rec.sales_rep_id
,x_leaseopp_rec.sales_territory_id
,x_leaseopp_rec.supplier_id
,x_leaseopp_rec.delivery_date
,x_leaseopp_rec.funding_date
,x_leaseopp_rec.property_tax_applicable
,x_leaseopp_rec.property_tax_billing_type
,x_leaseopp_rec.upfront_tax_treatment
,x_leaseopp_rec.install_site_id
,x_leaseopp_rec.usage_category
,x_leaseopp_rec.usage_industry_class
,x_leaseopp_rec.usage_industry_code
,x_leaseopp_rec.usage_amount
,x_leaseopp_rec.usage_location_id
,x_leaseopp_rec.originating_vendor_id
,x_leaseopp_rec.short_description
,x_leaseopp_rec.description
,x_leaseopp_rec.comments
FROM okl_lease_opportunities_v
WHERE id = p_leaseopp_id;
SELECT 'Y'
FROM OKL_CASH_FLOW_OBJECTS
WHERE SOURCE_ID = p_source_quote_id
AND SOURCE_TABLE = 'OKL_LEASE_QUOTES_B'
AND OTY_CODE = 'LEASE_QUOTE';
SELECT 'Y'
FROM OKL_CASH_FLOW_OBJECTS
WHERE SOURCE_ID = p_source_quote_id
AND SOURCE_TABLE = 'OKL_LEASE_QUOTES_B'
AND OTY_CODE = 'LEASE_QUOTE_CONSOLIDATED';
SELECT id
FROM OKL_ASSETS_B
WHERE PARENT_OBJECT_ID = p_source_quote_id
AND PARENT_OBJECT_CODE = 'LEASEQUOTE';
SELECT id
FROM OKL_FEES_B
WHERE PARENT_OBJECT_ID = p_source_quote_id
AND PARENT_OBJECT_CODE = 'LEASEQUOTE'
AND FEE_TYPE IN ('FINANCED', 'CAPITALIZED', 'ROLLOVER');
SELECT id
FROM OKL_SERVICES_B
WHERE PARENT_OBJECT_ID = p_source_quote_id
AND PARENT_OBJECT_CODE = 'LEASEQUOTE';
SELECT id
FROM OKL_FEES_B
WHERE PARENT_OBJECT_ID = p_source_quote_id
AND PARENT_OBJECT_CODE = 'LEASEQUOTE'
AND FEE_TYPE NOT IN ('FINANCED', 'CAPITALIZED', 'ROLLOVER');
SELECT id
FROM OKL_INSURANCE_ESTIMATES_B
WHERE lease_quote_id = p_source_quote_id ;
SELECT end_of_term_option_id
INTO ln_src_eot_id
FROM
okl_lease_quotes_b
WHERE
id = p_source_quote_id;
SELECT end_of_term_option_id
INTO ln_tgt_eot_id
FROM
okl_lease_quotes_b
WHERE
id = p_target_quote_id;
delete_quote_tax_fee( 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_quote_id => p_target_quote_id);
DELETE FROM okl_assets_tl WHERE id IN
(SELECT id FROM okl_assets_b WHERE parent_object_code = 'LEASEQUOTE' AND parent_object_id = p_lease_qte_rec.id);
DELETE FROM okl_assets_b WHERE parent_object_code = 'LEASEQUOTE' AND parent_object_id = p_lease_qte_rec.id;
DELETE FROM okl_fees_tl WHERE id IN
(SELECT id FROM okl_fees_b WHERE parent_object_code = 'LEASEQUOTE' AND parent_object_id = p_lease_qte_rec.id);
DELETE FROM okl_fees_b WHERE parent_object_code = 'LEASEQUOTE' AND parent_object_id = p_lease_qte_rec.id;
DELETE FROM okl_services_tl WHERE id IN
(SELECT id FROM okl_services_b WHERE parent_object_code = 'LEASEQUOTE' AND parent_object_id = p_lease_qte_rec.id);
DELETE FROM okl_services_b WHERE parent_object_code = 'LEASEQUOTE' AND parent_object_id = p_lease_qte_rec.id;
DELETE FROM okl_insurance_estimates_tl WHERE id IN
(SELECT id FROM okl_insurance_estimates_b WHERE lease_quote_id = p_lease_qte_rec.id);
DELETE FROM okl_insurance_estimates_b WHERE lease_quote_id = p_lease_qte_rec.id;
okl_lsq_pvt.delete_row(p_api_version => G_API_VERSION
,p_init_msg_list => G_FALSE
,x_return_status => l_return_status
,x_msg_count => x_msg_count
,x_msg_data => x_msg_data
,p_lsqv_rec => p_lease_qte_tbl(i));
SELECT NVL(tax_upfront_yn,'N')
FROM OKL_SYSTEM_PARAMS;
SELECT 'X'
FROM OKL_TAX_SOURCES
WHERE tax_call_type_code = 'UPFRONT_TAX'
AND ENTITY_CODE ='SALES_QUOTES'
AND trx_id = p_quote_id;
SELECT 'Y'
FROM okl_lease_quotes_b
WHERE parent_object_code = 'LEASEOPP'
AND parent_object_id = p_leaseopp_id
AND status = 'CT-ACCEPTED';
okl_lop_pvt.update_row(
p_api_version => G_API_VERSION
,p_init_msg_list => G_FALSE
,x_return_status => x_return_status
,x_msg_count => x_msg_count
,x_msg_data => x_msg_data
,p_lopv_rec => l_lease_opp_rec
,x_lopv_rec => x_lease_opp_rec );
SELECT id
FROM OKL_LEASE_QUOTES_B
WHERE PARENT_OBJECT_ID = p_source_leaseopp_id
AND PARENT_OBJECT_CODE = 'LEASEOPP';
SELECT object_version_number
FROM okl_lease_quotes_b
WHERE id = p_quote_id;
okl_lsq_pvt.update_row(p_api_version => G_API_VERSION
,p_init_msg_list => G_FALSE
,x_return_status => lx_return_status
,x_msg_count => lx_msg_count
,x_msg_data => lx_msg_data
,p_lsqv_rec => l_lease_qte_rec
,x_lsqv_rec => x_lease_qte_rec );
SELECT 'Y'
FROM okl_lease_quotes_b
WHERE parent_object_code = 'LEASEOPP'
AND parent_object_id = p_leaseopp_id
AND status = 'CT-ACCEPTED';
okl_lop_pvt.update_row(
p_api_version => G_API_VERSION
,p_init_msg_list => G_FALSE
,x_return_status => x_return_status
,x_msg_count => x_msg_count
,x_msg_data => x_msg_data
,p_lopv_rec => l_lease_opp_rec
,x_lopv_rec => x_lease_opp_rec );
SELECT
id
,attribute_category
,attribute1
,attribute2
,attribute3
,attribute4
,attribute5
,attribute6
,attribute7
,attribute8
,attribute9
,attribute10
,attribute11
,attribute12
,attribute13
,attribute14
,attribute15
,object_version_number
,asset_number
,parent_object_id
,parent_object_code
,install_site_id
,rate_card_id
,rate_template_id
,oec
,end_of_term_value_default
,end_of_term_value
,oec_percentage
,structured_pricing
,target_arrears
,lease_rate_factor
,target_amount
,target_frequency
,short_description
,description
,comments
INTO
x_asset_rec.id
,x_asset_rec.attribute_category
,x_asset_rec.attribute1
,x_asset_rec.attribute2
,x_asset_rec.attribute3
,x_asset_rec.attribute4
,x_asset_rec.attribute5
,x_asset_rec.attribute6
,x_asset_rec.attribute7
,x_asset_rec.attribute8
,x_asset_rec.attribute9
,x_asset_rec.attribute10
,x_asset_rec.attribute11
,x_asset_rec.attribute12
,x_asset_rec.attribute13
,x_asset_rec.attribute14
,x_asset_rec.attribute15
,x_asset_rec.object_version_number
,x_asset_rec.asset_number
,x_asset_rec.parent_object_id
,x_asset_rec.parent_object_code
,x_asset_rec.install_site_id
,x_asset_rec.rate_card_id
,x_asset_rec.rate_template_id
,x_asset_rec.oec
,x_asset_rec.end_of_term_value_default
,x_asset_rec.end_of_term_value
,x_asset_rec.oec_percentage
,x_asset_rec.structured_pricing
,x_asset_rec.target_arrears
,x_asset_rec.lease_rate_factor
,x_asset_rec.target_amount
,x_asset_rec.target_frequency
,x_asset_rec.short_description
,x_asset_rec.description
,x_asset_rec.comments
FROM okl_assets_v
WHERE id = p_asset_id;
PROCEDURE update_cash_flows(p_quote_id NUMBER
,p_source_object_code IN VARCHAR2
,p_source_object_id IN NUMBER
,x_return_status OUT NOCOPY VARCHAR2
,x_msg_count OUT NOCOPY NUMBER
,x_msg_data OUT NOCOPY VARCHAR2) IS
CURSOR c_get_cashflow_info(p_src_id OKL_CASH_FLOW_OBJECTS.SOURCE_ID%TYPE
,p_oty_code OKL_CASH_FLOW_OBJECTS.OTY_CODE%TYPE
,p_source_table OKL_CASH_FLOW_OBJECTS.SOURCE_TABLE%TYPE)
IS
SELECT CFLOW.ID , CFLOW.OBJECT_VERSION_NUMBER
FROM OKL_CASH_FLOWS CFLOW, OKL_CASH_FLOW_OBJECTS CFO
WHERE CFO.SOURCE_ID = p_src_id
AND CFO.OTY_CODE = p_oty_code
AND CFO.SOURCE_TABLE=p_source_table
AND CFLOW.CFO_ID = CFO.ID;
OKL_CAF_PVT.update_row(p_api_version => l_api_version
,p_init_msg_list => G_FALSE
,p_cafv_tbl => lp_cafv_tbl
,x_cafv_tbl => lx_cafv_tbl
,px_error_tbl => lx_error_tbl
,x_return_status => x_return_status
,x_msg_count => x_msg_count
,x_msg_data => x_msg_data);
END update_cash_flows;
SELECT COUNT(*)
FROM OKL_ASSETS_B
where parent_object_code = 'LEASEQUOTE'
AND parent_object_id = lp_quote_id;
select OAB.id
FROM OKL_LEASE_QUOTES_B OLQ,OKL_ASSETS_B OAB
where OAB.PARENT_OBJECT_ID = OLQ.ID
AND OAB.PARENT_OBJECT_CODE='LEASEQUOTE'
AND OLQ.ID= p_parent_object_id;
OKL_LEASE_QUOTE_CASHFLOW_PVT.delete_cashflows (p_api_version => G_API_VERSION
,p_init_msg_list => G_FALSE
,p_transaction_control => G_FALSE
,p_source_object_code => 'LEASE_QUOTE_CONSOLIDATED'
,p_source_object_id => p_quote_id
,x_return_status => x_return_status
,x_msg_count => x_msg_count
,x_msg_data => x_msg_data);
OKL_LEASE_QUOTE_CASHFLOW_PVT.delete_cashflows (
p_api_version => G_API_VERSION
,p_init_msg_list => G_FALSE
,p_transaction_control => G_TRUE --Check this
,p_source_object_code => 'LEASE_QUOTE'
,p_source_object_id => p_quote_id
,x_return_status => x_return_status
,x_msg_count => x_msg_count
,x_msg_data => x_msg_data);
update_cash_flows(p_quote_id => p_quote_id
,p_source_object_code => 'QUOTED_ASSET'
,p_source_object_id => lp_asset_tbl(i).id
,x_return_status => x_return_status
,x_msg_count => x_msg_count
,x_msg_data => x_msg_data);
okl_ass_pvt.update_row (p_api_version => G_API_VERSION
,p_init_msg_list => G_FALSE
,x_return_status => x_return_status
,x_msg_count => x_msg_count
,x_msg_data => x_msg_data
,p_assv_rec => lp_asset_tbl(i)
,x_assv_rec => lx_asset_rec);
update_cash_flows(p_quote_id => p_quote_id
,p_source_object_code => 'LEASE_QUOTE'
,p_source_object_id => lp_lease_qte_rec.id
,x_return_status => x_return_status
,x_msg_count => x_msg_count
,x_msg_data => x_msg_data);
OKL_LEASE_QUOTE_CASHFLOW_PVT.delete_cashflows (
p_api_version => G_API_VERSION
,p_init_msg_list => G_FALSE
,p_transaction_control => G_FALSE --Check this
,p_source_object_code => 'QUOTED_ASSET'
,p_source_object_id => lp_asset_tbl(i).id
,x_return_status => x_return_status
,x_msg_count => x_msg_count
,x_msg_data => x_msg_data);
okl_ass_pvt.update_row (p_api_version => G_API_VERSION
,p_init_msg_list => G_FALSE
,x_return_status => x_return_status
,x_msg_count => x_msg_count
,x_msg_data => x_msg_data
,p_assv_rec => lp_asset_tbl(i)
,x_assv_rec => lx_asset_rec);
okl_lsq_pvt.update_row(p_api_version => G_API_VERSION
,p_init_msg_list => G_FALSE
,x_return_status => x_return_status
,x_msg_count => x_msg_count
,x_msg_data => x_msg_data
,p_lsqv_rec => lp_lease_qte_rec
,x_lsqv_rec => lx_lease_qte_rec );
SELECT SUM(total_tax)
FROM okl_tax_sources
WHERE trx_id = cp_quote_id
AND asset_number IS NOT NULL
AND entity_code = OKL_PROCESS_SALES_TAX_PVT.G_SQ_ENTITY_CODE
AND event_class_code = OKL_PROCESS_SALES_TAX_PVT.G_SQ_EVENT_CLASS_CODE
AND application_id = OKL_PROCESS_SALES_TAX_PVT.G_OKL_APPLICATION_ID
AND trx_level_type = OKL_PROCESS_SALES_TAX_PVT.G_TRX_LEVEL_TYPE;
SELECT upfront_tax_treatment, upfront_tax_stream_type,
pricing_method, parent_object_code, parent_object_id
FROM okl_lease_quotes_b
WHERE id = cp_quote_id;
SELECT id, asset_number
FROM okl_assets_b
WHERE parent_object_id = cp_quote_id
AND parent_object_code = 'LEASEQUOTE';
SELECT total_tax
FROM okl_tax_sources
WHERE trx_id = cp_quote_id
AND asset_number = cp_asset_number
AND entity_code = OKL_PROCESS_SALES_TAX_PVT.G_SQ_ENTITY_CODE
AND event_class_code = OKL_PROCESS_SALES_TAX_PVT.G_SQ_EVENT_CLASS_CODE
AND application_id = OKL_PROCESS_SALES_TAX_PVT.G_OKL_APPLICATION_ID
AND trx_level_type = OKL_PROCESS_SALES_TAX_PVT.G_TRX_LEVEL_TYPE;
SELECT '1'
FROM okl_fees_b
WHERE parent_object_id = cp_quote_id
AND parent_object_code = 'LEASEQUOTE'
AND fee_purpose_code = 'SALESTAX';
SELECT id, object_version_number
, effective_from, supplier_id --sechawla 5-aug-2010 9962315 : added
FROM okl_fees_b
WHERE parent_object_id = cp_quote_id
AND parent_object_code = 'LEASEQUOTE'
AND fee_purpose_code = 'SALESTAX';
SELECT lre.id, lre.object_version_number, asset.asset_number,
lre.source_line_id, lre.related_line_id
FROM okl_line_relationships_b lre, okl_fees_b fee, okl_assets_b asset
WHERE fee.parent_object_id = cp_quote_id
AND fee.parent_object_code = 'LEASEQUOTE'
AND fee.fee_purpose_code = 'SALESTAX'
AND lre.related_line_id = fee.id
AND lre.related_line_type = fee.fee_type
AND lre.source_line_type = 'ASSET'
AND lre.source_line_id = asset.id
AND asset.parent_object_id = fee.parent_object_id
AND asset.parent_object_code = fee.parent_object_code;
ELSE -- Tax fee exists .. update it
OPEN l_fee_details(p_quote_id);
l_line_relation_tbl(i).record_mode := 'UPDATE';
OKL_LEASE_QUOTE_FEE_PVT.update_fee ( p_api_version => p_api_version
,p_init_msg_list => p_init_msg_list
,p_transaction_control => p_transaction_control
,p_fee_rec => l_qte_fee_rec
,p_assoc_asset_tbl => l_line_relation_tbl
,p_payment_header_rec => l_payment_header_rec
,p_payment_level_tbl => l_payment_level_tbl
,p_expense_header_rec => l_expense_header_rec
,p_expense_level_tbl => l_expense_level_tbl
,x_return_status => x_return_status
,x_msg_count => x_msg_count
,x_msg_data => x_msg_data );