DBA Data[Home] [Help]

PACKAGE: APPS.OKL_ACCOUNTING_UTIL

Source


1 PACKAGE OKL_ACCOUNTING_UTIL AUTHID CURRENT_USER AS
2 /* $Header: OKLRAUTS.pls 120.12 2009/05/29 18:14:56 sechawla ship $ */
3 
4   TYPE seg_num_array_type IS TABLE OF NUMBER
5   INDEX BY BINARY_INTEGER;
6 
7   TYPE seg_array_type IS TABLE OF FND_ID_FLEX_SEGMENTS.APPLICATION_COLUMN_NAME%TYPE
8   INDEX BY BINARY_INTEGER;
9 
10   TYPE seg_desc_array_type IS TABLE OF  FND_ID_FLEX_SEGMENTS_TL.FORM_LEFT_PROMPT%TYPE
11   INDEX BY BINARY_INTEGER;
12 
13   TYPE error_message_type IS TABLE OF VARCHAR2(2000)
14   INDEX BY BINARY_INTEGER;
15 
16   TYPE seg_num_name_type IS RECORD
17     (seg_num  seg_num_array_type,
18      seg_name seg_array_type,
19      seg_desc seg_desc_array_type);
20 
21   G_UNEXPECTED_ERROR          CONSTANT VARCHAR2(200) := 'OKL_CONTRACTS_UNEXPECTED_ERROR';
22   G_VERSION_OVERLAPS		  CONSTANT VARCHAR2(200) := 'OKL_VERSION_OVERLAPS';
23   G_SQLERRM_TOKEN             CONSTANT VARCHAR2(200) := 'OKL_SQLERRM';
24   G_SQLCODE_TOKEN             CONSTANT VARCHAR2(200) := 'OKL_SQLCODE';
25   G_TABLE_TOKEN		  		  CONSTANT VARCHAR2(100) := 'OKL_TABLE_NAME';
26   G_PARENT_TABLE_TOKEN		  CONSTANT VARCHAR2(100) := OKL_API.G_PARENT_TABLE_TOKEN;
27   G_CHILD_TABLE_TOKEN		  CONSTANT VARCHAR2(100) := OKL_API.G_CHILD_TABLE_TOKEN;
28   -- sgorantl 06/03/2002
29   G_RULE_DEF_NOT_FOUND        CONSTANT VARCHAR2(50)  := 'OKL_RULE_DEF_NOT_FOUND';
30   G_COL_NAME_TOKEN			  CONSTANT VARCHAR2(100) := OKL_API.G_COL_NAME_TOKEN;
31 
32   g_sysdate DATE := SYSDATE;
33 
34   -- Incorporated the change due to the failure in GCC check-in. Because ARCS does not allow code to be
35   -- checked in with hard-coded date with DD-MON-YYYY format, which may create problem in non-englis databases.
36 
37   -- g_final_date CONSTANT DATE := TO_DATE('31-DEC-9999','DD-MON-RRRR');
38 
39   -- Got the julian date and added 5300000 to get the date 10/22/9798
40 
41   g_final_date CONSTANT DATE := TO_DATE('1','j') + 5300000;
42 
43 
44   G_INIT_VERSION			  CONSTANT NUMBER := 1.0;
45   G_VERSION_MAJOR_INCREMENT	  CONSTANT NUMBER := 1.0;
46   G_VERSION_MINOR_INCREMENT	  CONSTANT NUMBER := 0.1;
47   G_VERSION_FORMAT			  CONSTANT VARCHAR2(100) := 'FM999.0999';
48 
49   G_APP_NAME				  CONSTANT VARCHAR2(3)   :=  OKL_API.G_APP_NAME;
50   G_PKG_NAME                  CONSTANT VARCHAR2(30)  := 'OKL_ACCOUNTING_UTIL';
51 
52   -- mvasudev, 9/25/01
53   G_VARCHAR2  VARCHAR2(10)    := 'VARCHAR2';
54   G_NUMBER    VARCHAR2(10)    := 'NUMBER';
55 
56   -- Keerthi 19-Sep-2003  Bug No 3149545
57   G_INVALID_VALUE			CONSTANT VARCHAR2(200) := Okc_Api.G_INVALID_VALUE;
58 
59   TYPE overlap_attrib_rec_type IS RECORD
60   (
61      attribute  VARCHAR2(30)
62     ,attrib_type VARCHAR2(10)   := G_VARCHAR2
63     ,value  VARCHAR2(150)
64   );
65   TYPE overlap_attrib_tbl_type IS TABLE OF overlap_attrib_rec_type
66         INDEX BY BINARY_INTEGER;
67   -- mvasudev, end
68 
69 /*
70 retruns segment array based
71 */
72 
73   PROCEDURE get_segment_array
74     (p_concate_segments IN VARCHAR2,
75 	p_delimiter IN VARCHAR2,
76 	p_seg_array_type OUT NOCOPY seg_array_type);
77 
78 /*
79 returns concatenated segment description or sql error message
80 */
81 
82   FUNCTION get_concate_desc
83     (p_chart_of_account_id IN NUMBER,
84     p_concate_segments IN VARCHAR2)
85 	RETURN VARCHAR2;
86 
87 /*
88 returns concatenated segment description or sql error message
89 */
90   FUNCTION get_concate_desc
91     (p_code_combination_id IN NUMBER)
92 	RETURN VARCHAR2;
93 
94 /*
95 Returns rule meaning or sql error message
96 */
97 
98   FUNCTION get_rule_meaning (p_rule_code IN VARCHAR2)
99            RETURN VARCHAR2;
100 
101 
102 
103 /*
104 returns 't' if lookup code is valid else returns 'f'.
105 p_view_app_id in number -
106 pass 0 if lookup values has been registered using application object librarary's fnd lookup form
107 pass 3 if lookup values has been regristered using  application object librarary's fnd common lookup form
108 pass respective application id throught, which lookup values has been registered. in this case p_app_id
109 and p_view_app_id will be same
110 
111 p_app_id in number default 540
112 pass application id in which you have registered your lookup type.
113 */
114 
115   FUNCTION validate_lookup_code
116     (p_lookup_type IN VARCHAR2,
117 	p_lookup_code IN VARCHAR2,
118 	p_app_id IN NUMBER DEFAULT 540,
119 	p_view_app_id IN NUMBER DEFAULT 0)
120 	RETURN VARCHAR2;
121 
122 /*
123 Returns all the error messages seprated by '--' and count for the same
124 */
125   PROCEDURE get_error_message
126     (p_msg_count OUT NOCOPY NUMBER,
127 	p_msg_text OUT NOCOPY VARCHAR2);
128 
129 /*
130 Returns all the error messages IN pl/sql table
131 */
132 
133   PROCEDURE get_error_message(p_all_message OUT NOCOPY error_message_type);
134 
135 /*
136 Returns all the error messages IN pl/sql table only if msg returned is not null
137 */
138 
139   PROCEDURE get_error_msg(p_all_message OUT NOCOPY error_message_type);
140 
141 /*
142 Returns 'T' if currency is valid and active else return 'F'
143 */
144 
145   FUNCTION validate_currency_code(p_currency_code IN VARCHAR2)
146   RETURN VARCHAR2;
147 
148 /*
149 Returns 'T' if CODE COMBINATION ID is valid for GL else returns 'F'
150 Modified on 11-JUL-2008 Rkuttiya for Multi GAAP Project
151 added parameter p_ledger_id
152 */
153 
154   FUNCTION validate_gl_ccid(p_ccid IN VARCHAR2,
155                             p_ledger_id IN NUMBER DEFAULT NULL)
156   RETURN VARCHAR2;
157 
158 /*
159 Return status of OKL period in case of error returns null
160 If p_ledger_id passed to the API is null then it considers ledger from primary representation.
161 Otherwise, it considers the ledger id that is passed to it.
162 Added p_ledger_id argument as part of bug 5707866 by nikshah
163 */
164   FUNCTION get_okl_period_status(p_period_name IN VARCHAR2, p_ledger_id IN NUMBER DEFAULT NULL)
165   RETURN VARCHAR2;
166 
167 /*
168 Return status of GL period in case of error returns null
169 If p_ledger_id passed to the API is null then it considers ledger from primary representation.
170 Otherwise, it considers the ledger id that is passed to it.
171 Added p_ledger_id argument as part of bug 5707866 by nikshah
172 */
173 
174   FUNCTION get_gl_period_status(p_period_name IN VARCHAR2, p_ledger_id IN NUMBER DEFAULT NULL)
175   RETURN VARCHAR2;
176 
177 /*
178 Returns 'T' if validate source id and source table else 'F'
179 */
180   FUNCTION validate_source_id_table
181     (p_source_id IN NUMBER,
182 	p_source_table IN VARCHAR2)
183 	RETURN VARCHAR2;
184 
185 /*
186 Returns out parameter set of books id and name or null in case of error
187 If p_ledger_id passed to the API is null then it considers ledger from primary representation.
188 Otherwise, it considers the ledger id that is passed to it.
189 Added p_ledger_id argument as part of bug 5707866 by nikshah
190 */
191   PROCEDURE get_set_of_books
192     (p_set_of_books_id OUT NOCOPY NUMBER,
193 	p_set_of_books_name OUT NOCOPY VARCHAR2, p_ledger_id IN NUMBER DEFAULT NULL);
194 
195 /*
196 Returns set of books id
197 11-JUL-2008 rkuttiya modified for Multi GAAP Project
198 Added new parameter p_representation_type
199 */
200 
201   FUNCTION get_set_of_books_id(p_representation_type IN VARCHAR2 DEFAULT
202 'PRIMARY')
203   RETURN NUMBER;
204 
205 /*
206 Returns set of books name given set of books id
207 */
208   FUNCTION get_set_of_books_name(p_set_of_books_id IN NUMBER)
209   RETURN VARCHAR2;
210 
211 /*
212 Returns rounded amount given amount and currency code
213 */
214 
215   FUNCTION round_amount
216     (p_amount IN NUMBER,
217 	p_currency_code IN VARCHAR2)
218 	RETURN NUMBER;
219 
220 /*
221 Returns rounded amount given amount,currency code and rounding rule
222 
223  The Procedure accepts 3 values.
224        Amount
225        Currency Code
226        Round Option(For rounding cross currency pass the value 'CC',for Streams
227                     'STM' and for Accounting Lines 'AEL')
228 */
229 
230 
231 PROCEDURE round_amount
232     (p_api_version      IN NUMBER,
233      p_init_msg_list 	IN VARCHAR2,
234      x_return_status    OUT NOCOPY VARCHAR2,
235      x_msg_count 	OUT NOCOPY NUMBER,
236      x_msg_data 	OUT NOCOPY VARCHAR2,
237      p_amount 		IN NUMBER,
238      p_currency_code 	IN VARCHAR2,
239      p_round_option     IN VARCHAR2,
240      x_rounded_amount	OUT NOCOPY NUMBER);
241 
242 
243 
244 /*
245 Returns currency conversion rate
246 */
247   FUNCTION get_curr_con_rate
248     (p_from_curr_code IN VARCHAR2,
249 	p_to_curr_code IN VARCHAR2,
250 	p_con_date IN DATE,
251 	p_con_type IN VARCHAR2)
252   RETURN NUMBER;
253 
254 /* Procedure to get the exchange rate */
255 
256 PROCEDURE get_curr_con_rate
257      (
258      p_api_version      IN NUMBER,
259      p_init_msg_list 	IN VARCHAR2,
260      x_return_status    OUT NOCOPY VARCHAR2,
261      x_msg_count 	OUT NOCOPY NUMBER,
262      x_msg_data 	OUT NOCOPY VARCHAR2,
263      p_from_curr_code 	IN VARCHAR2,
264      p_to_curr_code 	IN VARCHAR2,
265      p_con_date 	IN DATE,
266      p_con_type 	IN VARCHAR2,
267      x_conv_rate 	OUT NOCOPY NUMBER);
268 
269 /*
270 Returns accounting segment array based on set of books id assigned to responsibilty of the caller
271 10-JUL-2008 rkuttiya modified for Multi GAAP project
272 Added new parameter p_ledger_id
273 */
274   PROCEDURE get_accounting_segment
275     (p_segment_array OUT NOCOPY seg_num_name_type,
276      p_ledger_id IN NUMBER DEFAULT NULL);
277 
278 /*
279 returns meaning for the lookup type and code
280 p_view_app_id IN NUMBER -
281 pass 0 IF lookup VALUES has been registered USING application object librarary's fnd lookup form
282 pass 3 if lookup values has been regristered using  application object librarary's fnd common lookup FORM
283 pass respective application id throught, which lookup VALUES has been registered. IN this CASE p_app_id
284 AND p_view_app_id will be same
285 
286 p_app_id IN NUMBER DEFAULT 540
287 pass application id IN which you have registered your lookup TYPE.
288 */
289 
290   FUNCTION get_lookup_meaning
291     (p_lookup_type IN VARCHAR2,
292 	p_lookup_code IN VARCHAR2,
293 	p_app_id IN NUMBER DEFAULT 540,
294 	p_view_app_id IN NUMBER DEFAULT 0)
295 	RETURN VARCHAR2;
296 
297 /*
298 returns meaning for the lookup type and code
299 p_view_app_id IN NUMBER -
300 pass 0 IF lookup VALUES has been registered USING application object librarary's fnd lookup form
301 pass 3 if lookup values has been regristered using  application object librarary's fnd common lookup FORM
302 pass respective application id throught, which lookup VALUES has been registered. IN this CASE p_app_id
303 AND p_view_app_id will be same
304 
305 p_app_id IN NUMBER DEFAULT 540
306 pass application id IN which you have registered your lookup TYPE.
307 p_language IN VARCHAR2 DEFAULT USERENV(LANG)
308 pass language in which the meaning is desired
309 */
310 
311   FUNCTION get_lookup_meaning_lang
312     (p_lookup_type IN VARCHAR2,
313 	p_lookup_code IN VARCHAR2,
314 	p_app_id IN NUMBER DEFAULT 540,
315 	p_view_app_id IN NUMBER DEFAULT 0,
316     p_language IN VARCHAR2 DEFAULT USERENV('LANG'))
317 	RETURN VARCHAR2;
318 
319 /*
320 Get the lookup meaning from fa lookup tables
321 */
322 
323   FUNCTION get_fa_lookup_meaning
324     (p_lookup_type IN VARCHAR2,
325 	p_lookup_code IN VARCHAR2)
326 	RETURN VARCHAR2;
327 
328 
329 /*
330 returns 'T' if validated else 'F'
331 */
332 
333   FUNCTION validate_currency_con_type
334     (p_currency_con_type IN VARCHAR2)
335 	RETURN VARCHAR2;
336 
337 /*
338 returns period name , start date and end date given a date.
339 If p_ledger_id passed to the API is null then it considers ledger from primary representation.
340 Otherwise, it considers the ledger id that is passed to it.
341 Added p_ledger_id argument as part of bug 5707866 by nikshah
342 */
343 
344   PROCEDURE get_period_info(p_date IN DATE,
345   p_period_name OUT NOCOPY VARCHAR2,
346   p_start_date OUT NOCOPY DATE,
347   p_end_date OUT NOCOPY DATE,
348   p_ledger_id IN NUMBER DEFAULT NULL);
349 
350 /*
351 returns start date and end date given a period.
352 If p_ledger_id passed to the API is null then it considers ledger from primary representation.
353 Otherwise, it considers the ledger id that is passed to it.
354 Added p_ledger_id argument as part of bug 5707866 by nikshah
355 */
356 
357   PROCEDURE get_period_info(p_period_name IN VARCHAR2,
358   p_start_date OUT NOCOPY DATE,
359   p_end_date OUT NOCOPY DATE,
360   p_ledger_id IN NUMBER DEFAULT NULL);
361 
362 /*
363 returns functional currency code
364 If p_ledger_id passed to the API is null then it considers ledger from primary representation.
365 Otherwise, it considers the ledger id that is passed to it.
366 Added p_ledger_id argument as part of bug 5707866 by nikshah
367 */
368 
369   FUNCTION get_func_curr_code (p_ledger_id IN NUMBER DEFAULT NULL)
370   RETURN VARCHAR2;
371 
372 /*
373 returns 'T' if validated else 'F'
374 */
375 
376   FUNCTION validate_journal_category(p_category IN VARCHAR2)
377   RETURN VARCHAR2;
378 
379 /*
380 returns chart of account id if sucess else return -1;
381 If p_ledger_id passed to the API is null then it considers ledger from primary representation.
382 Otherwise, it considers the ledger id that is passed to it.
383 Added p_ledger_id argument as part of bug 5707866 by nikshah
384 */
385 
386   FUNCTION get_chart_of_accounts_id (p_ledger_id IN NUMBER DEFAULT NULL)
387   RETURN NUMBER;
388 
389 -- mvasudev, 9/25/01
390 /*
391 check overlaps - for any attribute
392 */
393 
394   PROCEDURE check_overlaps (
395 	p_id						IN NUMBER,
396       p_attrib_tbl				IN overlap_attrib_tbl_type,
397   	p_start_date_attribute_name	IN VARCHAR2 DEFAULT 'START_DATE',
398   	p_start_date				IN DATE,
399 	p_end_date_attribute_name	IN VARCHAR2 DEFAULT 'END_DATE',
400 	p_end_date					IN DATE,
401 	p_view						IN VARCHAR2,
402 	x_return_status				OUT NOCOPY VARCHAR2,
403 	x_valid						OUT NOCOPY BOOLEAN);
404   -- mvasudev, end
405 
406   -- mvasudev, 10/02/01
407 /*
408 Get Version - with any attribute
409 */
410   PROCEDURE get_version(
411     p_attrib_tbl				IN overlap_attrib_tbl_type,
412   	p_cur_version				   IN VARCHAR2,
413 	p_end_date_attribute_name	IN VARCHAR2 DEFAULT 'END_DATE',
414 	p_end_date					IN DATE,
415 	p_view						IN VARCHAR2,
416   	x_return_status				   OUT NOCOPY VARCHAR2,
417 	x_new_version				   OUT NOCOPY VARCHAR2);
418   -- mvasudev, end
419 
420 /*
421 convert the string into upper
422 */
423 
424 FUNCTION okl_upper(p_string IN VARCHAR2)
425 RETURN VARCHAR2;
426 
427 /*
428 get concatenated segments based on ccid
429 */
430 
431 FUNCTION get_concat_segments(p_ccid IN NUMBER)
432 RETURN VARCHAR2;
433 
434 
435 /*
436 format the amount according to profile options and currency code.
437 */
438 
439 FUNCTION format_amount(p_amount IN NUMBER
440                       ,p_currency_code IN VARCHAR2)
441 RETURN VARCHAR2;
442 
443 /*
444 validate the amount according to currency code.
445 */
446 
447 FUNCTION validate_amount(p_amount IN NUMBER
448                         ,p_currency_code IN VARCHAR2)
449 RETURN NUMBER;
450 
451 
452 /*  10-JUL-2008 rkuttiya modified for Multi GAAP
453  *  added a new parameter p_ledger_id
454  */
455 
456 FUNCTION get_segment_desc(p_segment IN VARCHAR2
457                          ,p_ledger_id IN NUMBER DEFAULT NULL)
458 RETURN VARCHAR2;
459 
460 /*
461 This Function gets the label for a particular AK attribute belongs
462 a particular region. This is called at the time of displaying a token
463 along with the message. It returns NULL if the region or the attribute
464 is not found.
465 */
466 
467 FUNCTION Get_Message_Token
468 (
469  p_region_code    IN ak_region_items.region_code%TYPE,
470  p_attribute_code IN ak_region_items.attribute_code%TYPE,
471  p_application_id IN fnd_application.application_id%TYPE DEFAULT 540
472 )
473 RETURN VARCHAR2;
474 
475 
476 
477 /*
478 This function returns the rounded amount for a given amount and currency code
479 using the cross currency rounding rule
480 */
481 
482 
483 FUNCTION cross_currency_round_amount
484     (p_amount IN NUMBER,
485      p_currency_code IN VARCHAR2)
486 RETURN NUMBER;
487 
488 
489 /*
490 This procedure returns the rounded amount for a given amount and currency code
491 using the cross currency rounding rule
492 */
493 
494 PROCEDURE cross_currency_round_amount
495     (p_api_version      IN NUMBER,
496      p_init_msg_list 	IN VARCHAR2,
497      x_return_status    OUT NOCOPY VARCHAR2,
498      x_msg_count 	OUT NOCOPY NUMBER,
499      x_msg_data 	OUT NOCOPY VARCHAR2,
500      p_amount 		IN NUMBER,
501      p_currency_code 	IN VARCHAR2,
502      x_rounded_amount	OUT NOCOPY NUMBER);
503 
504 
505 /*
506 This function returns the rounded and formatted amount for a given amount and currency
507 code using the cross currency rounding rule
508 */
509 
510 
511 FUNCTION cc_round_format_amount
512     (p_amount IN NUMBER,
513      p_currency_code IN VARCHAR2)
514 RETURN VARCHAR2;
515 
516 
517 /*
518 This procedure returns the rounded and formatted amount for a given amount and currency
519 code using the cross currency rounding rule
520 */
521 
522 PROCEDURE cc_round_format_amount
523     (p_api_version      IN NUMBER,
524      p_init_msg_list 	IN VARCHAR2,
525      x_return_status    OUT NOCOPY VARCHAR2,
526      x_msg_count 	OUT NOCOPY NUMBER,
527      x_msg_data 	OUT NOCOPY VARCHAR2,
528      p_amount 		IN NUMBER,
529      p_currency_code 	IN VARCHAR2,
530      x_formatted_amount OUT NOCOPY VARCHAR2);
531 
532 /*
533 This procedure converts the amount from contract currency to functional
534 currency. And then returns the rounded amount. This also returns the
535 currency conversion factors along.
536 */
537 
538 PROCEDURE convert_to_functional_currency
539 (
540  p_khr_id  		  	IN OKC_K_HEADERS_B.id%TYPE,
541  p_to_currency   		IN fnd_currencies.currency_code%TYPE,
542  p_transaction_date 		IN DATE,
543  p_amount 			IN NUMBER,
544  x_contract_currency		OUT NOCOPY OKC_K_HEADERS_B.currency_code%TYPE,
545  x_currency_conversion_type	OUT NOCOPY OKL_K_HEADERS.currency_conversion_type%TYPE,
546  x_currency_conversion_rate	OUT NOCOPY OKL_K_HEADERS.currency_conversion_rate%TYPE,
547  x_currency_conversion_date	OUT NOCOPY OKL_K_HEADERS.currency_conversion_date%TYPE,
548  x_converted_amount 		OUT NOCOPY NUMBER
549 );
550 
551 
552 /*
553 This overloaded procedure converts the amount from contract currency to functional
554 currency. And then returns the rounded amount. This also returns the
555 currency conversion factors along. This returns the retur_status also.
556 */
557 
558 PROCEDURE convert_to_functional_currency
559 (
560  p_khr_id  		  	IN OKC_K_HEADERS_B.id%TYPE,
561  p_to_currency   		IN fnd_currencies.currency_code%TYPE,
562  p_transaction_date 		IN DATE,
563  p_amount 			IN NUMBER,
564  x_return_status		OUT NOCOPY VARCHAR2,
565  x_contract_currency		OUT NOCOPY OKC_K_HEADERS_B.currency_code%TYPE,
566  x_currency_conversion_type	OUT NOCOPY OKL_K_HEADERS.currency_conversion_type%TYPE,
567  x_currency_conversion_rate	OUT NOCOPY OKL_K_HEADERS.currency_conversion_rate%TYPE,
568  x_currency_conversion_date	OUT NOCOPY OKL_K_HEADERS.currency_conversion_date%TYPE,
569  x_converted_amount 		OUT NOCOPY NUMBER
570 );
571 
572 
573 /*
574 This procedure converts the amount from functional currency to contract
575 currency. And then returns the rounded amount. This also returns the
576 currency conversion factors along.
577 */
578 
579 PROCEDURE convert_to_contract_currency
580 (
581  p_khr_id  		  	IN OKC_K_HEADERS_B.id%TYPE,
582  p_from_currency   		IN fnd_currencies.currency_code%TYPE,
583  p_transaction_date 		IN DATE,
584  p_amount 			IN NUMBER,
585  x_contract_currency		OUT NOCOPY OKC_K_HEADERS_B.currency_code%TYPE,
586  x_currency_conversion_type	OUT NOCOPY OKL_K_HEADERS.currency_conversion_type%TYPE,
587  x_currency_conversion_rate	OUT NOCOPY OKL_K_HEADERS.currency_conversion_rate%TYPE,
588  x_currency_conversion_date	OUT NOCOPY OKL_K_HEADERS.currency_conversion_date%TYPE,
589  x_converted_amount 		OUT NOCOPY NUMBER
590 );
591 
592 
593 /*
594 This overloaded procedure converts the amount from functional currency to contract
595 currency. And then returns the rounded amount. This also returns the
596 currency conversion factors along. . This returns the retur_status also.
597 */
598 
599 PROCEDURE convert_to_contract_currency
600 (
601  p_khr_id  		  	IN OKC_K_HEADERS_B.id%TYPE,
602  p_from_currency   		IN fnd_currencies.currency_code%TYPE,
603  p_transaction_date 		IN DATE,
604  p_amount 			IN NUMBER,
605  x_return_status		OUT NOCOPY VARCHAR2,
606  x_contract_currency		OUT NOCOPY OKC_K_HEADERS_B.currency_code%TYPE,
607  x_currency_conversion_type	OUT NOCOPY OKL_K_HEADERS.currency_conversion_type%TYPE,
608  x_currency_conversion_rate	OUT NOCOPY OKL_K_HEADERS.currency_conversion_rate%TYPE,
609  x_currency_conversion_date	OUT NOCOPY OKL_K_HEADERS.currency_conversion_date%TYPE,
610  x_converted_amount 		OUT NOCOPY NUMBER
611 );
612 
613 
614 /*
615 This function returns valid GL date
616 If p_ledger_id passed to the API is null then it considers ledger from primary representation.
617 Otherwise, it considers the ledger id that is passed to it.
618 Added p_ledger_id argument as part of bug 5707866 by nikshah
619 */
620 FUNCTION get_valid_gl_date(p_gl_date IN DATE, p_ledger_id IN NUMBER DEFAULT NULL)
621 RETURN DATE;
622 
623 -- Added by Santonyr 02-Aug-2004 for bug 3808697.
624 -- This function is to derive the transaction amount for each transaction from FA.
625 
626 FUNCTION get_fa_trx_amount
627   (p_book_type_code  IN VARCHAR2,
628    p_asset_id        IN NUMBER,
629    p_transaction_type IN VARCHAR2,
630    p_transaction_header_id IN  NUMBER   )
631 RETURN NUMBER;
632 
633 -- Added by Santonyr 10-Oct-2004.
634 -- This function is returns if a OKL transaction is actual or draft..
635 
636 FUNCTION Get_Draft_Actual_Trx
637   (p_trx_id IN NUMBER,
638   p_source_table IN VARCHAR2,
639   p_khr_id IN NUMBER )
640 RETURN VARCHAR2;
641 
642 -- Added by Santonyr 10-Dec-2004 for bug 4028662.
643 -- This function is to return the FA transaction date.
644 
645 
646 FUNCTION get_fa_trx_date
647   (p_book_type_code  IN VARCHAR2)
648 RETURN DATE;
649 
650 -- Added by Santonyr 10-Dec-2004 for bug 4028662.
651 -- This procedure is to return the FA transaction date.
652 
653 PROCEDURE get_fa_trx_date
654   (p_book_type_code  IN VARCHAR2,
655    x_return_status OUT NOCOPY VARCHAR2,
656    x_fa_trx_date OUT NOCOPY DATE);
657 
658 -- Added by Santonyr 10-Dec-2004 for bug 4028662.
659 -- This procedure is to return the first FA transaction date for a contract.
660 
661 FUNCTION Get_FA_Trx_Start_Date
662   (p_asset_number IN VARCHAR2,
663   p_corporate_book IN VARCHAR2,
664   p_khr_id IN NUMBER,
665   p_sts_code IN VARCHAR2)
666 RETURN DATE;
667 
668 -- Added by Santonyr 10-Dec-2004 for bug 4028662.
669 -- This procedure is to return the last FA transaction date for a contract.
670 
671 FUNCTION Get_FA_Trx_End_Date
672   (p_asset_number IN VARCHAR2,
673   p_corporate_book IN VARCHAR2,
674   p_khr_id IN NUMBER)
675 RETURN DATE;
676 
677 /*
678 Return valuation method code in case of error returns null
679 Added by nikshah 22-Jan-2007 for bug 5707866
680 */
681 FUNCTION get_valuation_method_code( p_ledger_id  NUMBER DEFAULT NULL)
682 RETURN VARCHAR2;
683 
684 /*
685 Return account derivation option, if not found in system options then return null
686 Added by nikshah 08-Feb-2007 for bug 5707866
687 */
688 FUNCTION get_account_derivation
689 RETURN VARCHAR2;
690 
691 -- MGAAP 7263041
692 FUNCTION get_fa_reporting_book( p_org_id  NUMBER DEFAULT NULL)
693 RETURN VARCHAR2;
694 
695 FUNCTION get_fa_reporting_book( p_kle_id  NUMBER ) RETURN VARCHAR2;
696 
697 -- SECHAWLA 09-mar-2009 : added as part of MG Impacts on Investor Agreement
698 PROCEDURE get_reporting_product(p_api_version           IN  	NUMBER,
699            		 	            p_init_msg_list         IN  	VARCHAR2,
700            			            x_return_status         OUT 	NOCOPY VARCHAR2,
701            			            x_msg_count             OUT 	NOCOPY NUMBER,
702            			            x_msg_data              OUT 	NOCOPY VARCHAR2,
703                                 p_contract_id 		    IN 		NUMBER,
704                                 x_rep_product           OUT   	NOCOPY VARCHAR2,
705 							    x_rep_product_id        OUT   	NOCOPY NUMBER,
706 								x_rep_deal_type         OUT     NOCOPY VARCHAR2);
707 
708 
709 END OKL_ACCOUNTING_UTIL;
710 
711 
712