DBA Data[Home] [Help]

APPS.OKL_AM_UTIL_PVT dependencies on DUAL

Line 4115: -- Function Name : get_actual_asset_residual

4111: END get_all_term_qte_for_contract;
4112:
4113: -- Start of comments
4114: --
4115: -- Function Name : get_actual_asset_residual
4116: -- Description : Get actual residual value for an asset
4117: -- Business Rules : Should be called with only terminated line
4118: -- Should be for OP/DF/SALES type Lease contract only -- which has FA values
4119: -- Parameters : p_khr_id -- Contract id

Line 4116: -- Description : Get actual residual value for an asset

4112:
4113: -- Start of comments
4114: --
4115: -- Function Name : get_actual_asset_residual
4116: -- Description : Get actual residual value for an asset
4117: -- Business Rules : Should be called with only terminated line
4118: -- Should be for OP/DF/SALES type Lease contract only -- which has FA values
4119: -- Parameters : p_khr_id -- Contract id
4120: -- p_kle_id -- Line Id

Line 4124: -- rmunjulu 4399736 For LOANS residual is the net investment calculated on quote

4120: -- p_kle_id -- Line Id
4121: -- History : RMUNJULU 18-MAY-04 3510740 Created
4122: -- rmunjulu 3816891 FORWARDPORT changed logic when termination with purchase
4123: -- rmunjulu 3816891 call formula ASSET_DF_TERMINATION_NIV for DF/ST term with/without purchase
4124: -- rmunjulu 4399736 For LOANS residual is the net investment calculated on quote
4125: -- nikshah -- Bug # 5484903 Fixed,
4126: -- Changed CURSOR get_acc_deprn1_csr (p_kle_id IN NUMBER) SQL definition
4127: -- akrangan -- changed tsu_code to tmt_status_code in get_quote_type_csr
4128: -- Version : 1.0

