6: subtype taiv_rec_type is okl_tai_pvt.taiv_rec_type;
7: subtype taiv_tbl_type is okl_tai_pvt.taiv_tbl_type;
8: subtype tilv_rec_type is okl_til_pvt.tilv_rec_type;
9: subtype tilv_tbl_type is okl_til_pvt.tilv_tbl_type;
10: subtype tldv_rec_type is okl_tld_pvt.tldv_rec_type;
11: subtype tldv_tbl_type is okl_tld_pvt.tldv_tbl_type;
12:
13: ----------------------------------------------------------------------------
14: -- Variables For Debugging and Logging
7: subtype taiv_tbl_type is okl_tai_pvt.taiv_tbl_type;
8: subtype tilv_rec_type is okl_til_pvt.tilv_rec_type;
9: subtype tilv_tbl_type is okl_til_pvt.tilv_tbl_type;
10: subtype tldv_rec_type is okl_tld_pvt.tldv_rec_type;
11: subtype tldv_tbl_type is okl_tld_pvt.tldv_tbl_type;
12:
13: ----------------------------------------------------------------------------
14: -- Variables For Debugging and Logging
15: ----------------------------------------------------------------------------
51: ,p_init_msg_list IN VARCHAR2 DEFAULT OKL_API.G_FALSE
52: ,x_return_status OUT NOCOPY VARCHAR2
53: ,x_msg_count OUT NOCOPY NUMBER
54: ,x_msg_data OUT NOCOPY VARCHAR2
55: ,p_tldv_tbl IN okl_tld_pvt.tldv_tbl_type
56: ,p_tai_id IN OKL_TRX_AR_INVOICES_B.ID%TYPE
57: )
58: IS
59: l_api_name CONSTANT VARCHAR2(30) := 'create_accounting_dist';
59: l_api_name CONSTANT VARCHAR2(30) := 'create_accounting_dist';
60: l_api_version CONSTANT NUMBER := 1.0;
61: l_til_loop_cnt NUMBER;
62: l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
63: lp_tldv_tbl okl_tld_pvt.tldv_tbl_type := p_tldv_tbl;
64: lx_tldv_tbl okl_tld_pvt.tldv_tbl_type;
65: l_tld_loop_cnt NUMBER;
66: lx_tldv_rec okl_tld_pvt.tldv_rec_type;
67: l_til_id NUMBER;
60: l_api_version CONSTANT NUMBER := 1.0;
61: l_til_loop_cnt NUMBER;
62: l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
63: lp_tldv_tbl okl_tld_pvt.tldv_tbl_type := p_tldv_tbl;
64: lx_tldv_tbl okl_tld_pvt.tldv_tbl_type;
65: l_tld_loop_cnt NUMBER;
66: lx_tldv_rec okl_tld_pvt.tldv_rec_type;
67: l_til_id NUMBER;
68: l_trx_header_id OKL_TRX_AR_INVOICES_B.ID%TYPE;
62: l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
63: lp_tldv_tbl okl_tld_pvt.tldv_tbl_type := p_tldv_tbl;
64: lx_tldv_tbl okl_tld_pvt.tldv_tbl_type;
65: l_tld_loop_cnt NUMBER;
66: lx_tldv_rec okl_tld_pvt.tldv_rec_type;
67: l_til_id NUMBER;
68: l_trx_header_id OKL_TRX_AR_INVOICES_B.ID%TYPE;
69: l_til_debug_cnt NUMBER;
70: l_tld_debug_cnt NUMBER;
1874: ,p_tilv_tbl IN okl_til_pvt.tilv_tbl_type
1875: ,x_taiv_rec OUT NOCOPY okl_tai_pvt.taiv_rec_type
1876: ,x_tilv_tbl OUT NOCOPY okl_til_pvt.tilv_tbl_type
1877: -- start: cklee -- fixed return parameters issues 4/6/07
1878: ,x_tldv_tbl OUT NOCOPY okl_tld_pvt.tldv_tbl_type
1879: -- end: cklee -- fixed return parameters issues 4/6/07
1880: ,p_cpl_id IN NUMBER DEFAULT NULL
1881: )
1882: is
1887: lp_taiv_rec okl_tai_pvt.taiv_rec_type := p_taiv_rec;
1888: lx_taiv_rec okl_tai_pvt.taiv_rec_type;
1889: lp_tilv_tbl okl_til_pvt.tilv_tbl_type := p_tilv_tbl;
1890: lx_tilv_tbl okl_til_pvt.tilv_tbl_type;
1891: lp_tldv_tbl okl_tld_pvt.tldv_tbl_type;
1892: lx_tldv_tbl okl_tld_pvt.tldv_tbl_type;
1893: l_taiv_id NUMBER;
1894: lx_tilv_rec okl_til_pvt.tilv_rec_type;
1895: l_tld_loop_cnt NUMBER;
1888: lx_taiv_rec okl_tai_pvt.taiv_rec_type;
1889: lp_tilv_tbl okl_til_pvt.tilv_tbl_type := p_tilv_tbl;
1890: lx_tilv_tbl okl_til_pvt.tilv_tbl_type;
1891: lp_tldv_tbl okl_tld_pvt.tldv_tbl_type;
1892: lx_tldv_tbl okl_tld_pvt.tldv_tbl_type;
1893: l_taiv_id NUMBER;
1894: lx_tilv_rec okl_til_pvt.tilv_rec_type;
1895: l_tld_loop_cnt NUMBER;
1896: l_til_ln_number NUMBER;
1893: l_taiv_id NUMBER;
1894: lx_tilv_rec okl_til_pvt.tilv_rec_type;
1895: l_tld_loop_cnt NUMBER;
1896: l_til_ln_number NUMBER;
1897: lx_tldv_rec okl_tld_pvt.tldv_rec_type;
1898: l_til_id NUMBER;
1899: l_til_debug_cnt NUMBER;
1900: l_tld_debug_cnt NUMBER;
1901: p_bpd_acc_rec Okl_Acc_Call_Pub.bpd_acc_rec_type;
2099:
2100: /***
2101: -- Developer Note:
2102: -- 1. For each TIL record, copy STY_ID, AMOUNT, ORG_ID, INVENTORY_ORG_ID, INVENTORY_ITEM_ID
2103: -- to TLD pl/sql record and call okl_tld_pvt.insert_row() to create TLD.
2104: -- 2. lx_tilv_rec.TXL_AR_LINE_NUMBER is not required for this procesdure
2105: --
2106: ***/
2107: lp_tldv_tbl(l_til_loop_cnt).TIL_ID_DETAILS := l_til_id;
2153: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
2154: END IF;
2155: -- end: cklee -- add additional columns 3/19/07
2156:
2157: okl_tld_pvt.insert_row(
2158: p_api_version => p_api_version,
2159: p_init_msg_list => p_init_msg_list,
2160: x_return_status => l_return_status,
2161: x_msg_count => x_msg_count,
2186:
2187: If lp_tldv_tbl(l_tld_loop_cnt).TXL_AR_LINE_NUMBER = l_til_ln_number then
2188: -- Assign lx_til_rec.ID to lp_tld_rec.TIL_ID_DETAILS;
2189: lp_tldv_tbl(l_tld_loop_cnt).TIL_ID_DETAILS := l_til_id;
2190: -- Create okl_TXD_AR_LN_DTLS_B record: okl_tld_pvt.insert_row;
2191: okl_tld_pvt.insert_row(
2192: p_api_version => p_api_version,
2193: p_init_msg_list => p_init_msg_list,
2194: x_return_status => l_return_status,
2187: If lp_tldv_tbl(l_tld_loop_cnt).TXL_AR_LINE_NUMBER = l_til_ln_number then
2188: -- Assign lx_til_rec.ID to lp_tld_rec.TIL_ID_DETAILS;
2189: lp_tldv_tbl(l_tld_loop_cnt).TIL_ID_DETAILS := l_til_id;
2190: -- Create okl_TXD_AR_LN_DTLS_B record: okl_tld_pvt.insert_row;
2191: okl_tld_pvt.insert_row(
2192: p_api_version => p_api_version,
2193: p_init_msg_list => p_init_msg_list,
2194: x_return_status => l_return_status,
2195: x_msg_count => x_msg_count,
2402: --
2403: -- If caller pass the following parameters with data,
2404: -- ,p_taiv_rec IN okl_tai_pvt.taiv_rec_type
2405: -- ,p_tilv_tbl IN okl_til_pvt.tilv_tbl_type
2406: -- ,p_tldv_tbl IN okl_tld_pvt.tldv_tbl_type
2407: -- then system assume caller is intend to create stream based (with stream element)
2408: -- internal billing transactions.
2409: --
2410: -- In this scenario, the following rules applied:
2439: ,x_msg_count OUT NOCOPY NUMBER
2440: ,x_msg_data OUT NOCOPY VARCHAR2
2441: ,p_taiv_rec IN okl_tai_pvt.taiv_rec_type
2442: ,p_tilv_tbl IN okl_til_pvt.tilv_tbl_type
2443: ,p_tldv_tbl IN okl_tld_pvt.tldv_tbl_type
2444: ,x_taiv_rec OUT NOCOPY okl_tai_pvt.taiv_rec_type
2445: ,x_tilv_tbl OUT NOCOPY okl_til_pvt.tilv_tbl_type
2446: ,x_tldv_tbl OUT NOCOPY okl_tld_pvt.tldv_tbl_type
2447: )
2442: ,p_tilv_tbl IN okl_til_pvt.tilv_tbl_type
2443: ,p_tldv_tbl IN okl_tld_pvt.tldv_tbl_type
2444: ,x_taiv_rec OUT NOCOPY okl_tai_pvt.taiv_rec_type
2445: ,x_tilv_tbl OUT NOCOPY okl_til_pvt.tilv_tbl_type
2446: ,x_tldv_tbl OUT NOCOPY okl_tld_pvt.tldv_tbl_type
2447: )
2448: is
2449: l_api_name CONSTANT VARCHAR2(30) := 'create_sel_billing_trx';
2450: l_api_version CONSTANT NUMBER := 1.0;
2453: lp_taiv_rec okl_tai_pvt.taiv_rec_type := p_taiv_rec;
2454: lx_taiv_rec okl_tai_pvt.taiv_rec_type;
2455: lp_tilv_tbl okl_til_pvt.tilv_tbl_type := p_tilv_tbl;
2456: lx_tilv_tbl okl_til_pvt.tilv_tbl_type;
2457: lp_tldv_tbl okl_tld_pvt.tldv_tbl_type := p_tldv_tbl;
2458: lx_tldv_tbl okl_tld_pvt.tldv_tbl_type;
2459: l_taiv_id NUMBER;
2460: lx_tilv_rec okl_til_pvt.tilv_rec_type;
2461: l_tld_loop_cnt NUMBER;
2454: lx_taiv_rec okl_tai_pvt.taiv_rec_type;
2455: lp_tilv_tbl okl_til_pvt.tilv_tbl_type := p_tilv_tbl;
2456: lx_tilv_tbl okl_til_pvt.tilv_tbl_type;
2457: lp_tldv_tbl okl_tld_pvt.tldv_tbl_type := p_tldv_tbl;
2458: lx_tldv_tbl okl_tld_pvt.tldv_tbl_type;
2459: l_taiv_id NUMBER;
2460: lx_tilv_rec okl_til_pvt.tilv_rec_type;
2461: l_tld_loop_cnt NUMBER;
2462: l_til_ln_number NUMBER;
2459: l_taiv_id NUMBER;
2460: lx_tilv_rec okl_til_pvt.tilv_rec_type;
2461: l_tld_loop_cnt NUMBER;
2462: l_til_ln_number NUMBER;
2463: lx_tldv_rec okl_tld_pvt.tldv_rec_type;
2464: l_til_id NUMBER;
2465: l_til_debug_cnt NUMBER;
2466: l_tld_debug_cnt NUMBER;
2467: p_bpd_acc_rec Okl_Acc_Call_Pub.bpd_acc_rec_type;
2678: lp_tldv_tbl(l_tld_loop_cnt).TIL_ID_DETAILS := l_til_id;
2679: lp_tldv_tbl(l_til_loop_cnt).LINE_DETAIL_NUMBER := l_til_loop_cnt;
2680: lp_tldv_tbl(l_tld_loop_cnt).KHR_ID := lp_taiv_rec.KHR_ID;
2681: lp_tldv_tbl(l_til_loop_cnt).KLE_ID := lp_tilv_tbl(l_til_loop_cnt).KLE_ID;
2682: -- Create okl_TXD_AR_LN_DTLS_B record: okl_tld_pvt.insert_row;
2683:
2684: -- rmunjulu R12 Fixes -- Added the below to populate the tld columns
2685: -- lp_tldv_tbl(l_til_loop_cnt).STY_ID := lx_tilv_rec.STY_ID;
2686: -- start: cklee til.amount may not be the same as tld amount, so commented the following code
2727: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
2728: END IF;
2729: -- end: cklee -- add additional columns 3/19/07
2730:
2731: okl_tld_pvt.insert_row(
2732: p_api_version => p_api_version,
2733: p_init_msg_list => p_init_msg_list,
2734: x_return_status => l_return_status,
2735: x_msg_count => x_msg_count,
2938: --
2939: -- If caller pass the following parameters with data,
2940: -- ,p_taiv_rec IN okl_tai_pvt.taiv_rec_type
2941: -- ,p_tilv_tbl IN okl_til_pvt.tilv_tbl_type
2942: -- ,p_tldv_tbl IN okl_tld_pvt.tldv_tbl_type
2943: -- then system assume caller is intend to create stream based (with stream element)
2944: -- internal billing transactions.
2945: --
2946: -- In this scenario, the following rules applied:
2996: ,x_msg_count OUT NOCOPY NUMBER
2997: ,x_msg_data OUT NOCOPY VARCHAR2
2998: ,p_taiv_rec IN okl_tai_pvt.taiv_rec_type
2999: ,p_tilv_tbl IN okl_til_pvt.tilv_tbl_type
3000: ,p_tldv_tbl IN okl_tld_pvt.tldv_tbl_type
3001: ,x_taiv_rec OUT NOCOPY okl_tai_pvt.taiv_rec_type
3002: ,x_tilv_tbl OUT NOCOPY okl_til_pvt.tilv_tbl_type
3003: ,x_tldv_tbl OUT NOCOPY okl_tld_pvt.tldv_tbl_type
3004: ,p_cpl_id IN NUMBER DEFAULT NULL
2999: ,p_tilv_tbl IN okl_til_pvt.tilv_tbl_type
3000: ,p_tldv_tbl IN okl_tld_pvt.tldv_tbl_type
3001: ,x_taiv_rec OUT NOCOPY okl_tai_pvt.taiv_rec_type
3002: ,x_tilv_tbl OUT NOCOPY okl_til_pvt.tilv_tbl_type
3003: ,x_tldv_tbl OUT NOCOPY okl_tld_pvt.tldv_tbl_type
3004: ,p_cpl_id IN NUMBER DEFAULT NULL
3005: )
3006: is
3007: l_api_name CONSTANT VARCHAR2(30) := 'CREATE_BILLING_TRX';
3011: lp_taiv_rec okl_tai_pvt.taiv_rec_type := p_taiv_rec;
3012: lx_taiv_rec okl_tai_pvt.taiv_rec_type;
3013: lp_tilv_tbl okl_til_pvt.tilv_tbl_type := p_tilv_tbl;
3014: lx_tilv_tbl okl_til_pvt.tilv_tbl_type;
3015: lp_tldv_tbl okl_tld_pvt.tldv_tbl_type := p_tldv_tbl;
3016: lx_tldv_tbl okl_tld_pvt.tldv_tbl_type;
3017: l_taiv_id NUMBER;
3018: lx_tilv_rec okl_til_pvt.tilv_rec_type;
3019: l_tld_loop_cnt NUMBER;
3012: lx_taiv_rec okl_tai_pvt.taiv_rec_type;
3013: lp_tilv_tbl okl_til_pvt.tilv_tbl_type := p_tilv_tbl;
3014: lx_tilv_tbl okl_til_pvt.tilv_tbl_type;
3015: lp_tldv_tbl okl_tld_pvt.tldv_tbl_type := p_tldv_tbl;
3016: lx_tldv_tbl okl_tld_pvt.tldv_tbl_type;
3017: l_taiv_id NUMBER;
3018: lx_tilv_rec okl_til_pvt.tilv_rec_type;
3019: l_tld_loop_cnt NUMBER;
3020: l_til_ln_number NUMBER;
3017: l_taiv_id NUMBER;
3018: lx_tilv_rec okl_til_pvt.tilv_rec_type;
3019: l_tld_loop_cnt NUMBER;
3020: l_til_ln_number NUMBER;
3021: lx_tldv_rec okl_tld_pvt.tldv_rec_type;
3022: l_til_id NUMBER;
3023: l_til_debug_cnt NUMBER;
3024: l_tld_debug_cnt NUMBER;
3025: p_bpd_acc_rec Okl_Acc_Call_Pub.bpd_acc_rec_type;
3437: ,p_taiv_rec IN okl_tai_pvt.taiv_rec_type
3438: ,p_tilv_tbl IN okl_til_pvt.tilv_tbl_type
3439: ,x_taiv_rec OUT NOCOPY okl_tai_pvt.taiv_rec_type
3440: ,x_tilv_tbl OUT NOCOPY okl_til_pvt.tilv_tbl_type
3441: ,x_tldv_tbl OUT NOCOPY okl_tld_pvt.tldv_tbl_type
3442: )
3443: IS
3444:
3445: l_api_name CONSTANT VARCHAR2(30) := 'update_manual_invoice';
3449: lp_taiv_rec okl_tai_pvt.taiv_rec_type := p_taiv_rec;
3450: lx_taiv_rec okl_tai_pvt.taiv_rec_type;
3451: lp_tilv_tbl okl_til_pvt.tilv_tbl_type := p_tilv_tbl;
3452: lx_tilv_tbl okl_til_pvt.tilv_tbl_type;
3453: lp_tldv_tbl okl_tld_pvt.tldv_tbl_type;
3454: lx_tldv_tbl okl_tld_pvt.tldv_tbl_type;
3455: l_taiv_id NUMBER;
3456: lx_tilv_rec okl_til_pvt.tilv_rec_type;
3457: l_tld_loop_cnt NUMBER;
3450: lx_taiv_rec okl_tai_pvt.taiv_rec_type;
3451: lp_tilv_tbl okl_til_pvt.tilv_tbl_type := p_tilv_tbl;
3452: lx_tilv_tbl okl_til_pvt.tilv_tbl_type;
3453: lp_tldv_tbl okl_tld_pvt.tldv_tbl_type;
3454: lx_tldv_tbl okl_tld_pvt.tldv_tbl_type;
3455: l_taiv_id NUMBER;
3456: lx_tilv_rec okl_til_pvt.tilv_rec_type;
3457: l_tld_loop_cnt NUMBER;
3458: l_til_ln_number NUMBER;
3455: l_taiv_id NUMBER;
3456: lx_tilv_rec okl_til_pvt.tilv_rec_type;
3457: l_tld_loop_cnt NUMBER;
3458: l_til_ln_number NUMBER;
3459: lx_tldv_rec okl_tld_pvt.tldv_rec_type;
3460: l_til_id NUMBER;
3461: til_id NUMBER;
3462: i NUMBER DEFAULT 0;
3463: crt_count NUMBER := 0;
3563:
3564: /***
3565: -- Developer Note:
3566: -- 1. For each TIL record, copy STY_ID, AMOUNT, ORG_ID, INVENTORY_ORG_ID, INVENTORY_ITEM_ID
3567: -- to TLD pl/sql record and call okl_tld_pvt.insert_row() to create TLD.
3568: -- 2. lx_tilv_rec.TXL_AR_LINE_NUMBER is not required for this procesdure
3569: ***/
3570: lp_tldv_tbl(i).ID := til_id;
3571: lp_tldv_tbl(i).STY_ID := lx_tilv_rec.STY_ID;
3576: --lp_tldv_tbl(i).LINE_DETAIL_NUMBER := l_til_loop_cnt;
3577: lp_tldv_tbl(i).KHR_ID := lp_taiv_rec.KHR_ID;
3578: lp_tldv_tbl(i).KLE_ID := lx_tilv_rec.KLE_ID;
3579:
3580: okl_tld_pvt.update_row(
3581: p_api_version => p_api_version,
3582: p_init_msg_list => p_init_msg_list,
3583: x_return_status => l_return_status,
3584: x_msg_count => x_msg_count,
3679: l_til_id := lx_tilv_rec.id;
3680: /***
3681: -- Developer Note:
3682: -- 1. For each TIL record, copy STY_ID, AMOUNT, ORG_ID, INVENTORY_ORG_ID, INVENTORY_ITEM_ID
3683: -- to TLD pl/sql record and call okl_tld_pvt.insert_row() to create TLD.
3684: -- 2. lx_tilv_rec.TXL_AR_LINE_NUMBER is not required for this procesdure
3685: --
3686: ***/
3687: lp_tldv_tbl(i).TIL_ID_DETAILS := l_til_id;
3728: END IF;
3729: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
3730: END IF;
3731:
3732: okl_tld_pvt.insert_row(
3733: p_api_version => p_api_version,
3734: p_init_msg_list => p_init_msg_list,
3735: x_return_status => l_return_status,
3736: x_msg_count => x_msg_count,
3858: l_til_id OKL_TXL_AR_INV_LNS_B.ID%TYPE ;
3859: l_til_id OKL_TXD_AR_LN_DTLS_B.ID%TYPE ;
3860: l_taiv_rec okl_tai_pvt.taiv_rec_type;
3861: l_tilv_rec okl_til_pvt.tilv_rec_type;
3862: l_tldv_rec okl_tld_pvt.tldv_rec_type;
3863:
3864: CURSOR get_til_dtl_csr IS
3865: SELECT ID til_id
3866: FROM OKL_TXL_AR_INV_LNS_B
3904: FOR get_tld_dtl_rec in get_tld_dtl_csr(l_tilv_rec.id )
3905: LOOP
3906: l_tldv_rec.id := get_tld_dtl_rec.tld_id;
3907: --Delete a TLD Record.
3908: OKL_TLD_PVT.delete_row(p_api_version => p_api_version,
3909: p_init_msg_list => p_init_msg_list,
3910: x_return_status => l_return_status,
3911: x_msg_count => x_msg_count,
3912: x_msg_data => x_msg_data,
3955: FOR get_tld_dtl_rec in get_tld_dtl_csr(lp_til_id)
3956: LOOP
3957: l_tldv_rec.id := get_tld_dtl_rec.tld_id;
3958: --Delete a TLD Record.
3959: OKL_TLD_PVT.delete_row(p_api_version => p_api_version,
3960: p_init_msg_list => p_init_msg_list,
3961: x_return_status => l_return_status,
3962: x_msg_count => x_msg_count,
3963: x_msg_data => x_msg_data,