1 PACKAGE BODY jai_general_pkg AS
2 /* $Header: jai_general.plb 120.8 2007/10/01 09:07:31 pramasub ship $ */
3
4 /*----------------------------------------------------------------------------------------------------------------------------
5 CHANGE HISTORY for FILENAME: jai_general_pkg.sql
6 S.No dd/mm/yyyy Author and Details
7 ------------------------------------------------------------------------------------------------------------------------------
8 1 16/07/2004 Vijay Shankar for Bug# 3496408, Version:115.0
9 This Package is coded for Common Procedure/Functions that will be used across localization Product.
10 Different Functions are Packages are available in this Package to make Application coding simple
11
12
13 2 15/12/2004 Vijay Shankar for Bug#4068823, FileVersion:115.1
14 added following new procedures/functions for the purpose of ServiceTax and Education Cess Enhancements
15 - get_accounting_method : Returns the Accounting method corresponding to the Operating Unit
16 - is_item_an_expense : Returns whether item is Expense or not based on Inventory_Item_Flag of Organization Item
17
18 3. 08-Jun-2005 Version 116.2 jai_general -Object is Modified to refer to New DB Entity names in place of Old DB Entity Names
19 as required for CASE COMPLAINCE.
20
21 4. 06-Jul-2005 Sanjikum for Bug#4474501
22 Commented the definition of function get_accounting_method
23
24 5. 03-Feb-2006 avallabh for Bug 4929644. Version 120.2.
25 Removed the definition of function is_orgn_opm_enabled, since it is not used anywhere else. Also removed the
26 definition of function get_accounting_method, so that no unused code is left over.
27
28 DEPENDENCY:
29 -----------
30 IN60105D2 + 3496408
31 IN60106 + 4068823
32
33 3 07/03/2005 Harshita for bug #4245062, FileVersion:115.2
34 Added the function ja_in_vat_assessable_value.
35 This function calculates the vat assessable value for a customer or a vendor.
36 Base bug - #4245089
37
38 DEPENDENCY :
39 ------------
40 4245089
41
42 ----------------------------------------------------------------------------------------------------------------------------*/
43
44
45 /* added by Vijay Shankar for Bug#4068823 */
46 FUNCTION is_item_an_expense(
47 p_organization_id IN NUMBER,
48 p_item_id IN NUMBER
49 ) RETURN VARCHAR2 IS
50
51 CURSOR c_item_flag(cp_organization_id IN NUMBER, cp_item_id IN NUMBER) IS
52 SELECT inventory_item_flag
53 FROM mtl_system_items
54 WHERE organization_id = cp_organization_id
55 AND inventory_item_id = cp_item_id;
56
57 lv_inv_item_flag MTL_SYSTEM_ITEMS.inventory_item_flag%TYPE;
58
59 lv_expense_flag VARCHAR2(1);
60 lv_object_name CONSTANT VARCHAR2 (61) := 'jai_general_pkg.is_item_an_expense';
61
62 BEGIN
63
64 OPEN c_item_flag(p_organization_id, p_item_id);
65 FETCH c_item_flag INTO lv_inv_item_flag;
66 CLOSE c_item_flag;
67
68 IF lv_inv_item_flag = 'Y' THEN
69 lv_expense_flag := 'N';
70 ELSE
71 lv_expense_flag := 'Y';
72 END IF;
73
74 RETURN lv_expense_flag;
75
76 EXCEPTION
77 WHEN OTHERS THEN
78 FND_MESSAGE.SET_NAME('JA','JAI_EXCEPTION_OCCURED');
79 FND_MESSAGE.SET_TOKEN('JAI_PROCESS_MSG', lv_object_name ||'. Err:'||sqlerrm );
80 app_exception.raise_exception;
81 END is_item_an_expense;
82
83 FUNCTION get_fin_year( p_organization_id IN NUMBER) RETURN NUMBER IS
84
85 CURSOR c_active_fin_year IS
86 SELECT max(fin_year) fin_year
87 FROM JAI_CMN_FIN_YEARS
88 WHERE organization_id = p_organization_id
89 AND fin_active_flag = 'Y';
90
91 ln_fin_year NUMBER;
92 lv_object_name CONSTANT VARCHAR2 (61) := 'jai_general_pkg.get_fin_year';
93
94 BEGIN
95 OPEN c_active_fin_year;
96 FETCH c_active_fin_year INTO ln_fin_year;
97 CLOSE c_active_fin_year;
98 RETURN ln_fin_year;
99 EXCEPTION
100 WHEN OTHERS THEN
101 FND_MESSAGE.SET_NAME ('JA','JAI_EXCEPTION_OCCURED');
102 FND_MESSAGE.SET_TOKEN ('JAI_PROCESS_MSG',lv_object_name ||'.Err:'||sqlerrm);
103 app_exception.raise_exception;
104 END get_fin_year;
105
106 PROCEDURE get_range_division (
107 p_vendor_id in number,
108 p_vendor_site_id in number,
109 p_range_no OUT NOCOPY varchar2,
110 p_division_no OUT NOCOPY varchar2
111 ) IS
112
113 CURSOR c_range_division IS
114 SELECT excise_duty_range, excise_duty_division
115 FROM JAI_CMN_VENDOR_SITES
116 WHERE vendor_id = p_vendor_id
117 AND vendor_site_id = p_vendor_site_id;
118 lv_object_name CONSTANT VARCHAR2 (61) := 'jai_general_pkg.get_range_division';
119 BEGIN
120
121 OPEN c_range_division;
122 FETCH c_range_division INTO p_range_no, p_division_no;
123 CLOSE c_range_division;
124 EXCEPTION
125 WHEN OTHERS THEN
126 p_range_no:=null;
127 p_division_no:=null;
128 FND_MESSAGE.SET_NAME ('JA','JAI_EXCEPTION_OCCURED');
129 FND_MESSAGE.SET_TOKEN ('JAI_PROCESS_MSG',lv_object_name ||'.Err:'||sqlerrm);
130 app_exception.raise_exception;
131 END get_range_division;
132
133 FUNCTION get_currency_precision (
134 p_organization_id IN NUMBER
135 ) RETURN NUMBER IS
136
137 CURSOR c_precision IS
138 SELECT nvl(fcl.precision,0)
139 -- FROM fnd_currencies_vl fcl
140 FROM fnd_currencies fcl
141 WHERE fcl.currency_code = 'INR'
142 AND NVL(fcl.enabled_flag, 'N') = 'Y'
143 AND NVL(fcl.currency_flag, 'N') = 'Y'
144 AND NVL(start_date_active, SYSDATE) <= SYSDATE
145 AND NVL(end_date_active, SYSDATE ) >= SYSDATE;
146
147 ln_precision FND_CURRENCIES_VL.precision%TYPE;
148
149 BEGIN
150
151 OPEN c_precision;
152 FETCH c_precision INTO ln_precision;
153 CLOSE c_precision;
154
155 RETURN ln_precision;
156
157 END get_currency_precision;
158
159 FUNCTION get_gl_concatenated_segments(
160 p_code_combination_id IN NUMBER
161 ) RETURN VARCHAR2 IS
162 lv_object_name CONSTANT VARCHAR2 (61) := 'jai_general_pkg.get_gl_concatenated_segments';
163 lv_concatenated_segments GL_CODE_COMBINATIONS_KFV.concatenated_segments%TYPE;
164 CURSOR c_concatenated_segments(cp_code_combination_id IN NUMBER) IS
165 SELECT concatenated_segments
166 FROM gl_code_combinations_kfv
167 WHERE code_combination_id = cp_code_combination_id;
168
169 BEGIN
170
171 OPEN c_concatenated_segments(p_code_combination_id);
172 FETCH c_concatenated_segments INTO lv_concatenated_segments;
173 CLOSE c_concatenated_segments;
174
175 RETURN lv_concatenated_segments;
176 EXCEPTION
177 WHEN OTHERS THEN
178 FND_MESSAGE.SET_NAME ('JA','JAI_EXCEPTION_OCCURED');
179 FND_MESSAGE.SET_TOKEN ('JAI_PROCESS_MSG',lv_object_name ||'.Err:'||sqlerrm);
180 app_exception.raise_exception;
181 END get_gl_concatenated_segments;
182
183 FUNCTION get_organization_code (
184 p_organization_id IN NUMBER
185 ) RETURN VARCHAR2 IS
186 /* Bug 5243532. Added by Lakshmi Gopalsami
187 * Removed the cursor c_fetch_orgn_code which is referring
188 * to org_organization_definitions
189 * and implemented using caching logic.
190 */
191 l_func_curr_det jai_plsql_cache_pkg.func_curr_details;
192 -- End for bug 5243532
193 lv_organization_code ORG_ORGANIZATION_DEFINITIONS.organization_code%TYPE;
194 lv_object_name CONSTANT VARCHAR2 (61) := 'jai_general_pkg.get_organization_code';
195 BEGIN
196
197 l_func_curr_det := jai_plsql_cache_pkg.return_sob_curr
198 (p_org_id => p_organization_id );
199 lv_organization_code := l_func_curr_det.organization_code;
200
201
202 RETURN lv_organization_code;
203 EXCEPTION
204 WHEN OTHERS THEN
205 FND_MESSAGE.SET_NAME ('JA','JAI_EXCEPTION_OCCURED');
206 FND_MESSAGE.SET_TOKEN ('JAI_PROCESS_MSG',lv_object_name ||'.Err:'||sqlerrm);
207 app_exception.raise_exception;
208 END get_organization_code;
209
210 FUNCTION get_rg_register_type(p_item_class IN VARCHAR2) RETURN VARCHAR2 IS
211
212 lv_register_type VARCHAR2(1);
213 lv_object_name CONSTANT VARCHAR2 (61) := 'jai_general_pkg.get_rg_register_type';
214 BEGIN
215
216 /* This procedure should be used only for Receipt Transactions. Because FGIN and FGEX should hit RG1, but incase of RMA Receipt
217 the should hit RG23A Register */
218
219 IF p_item_class IN ('RMIN', 'RMEX', 'CCIN', 'CCEX', 'FGIN', 'FGEX') THEN --narao
220 lv_register_type := 'A';
221 ELSIF p_item_class IN ('CGIN', 'CGEX') THEN
222 lv_register_type := 'C';
223 ELSE
224 lv_register_type := NULL;
225 END IF;
226
227 RETURN lv_register_type;
228 EXCEPTION
229 WHEN OTHERS THEN
230 FND_MESSAGE.SET_NAME ('JA','JAI_EXCEPTION_OCCURED');
231 FND_MESSAGE.SET_TOKEN ('JAI_PROCESS_MSG',lv_object_name ||'.Err:'||sqlerrm);
232 app_exception.raise_exception;
233 END get_rg_register_type;
234
235 FUNCTION get_primary_uom_code(p_organization_id IN NUMBER, p_inventory_item_id IN NUMBER) RETURN VARCHAR2 IS
236
237 CURSOR c_get_primary_uom_code IS
238 SELECT primary_uom_code
239 FROM mtl_system_items
240 WHERE organization_id = p_organization_id
241 AND inventory_item_id = p_inventory_item_id;
242
243 lv_uom_code MTL_SYSTEM_ITEMS.primary_uom_code%TYPE;
244 lv_object_name CONSTANT VARCHAR2 (61) := 'jai_general_pkg.get_primary_uom_code';
245
246 BEGIN
247
248 OPEN c_get_primary_uom_code;
249 FETCH c_get_primary_uom_code INTO lv_uom_code;
250 CLOSE c_get_primary_uom_code;
251
252 RETURN lv_uom_code;
253 EXCEPTION
254 WHEN OTHERS THEN
255 FND_MESSAGE.SET_NAME ('JA','JAI_EXCEPTION_OCCURED');
256 FND_MESSAGE.SET_TOKEN ('JAI_PROCESS_MSG',lv_object_name ||'.Err:'||sqlerrm);
257 app_exception.raise_exception;
258 END get_primary_uom_code;
259
260 FUNCTION get_uom_code(p_uom IN VARCHAR2) RETURN VARCHAR2 IS
261 CURSOR c_uom_code IS
262 SELECT uom_code
263 FROM mtl_units_of_measure
264 WHERE unit_of_measure = p_uom;
265
266 lv_uom_code MTL_UNITS_OF_MEASURE.uom_code%TYPE;
267 lv_object_name CONSTANT VARCHAR2 (61) := 'jai_general_pkg.get_uom_code';
268
269 BEGIN
270 OPEN c_uom_code;
271 FETCH c_uom_code INTO lv_uom_code;
272 CLOSE c_uom_code;
273
274 RETURN lv_uom_code;
275
276 EXCEPTION
277 WHEN OTHERS THEN
278 FND_MESSAGE.SET_NAME ('JA','JAI_EXCEPTION_OCCURED');
279 FND_MESSAGE.SET_TOKEN ('JAI_PROCESS_MSG',lv_object_name ||'.Err:'||sqlerrm);
280 app_exception.raise_exception;
281 END get_uom_code;
282
283 FUNCTION get_orgn_master_flag(p_organization_id IN NUMBER, p_location_id IN NUMBER) RETURN VARCHAR2 IS
284
285 CURSOR c_master_flag IS
286 SELECT master_org_flag
287 FROM JAI_CMN_INVENTORY_ORGS
288 WHERE organization_id = p_organization_id
289 AND location_id = p_location_id;
290
291 lv_master_flag JAI_CMN_INVENTORY_ORGS.master_org_flag%TYPE;
292 lv_object_name CONSTANT VARCHAR2 (61) := 'jai_general_pkg.get_orgn_master_flag';
293 BEGIN
294 OPEN c_master_flag;
295 FETCH c_master_flag INTO lv_master_flag;
296 CLOSE c_master_flag;
297
298 RETURN lv_master_flag;
299 EXCEPTION
300 WHEN OTHERS THEN
301 FND_MESSAGE.SET_NAME ('JA','JAI_EXCEPTION_OCCURED');
302 FND_MESSAGE.SET_TOKEN ('JAI_PROCESS_MSG',lv_object_name ||'.Err:'||sqlerrm);
303 app_exception.raise_exception;
304 END get_orgn_master_flag;
305
306 FUNCTION get_matched_boe_no(
307 p_transaction_id IN NUMBER
308 ) RETURN VARCHAR2 IS
309 lv_boe_no VARCHAR2(150); -- := ''; --rpokkula for File.Sql.35
310 lv_object_name CONSTANT VARCHAR2 (61) := 'jai_general_pkg.get_matched_boe_no';
311 BEGIN
312
313 lv_boe_no := ''; --rpokkula for File.Sql.35
314
315 FOR r_boe IN (SELECT boe_id FROM JAI_CMN_BOE_MATCHINGS
316 WHERE transaction_id = p_transaction_id)
317 LOOP
318 IF NVL(length(lv_boe_no), 0) <= 135 THEN
319 lv_boe_no := lv_boe_no||to_char(r_boe.boe_id)||'/';
320 END IF;
321 END LOOP;
322
323 lv_boe_no := Rtrim(lv_boe_no, '/');
324
325 RETURN lv_boe_no;
326 EXCEPTION
327 WHEN OTHERS THEN
328 FND_MESSAGE.SET_NAME ('JA','JAI_EXCEPTION_OCCURED');
329 FND_MESSAGE.SET_TOKEN ('JAI_PROCESS_MSG',lv_object_name ||'.Err:'||sqlerrm);
330 app_exception.raise_exception;
331 END get_matched_boe_no;
332
333 FUNCTION trxn_to_primary_conv_rate(
334 p_transaction_uom_code IN MTL_UNITS_OF_MEASURE.uom_code%TYPE,
335 p_primary_uom_code IN MTL_UNITS_OF_MEASURE.uom_code%TYPE,
336 p_inventory_item_id IN MTL_SYSTEM_ITEMS.inventory_item_id%TYPE
337 ) RETURN NUMBER IS
338 vTransToPrimaryUOMConv NUMBER;
339 lv_object_name CONSTANT VARCHAR2 (61) := 'jai_general_pkg.trxn_to_primary_conv_rate';
340 BEGIN
341
342 IF p_transaction_uom_code <> p_primary_uom_code THEN
343 INV_CONVERT.inv_um_conversion(
344 p_transaction_uom_code, p_primary_uom_code,
345 p_inventory_item_id, vTransToPrimaryUOMConv
346 );
347
348 IF nvl(vTransToPrimaryUOMConv, 0) <= 0 THEN
349 INV_CONVERT.inv_um_conversion(
350 p_transaction_uom_code, p_primary_uom_code,
351 0, vTransToPrimaryUOMConv
352 );
353 IF nvl(vTransToPrimaryUOMConv, 0) <= 0 THEN
354 vTransToPrimaryUOMConv := 1;
355 END IF;
356 END IF;
357
358 ELSE
359 vTransToPrimaryUOMConv := 1;
360 END IF;
361
362 RETURN vTransToPrimaryUOMConv;
363 EXCEPTION
364 WHEN OTHERS THEN
365 FND_MESSAGE.SET_NAME ('JA','JAI_EXCEPTION_OCCURED');
366 FND_MESSAGE.SET_TOKEN ('JAI_PROCESS_MSG',lv_object_name ||'.Err:'||sqlerrm);
367 app_exception.raise_exception;
368 END trxn_to_primary_conv_rate;
369
370 FUNCTION get_last_record_of_rg(
371 p_register_name IN VARCHAR2,
372 p_organization_id IN NUMBER,
373 p_location_id IN NUMBER,
374 p_inventory_item_id IN NUMBER,
375 p_fin_year IN NUMBER DEFAULT NULL
376 ) RETURN NUMBER IS
377
378 -- RG23 Part I
379 CURSOR c_rg23_part1(cp_register_type IN VARCHAR2, cp_fin_year IN NUMBER) IS
380 SELECT register_id FROM JAI_CMN_RG_23AC_I_TRXS
381 WHERE organization_id = p_organization_id
382 AND location_id = p_location_id
383 AND register_type = cp_register_type
384 AND inventory_item_id = p_inventory_item_id
385 AND fin_year = cp_fin_year
386 AND slno = (select max(slno) from JAI_CMN_RG_23AC_I_TRXS
387 WHERE organization_id = p_organization_id
388 AND location_id = p_location_id
389 AND register_type = cp_register_type
390 AND inventory_item_id = p_inventory_item_id
391 AND fin_year = cp_fin_year);
392
393 -- RG1
394 CURSOR c_rg1(cp_fin_year IN NUMBER) IS
395 SELECT register_id FROM JAI_CMN_RG_I_TRXS
396 WHERE organization_id = p_organization_id
397 AND location_id = p_location_id
398 AND inventory_item_id = p_inventory_item_id
399 AND fin_year = cp_fin_year
400 AND slno = (select max(slno) from JAI_CMN_RG_I_TRXS
401 WHERE organization_id = p_organization_id
402 AND location_id = p_location_id
403 AND inventory_item_id = p_inventory_item_id
404 AND fin_year = cp_fin_year);
405
406 -- RG23D
407 CURSOR c_rg23d(cp_fin_year IN NUMBER) IS
408 SELECT register_id FROM JAI_CMN_RG_23D_TRXS
409 WHERE organization_id = p_organization_id
410 AND location_id = p_location_id
411 AND inventory_item_id = p_inventory_item_id
412 AND fin_year = cp_fin_year
413 AND slno = (select max(slno) from JAI_CMN_RG_23D_TRXS
414 WHERE organization_id = p_organization_id
415 AND location_id = p_location_id
416 AND inventory_item_id = p_inventory_item_id
417 AND fin_year = cp_fin_year);
418
419 -- RG23 Part II
420 CURSOR c_rg23_part2(cp_register_type IN VARCHAR2, cp_fin_year IN NUMBER) IS
421 SELECT register_id FROM JAI_CMN_RG_23AC_II_TRXS
422 WHERE organization_id = p_organization_id
423 AND location_id = p_location_id
424 AND register_type = cp_register_type
425 AND fin_year = cp_fin_year
426 AND slno = (select max(slno) from JAI_CMN_RG_23AC_II_TRXS
427 WHERE organization_id = p_organization_id
428 AND location_id = p_location_id
429 AND register_type = cp_register_type
430 AND fin_year = cp_fin_year);
431
432 -- PLA
433 CURSOR c_pla(cp_fin_year IN NUMBER) IS
434 SELECT register_id FROM JAI_CMN_RG_PLA_TRXS
435 WHERE organization_id = p_organization_id
436 AND location_id = p_location_id
437 AND fin_year = cp_fin_year
438 AND slno = (select max(slno) from JAI_CMN_RG_PLA_TRXS
439 WHERE organization_id = p_organization_id
440 AND location_id = p_location_id
441 AND fin_year = cp_fin_year);
442
443 lv_register_type VARCHAR2(1);
444 ln_register_id NUMBER;
445 ln_fin_year NUMBER(4);
446 ln_prev_fin_year NUMBER(4);
447 lv_object_name CONSTANT VARCHAR2 (61) := 'jai_general_pkg.get_last_record_of_rg';
448 BEGIN
449
450 IF p_fin_year IS NULL THEN
451 ln_fin_year := jai_general_pkg.get_fin_year(p_organization_id);
452 ELSE
453 ln_fin_year := p_fin_year;
454 END IF;
455 ln_prev_fin_year := ln_fin_year - 1;
456
457 IF p_register_name IN ('RG23A_1', 'RG23A_2') THEN
458 lv_register_type := 'A';
459 ELSIF p_register_name IN ('RG23C_1', 'RG23C_2') THEN
460 lv_register_type := 'C';
461 END IF;
462
463 IF p_register_name IN ('RG23A_1', 'RG23C_1') THEN
464 OPEN c_rg23_part1(lv_register_type, ln_fin_year);
465 FETCH c_rg23_part1 INTO ln_register_id;
466 CLOSE c_rg23_part1;
467 IF ln_register_id IS NULL THEN
468 OPEN c_rg23_part1(lv_register_type, ln_prev_fin_year);
469 FETCH c_rg23_part1 INTO ln_register_id;
470 CLOSE c_rg23_part1;
471 END IF;
472
473 ELSIF p_register_name = 'RG1' THEN
474 OPEN c_rg1(ln_fin_year);
475 FETCH c_rg1 INTO ln_register_id;
476 CLOSE c_rg1;
477 IF ln_register_id IS NULL THEN
478 OPEN c_rg1(ln_prev_fin_year);
479 FETCH c_rg1 INTO ln_register_id;
480 CLOSE c_rg1;
481 END IF;
482
483 ELSIF p_register_name = 'RG23D' THEN
484 OPEN c_rg23d(ln_fin_year);
485 FETCH c_rg23d INTO ln_register_id;
486 CLOSE c_rg23d;
487 IF ln_register_id IS NULL THEN
488 OPEN c_rg23d(ln_prev_fin_year);
489 FETCH c_rg23d INTO ln_register_id;
490 CLOSE c_rg23d;
491 END IF;
492
493 ELSIF p_register_name IN ('RG23A_2', 'RG23C_2') THEN
494 OPEN c_rg23_part2(lv_register_type, ln_fin_year);
495 FETCH c_rg23_part2 INTO ln_register_id;
496 CLOSE c_rg23_part2;
497 IF ln_register_id IS NULL THEN
498 OPEN c_rg23_part2(lv_register_type, ln_prev_fin_year);
499 FETCH c_rg23_part2 INTO ln_register_id;
500 CLOSE c_rg23_part2;
501 END IF;
502
503 ELSIF p_register_name = 'PLA' THEN
504 OPEN c_pla(ln_fin_year);
505 FETCH c_pla INTO ln_register_id;
506 CLOSE c_pla;
507 IF ln_register_id IS NULL THEN
508 OPEN c_pla(ln_prev_fin_year);
509 FETCH c_pla INTO ln_register_id;
510 CLOSE c_pla;
511 END IF;
512
513 END IF;
514
515 RETURN ln_register_id;
516 EXCEPTION
517 WHEN OTHERS THEN
518 FND_MESSAGE.SET_NAME ('JA','JAI_EXCEPTION_OCCURED');
519 FND_MESSAGE.SET_TOKEN ('JAI_PROCESS_MSG',lv_object_name ||'.Err:'||sqlerrm);
520 app_exception.raise_exception;
521 END get_last_record_of_rg;
522
523 PROCEDURE update_rg_balances(
524 p_organization_id IN NUMBER,
525 p_location_id IN NUMBER,
526 p_register IN VARCHAR2,
527 p_amount IN NUMBER,
528 p_transaction_source IN VARCHAR2,
529 p_called_from IN VARCHAR2
530 ) IS
531
532 ln_rg23a_amount NUMBER;
533 ln_rg23c_amount NUMBER;
534 ln_pla_amount NUMBER;
535 lv_object_name CONSTANT VARCHAR2 (61) := 'jai_general_pkg.update_rg_balances';
536
537 BEGIN
538
539 IF p_register = 'A' THEN
540 ln_rg23a_amount := p_amount;
541 ln_rg23c_amount := 0;
542 ln_pla_amount := 0;
543 ELSIF p_register = 'C' THEN
544 ln_rg23a_amount := 0;
545 ln_rg23c_amount := p_amount;
546 ln_pla_amount := 0;
547 ELSIF p_register = 'PLA' THEN
548 ln_rg23a_amount := 0;
549 ln_rg23c_amount := 0;
550 ln_pla_amount := p_amount;
551 ELSE
552 ln_rg23a_amount := 0;
553 ln_rg23c_amount := 0;
554 ln_pla_amount := 0;
555 END IF;
556
557 UPDATE JAI_CMN_RG_BALANCES
558 SET rg23a_balance = nvl(rg23a_balance,0) + ln_rg23a_amount,
559 rg23c_balance = nvl(rg23c_balance,0) + ln_rg23c_amount,
560 pla_balance = nvl(pla_balance,0) + ln_pla_amount
561 WHERE organization_id = p_location_id
562 AND location_id = p_location_id;
563 EXCEPTION
564 WHEN OTHERS THEN
565 FND_MESSAGE.SET_NAME ('JA','JAI_EXCEPTION_OCCURED');
566 FND_MESSAGE.SET_TOKEN ('JAI_PROCESS_MSG',lv_object_name ||'.Err:'||sqlerrm);
567 app_exception.raise_exception;
568 END update_rg_balances;
569
570 function plot_codepath
571 (
572 p_statement_id in varchar2,
573 p_codepath in varchar2,
574 p_calling_procedure in varchar2 default null,
575 p_special_call in varchar2 default null
576 )
577 return varchar2
578 IS
579 -- Bug 5581319. Set the length to 1996 instead of 2000
580
581 lv_size_of_codepath number:= 1996;
582 lv_codepath VARCHAR2(1996);
583
584 lv_mesg varchar2(200); -- := ''; --rpokkula for File.Sql.35
585 ln_tot_length number;
586 begin
587 lv_mesg := ''; --rpokkula for File.Sql.35
588 -- P1 bug5243532 commented the following assignment.
589 -- lv_codepath := p_codepath;
590
591 if p_special_call = 'START' then
592 lv_mesg := lv_mesg || '>>' || nvl(p_calling_procedure, ' ') || '~';
593 end if;
594
595 lv_mesg := lv_mesg || ':' || NVL(p_statement_id, '0');
596
597 if p_special_call = 'END' then
598 lv_mesg := lv_mesg || '<<' ;
599 end if;
600
601 -- P1 bug . changed to p_codepath instead of lv_codepath.
602
603 ln_tot_length := length(p_codepath) + length(lv_mesg);
604
605 if ln_tot_length > lv_size_of_codepath then
606 lv_codepath := substr(p_codepath, ln_tot_length-lv_size_of_codepath +1 );
607
608 ELSE
609 /* Bug 5243532. Added by Lakshmi Gopalsami
610 | Assigned the same value of p_codepath if the length is not exceeding.
611 */
612 lv_codepath := p_codepath;
613 END IF ;
614
615 lv_codepath := lv_codepath ||lv_mesg;
616
617 return lv_codepath;
618
619 exception
620 when others then
621 FND_FILE.put_line( FND_FILE.log, '/////// Error IN GENERAL_PKG.plot_codepath. lv_mesg'||lv_mesg);
622
623 lv_codepath := 'Exception in plot_codepath :' || sqlerrm || '/' || lv_codepath;
624 return lv_codepath;
625 end plot_codepath;
626
627
628
629 FUNCTION ja_in_vat_assessable_value(
630 p_party_id IN NUMBER,
631 p_party_site_id IN NUMBER,
632 p_inventory_item_id IN NUMBER,
633 p_uom_code IN VARCHAR2,
634 p_default_price IN NUMBER,
635 p_ass_value_date IN DATE, -- DEFAULT SYSDATE, -- Added global variable gd_ass_value_date in package spec. by rpokkula for File.Sql.35
636 p_party_type IN VARCHAR2
637 ) RETURN NUMBER IS
638
639 ------------------------------------------------Cursors for Customer------------------------------------------
640
641 CURSOR address_cur( p_party_site_id IN NUMBER )
642 IS
643 SELECT NVL(cust_acct_site_id, 0) address_id
644 FROM hz_cust_site_uses_all A -- Removed ra_site_uses_all for Bug# 4434287
645 WHERE A.site_use_id = NVL(p_party_site_id,0);
646
647 /*
648 Get the assessable Value based on the Customer Id, Address Id, inventory_item_id, uom code, ,Ordered date.
649 Exact Match condition
650 */
651 CURSOR c_vat_ass_value_cust
652 ( p_party_id NUMBER ,
653 p_address_id NUMBER ,
654 p_inventory_item_id NUMBER ,
655 p_uom_code VARCHAR2,
656 p_ordered_date DATE
657 )
658 IS
659 SELECT
660 b.operand list_price,
661 c.product_uom_code list_price_uom_code
662 FROM
663 JAI_CMN_CUS_ADDRESSES a,
664 qp_list_lines b,
665 qp_pricing_attributes c
666 WHERE
667 a.customer_id = p_party_id AND
668 a.address_id = p_address_id AND
669 a.vat_price_list_id = b.LIST_header_ID AND
670 c.list_line_id = b.list_line_id AND
671 c.product_attr_value = to_char(p_inventory_item_id) AND
672 c.product_uom_code = p_uom_code AND
673 p_ordered_date BETWEEN nvl( start_date_active, p_ordered_date) AND
674 nvl( end_date_active, SYSDATE);
675
676 /*
677 Get the assessable Value based on the Customer Id, Address Id, inventory_item_id, Ordered date.
678 Exact Match condition
679 */
680 CURSOR c_vat_ass_value_pri_uom_cust(
681 p_party_id NUMBER,
682 p_address_id NUMBER,
683 p_inventory_item_id NUMBER,
684 p_ordered_date DATE
685 )
686 IS
687 SELECT
688 b.operand list_price,
689 c.product_uom_code list_price_uom_code
690 FROM
691 JAI_CMN_CUS_ADDRESSES a,
692 qp_list_lines b,
693 qp_pricing_attributes c
694 WHERE
695 a.customer_id = p_party_id AND
696 a.address_id = p_address_id AND
697 a.vat_price_list_id = b.list_header_id AND
698 c.list_line_id = b.list_line_id AND
699 c.product_attr_value = to_char(p_inventory_item_id) AND
700 trunc(nvl(b.end_date_active,sysdate)) >= trunc(p_ordered_date) AND
701 nvl(primary_uom_flag,'N') ='Y';
702
703 CURSOR c_vat_ass_value_other_uom_cust
704 (
705 p_party_id NUMBER,
706 p_address_id NUMBER,
707 p_inventory_item_id NUMBER,
708 p_ordered_date DATE
709 )
710 IS
711 SELECT
712 b.operand list_price,
713 c.product_uom_code list_price_uom_code
714 FROM
715 JAI_CMN_CUS_ADDRESSES a,
716 qp_list_lines b,
717 qp_pricing_attributes c
718 WHERE
719 a.customer_id = p_party_id AND
720 a.address_id = p_address_id AND
721 a.vat_price_list_id = b.LIST_header_ID AND
722 c.list_line_id = b.list_line_id AND
723 c.PRODUCT_ATTR_VALUE = TO_CHAR(p_inventory_item_id) AND
724 NVL(b.end_date_active,SYSDATE) >= p_ordered_date;
725 -------------------------------------end, cursors for customer------------------------------------------------------
726
727 ----------------------------------------cursors for vendor--------------------------------------------------
728
729 /*
730 Get the assessable Value based on the Customer Id, Address Id, inventory_item_id, uom code, ,Ordered date.
731 Exact Match condition
732 */
733 CURSOR c_vat_ass_value_vend
734 ( p_vendor_id NUMBER ,
735 p_address_id NUMBER ,
736 p_inventory_item_id NUMBER ,
737 p_uom_code VARCHAR2,
738 p_ordered_date DATE
739 )
740 IS
741 SELECT
742 b.operand list_price,
743 c.product_uom_code list_price_uom_code
744 FROM
745 JAI_CMN_VENDOR_SITES a,
746 qp_list_lines b,
747 qp_pricing_attributes c
748 WHERE
749 a.vendor_id = p_vendor_id AND
750 a.vendor_site_id = p_address_id AND
751 a.vat_price_list_id = b.LIST_header_ID AND
752 c.list_line_id = b.list_line_id AND
753 c.product_attr_value = to_char(p_inventory_item_id) AND
754 c.product_uom_code = p_uom_code AND
755 p_ordered_date BETWEEN nvl( start_date_active, p_ordered_date) AND
756 nvl( end_date_active, SYSDATE);
757
758 /*
759 Get the assessable Value based on the Customer Id, Address Id, inventory_item_id, Ordered date.
760 Exact Match condition
761 */
762
763 CURSOR c_vat_ass_value_pri_uom_vend(
764 p_vendor_id NUMBER,
765 p_address_id NUMBER,
766 p_inventory_item_id NUMBER,
767 p_ordered_date DATE
768 )
769 IS
770 SELECT
771 b.operand list_price,
772 c.product_uom_code list_price_uom_code
773 FROM
774 JAI_CMN_VENDOR_SITES a,
775 qp_list_lines b,
776 qp_pricing_attributes c
777 WHERE
778 a.vendor_id = p_vendor_id AND
779 a.vendor_site_id = p_address_id AND
780 a.vat_price_list_id = b.list_header_id AND
781 c.list_line_id = b.list_line_id AND
782 c.product_attr_value = to_char(p_inventory_item_id) AND
783 trunc(nvl(b.end_date_active,sysdate)) >= trunc(p_ordered_date) AND
784 nvl(primary_uom_flag,'N') ='Y';
785
786 CURSOR c_vat_ass_value_other_uom_vend
787 (
788 p_vendor_id NUMBER,
789 p_address_id NUMBER,
790 p_inventory_item_id NUMBER,
791 p_ordered_date DATE
792 )
793 IS
794 SELECT
795 b.operand list_price,
796 c.product_uom_code list_price_uom_code
797 FROM
798 JAI_CMN_VENDOR_SITES a,
799 qp_list_lines b,
800 qp_pricing_attributes c
801 WHERE
802 a.vendor_id = p_vendor_id AND
803 a.vendor_site_id = p_address_id AND
804 a.vat_price_list_id = b.LIST_header_ID AND
805 c.list_line_id = b.list_line_id AND
806 c.PRODUCT_ATTR_VALUE = TO_CHAR(p_inventory_item_id) AND
807 NVL(b.end_date_active,SYSDATE) >= p_ordered_date;
808
809 --------------------------------end, cursors for vendor--------------------------------------------------
810 v_primary_uom_code qp_pricing_attributes.product_uom_code%type;
811 v_other_uom_code qp_pricing_attributes.product_uom_code%type;
812
813 v_debug CHAR(1); -- := 'N'; --rpokkula for File.Sql.35
814 v_address_id NUMBER;
815 v_assessable_value NUMBER;
816 v_conversion_rate NUMBER;
817 v_price_list_uom_code CHAR(4);
818 lv_object_name CONSTANT VARCHAR2 (61) := 'jai_general_pkg.ja_in_vat_assessable_value';
819
820 BEGIN
821 /*----------------------------------------------------------------------------------------------------------------------------
822 CHANGE HISTORY :
823
824
825 Future Dependencies For the release Of this Object:-
826 (Please add a row in the section below only if your bug introduces a dependency due to spec change/ A new call to a object/
827 A datamodel change )
828
829 ----------------------------------------------------------------------------------------------------------------------------------------------------
830 Current Version Current Bug Dependent Files Version Author Date Remarks
831 Of File On Bug/Patchset Dependent On
832
833 ----------------------------------------------------------------------------------------------------------------------------------------------------
834
835
836 ----------------------------------------------------------------------------------------------------------------------------------------------------*/
837 v_debug := jai_constants.NO ; --rpokkula for File.Sql.35
838
839 IF p_party_type = 'C' THEN --- Processing for Customer
840
841 /******************************** Part 1 Get Customer address id ******************************/
842 OPEN address_cur(p_party_site_id);
843 FETCH address_cur INTO v_address_id;
844 CLOSE address_cur;
845
846
847 IF v_debug = 'Y' THEN
848 fnd_file.put_line(fnd_file.log, 'v_address_id -> '|| v_address_id);
849 END IF;
850
851
852 ----------------------------------------------------------------------------------------------------------
853 /*
854 --Assessable Value Fetching Logic is based upon the following logic now.....
855 --Each Logic will come into picture only if the preceding one does not get any value.
856 --1. Assessable Value is picked up for the Customer Id, Address Id, UOM Code, inventory_item_id,Assessable value date
857 --2. Assessable Value is picked up for the Customer Id, Null Site, UOM Code, Assessable value date
858
859 --3. Assessable Value and Primary UOM is picked up for the Customer Id, Address Id, inventory_item_id, Assessable value date
860 for the Primary UOM defined in Price List.
861 Then Inv_convert.Inv_um_conversion is called and the UOM rate is calculated and is included
862 as the product of the Assessable value.
863 --4. Assessable Value is picked up for the Customer Id, Address Id, inventory_item_id, Assessable value date
864 on a first come first serve basis.
865 --5. If all the above are not found then the initial logic of picking up the Assessable value is followed (Unit selling price)
866 and then inv_convert.inv_um_conversion is called and the UOM rate is calculated and is included
867 as the product of the Assessable value.
868 */
869 ----------------------------------------------------------------------------------------------------------
870
871 /********************************************* Part 2 ****************************************/
872
873 /*
874 Get the Assessable Value based on the Customer Id, Address Id, UOM Code, inventory_item_id,Ordered date
875 Exact Match condition.
876 */
877
878 -- Fetch Assessable Price List Value for the given Customer and Location Combination
879 OPEN c_vat_ass_value_cust( p_party_id, v_address_id, p_inventory_item_id, p_uom_code, trunc(p_ass_value_date));
880 FETCH c_vat_ass_value_cust INTO v_assessable_value, v_price_list_uom_code;
881 CLOSE c_vat_ass_value_cust;
882
883 /********************************************* Part 3 ****************************************/
884
885 /*
886 Get the Assessable Value based on the Customer Id, Null Site, UOM Code, inventory_item_id,Ordered date
887 Null Site condition.
888 */
889
890 IF v_assessable_value IS NULL THEN
891
892 IF v_debug = 'Y' THEN
893 fnd_file.put_line(fnd_file.log,' Inside IF OF v_assessable_value IS NULL ');
894 END IF;
895
896 -- Fetch Assessable Price List Value for the
897 -- given Customer and NULL LOCATION Combination
898 OPEN c_vat_ass_value_cust( p_party_id, 0, p_inventory_item_id, p_uom_code, trunc(p_ass_value_date) );
899 FETCH c_vat_ass_value_cust INTO v_assessable_value, v_price_list_uom_code;
900 CLOSE c_vat_ass_value_cust;
901
902 END IF;
903
904 IF v_debug = 'Y' THEN
905 fnd_file.put_line(fnd_file.log, '2 v_assessable_value -> '||v_assessable_value||', v_price_list_uom_code -> '||v_price_list_uom_code);
906 END IF;
907
908 /********************************************* Part 4 ****************************************/
909
910 /*
911 Get the Assessable Value based on the Customer Id, Address id, inventory_item_id,primary_uom_code and Ordered date
912 Primary UOM condition.
913 */
914
915
916 IF v_assessable_value is null THEN
917
918 open c_vat_ass_value_pri_uom_cust
919 (
920 p_party_id,
921 v_address_id,
922 p_inventory_item_id,
923 trunc(p_ass_value_date)
924 );
925 fetch c_vat_ass_value_pri_uom_cust into v_assessable_value,v_primary_uom_code;
926 close c_vat_ass_value_pri_uom_cust;
927
928 IF v_primary_uom_code is not null THEN
929
930 inv_convert.inv_um_conversion
931 (
932 p_uom_code,
933 v_primary_uom_code,
934 p_inventory_item_id,
935 v_conversion_rate
936 );
937
938
939 IF nvl(v_conversion_rate, 0) <= 0 THEN
940 Inv_Convert.inv_um_conversion( p_uom_code, v_primary_uom_code, 0, v_conversion_rate );
941 IF NVL(v_conversion_rate, 0) <= 0 THEN
942 v_conversion_rate := 0;
943 END IF;
944 END IF;
945
946 v_assessable_value := NVL(v_assessable_value,0) * v_conversion_rate;
947
948 ELSE
949 /* Primary uom code setup not found for the customer id, address id, inventory_item_id and ordered_date.
950 Get the assessable value for a combination of customer id, address id, inventory_item_id
951 and ordered_date. Pick up the assessable value by first come first serve basis.
952 */
953
954 OPEN c_vat_ass_value_other_uom_cust
955 (
956 p_party_id,
957 v_address_id,
958 p_inventory_item_id,
959 trunc(p_ass_value_date)
960 );
961 FETCH c_vat_ass_value_other_uom_cust into v_assessable_value,v_other_uom_code;
962 CLOSE c_vat_ass_value_other_uom_cust;
963
964 IF v_other_uom_code is not null THEN
965 inv_convert.inv_um_conversion
966 (
967 p_uom_code,
968 v_other_uom_code,
969 p_inventory_item_id,
970 v_conversion_rate
971 );
972
973 IF nvl(v_conversion_rate, 0) <= 0 THEN
974
975 Inv_Convert.inv_um_conversion( p_uom_code, v_primary_uom_code, 0, v_conversion_rate );
976
977 IF NVL(v_conversion_rate, 0) <= 0 THEN
978 v_conversion_rate := 0;
979 END IF;
980 END IF;
981 v_assessable_value := NVL(v_assessable_value,0) * v_conversion_rate;
982
983 END IF; --end if for v_other_uom_code is not null
984 END IF; --end if for v_primary_uom_code is not null
985 END IF; --end if for v_assessable_value
986 --Ends here..........................
987 IF nvl(v_assessable_value,0) =0 THEN
988 IF v_debug = 'Y' THEN
989 fnd_file.put_line(fnd_file.log,' No Assessable value is defined, so default price is returning back ');
990 END IF;
991
992 v_assessable_value := NVL(p_default_price, 0);
993 END IF;
994
995 RETURN v_assessable_value;
996
997 ELSIF p_party_type = 'V' THEN -- Processing for vendor
998
999 /******************************** Part 1 Get Vendor address id ******************************/
1000 ----------------------------------------------------------------------------------------------------------
1001 /*
1002 --Assessable Value Fetching Logic is based upon the following logic now.....
1003 --Each Logic will come into picture only if the preceding one does not get any value.
1004 --1. Assessable Value is picked up for the Vendor Id, Address Id, UOM Code, inventory_item_id,Assessable value date
1005 --2. Assessable Value is picked up for the Vendor Id, Null Site, UOM Code, Assessable value date
1006
1007 --3. Assessable Value and Primary UOM is picked up for the Vendor Id, Address Id, inventory_item_id, Assessable value date
1008 for the Primary UOM defined in Price List.
1009 Then Inv_convert.Inv_um_conversion is called and the UOM rate is calculated and is included
1010 as the product of the Assessable value.
1011 --4. Assessable Value is picked up for the Vendor Id, Address Id, inventory_item_id, Assessable value date
1012 on a first come first serve basis.
1013 --5. If all the above are not found then the initial logic of picking up the Assessable value is followed (Unit selling price)
1014 and then inv_convert.inv_um_conversion is called and the UOM rate is calculated and is included
1015 as the product of the Assessable value.
1016 */
1017 ----------------------------------------------------------------------------------------------------------
1018
1019 /********************************************* Part 2 ****************************************/
1020
1021 /*
1022 Get the Assessable Value based on the Vendor Id, Address Id, UOM Code, inventory_item_id,Ordered date
1023 Exact Match condition.
1024 */
1025
1026 -- Fetch Assessable Price List Value for the given Vendor and Location Combination
1027 OPEN c_vat_ass_value_vend( p_party_id, p_party_site_id, p_inventory_item_id, p_uom_code, trunc(p_ass_value_date));
1028 FETCH c_vat_ass_value_vend INTO v_assessable_value, v_price_list_uom_code;
1029 CLOSE c_vat_ass_value_vend;
1030
1031 /********************************************* Part 3 ****************************************/
1032
1033 /*
1034 Get the Assessable Value based on the vendor Id, Null Site, UOM Code, inventory_item_id,Ordered date
1035 Null Site condition.
1036 */
1037
1038 IF v_assessable_value IS NULL THEN
1039
1040 IF v_debug = 'Y' THEN
1041 fnd_file.put_line(fnd_file.log,' Inside IF OF v_assessable_value IS NULL ');
1042 END IF;
1043
1044 -- Fetch Assessable Price List Value for the
1045 -- given Vendor and NULL LOCATION Combination
1046 /*OPEN c_vat_ass_value_cust( p_party_id, 0, p_inventory_item_id, p_uom_code, trunc(p_ass_value_date) );
1047 FETCH c_vat_ass_value_cust INTO v_assessable_value, v_price_list_uom_code;
1048 CLOSE c_vat_ass_value_cust;*/ -- commented the above three lines for bug #6445020
1049 -- and introduced the following three lines(rchandan)
1050 OPEN c_vat_ass_value_vend( p_party_id, 0, p_inventory_item_id, p_uom_code, trunc(p_ass_value_date) );
1051 FETCH c_vat_ass_value_vend INTO v_assessable_value, v_price_list_uom_code;
1052 CLOSE c_vat_ass_value_vend;
1053
1054 END IF;
1055
1056 IF v_debug = 'Y' THEN
1057 fnd_file.put_line(fnd_file.log, '2 v_assessable_value -> '||v_assessable_value||', v_price_list_uom_code -> '||v_price_list_uom_code);
1058 END IF;
1059
1060 /********************************************* Part 4 ****************************************/
1061
1062 /*
1063 Get the Assessable Value based on the Vendor Id, Address id, inventory_item_id,primary_uom_code and Ordered date
1064 Primary UOM condition.
1065 */
1066
1067
1068 IF v_assessable_value is null THEN
1069
1070 open c_vat_ass_value_pri_uom_vend
1071 (
1072 p_party_id,
1073 p_party_site_id,
1074 p_inventory_item_id,
1075 trunc(p_ass_value_date)
1076 );
1077 fetch c_vat_ass_value_pri_uom_vend into v_assessable_value,v_primary_uom_code;
1078 close c_vat_ass_value_pri_uom_vend;
1079
1080 IF v_primary_uom_code is not null THEN
1081
1082 inv_convert.inv_um_conversion
1083 (
1084 p_uom_code,
1085 v_primary_uom_code,
1086 p_inventory_item_id,
1087 v_conversion_rate
1088 );
1089
1090
1091 IF nvl(v_conversion_rate, 0) <= 0 THEN
1092 Inv_Convert.inv_um_conversion( p_uom_code, v_primary_uom_code, 0, v_conversion_rate );
1093 IF NVL(v_conversion_rate, 0) <= 0 THEN
1094 v_conversion_rate := 0;
1095 END IF;
1096 END IF;
1097
1098 v_assessable_value := NVL(v_assessable_value,0) * v_conversion_rate;
1099
1100 ELSE
1101 /* Primary uom code setup not found for the Vendor id, address id, inventory_item_id and ordered_date.
1102 Get the assessable value for a combination of Vendor id, address id, inventory_item_id
1103 and ordered_date. Pick up the assessable value by first come first serve basis.
1104 */
1105
1106 OPEN c_vat_ass_value_other_uom_vend
1107 (
1108 p_party_id,
1109 p_party_site_id,
1110 p_inventory_item_id,
1111 trunc(p_ass_value_date)
1112 );
1113 FETCH c_vat_ass_value_other_uom_vend into v_assessable_value,v_other_uom_code;
1114 CLOSE c_vat_ass_value_other_uom_vend;
1115
1116 IF v_other_uom_code is not null THEN
1117 inv_convert.inv_um_conversion
1118 (
1119 p_uom_code,
1120 v_other_uom_code,
1121 p_inventory_item_id,
1122 v_conversion_rate
1123 );
1124
1125 IF nvl(v_conversion_rate, 0) <= 0 THEN
1126
1127 Inv_Convert.inv_um_conversion( p_uom_code, v_primary_uom_code, 0, v_conversion_rate );
1128
1129 IF NVL(v_conversion_rate, 0) <= 0 THEN
1130 v_conversion_rate := 0;
1131 END IF;
1132 END IF;
1133 v_assessable_value := NVL(v_assessable_value,0) * v_conversion_rate;
1134
1135 END IF; --end if for v_other_uom_code is not null
1136 END IF; --end if for v_primary_uom_code is not null
1137 END IF; --end if for v_assessable_value
1138 --Ends here..........................
1139 IF nvl(v_assessable_value,0) =0 THEN
1140 IF v_debug = 'Y' THEN
1141 fnd_file.put_line(fnd_file.log,' No Assessable value is defined, so default price is returning back ');
1142 END IF;
1143
1144 v_assessable_value := NVL(p_default_price, 0);
1145 END IF;
1146
1147 RETURN v_assessable_value;
1148 END IF ;
1149
1150 EXCEPTION
1151 WHEN OTHERS THEN
1152 FND_MESSAGE.SET_NAME ('JA','JAI_EXCEPTION_OCCURED');
1153 FND_MESSAGE.SET_TOKEN ('JAI_PROCESS_MSG',lv_object_name ||'.Err:'||sqlerrm);
1154 app_exception.raise_exception;
1155
1156 END ja_in_vat_assessable_value;
1157
1158 END jai_general_pkg;