Line 4131: FUNCTION get_actual_asset_residual (

4127: -- akrangan -- changed tsu_code to tmt_status_code in get_quote_type_csr
4128: -- Version : 1.0
4129: --
4130: -- End of comments
4131: FUNCTION get_actual_asset_residual (
4132: p_khr_id IN NUMBER,
4133: p_kle_id IN NUMBER) RETURN NUMBER IS
4134:
4135: -- get asset termination date

Line 4245: -- get asset residual value (RMUNJULU)

4241: AND tal_type = 'AML'
4242: AND ROWNUM < 2;
4243:
4244: -- rmunjulu 3735773
4245: -- get asset residual value (RMUNJULU)
4246: CURSOR get_asset_residual_csr (p_kle_id IN NUMBER) IS
4247: SELECT nvl(residual_value,0) residual_value
4248: FROM okl_k_lines
4249: WHERE id = p_kle_id;

Line 4246: CURSOR get_asset_residual_csr (p_kle_id IN NUMBER) IS

4242: AND ROWNUM < 2;
4243:
4244: -- rmunjulu 3735773
4245: -- get asset residual value (RMUNJULU)
4246: CURSOR get_asset_residual_csr (p_kle_id IN NUMBER) IS
4247: SELECT nvl(residual_value,0) residual_value
4248: FROM okl_k_lines
4249: WHERE id = p_kle_id;
4250:

Line 4247: SELECT nvl(residual_value,0) residual_value

4243:
4244: -- rmunjulu 3735773
4245: -- get asset residual value (RMUNJULU)
4246: CURSOR get_asset_residual_csr (p_kle_id IN NUMBER) IS
4247: SELECT nvl(residual_value,0) residual_value
4248: FROM okl_k_lines
4249: WHERE id = p_kle_id;
4250:
4251: -- rmunjulu 3735773

Line 4266: l_asset_residual NUMBER;

4262:
4263: l_date_terminated DATE;
4264: l_quote_id NUMBER;
4265: l_quote_type OKL_TRX_QUOTES_B.qtp_code%TYPE;
4266: l_asset_residual NUMBER;
4267: l_deprn_amt NUMBER;
4268: l_deal_type OKL_K_HEADERS.deal_type%TYPE;
4269: l_cost NUMBER;
4270: l_period_open VARCHAR2(1);

Line 4275: l_residual NUMBER;

4271:
4272: Expected_error EXCEPTION;
4273:
4274: -- rmunjulu 3735773
4275: l_residual NUMBER;
4276: l_corp_book_cost NUMBER;
4277:
4278: l_params okl_execute_formula_pub.ctxt_val_tbl_type;
4279: l_formula_name VARCHAR2(300);

Line 4304: l_asset_residual := 0;

4300: RAISE Expected_Error;
4301:
4302: END IF;
4303:
4304: l_asset_residual := 0;
4305: l_cost := 0;
4306: l_deprn_amt := 0;
4307:
4308: -- rmunjulu 3735773

Line 4309: l_residual := 0;

4305: l_cost := 0;
4306: l_deprn_amt := 0;
4307:
4308: -- rmunjulu 3735773
4309: l_residual := 0;
4310: l_corp_book_cost := 0;
4311:
4312: l_formula_name := 'ASSET_DF_TERMINATION_NIV';
4313:

Line 4340: -- If DF/ST Lease then the asset residual is residual value

4336: l_deal_type := get_khr_deal_rec.deal_type;
4337: END LOOP;
4338:
4339: -- rmunjulu 3735773
4340: -- If DF/ST Lease then the asset residual is residual value
4341: IF l_deal_type IN ('LEASEDF', 'LEASEST') THEN -- non OP lease
4342:
4343: /* -- rmunjulu This piece of logic now resides in seeded formula, so call formula to get value
4344: -- Same logic as used in Retirement to update corporate book cost

Line 4345: -- get the asset residual value

4341: IF l_deal_type IN ('LEASEDF', 'LEASEST') THEN -- non OP lease
4342:
4343: /* -- rmunjulu This piece of logic now resides in seeded formula, so call formula to get value
4344: -- Same logic as used in Retirement to update corporate book cost
4345: -- get the asset residual value
4346: FOR get_asset_residual_rec IN get_asset_residual_csr (p_kle_id) LOOP
4347: l_residual := get_asset_residual_rec.residual_value;
4348: END LOOP;
4349:

Line 4346: FOR get_asset_residual_rec IN get_asset_residual_csr (p_kle_id) LOOP

4342:
4343: /* -- rmunjulu This piece of logic now resides in seeded formula, so call formula to get value
4344: -- Same logic as used in Retirement to update corporate book cost
4345: -- get the asset residual value
4346: FOR get_asset_residual_rec IN get_asset_residual_csr (p_kle_id) LOOP
4347: l_residual := get_asset_residual_rec.residual_value;
4348: END LOOP;
4349:
4350: -- get the asset cost from corporate book -- will be 0 normally

Line 4347: l_residual := get_asset_residual_rec.residual_value;

4343: /* -- rmunjulu This piece of logic now resides in seeded formula, so call formula to get value
4344: -- Same logic as used in Retirement to update corporate book cost
4345: -- get the asset residual value
4346: FOR get_asset_residual_rec IN get_asset_residual_csr (p_kle_id) LOOP
4347: l_residual := get_asset_residual_rec.residual_value;
4348: END LOOP;
4349:
4350: -- get the asset cost from corporate book -- will be 0 normally
4351: FOR get_corp_book_cost_rec IN get_corp_book_cost_csr (p_kle_id) LOOP

Line 4355: -- asset residual will be same calculation used in asset disposal

4351: FOR get_corp_book_cost_rec IN get_corp_book_cost_csr (p_kle_id) LOOP
4352: l_corp_book_cost := get_corp_book_cost_rec.cost;
4353: END LOOP;
4354:
4355: -- asset residual will be same calculation used in asset disposal
4356: l_asset_residual := l_residual - l_corp_book_cost + l_corp_book_cost;
4357: */
4358:
4359: -- rmunjulu Call the seeded formula to get residual value

Line 4356: l_asset_residual := l_residual - l_corp_book_cost + l_corp_book_cost;

4352: l_corp_book_cost := get_corp_book_cost_rec.cost;
4353: END LOOP;
4354:
4355: -- asset residual will be same calculation used in asset disposal
4356: l_asset_residual := l_residual - l_corp_book_cost + l_corp_book_cost;
4357: */
4358:
4359: -- rmunjulu Call the seeded formula to get residual value
4360: l_params(1).name := 'QUOTE_ID';

Line 4359: -- rmunjulu Call the seeded formula to get residual value

4355: -- asset residual will be same calculation used in asset disposal
4356: l_asset_residual := l_residual - l_corp_book_cost + l_corp_book_cost;
4357: */
4358:
4359: -- rmunjulu Call the seeded formula to get residual value
4360: l_params(1).name := 'QUOTE_ID';
4361: l_params(1).value := l_quote_id;
4362:
4363: get_formula_value (

Line 4368: x_formula_value => l_asset_residual,

4364: p_formula_name => l_formula_name,
4365: p_chr_id => p_khr_id,
4366: p_cle_id => p_kle_id,
4367: p_additional_parameters => l_params,
4368: x_formula_value => l_asset_residual,
4369: x_return_status => l_return_status);
4370:
4371: IF l_asset_residual IS NULL THEN
4372:

Line 4371: IF l_asset_residual IS NULL THEN

4367: p_additional_parameters => l_params,
4368: x_formula_value => l_asset_residual,
4369: x_return_status => l_return_status);
4370:
4371: IF l_asset_residual IS NULL THEN
4372:
4373: l_asset_residual := 0;
4374: END IF;
4375:

