DBA Data[Home] [Help]

PACKAGE BODY: APPS.ARP_TAX_STR_PKG

Source


1 PACKAGE BODY ARP_TAX_STR_PKG AS
2 /* $Header: ARTXSTRB.pls 115.1 2002/08/30 00:54:28 cleyvaol ship $ */
3 
4 g_segments_array_min       FND_FLEX_EXT.SegmentArray;
5 g_segments_array_max       FND_FLEX_EXT.SegmentArray;
6 
7 TYPE ccid_inrange IS TABLE OF varchar2(1)
8   INDEX BY BINARY_INTEGER;
9 
10 g_ccid_inrange ccid_inrange;
11 
12 /* =======================================================================|
13  | PROCEDURE initialize
14  |
15  | DESCRIPTION
16  |      Initilize the arrays to hold the segments of range of accounts
17  |      given. This will be held by two array during the same session
18  |      to do not recalculate them every time the function
19  |      get_ccid_inrange_flag is called.
20  |
21  | PARAMETERS
22  |      p_min_gl_flex  IN  VARCHAR2. String containg the min range of
23  |                                   accounts given.
24  |      p_max_gl_flex  IN  VARCHAR2. String containg the max range of
25  |                                   accounts given.
26  *========================================================================*/
27 PROCEDURE initialize(p_min_gl_flex VARCHAR2,
28                      p_max_gl_flex VARCHAR2) IS
29 
30 l_segments_delimiter VARCHAR2(1) := null;
31 l_number_segs        NUMBER;
32 
33 BEGIN
34 
35   --
36   -- GET THE DELIMITER
37   --
38   l_segments_delimiter := FND_FLEX_EXT.GET_DELIMITER('SQLGL','GL#',101);
39 
40   --
41   -- OBTAIN THE ARRAYS WITH THE SEGMENTS FOR EACH STRING
42   --
43   l_number_segs := FND_FLEX_EXT.BREAKUP_SEGMENTS(p_min_gl_flex ,l_segments_delimiter,g_segments_array_min);
44   l_number_segs := FND_FLEX_EXT.BREAKUP_SEGMENTS(p_max_gl_flex ,l_segments_delimiter,g_segments_array_max);
45 
46 END initialize;
47 
48 /* =======================================================================
49  | FUNCTION get_credit_memo_trx_number
50  |
51  | DESCRIPTION
52  |      Returns the transaction number for the credit memo.
53  |
54  | SCOPE - PUBLIC
55  |
56  | PARAMETERS
57  |      p_previous_customer_trx_id  IN  Transaction to wich the Credit
58  |                                      Memo is refering.
59  |
60  *======================================================================*/
61 FUNCTION get_credit_memo_trx_number(p_previous_customer_trx_id  IN NUMBER)
62           RETURN VARCHAR IS
63 
64 l_trx_number ra_customer_trx_all.trx_number%TYPE := null;
65 
66 BEGIN
67   IF p_previous_customer_trx_id IS NOT NULL THEN
68     BEGIN
69       Select trx_number
70       into   l_trx_number
71       from   ra_customer_trx_all
72       where  customer_trx_id = p_previous_customer_trx_id;
73     EXCEPTION
74       WHEN NO_DATA_FOUND THEN
75         NULL;
76       WHEN TOO_MANY_ROWS THEN
77         NULL;
78       WHEN OTHERS THEN
79         NULL;
80     END;
81   END IF;
82   RETURN l_trx_number;
83 END get_credit_memo_trx_number;
84 
85 /* ==========================================================================
86  | FUNCTION get_credit_memo_trx_date
87  |
88  | DESCRIPTION
89  |      Returns the transaction date for the credit memo.
90  |
91  | SCOPE - PUBLIC
92  |
93  | PARAMETERS
94  |      p_previous_customer_trx_id  IN  Transaction to wich the Credit Memo is
95  |                               refering.
96  *==========================================================================*/
97 FUNCTION  get_credit_memo_trx_date(p_previous_customer_trx_id  IN NUMBER ) RETURN DATE IS
98 
99 l_trx_date ra_customer_trx_all.trx_date%TYPE := null;
100 
101 BEGIN
102   IF p_previous_customer_trx_id IS NOT NULL THEN
103     BEGIN
104       Select trx_date
105       into   l_trx_date
106       from   ra_customer_trx_all
107       where  customer_trx_id = p_previous_customer_trx_id;
108     EXCEPTION
109       WHEN NO_DATA_FOUND THEN
110         NULL;
111       WHEN TOO_MANY_ROWS THEN
112         NULL;
113       WHEN OTHERS THEN
114         NULL;
115     END;
116   END IF;
117   RETURN l_trx_date;
118 END get_credit_memo_trx_date;
119 
120 
121 /* =========================================================================
122  | FUNCTION get_ccid_inrange_flag
123  |
124  | DESCRIPTION
125  |      Returns the transaction date for the credit memo.
126  |
127  | SCOPE - PUBLIC
128  |
129  | PARAMETERS
130  |      p_code_combination_id         IN Code Combination Id to identify if
131  |                                       it is in the range of the segments
132  |                                       given.
133  |      p_array_min_gl_flex,
134  |      p_array_max_gl_flex           IN Array of segments that define
135  |                                       the range to evaluate for the CCID.
136  *==========================================================================*/
137 FUNCTION  get_ccid_inrange_flag(p_code_combination_id   IN NUMBER
138                                 ) RETURN VARCHAR2 IS
139 
140 l_segments_array     FND_FLEX_EXT.SegmentArray;
141 l_number_segs        NUMBER;
142 l_segments_found     BOOLEAN;
143 
144 BEGIN
145   IF NOT(g_ccid_inrange.EXISTS(p_code_combination_id)) THEN
146     --
147     -- GET THE ARRAY OF SEGMENTS OF THE CODE COMBINATION ID
148     --
149 
150     l_segments_found :=FND_FLEX_EXT.GET_SEGMENTS('SQLGL','GL#',101,p_code_combination_id,l_number_segs,l_segments_array);
151     g_ccid_inrange(p_code_combination_id) := 'N';
152 
153     --
154     -- EVALUATE IF THE CCID IS IN THE SEGMENT RANGE GIVEN
155     --
156     FOR i in 1..l_number_segs LOOP
157       IF l_segments_array(i) not between g_segments_array_min(i) and g_segments_array_max(i) THEN
158         RETURN 'N';
159       END IF;
160     END LOOP;
161 
162     g_ccid_inrange(p_code_combination_id) := 'Y';
163     RETURN 'Y';
164   ELSE
165     RETURN g_ccid_inrange(p_code_combination_id);
166   END IF;
167 
168 END get_ccid_inrange_flag;
169 
170 END ARP_TAX_STR_PKG;