1 PACKAGE OKL_INTERNAL_BILLING_PVT AS
2 /* $Header: OKLRIARS.pls 120.1 2007/07/17 09:22:15 gkhuntet noship $ */
3 ----------------------------------------------------------------------------
4 -- GLOBAL VARIABLES
5 ----------------------------------------------------------------------------
6 G_PKG_NAME CONSTANT VARCHAR2(200) := 'OKL_INTERNAL_BILLING_PVT';
7 G_APP_NAME CONSTANT VARCHAR2(3) := OKL_API.G_APP_NAME;
8
9 G_RET_STS_SUCCESS CONSTANT VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
10 G_RET_STS_UNEXP_ERROR CONSTANT VARCHAR2(1) := OKL_API.G_RET_STS_UNEXP_ERROR;
11 G_RET_STS_ERROR CONSTANT VARCHAR2(1) := OKL_API.G_RET_STS_ERROR;
12 G_EXCEPTION_ERROR EXCEPTION;
13 G_EXCEPTION_UNEXPECTED_ERROR EXCEPTION;
14
15 G_UNEXPECTED_ERROR CONSTANT VARCHAR2(30) := 'OKL_UNEXPECTED_ERROR';
16 G_SQLERRM_TOKEN CONSTANT VARCHAR2(30) := 'OKL_SQLERRM';
17 G_SQLCODE_TOKEN CONSTANT VARCHAR2(30) := 'OKL_SQLCODE';
18
19 G_EXC_NAME_OTHERS CONSTANT VARCHAR2(6) := 'OTHERS';
20 G_API_TYPE CONSTANT VARCHAR(4) := '_PVT';
21 G_UI_DATE_MASK VARCHAR2(15) := fnd_profile.value('ICX_DATE_FORMAT_MASK');
22 G_OKL_LLA_INVALID_DATE_FORMAT CONSTANT VARCHAR2(30) := 'OKL_LLA_INVALID_DATE_FORMAT';
23 G_NOT_UNIQUE CONSTANT VARCHAR2(30) := 'OKL_LLA_NOT_UNIQUE';
24 G_REQUIRED_VALUE CONSTANT VARCHAR2(30) := 'OKL_REQUIRED_VALUE';
25 G_LLA_RANGE_CHECK CONSTANT VARCHAR2(30) := 'OKL_LLA_RANGE_CHECK';
26 G_INVALID_VALUE CONSTANT VARCHAR2(30) := OKL_API.G_INVALID_VALUE;
27 G_COL_NAME_TOKEN CONSTANT VARCHAR2(30) := OKL_API.G_COL_NAME_TOKEN;
28
29 ----------------------------------------------------------------------------
30 -- Data Structures
31 ----------------------------------------------------------------------------
32 ----------------------------------------------------------------------------
33 -- Global Exception
34 ----------------------------------------------------------------------------
35 G_EXCEPTION_HALT_VALIDATION EXCEPTION;
36
37 ----------------------------------------------------------------------------
38 -- Procedures and Functions
39 ------------------------------------------------------------------------------
40 ----------------------------------------------------------------------------------
41 -- Start of comments
42 --
43 -- Procedure Name : CREATE_BILLING_TRX
44 -- Description : wrapper api to create internal billing transactions
45 -- Business Rules :
46 -- Usage:
47 -- (1) Caller pass 3 layers of billing data:
48 -- -----------------------------------------
49 --
50 -- If caller pass the following parameters with data,
51 -- ,p_taiv_rec IN okl_tai_pvt.taiv_rec_type
52 -- ,p_tilv_tbl IN okl_til_pvt.tilv_tbl_type
53 -- ,p_tldv_tbl IN okl_tld_pvt.tldv_tbl_type
54 -- then system assume caller is intend to create stream based (with stream element)
55 -- internal billing transactions.
56 --
57 -- In this scenario, the following rules applied:
58 -- R1): If p_tilv_tbl(n).TXL_AR_LINE_NUMBER exists, but p_tldv_tbl(n).TXL_AR_LINE_NUMBER
59 -- doesn't exists, throw error.
60 -- R2): If p_tldv_tbl(n).TXL_AR_LINE_NUMBER exists, but p_tilv_tbl(n).TXL_AR_LINE_NUMBER
61 -- doesn't exists, throw error.
62 --
63 -- Note:
64 -- p_tilv_tbl(n).TXL_AR_LINE_NUMBER :
65 -- User key to link between p_tilv_rec and p_tldv_tbl
66 --
67 -- p_tldv_tbl(n).TXL_AR_LINE_NUMBER :
68 -- User key to link between p_tldv_rec and p_tilv_rec
69 --
70 -- Note: In order to process this API properly, you need to pass user enter TXL_AR_LINE_NUMBER
71 -- to link between p_tilv_rec and p_tldv_tbl.
72 --
73 -- (2) Caller pass 2 layers of billing data:
74 -- -----------------------------------------
75 --
76 -- If caller pass the following parameters with data,
77 -- ,p_taiv_rec IN okl_tai_pvt.taiv_rec_type
78 -- ,p_tilv_tbl IN okl_til_pvt.tilv_tbl_type
79 -- then system assume caller is intend to create non-stream based (without stream element)
80 -- internal billing transactions.
81 --
82 -- In this scenario, p_tilv_tbl(n).TXL_AR_LINE_NUMBER is not a required attribute.
83 -- If user does pass p_tilv_tbl(n).TXL_AR_LINE_NUMBER, system will assume this is a
84 -- redundant data.
85 -- System will copy the major attributes (STY_ID, AMOUNT, etc) from p_tilv_rec to
86 -- create record in OKL_TXD_AR_LN_DTLS_b/tl table (Internal billing invoice/invoce line)
87 --
88 -- (3) Caller pass 1 layer of billing data:
89 -- -----------------------------------------
90 -- If p_tilv_tbl.count = 0, throw error.
91 --
92 -- Note: 1. Assume all calling API will validate attributes before make the call. This is
93 -- the current architecture and we will adopt all validation logic from calling API
94 -- to this central API in the future.
95 -- Parameters :
96 --
97 -- p_taiv_rec: Internal billing contract transaction header (okl_trx_ar_invoices_v)
98 -- p_tilv_tbl: Internal billing contract transaction line (OKL_TXL_AR_INV_LNS_V)
99 -- p_tldv_tbl: Internal billing invoice/invoce line (OKL_TXD_AR_LN_DTLS_V)
100 -- Version : 1.0
101 -- End of comments
102 ----------------------------------------------------------------------------------
103 PROCEDURE CREATE_BILLING_TRX(
104 p_api_version IN NUMBER
105 ,p_init_msg_list IN VARCHAR2 DEFAULT OKL_API.G_FALSE
106 ,x_return_status OUT NOCOPY VARCHAR2
107 ,x_msg_count OUT NOCOPY NUMBER
108 ,x_msg_data OUT NOCOPY VARCHAR2
109 ,p_taiv_rec IN okl_tai_pvt.taiv_rec_type
110 ,p_tilv_tbl IN okl_til_pvt.tilv_tbl_type
111 ,p_tldv_tbl IN okl_tld_pvt.tldv_tbl_type
112 ,x_taiv_rec OUT NOCOPY okl_tai_pvt.taiv_rec_type
113 ,x_tilv_tbl OUT NOCOPY okl_til_pvt.tilv_tbl_type
114 ,x_tldv_tbl OUT NOCOPY okl_tld_pvt.tldv_tbl_type
115 );
116
117 ----------------------------------------------------------------------------------
118 -- Start of comments
119 --
120 -- Procedure Name : Get_Invoice_format
121 -- Description : wrapper api to retrieve OKL invoice format type and
122 -- invoice format line type
123 -- Business Rules :
124 -- 1. If passed in inf_id and sty_id matches, get the invoice_format_type and
125 -- invoice format line type
126 -- 2. If passed in inf_id matches, but stream is missing, get the defaulted
127 -- invoice_format_type and invoice format line type
128 -- 3 If passed in inf_id and sty_id are null, assign null to the
129 -- invoice_format_type and invoice format line type
130 -- Parameters :
131 --
132 -- Version : 1.0
133 -- End of comments
134 ----------------------------------------------------------------------------------
135 PROCEDURE Get_Invoice_format(
136 p_api_version IN NUMBER
137 ,p_init_msg_list IN VARCHAR2 DEFAULT OKL_API.G_FALSE
138 ,x_return_status OUT NOCOPY VARCHAR2
139 ,x_msg_count OUT NOCOPY NUMBER
140 ,x_msg_data OUT NOCOPY VARCHAR2
141 ,p_inf_id IN NUMBER DEFAULT NULL
142 ,p_sty_id IN NUMBER DEFAULT NULL
143 ,x_invoice_format_type OUT NOCOPY VARCHAR2
144 ,x_invoice_format_line_type OUT NOCOPY VARCHAR2
145 );
146
147 -- Start of comments
148
149 -- API name : update_manual_invoice
150 -- Pre-reqs : None
151 -- Function : It is Used to Update header in TAI and Insert/Update line
152 -- in TIL/TLD. And if the trx_status_code is submitted then
153 -- make a accounting call for all TLD records.
154 -- Parameters :
155 -- IN : p_api_version - Standard input parameter
156 -- p_init_msg_list - Standard input parameter
157 -- p_taiv_rec - Record type for OKL_TRX_AR_INVOICES_B.
158 -- p_tilv_tbl -- Table type for OKL_TXL_AR_INV_LNS_B.
159 -- Version : 1.0
160 -- History : gkhuntet created.
161 -- End of comments
162
163 PROCEDURE update_manual_invoice(
164 p_api_version IN NUMBER
165 ,p_init_msg_list IN VARCHAR2 DEFAULT OKL_API.G_FALSE
166 ,x_return_status OUT NOCOPY VARCHAR2
167 ,x_msg_count OUT NOCOPY NUMBER
168 ,x_msg_data OUT NOCOPY VARCHAR2
169 ,p_taiv_rec IN okl_tai_pvt.taiv_rec_type
170 ,p_tilv_tbl IN okl_til_pvt.tilv_tbl_type
171 ,x_taiv_rec OUT NOCOPY okl_tai_pvt.taiv_rec_type
172 ,x_tilv_tbl OUT NOCOPY okl_til_pvt.tilv_tbl_type
173 ,x_tldv_tbl OUT NOCOPY okl_tld_pvt.tldv_tbl_type
174 );
175
176
177
178 PROCEDURE delete_manual_invoice(
179 p_api_version IN NUMBER
180 ,p_init_msg_list IN VARCHAR2 DEFAULT OKL_API.G_FALSE
181 ,x_return_status OUT NOCOPY VARCHAR2
182 ,x_msg_count OUT NOCOPY NUMBER
183 ,x_msg_data OUT NOCOPY VARCHAR2
184 ,p_taiv_id NUMBER
185 ,p_tilv_id NUMBER
186 );
187
188
189
190
191
192
193
194 END OKL_INTERNAL_BILLING_PVT;