Line 4373: l_asset_residual := 0;

4369: x_return_status => l_return_status);
4370:
4371: IF l_asset_residual IS NULL THEN
4372:
4373: l_asset_residual := 0;
4374: END IF;
4375:
4376: ELSIF l_deal_type IN ('LEASEOP') THEN -- OP Lease
4377:

Line 4378: -- -- Get the purchase amount quote line which will be the asset residual

4374: END IF;
4375:
4376: ELSIF l_deal_type IN ('LEASEOP') THEN -- OP Lease
4377:
4378: -- -- Get the purchase amount quote line which will be the asset residual
4379: -- FOR get_purchase_amt_rec IN get_purchase_amt_csr (l_quote_id, p_kle_id) LOOP
4380: -- l_asset_residual := get_purchase_amt_rec.amount;
4381: -- END LOOP;
4382:

Line 4380: -- l_asset_residual := get_purchase_amt_rec.amount;

4376: ELSIF l_deal_type IN ('LEASEOP') THEN -- OP Lease
4377:
4378: -- -- Get the purchase amount quote line which will be the asset residual
4379: -- FOR get_purchase_amt_rec IN get_purchase_amt_csr (l_quote_id, p_kle_id) LOOP
4380: -- l_asset_residual := get_purchase_amt_rec.amount;
4381: -- END LOOP;
4382:
4383: -- rmunjulu 3735773 -- use the same logic as used for term without purchase
4384: -- Calculate the Net Book Value for the asset on termination date

Line 4409: -- Calculate net book value which will be residual

4405: FOR get_asset_cost_rec IN get_asset_cost_csr (p_kle_id) LOOP
4406: l_cost := get_asset_cost_rec.original_cost;
4407: END LOOP;
4408:
4409: -- Calculate net book value which will be residual
4410: l_asset_residual := l_cost - l_deprn_amt;
4411:
4412: ELSIF l_deal_type IN ('LOAN','LOAN-REVOLVING') THEN -- rmunjulu 4399736
4413:

Line 4410: l_asset_residual := l_cost - l_deprn_amt;

4406: l_cost := get_asset_cost_rec.original_cost;
4407: END LOOP;
4408:
4409: -- Calculate net book value which will be residual
4410: l_asset_residual := l_cost - l_deprn_amt;
4411:
4412: ELSIF l_deal_type IN ('LOAN','LOAN-REVOLVING') THEN -- rmunjulu 4399736
4413:
4414: -- get residual value as the one populated on the quote

Line 4414: -- get residual value as the one populated on the quote

4410: l_asset_residual := l_cost - l_deprn_amt;
4411:
4412: ELSIF l_deal_type IN ('LOAN','LOAN-REVOLVING') THEN -- rmunjulu 4399736
4413:
4414: -- get residual value as the one populated on the quote
4415: l_asset_residual := l_net_investment;
4416:
4417: ELSE
4418:

Line 4415: l_asset_residual := l_net_investment;

4411:
4412: ELSIF l_deal_type IN ('LOAN','LOAN-REVOLVING') THEN -- rmunjulu 4399736
4413:
4414: -- get residual value as the one populated on the quote
4415: l_asset_residual := l_net_investment;
4416:
4417: ELSE
4418:
4419: l_asset_residual := 0;

Line 4419: l_asset_residual := 0;

4415: l_asset_residual := l_net_investment;
4416:
4417: ELSE
4418:
4419: l_asset_residual := 0;
4420:
4421: END IF;
4422:
4423: ELSE -- without purchase

Line 4436: l_asset_residual := get_deprn_cost_rec.depreciation_cost;

4432: /* -- rmunjulu This piece of logic now resides in seeded formula, so call formula to get value
4433: -- Get the Off-lease trn value
4434: FOR get_deprn_cost_rec IN get_deprn_cost_csr (p_kle_id ) LOOP
4435:
4436: l_asset_residual := get_deprn_cost_rec.depreciation_cost;
4437:
4438: END LOOP;
4439: */
4440: -- rmunjulu Call the seeded formula to get residual value

