1 PACKAGE BODY GMLCOPPR AS
2 /* $Header: GMLCPPRB.pls 120.1 2011/09/15 15:11:47 adeshmuk ship $ */
3 /* Exceptions */
4 e_orig_record_not_found EXCEPTION ;
5 e_invalid_decimal EXCEPTION ;
6 e_null_price_change EXCEPTION ;
7
8 /* Error Numbers and Messages */
9 v_orig_record_not_found_eno NUMBER DEFAULT -30001;
10
11 v_invalid_decimal_emsg VARCHAR2(100) ;
12 v_invalid_decimal_eno NUMBER DEFAULT -30002;
13
14 v_null_price_change_eno NUMBER DEFAULT -30003;
15
16 /*========================================================================+
17 | NAME |
18 | copy_list |
19 | SYNOPSIS |
20 | Creates a copy of an existing pricelist. |
21 | PARAMETERS |
22 | p_old_pricelist_id IN Surrogate for Pricelist to be copied from. |
23 | p_pricelist_code IN New pricelist code. Null not allowed. |
24 | p_pricelist_desc1 IN New pricelist desc. |
25 | If null uses value from existing pricelist. |
26 | p_pricesort_name IN New pricesort name. |
27 | If null uses value from existing pricelist. |
28 | p_currency_code IN New pricelist currency. |
29 | If null uses value from existing pricelist. |
30 | p_comments IN New comments. |
31 | p_price_change_type IN Price change type |
32 | ( 1= percent change, 2= absolute change). |
33 | p_price_change IN Value for price change. |
34 | Can not be null if type above is 1 or 2. |
35 | p_decimal IN Decimal for rounding changed price ( 0 to 6). |
36 | Can not be null if type above is 1 or 2. |
37 | p_copy_text IN Flag to include text in the copy ( Y/N) |
38 | p_user_id IN Applications user id. |
39 | p_err_num OUT If positive, ID of new list; |
40 | else error as described below. |
41 | p_err_msg OUT Error message. |
42 | DESCRIPTION |
43 | |
44 | ERROR Codes and messages |
45 | Positive Number : ID of newly created record, no errors. |
46 | Database errors : -1 to -30000 |
47 | User defined :common to the package: -30001 to -30009 |
48 | user defined: Procedure specific : -30010 to -30019 |
49 +========================================================================*/
50 PROCEDURE copy_list ( p_old_pricelist_id IN OP_PRCE_MST.PRICELIST_ID%TYPE ,
51 p_pricelist_code IN OP_PRCE_MST.PRICELIST_CODE%TYPE,
52 p_pricelist_desc1 IN OP_PRCE_MST.PRICELIST_DESC1%TYPE,
53 p_pricesort_name IN OP_PRCE_MST.PRICESORT_NAME%TYPE,
54 p_currency_code IN OP_PRCE_MST.CURRENCY_CODE%TYPE ,
55 p_comments IN OP_PRCE_MST.COMMENTS%TYPE ,
56 p_price_change_type IN NUMBER ,
57 p_price_change IN NUMBER ,
58 p_decimal IN NUMBER ,
59 p_copy_text IN VARCHAR2 ,
60 p_user_id IN OP_PRCE_MST.CREATED_BY%TYPE ,
61 p_err_num OUT NOCOPY NUMBER ,
62 p_err_msg OUT NOCOPY VARCHAR2
63 ) IS
64
65 BEGIN
66
67 NULL;
68
69 EXCEPTION
70 WHEN OTHERS THEN
71 NULL;
72
73 END copy_list;
74
75
76 /*========================================================================+
77 | NAME |
78 | copy_contract |
79 | SYNOPSIS |
80 | create a new contract by copying an existing one. |
81 | |
82 | PARAMETERS |
83 | p_old_contract_id IN Surrogate for Contract to be copied from. |
84 | p_contract_no IN New contract no. Null not allowed. |
85 | p_contract_desc1 IN New contract long desc. |
86 | If null uses value from existing contract. |
87 | p_contract_desc2 IN New contract short desc. |
88 | If null uses value from existing contract. |
89 | p_comments IN New contract comments. |
90 | p_currency_code IN New contract currency. |
91 | If null uses value from existing contract. |
92 | p_exchange_rate IN New contract exchange rate. |
93 | If null uses value from existing contract. |
94 | p_mul_div_sign IN New contract mul-div-sign ( 0 or 1 ). |
95 | If null uses value from existing contract. |
96 | p_presales_ord_id IN New contract assoicated BSO. . |
97 | p_price_change_type IN Price change type |
98 | ( 1= percent change, 2= absolute change). |
99 | p_price_change IN Value for price change. |
100 | Can not be null if type above is 1 or 2. |
101 | p_decimal IN Decimal for rounding changed price ( 0 to 6). |
102 | Can not be null if type above is 1 or 2. |
103 | p_copy_text IN Flag to include text in the copy ( Y/N) |
104 | p_user_id IN Applications user id. |
105 | p_err_num OUT If positive, ID of new list; |
106 | else error as described below. |
107 | p_err_msg OUT Error message. |
108 | DESCRIPTION |
109 | |
110 | ERROR Codes and messages |
111 | Positive Number : ID of newly created record, no errors. |
112 | Database errors : -1 to -30000 |
113 | User defined :common to the package: -30001 to -30009 |
114 | user defined: Procedure specific : -30020 to -30029 |
115 +========================================================================*/
116 PROCEDURE copy_contract( p_old_contract_id IN OP_CNTR_HDR.CONTRACT_ID%TYPE ,
117 p_contract_no IN OP_CNTR_HDR.CONTRACT_NO%TYPE ,
118 p_contract_desc1 IN OP_CNTR_HDR.CONTRACT_DESC1%TYPE,
119 p_contract_desc2 IN OP_CNTR_HDR.CONTRACT_DESC2%TYPE,
120 p_comments IN OP_CNTR_HDR.COMMENTS%TYPE ,
121 p_contract_currency IN OP_CNTR_HDR.CONTRACT_CURRENCY%TYPE ,
122 p_exchange_rate IN OP_CNTR_HDR.EXCHANGE_RATE%TYPE ,
123 p_mul_div_sign IN OP_CNTR_HDR.MUL_DIV_SIGN%TYPE ,
124 p_presales_ord_id IN OP_CNTR_HDR.PRESALES_ORD_ID%TYPE ,
125 p_price_change_type IN NUMBER ,
126 p_price_change IN NUMBER ,
127 p_decimal IN NUMBER ,
128 p_copy_text IN VARCHAR2 ,
129 p_user_id IN OP_CNTR_HDR.CREATED_BY%TYPE ,
130 p_err_num OUT NOCOPY NUMBER ,
131 p_err_msg OUT NOCOPY VARCHAR2
132 ) IS
133
134 BEGIN
135
136 NULL;
137
138 EXCEPTION
139 WHEN OTHERS THEN
140 NULL;
141
142 END copy_contract;
143
144 /*========================================================================+
145 | NAME |
146 | copy_charge |
147 | SYNOPSIS |
148 | Create a new charge from an existing one. |
149 | |
150 | PARMS |
151 | p_old_charge_id IN Surrogate for Charge to be copied from. |
152 | p_charge_code IN New charge code. Null not allowed. |
153 | p_charge_desc IN New charge desc. |
154 | If null uses value from existing charge. |
155 | p_charge_type IN New charge type. |
156 | If null uses value from existing charge. |
157 | p_chgtax_class IN New charge tax class. |
158 | If null uses value from existing charge. |
159 | p_billable_ind IN New contract biallable ind (0 or 1 ). |
160 | If null uses value from existing charge. |
161 | p_currency_code IN New contract currency. |
162 | If null uses value from existing charge. |
163 | p_price_change_type IN Price change type |
164 | ( 1= percent change, 2= absolute change). |
165 | p_price_change IN Value for price change. |
166 | Can not be null if type above is 1 or 2. |
167 | p_decimal IN Decimal for rounding changed price ( 0 to 6). |
168 | Can not be null if type above is 1 or 2. |
169 | p_copy_text IN Flag to include text in the copy ( Y/N) |
170 | p_user_id IN Applications user id. |
171 | p_err_num OUT If positive, ID of new list; |
172 | else error as described below. |
173 | p_err_msg OUT Error message. |
174 | |
175 | DESCRIPTION |
176 | |
177 | |
178 | ERROR Codes and messages |
179 | Positive Number : ID of newly created record, no errors. |
180 | Database errors : -1 to -30000 |
181 | User defined :common to the package: -30001 to -30009 |
182 | user defined: Procedure specific : -30030 to -30039 |
183 +========================================================================*/
184
185 PROCEDURE copy_charge( p_old_charge_id IN OP_CHRG_MST.CHARGE_ID%TYPE ,
186 p_charge_code IN OP_CHRG_MST.CHARGE_CODE%TYPE ,
187 p_charge_desc IN OP_CHRG_MST.CHARGE_DESC%TYPE ,
188 p_charge_type IN OP_CHRG_MST.CHARGE_TYPE%TYPE ,
189 p_chgtax_class IN OP_CHRG_MST.CHGTAX_CLASS%TYPE ,
190 p_billable_ind IN OP_CHRG_MST.BILLABLE_IND%TYPE ,
191 p_currency_code IN OP_CHRG_MST.CURRENCY_CODE%TYPE ,
192 p_price_change_type IN NUMBER ,
193 p_price_change IN NUMBER ,
194 p_decimal IN NUMBER ,
195 p_copy_text IN VARCHAR2 ,
196 p_user_id IN OP_CHRG_MST.CREATED_BY%TYPE ,
197 p_err_num OUT NOCOPY NUMBER ,
198 p_err_msg OUT NOCOPY VARCHAR2
199 ) IS
200 BEGIN
201 NULL;
202
203 EXCEPTION
204
205 WHEN OTHERS THEN
206 NULL;
207
208 END copy_charge;
209
210 /*========================================================================+
211 | NAME |
212 | copy_effectivity |
213 | SYNOPSIS |
214 | Creates a new effectivity record for a pricelist, contract, |
215 | or header charge, based on existing effectivity of the same type |
216 | |
217 | PARMS |
218 | p_old_priceff_id IN Surrogate for effectivity to be copied from. |
219 | p_list_id IN pricelist/Contract/Charge surrogate |
220 | for which new effectivity will be created. |
221 | p_new_start_date IN Start date for new record. |
222 | p_new_end_date IN End date for new record. |
223 | p_new_preference IN Preference for new record. |
224 | p_copy_text IN Flag to include text in the copy ( Y/N) |
225 | p_user_id IN Applications user id. |
226 | p_err_num OUT If positive, ID of new list; |
227 | else error as described below. |
228 | p_err_msg OUT Error message. |
229 | |
230 | DESCRIPTION |
231 | |
232 | ERROR Codes and messages |
233 | Positive Number : ID of newly created record, no errors. |
234 | Database errors : -1 to -30000 |
235 | User defined :common to the package: -30001 to -30009 |
236 | user defined: Procedure specific : -30040 to -30049 |
237 | |
238 +========================================================================*/
239
240 PROCEDURE copy_effectivity( p_old_priceff_id IN OP_PRCE_EFF.PRICEFF_ID%TYPE ,
241 p_list_id IN OP_PRCE_EFF.PRICELIST_ID%TYPE ,
242 p_new_start_date IN OP_PRCE_EFF.START_DATE%TYPE ,
243 p_new_end_date IN OP_PRCE_EFF.END_DATE%TYPE ,
244 p_new_preference IN OP_PRCE_EFF.PREFERENCE%TYPE ,
245 p_copy_text IN VARCHAR2 ,
246 p_user_id IN OP_PRCE_EFF.CREATED_BY%TYPE ,
247 p_err_num OUT NOCOPY NUMBER ,
248 p_err_msg OUT NOCOPY VARCHAR2
249 ) IS
250 BEGIN
251 NULL;
252
253 EXCEPTION
254 WHEN OTHERS THEN
255 NULL;
256 END copy_effectivity;
257
258 /*========================================================================+
259 | NAME |
260 | copy_charge_asc |
264 | |
261 | SYNOPSIS |
262 | Creates a new customer-item charge association record for |
263 | line level charges based on existing association. |
265 | PARMS |
266 | p_old_chargeitem_id IN Surrogate for association to be copied from. |
267 | p_charge_id IN Charge surrogate for which |
268 | new association will be created. |
269 | p_copy_text IN Flag to include text in the copy ( Y/N) |
270 | p_user_id IN Applications user id. |
271 | p_err_num OUT If positive, ID of new list; |
272 | else error as described below. |
273 | p_err_msg OUT Error message. |
274 | |
275 | ERROR Codes and messages |
276 | Positive Number : ID of newly created record, no errors. |
277 | Database errors : -1 to -30000 |
278 | User defined :common to the package: -30001 to -30009 |
279 | user defined: Procedure specific : -30050 to -30059 |
280 | |
281 +========================================================================*/
282
283 PROCEDURE copy_charge_asc ( p_old_chargeitem_id IN OP_CHRG_ITM.CHARGEITEM_ID%TYPE ,
284 p_charge_id IN OP_CHRG_ITM.CHARGE_ID%TYPE ,
285 p_copy_text IN VARCHAR2 ,
286 p_user_id IN OP_CHRG_MST.CREATED_BY%TYPE ,
287 p_err_num OUT NOCOPY NUMBER ,
288 p_err_msg OUT NOCOPY VARCHAR2
289 ) IS
290 BEGIN
291 NULL;
292
293 EXCEPTION
294
295 WHEN OTHERS THEN
296 NULL;
297
298 END copy_charge_asc;
299
300 /*========================================================================+
301 | NAME |
302 | copy_text_record |
303 | SYNOPSIS |
304 | Proc copy_text_record |
305 | PARMS |
306 | P_old_text_code IN Old text code to be copied from. |
307 | P_new_text_code IN text code for the new record. |
308 | P_user_id IN Application ser id. |
309 | DESCRIPTION |
310 | |
311 | |
312 +========================================================================*/
313
314 PROCEDURE copy_text_record( p_old_text_code IN OP_TEXT_HDR.TEXT_CODE%TYPE ,
315 p_new_text_code IN OP_TEXT_HDR.TEXT_CODE%TYPE ,
316 p_user_id IN OP_TEXT_HDR.CREATED_BY%TYPE
317 ) IS
318 BEGIN
319 NULL;
320 END copy_text_record;
321
322 /*========================================================================+
323 | NAME |
324 | create_pricelist_id |
325 | SYNOPSIS |
326 | function create_pricelist_id |
327 | DESCRIPTION |
328 | Generates and returns new pricelist_id from the sequence. |
329 +========================================================================*/
330
331 FUNCTION create_pricelist_id RETURN NUMBER IS
332
333 BEGIN
334 NULL;
335 return NULL;
336
337 END create_pricelist_id;
338 /*========================================================================+
339 | NAME |
340 | create_price_id |
341 | SYNOPSIS |
342 | |
343 | DESCRIPTION |
344 | Generates and returns price id from sequence. |
345 +========================================================================*/
346 FUNCTION create_price_id RETURN NUMBER IS
347
348 BEGIN
349 NULL;
350
351 return NULL;
352
353 END create_price_id;
354
355 /*========================================================================+
356 | NAME |
357 | create_breaktype_id |
358 | SYNOPSIS |
362 +========================================================================*/
359 | |
360 | DESCRIPTION |
361 | Generates and returns breaktype_id. |
363 FUNCTION create_breaktype_id RETURN NUMBER IS
364
365 BEGIN
366 NULL;
367
368 return NULL;
369
370 END create_breaktype_id;
371 /*========================================================================+
372 | NAME |
373 | create_priceff_id |
374 | SYNOPSIS |
375 | |
376 | DESCRIPTION |
377 | Generates and returns effectivity id from sequence. |
378 +========================================================================*/
379 FUNCTION create_priceff_id RETURN NUMBER IS
380 BEGIN
381 NULL;
382 return NULL;
383 END create_priceff_id;
384 /*========================================================================+
385 | NAME |
386 | create_charge_id |
387 | SYNOPSIS |
388 | proc create_charge_id |
389 | DESCRIPTION |
390 | generates and returns a new charge_id from the sequence. |
391 +========================================================================*/
392
393 FUNCTION create_charge_id RETURN NUMBER IS
394 BEGIN
395 NULL;
396 return NULL;
397
398 END create_charge_id;
399 /*========================================================================+
400 | NAME |
401 | create_chargitem_id |
402 | SYNOPSIS |
403 | |
404 | DESCRIPTION |
405 | Generates returns a new chargeitem_id from sequence. |
406 +========================================================================*/
407 FUNCTION create_chargeitem_id RETURN NUMBER IS
408 BEGIN
409 NULL;
410
411 return NULL;
412 END create_chargeitem_id;
413
414 /*========================================================================+
415 | NAME |
416 | create_chargebreak_id |
417 | SYNOPSIS |
418 | |
419 | DESCRIPTION |
420 | Generates chargebreak_id. |
421 +========================================================================*/
422
423 FUNCTION create_chargebreak_id RETURN NUMBER IS
424 BEGIN
425
426 return NULL;
427
428 END create_chargebreak_id;
429 /*========================================================================+
430 | NAME |
431 | create_contract_id |
432 | SYNOPSIS |
433 | proc create_contract_id |
434 | DESCRIPTION |
435 | This procedure creates a new contract_id from the sequence. |
436 +========================================================================*/
437
438 FUNCTION create_contract_id RETURN NUMBER IS
439 BEGIN
440 NULL;
441
442 return NULL;
443
444 END create_contract_id;
445 /*========================================================================+
446 | NAME |
447 | create_text_code |
448 | SYNOPSIS |
449 | proc create_text_code |
450 | DESCRIPTION |
451 | This procedure creates a new text_code from the sequence. |
452 +========================================================================*/
453
454 FUNCTION create_text_code RETURN NUMBER IS
455 BEGIN
456
457 NULL;
458
459 return NULL;
460
461 END create_text_code;
462
463 END;