Line 4440: -- rmunjulu Call the seeded formula to get residual value

4436: l_asset_residual := get_deprn_cost_rec.depreciation_cost;
4437:
4438: END LOOP;
4439: */
4440: -- rmunjulu Call the seeded formula to get residual value
4441: l_params(1).name := 'QUOTE_ID';
4442: l_params(1).value := l_quote_id;
4443:
4444: get_formula_value (

Line 4449: x_formula_value => l_asset_residual,

4445: p_formula_name => l_formula_name,
4446: p_chr_id => p_khr_id,
4447: p_cle_id => p_kle_id,
4448: p_additional_parameters => l_params,
4449: x_formula_value => l_asset_residual,
4450: x_return_status => l_return_status);
4451:
4452: IF l_asset_residual IS NULL THEN
4453:

Line 4452: IF l_asset_residual IS NULL THEN

4448: p_additional_parameters => l_params,
4449: x_formula_value => l_asset_residual,
4450: x_return_status => l_return_status);
4451:
4452: IF l_asset_residual IS NULL THEN
4453:
4454: l_asset_residual := 0;
4455: END IF;
4456:

Line 4454: l_asset_residual := 0;

4450: x_return_status => l_return_status);
4451:
4452: IF l_asset_residual IS NULL THEN
4453:
4454: l_asset_residual := 0;
4455: END IF;
4456:
4457: ELSIF l_deal_type IN ('LEASEOP') THEN -- OP LEASE
4458:

Line 4484: -- Calculate net book value which will be residual

4480: FOR get_asset_cost_rec IN get_asset_cost_csr (p_kle_id) LOOP
4481: l_cost := get_asset_cost_rec.original_cost;
4482: END LOOP;
4483:
4484: -- Calculate net book value which will be residual
4485: l_asset_residual := l_cost - l_deprn_amt;
4486:
4487: ELSIF l_deal_type IN ('LOAN','LOAN-REVOLVING') THEN -- rmunjulu 4399736
4488:

Line 4485: l_asset_residual := l_cost - l_deprn_amt;

4481: l_cost := get_asset_cost_rec.original_cost;
4482: END LOOP;
4483:
4484: -- Calculate net book value which will be residual
4485: l_asset_residual := l_cost - l_deprn_amt;
4486:
4487: ELSIF l_deal_type IN ('LOAN','LOAN-REVOLVING') THEN -- rmunjulu 4399736
4488:
4489: -- get residual value as the one populated on the quote

Line 4489: -- get residual value as the one populated on the quote

4485: l_asset_residual := l_cost - l_deprn_amt;
4486:
4487: ELSIF l_deal_type IN ('LOAN','LOAN-REVOLVING') THEN -- rmunjulu 4399736
4488:
4489: -- get residual value as the one populated on the quote
4490: l_asset_residual := l_net_investment;
4491:
4492: ELSE
4493:

Line 4490: l_asset_residual := l_net_investment;

4486:
4487: ELSIF l_deal_type IN ('LOAN','LOAN-REVOLVING') THEN -- rmunjulu 4399736
4488:
4489: -- get residual value as the one populated on the quote
4490: l_asset_residual := l_net_investment;
4491:
4492: ELSE
4493:
4494: l_asset_residual := 0;

Line 4494: l_asset_residual := 0;

4490: l_asset_residual := l_net_investment;
4491:
4492: ELSE
4493:
4494: l_asset_residual := 0;
4495:
4496: END IF;
4497:
4498: END IF;

Line 4500: RETURN l_asset_residual;

4496: END IF;
4497:
4498: END IF;
4499:
4500: RETURN l_asset_residual;
4501:
4502: EXCEPTION
4503: WHEN Expected_error THEN
4504: IF get_acc_deprn_csr%ISOPEN THEN

Line 4515: END get_actual_asset_residual;

4511: CLOSE get_acc_deprn_csr;
4512: END IF;
4513: RETURN 0;
4514:
4515: END get_actual_asset_residual;
4516:
4517: -- Start of comments
4518: --
4519: -- Function Name : get_anticipated_bill

Line 4879: FROM DUAL

4875: x_return_status OUT NOCOPY VARCHAR2) RETURN VARCHAR2 IS
4876:
4877: CURSOR get_termination_trn_csr (p_khr_id IN NUMBER) IS
4878: SELECT 'Y'
4879: FROM DUAL
4880: WHERE EXISTS (SELECT id
4881: FROM OKL_TRX_CONTRACTS
4882: WHERE khr_id = p_khr_id
4883: AND tmt_status_code NOT IN ('PROCESSED', 'CANCELED') --akrangan changed