DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_AU_EXC

Source


1 package body pay_au_exc as
2 /* $Header: pyauexch.pkb 120.4 2007/08/13 06:11:16 dduvvuri noship $ */
3 --
4 -- Change List
5 -- ----------
6 -- DATE        Name            Vers     Bug No    Description
7 -- -----------+---------------+--------+--------+-----------------------+
8 -- 24-NOV-1999 sgoggin          1.0                 Created
9 -- 29-Jul-2002 Ragovind         1.1     2123970     Added Code for Balance Adjument Process Enhancement.
10 -- 30-Jul-2002 Ragovind         1.2     2123970     Modified the SQL Statement and written a cursor.
11 -- 03-Dec-2002 Ragovind         1.3     2689226     Added NOCOPY to the functions pyauexc.asg_ptd_ec,
12 --                                                  pyauexc.asg_span_ec.
13 -- 22-Mar-2004 jkarouza         1.0     3083198     Renamed file to pyauexch.pkb and package name to
14 --                                                  PAY_AU_EXC
15 -- 07-Apr-2004 puchil           1.1     3075319     changed the function
16 --                                                  asg_span_ec to use effective
17 --                                                  date.
18 -- 21-Jun-2004 punmehta        115.2    3583020     Nulled the PTD expiry chekcing code
19 -- 21-Jun-2004 punmehta        115.3    3583020     Removed GSCC warnings
20 -- 09-Aug-2004 abhkumar        115.4    2610141     Modfied the code to support LE level balances
21 -- 30-Nov-2005 avenkatk        115.5    4351318     Introduced procedure fbt_ytd_start.
22 -- 19-Jul-2007 vamittal        115.6    6159013     Changed Expiry Checking Procedure for
23 --                                                  _ASG_LE_TD and _ASG_TD Dimension
24 -- 13-Aug-2007 dduvvuri        115.8    6159013     Added Change History
25 
26 --                                                  Comments
27 -- -----------+---------------+--------+--------+-----------------------+
28 --
29 --
30 g_fin_year_start  varchar2(6);
31 g_fbt_year_start  varchar2(6);
32 g_cal_year_start  varchar2(6);
33 --
34 --
35 -- get offset of fbt year start with reference to calender year in months and days
36 l_fbtyr_months_offset NUMBER(2);
37 l_fbtyr_days_offset   NUMBER(2);
38 
39 -------------------------------- next_period ---------------------------------------------------
40 --
41 -- NAME        : next_period
42 -- DESCRIPTION : Given a date and a payroll action id, returns the date after the
43 --               end of the containing payroll action id's pay period.
44 
45    FUNCTION next_period ( p_payroll_action_id in number,
46                           p_given_date in date )
47                                                RETURN date is
48    l_next_to_end_date date := NULL;
49    BEGIN
50    /* Get the date next to the end date of the given period,
51       having the payroll action id */
52      SELECT PTP.end_date+1
53        INTO l_next_to_end_date
54        FROM per_time_periods ptp,
55             pay_payroll_actions pact
56       WHERE pact.payroll_action_id = p_payroll_action_id
57         AND pact.payroll_id    = ptp.payroll_id
58         AND p_given_date between ptp.start_date and ptp.end_date;
59 
60      return l_next_to_end_date;
61 
62    END next_period;
63 ------------------------------- next_month -----------------------------------------------------
64 --
65 -- NAME        : next_month
66 -- DESCRIPTION : Given a date returns the next month's start date.
67 
68    FUNCTION next_month (p_given_date in date )
69                   RETURN date is
70    BEGIN
71    /* Return the next month's start date */
72       RETURN trunc(add_months(p_given_date,1),'MM');
73    END next_month;
74 
75 -------------------------------  next_quarter --------------------------------------------------
76 --
77 -- NAME 	   : next_quarter
78 -- DESCRIPTION : Given a date returns the next quarter's start date.
79 
80    FUNCTION next_quarter (p_given_date in date)
81                    RETURN date is
82    BEGIN
83    /* Return the next quarter's start date */
84       RETURN trunc(add_months(p_given_date,3),'Q');
85    END next_quarter;
86 
87 ------------------------------  next_year -----------------------------------------------------
88 --
89 -- NAME 	   : next_year
90 -- DESCRIPTION : Given a date returns the next year's start date.
91 
92    FUNCTION next_year (p_given_date in date)
93                   RETURN date is
94    BEGIN
95    /* Return the next year's start date */
96       RETURN trunc(add_months(p_given_date,12),'Y');
97    END next_year;
98 
99 ------------------------------- next_fin_quarter -------------------------------------------
100 --
101 -- NAME 	   : next_fin_quarter
102 -- DESCRIPTION : Given a date returns the next fiscal quarter's start date.
103 
104    FUNCTION next_fin_quarter (p_beg_of_the_year in date, p_given_date in date )
105                   RETURN date is
106 
107       -- get offset of fin year start with reference to calender year in months and days
108       l_finyr_months_offset NUMBER(2);
109       l_finyr_days_offset   NUMBER(2);
110 
111    BEGIN
112       l_finyr_months_offset := to_char(p_beg_of_the_year,'MM') - 1;
113       l_finyr_days_offset   := to_char(p_beg_of_the_year,'DD') - 1;
114 
115    /* Return the next fiscal quarter's start date */
116       RETURN (add_months(next_quarter(add_months(p_given_date,-l_finyr_months_offset)
117                                   -l_finyr_days_offset),l_finyr_months_offset)+ l_finyr_days_offset);
118    END next_fin_quarter;
119 
120 ------------------------------- next_fin_year -------------------------------------------
121 --
122 -- NAME 	   : next_fin_year
123 -- DESCRIPTION : Given a date returns the next fiscal quarter's start date.
124 
125    FUNCTION next_fin_year ( p_beg_of_the_year in date, p_given_date in date )
126                   RETURN date is
127 
128       -- get offset of fin year start with reference to calender year in months and days
129       l_finyr_months_offset NUMBER(2);
130       l_finyr_days_offset   NUMBER(2);
131    BEGIN
132       l_finyr_months_offset := to_char(p_beg_of_the_year,'MM') - 1;
133       l_finyr_days_offset   := to_char(p_beg_of_the_year,'DD') - 1;
134 
135    /* Return the next fiscal quarter's start date */
136       RETURN (add_months(next_year(add_months(p_given_date,-l_finyr_months_offset)
137                                   -l_finyr_days_offset),l_finyr_months_offset)+ l_finyr_days_offset);
138    END next_fin_year;
139 
140 ------------------------------- next_fbt_quarter -----------------------------------------
141 --
142 -- NAME 	    : next_fbt_quarter
143 -- DESCRIPTION  : Given a start of fbt year and a date returns the next fbt quarter's start date.
144 
145    FUNCTION next_fbt_quarter ( p_given_date in date )
146                      RETURN date is
147 
148    BEGIN
149    /* Return the next fbt quarter's start date */
150       RETURN (add_months(next_quarter(add_months(p_given_date,-l_fbtyr_months_offset)
151                                    -l_fbtyr_days_offset),l_fbtyr_months_offset)+ l_fbtyr_days_offset);
152    END next_fbt_quarter;
153 
154 ------------------------------- next_fbt_year -----------------------------------------
155 --
156 -- NAME 	    : next_fbt_year
157 -- DESCRIPTION  : Given a start of fbt year and a date returns the next fbt year's start date.
158 
159    FUNCTION next_fbt_year ( p_given_date in date )
160                      RETURN date is
161 
162    BEGIN
163    /* Return the next fbt quarter's start date */
164       RETURN (add_months(next_year(add_months(p_given_date,-l_fbtyr_months_offset)
165                                    -l_fbtyr_days_offset),l_fbtyr_months_offset)+l_fbtyr_days_offset);
166 
167    END next_fbt_year;
168 
169 -------------------------------- asg_ptd_ec ----------------------------------------------------
170 --
171 --  name
172 --     asg_ptd_ec - assignment processing period to date expiry check.
173 --  description
174 --     expiry checking code for the following:
175 --       au assignment-level process period to date balance dimension
176 --  notes
177 --     the associated dimension is expiry checked at payroll action level
178 --
179 procedure asg_ptd_ec
180 	(   p_owner_payroll_action_id    in     number      -- run created balance.
181 	,   p_user_payroll_action_id     in     number      -- current run.
182 	,   p_owner_assignment_action_id in     number      -- assact created balance.
183 	,   p_user_assignment_action_id  in     number      -- current assact..
184 	,   p_owner_effective_date       in     date        -- eff date of balance.
185 	,   p_user_effective_date        in     date        -- eff date of current run.
186 	,   p_dimension_name             in     varchar2    -- balance dimension name.
187 	,   p_expiry_information         out NOCOPY number      -- dimension expired flag.
188 	) is
189 
190  --
191 	cursor csr_time
192 	  ( p_payroll_action_id       number
193 	  , p_assignment_action_id    number
194 	  , p_effective_date          date) is
195 	  select  ptp.time_period_id
196 	  from    pay_payroll_actions         act
197 	  ,       per_time_periods            ptp
198 	  where   payroll_action_id           = p_payroll_action_id
199 				 and act.date_earned         between ptp.start_date and ptp.end_date
200 				 and act.payroll_id          = ptp.payroll_id
201 				 and act.effective_date      = p_effective_date;
202 	  --
203 	  l_user_time_period_id     number;
204 	  l_owner_time_period_id    number;
205 	  --
206 begin
207   --Bug3583020 - Code removed as PTD balance values are now not stored in lates balances.
208   null;
209 end asg_ptd_ec;
210 --
211 -------------------------------- asg_span_ec -----------------------------------------------
212 --
213 --  name
214 --     asg_span_ec - assignment processing year to date expiry check.
215 --  description
216 --     expiry checking code for the following:
217 --       au assignment-level process year to date balance dimension
218 --  notes
219 --     the associated dimension is expiry checked at payroll action level
220 --
221 -- Bug 3075319 - Changed the function to use effective date.
222 -- Bug 6159013 - Added Expiry Checking Code for _ASG_TD and _ASG_LE_TD
223 --               Dimensions
224 
225 procedure asg_span_ec
226 	(   p_owner_payroll_action_id    in     number    -- run created balance.
227 	,   p_user_payroll_action_id     in     number    -- current run.
228 	,   p_owner_assignment_action_id in     number    -- assact created balance.
229 	,   p_user_assignment_action_id  in     number    -- current assact.
230 	,   p_owner_effective_date       in     date      -- eff date of balance.
231 	,   p_user_effective_date        in     date      -- eff date of current run.
232 	,   p_dimension_name             in     varchar2  -- balance dimension name.
233 	,   p_expiry_information         out NOCOPY number    -- dimension expired flag.
234 	) is
235 	  --
236 	  cursor  csr_get_business_group is
237 	  select  business_group_id
238 	  from    pay_assignment_actions_v
239 	  where   assignment_action_id = p_user_assignment_action_id;
240 
241 	  --
242 	  l_user_span_start     date;
243 	  l_owner_start         date;
244 	  l_date_dd_mm          varchar2(11);
245 	  l_fy_user_span_start  date;
246 	  l_frequency           number;
247 	  l_dimension_name      pay_balance_dimensions.dimension_name%type;
248 	  l_business_group_id   pay_payroll_actions.business_group_id%type;
249 	  --
250 begin
251   hr_utility.set_location('Entering: asg_span_ec', 1);
252   l_dimension_name  := upper(p_dimension_name);
253   -- Get the year component of the input date
254   hr_utility.trace(' asg_span_ec: p_owner_payroll_action_id='||to_char(p_owner_payroll_action_id));
255   hr_utility.trace(' asg_span_ec: p_user_payroll_action_id='||to_char(p_user_payroll_action_id));
256   hr_utility.trace(' asg_span_ec: p_owner_assignment_action_id='||to_char(p_owner_assignment_action_id));
257   hr_utility.trace(' asg_span_ec: p_user_assignment_action_id='||to_char(p_user_assignment_action_id));
258   hr_utility.trace(' asg_span_ec: p_dimension_name ='||p_dimension_name );
259   hr_utility.trace(' asg_span_ec: p_owner_effective_date='||to_char(p_owner_effective_date,'DD-MON-YYYY'));
260   hr_utility.trace(' asg_span_ec: p_user_effective_date='||to_char(p_user_effective_date,'DD-MON-YYYY'));
261 
262   --
263   -- select the start span for the using action.
264   -- if the owning action associated with the latest balance, is
265   -- before the start of the span for the using effective date
266   -- then it has expired.
267   --
268 /*6159013 These Two Dimension Never Expires hence Returning 0 as
269 expiry Date*/
270   IF p_dimension_name in ('_ASG_TD','_ASG_LE_TD') THEN
271      p_expiry_information := 0;
272      RETURN;
273 -- ASG_YTD
274   elsif lower(l_dimension_name) in ('_asg_ytd','_asg_le_ytd') then --2610141
275     --
276     l_frequency := 1;
277     l_date_dd_mm := g_fin_year_start;
278   --
279   -- ASG_FY_YTD ASG_FY_QTD
280   elsif lower(l_dimension_name) in ('_asg_fy_ytd','_asg_fy_qtd','_asg_le_fy_ytd', '_asg_le_fy_qtd') then --2610141
281     -- Get the business group
282     open csr_get_business_group;
283     fetch csr_get_business_group into l_business_group_id;
284     close csr_get_business_group;
285     -- Lookup the fiscal start date for this business group
286     l_fy_user_span_start := hr_au_routes.get_fiscal_date( l_business_group_id);
287     -- Check if its a yearly or quarterly balance
288     if lower(l_dimension_name) in ('_asg_fy_ytd','_asg_le_fy_ytd') then --2610141
289       l_frequency := 1;
290     else
291       l_frequency := 4;
292     end if;
293     --
294     l_date_dd_mm := to_char(l_fy_user_span_start,'dd-mm-');
295   --
296   -- ASG_MTD
297   elsif lower(l_dimension_name) in ('_asg_mtd','_asg_le_mtd') then --2610141
298     --
299     l_frequency := 12;
300     l_date_dd_mm := g_cal_YEAR_START;
301   --
302   -- ASG_QTD
303   elsif lower(l_dimension_name) in ('_asg_qtd','_asg_le_qtd') then --2610141
304     --
305     l_frequency := 4;
306     l_date_dd_mm := g_cal_YEAR_START;
307   --
308   -- ASG_CAL_YTD
309   elsif lower(l_dimension_name) in ('_asg_cal_ytd','_asg_le_cal_ytd') then --2610141
310     l_frequency := 1;
311     l_date_dd_mm := g_cal_YEAR_START;
312   --
313   -- ASG_FBT_QTD
314   elsif lower(l_dimension_name) = '_asg_fbt_qtd' then
315     --
316     l_frequency := 4;
317     l_date_dd_mm := g_fbt_YEAR_START;
318   --
319   -- ASG_FBT_YTD
320   elsif lower(l_dimension_name) in ('_asg_fbt_ytd','_asg_le_fbt_ytd') then --2610141
321     --
322     l_frequency := 1;
323     l_date_dd_mm := g_fbt_YEAR_START;
324   --
325   end if;
326   --
327   -- Bug 3075319 - Changed the logic to use the effective_date
328   l_user_span_start := hr_au_routes.span_start( p_user_effective_date
329                                               , l_frequency
330                                               , l_date_dd_mm);
331   --
332   hr_utility.trace(' asg_span_ec: l_user_span_start='||to_char(l_user_span_start,'DD-MON-YYYY'));
333   --
334   if p_owner_effective_date < l_user_span_start then
335     p_expiry_information      := 1;
336     hr_utility.set_location('  asg_span_ec: EXPIRED', 10);
337   else
338     p_expiry_information      := 0;
339     hr_utility.set_location('  asg_span_ec: NOT EXPIRED', 10);
340   end if;
341   --
342 end asg_span_ec;
343 
344 --
345 -------------------------------- asg_span_ec -----------------------------------------------
346 -------------------Over Loaded function for balance adjustment process----------------------
347 --
348 --  NAME           :  asg_span_ec
349 --  DESCRIPTION    :  Expiry checking code for the following:
350 --                    AU assignment-level process year to date balance dimension
351 --  NOTES          :  The associated dimension is expiry checked at payroll action level
352 --
353 
354 PROCEDURE asg_span_ec
355 	(   p_owner_payroll_action_id    in     number    -- run created balance.
356 	,   p_user_payroll_action_id     in     number    -- current run.
357 	,   p_owner_assignment_action_id in     number    -- assact created balance.
358 	,   p_user_assignment_action_id  in     number    -- current assact.
359 	,   p_owner_effective_date       in     date      -- eff date of balance.
363 	) is
360 	,   p_user_effective_date        in     date      -- eff date of current run.
361 	,   p_dimension_name             in     varchar2  -- balance dimension name.
362 	,   p_expiry_information         out NOCOPY   date      -- dimension expired date.
364 
365       l_beg_of_fiscal_year date;
366       l_user_le_start_date   date;
367       cursor get_beg_of_fiscal_year(c_owner_payroll_action_id number)
368        is
369         SELECT fnd_date.canonical_to_date(org_information11)
370         FROM   pay_payroll_actions PACT,
371                hr_organization_information HOI
372         WHERE  UPPER(HOI.org_information_context) = 'BUSINESS GROUP INFORMATION'
373         AND    HOI.organization_id = PACT.business_group_id
374         AND    PACT.payroll_action_id = c_owner_payroll_action_id;
375 
376 
377 BEGIN
378 
379   hr_utility.trace('p_owner_payroll_action_id  :'||p_owner_payroll_action_id);
380   hr_utility.trace('p_user_payroll_action_id :'||p_user_payroll_action_id);
381   hr_utility.trace('p_owner_assignment_action_id :' ||p_owner_assignment_action_id);
382   hr_utility.trace('p_user_assignment_action_id  :' ||p_user_assignment_action_id  );
383   hr_utility.trace('p_owner_effective_date       :' ||p_owner_effective_date       );
384   hr_utility.trace('p_user_effective_date        :' ||p_user_effective_date        );
385   hr_utility.trace('p_dimension_name             :' ||p_dimension_name             );
386 
387   /*6159013 These Two Dimension Never Expires hence Returning 31-DEC-4712 as expiry Date*/
388   IF p_dimension_name in ('_ASG_TD','_ASG_LE_TD') THEN
389      p_expiry_information := fnd_date.canonical_to_date('4712/12/31');
390 
391  /* These balance dimensions never expire and hence considered as special cases
392      return the p_owner_effective_date for these cases */
393   ELSIF p_dimension_name in ('_ASG_RUN','_ASG_LE_RUN') THEN --2610141
394      p_expiry_information := p_owner_effective_date;
395      hr_utility.trace('p_expiry_information'||p_dimension_name||':'||p_expiry_information);
396 
397   /* The balance dimension '_ASG_MTD' is checking for feed using the normal calendar year
398      so, we use next_month function to get the expiry date of the dimension */
399   ELSIF p_dimension_name in ('_ASG_MTD','_ASG_LE_MTD') THEN --2610141
400      p_expiry_information := next_month(p_owner_effective_date)-1;
401      hr_utility.trace('p_expiry_information'||p_dimension_name||':'||p_expiry_information);
402 
403   /* The balance dimension '_ASG_QTD' is checking for feed using the normal calendar year
404      so, we use next_quarter function to get the expiry date of the dimension */
405   ELSIF p_dimension_name in ('_ASG_QTD','_ASG_LE_QTD') THEN --2610141
406      p_expiry_information := next_quarter(p_owner_effective_date)-1;
407      hr_utility.trace('p_expiry_information'||p_dimension_name||':'||p_expiry_information);
408 
409   /* The balance dimension '_ASG_CAL_YTD' is checking for feed using the normal calendar year
410      so, we use next_year function to get the expiry date of the dimension */
411   ELSIF p_dimension_name in ('_ASG_CAL_YTD','_ASG_LE_CAL_YTD') THEN --2610141
412      p_expiry_information := next_year(p_owner_effective_date)-1;
413      hr_utility.trace('p_expiry_information'||p_dimension_name||':'||p_expiry_information);
414 
415   /* The balance dimension '_ASG_YTD' is checking for feed using the financial year
416      so, we use next_fin_year function to get the expiry date of the dimension */
417   ELSIF p_dimension_name in ('_ASG_YTD','_ASG_LE_YTD') THEN --2610141
418      p_expiry_information := next_fin_year(to_date(g_fin_year_start,'DD-MM-'), p_owner_effective_date)-1;
419      hr_utility.trace('p_expiry_information'||p_dimension_name||':'||p_expiry_information);
420 
421   /* The balance dimension '_ASG_FY_QTD' is checking for feed using the financial year
422      so, we use next_fin_quarter function to get the expiry date of the dimension */
423   ELSIF p_dimension_name in ('_ASG_FY_QTD','_ASG_LE_FY_QTD') THEN --2610141
424      open get_beg_of_fiscal_year(p_owner_payroll_action_id);
425      fetch get_beg_of_fiscal_year into l_beg_of_fiscal_year;
426      close get_beg_of_fiscal_year;
427 
428      hr_utility.trace('l_beg_of_fiscal_year :'||l_beg_of_fiscal_year);
429      p_expiry_information := next_fin_quarter(l_beg_of_fiscal_year, p_owner_effective_date)-1;
430      hr_utility.trace('p_expiry_information'||p_dimension_name||':'||p_expiry_information);
431 
432   /* The balance dimension '_ASG_FY_YTD' is checking for feed using the financial year
433      so, we use next_fin_year function to get the expiry date of the dimension */
434   ELSIF p_dimension_name in ('_ASG_FY_YTD','_ASG_LE_FY_YTD') THEN --2610141
435      open get_beg_of_fiscal_year(p_owner_payroll_action_id);
436      fetch get_beg_of_fiscal_year into l_beg_of_fiscal_year;
437      close get_beg_of_fiscal_year;
438 
439      hr_utility.trace('l_beg_of_fiscal_year :'||l_beg_of_fiscal_year);
440      p_expiry_information := next_fin_year(l_beg_of_fiscal_year, p_owner_effective_date)-1;
441      hr_utility.trace('p_expiry_information'||p_dimension_name||':'||p_expiry_information);
442 
443   /* The balance dimension '_ASG_FBT_YTD' is checking for feed using the fbt year
444      so, we use next_fbt_year function to get the expiry date of the dimension */
445   ELSIF p_dimension_name in ('_ASG_FBT_YTD','_ASG_LE_FBT_YTD') THEN --2610141
446      p_expiry_information := next_fbt_year(p_owner_effective_date)-1;
447      hr_utility.trace('p_expiry_information'||p_dimension_name||':'||p_expiry_information);
448 
449   ELSE
450      hr_utility.set_message(801, 'NO_EXP_CHECK_FOR_THIS_DIMENSION');
451      hr_utility.raise_error;
452   END IF;
453 
454 
455 END asg_span_ec;
456 
457 -------------------------------- asg_ptd_ec ----------------------------------------------------
458 -------------------Over Loaded function for balance adjustment process--------------------------
459 --
460 --  NAME        :  asg_ptd_ec
461 --  DESCRIPTION :  Expiry checking code for the following:
462 --                 AU assignment-level process period to date balance dimension
463 --  NOTES       :  The associated dimension is expiry checked at payroll action level
464 --
465 PROCEDURE asg_ptd_ec
466 	(   p_owner_payroll_action_id    in     number      -- run created balance.
467 	,   p_user_payroll_action_id     in     number      -- current run.
468 	,   p_owner_assignment_action_id in     number      -- assact created balance.
469 	,   p_user_assignment_action_id  in     number      -- current assact..
470 	,   p_owner_effective_date       in     date        -- eff date of balance.
471 	,   p_user_effective_date        in     date        -- eff date of current run.
472 	,   p_dimension_name             in     varchar2    -- balance dimension name.
473 	,   p_expiry_information         out NOCOPY   date        -- dimension expired flag.
474 	) is
475 BEGIN
476   --Bug3583020 - Code removed as PTD balance values are now not stored in lates balances.
477   null;
478 
479 END asg_ptd_ec;
480 
481 /* Bug 4351318 - Procedure introduced */
482 /* -------------------------------- fbt_ytd_start ------------------------------------------
483 -------------------Procedure to return the START_DATE for FBT dimension--------------------
484 --  NAME           : fbt_ytd_start
485 --  DESCRIPTION    : This procedure finds the start date based on the    --
486 --                   effective date for the dimension name _ASG_LE_FBT_YTD
487 --  NOTES          : The associated dimension is expiry checked for Run balances using the
488 --                   Start Date returned.
489 */
490 PROCEDURE fbt_ytd_start( p_effective_date  IN  DATE     ,
491                          p_start_date      OUT NOCOPY DATE,
492                          p_start_date_code IN  VARCHAR2 DEFAULT NULL,
493                          p_payroll_id      IN  NUMBER   DEFAULT NULL,
494                          p_bus_grp         IN  NUMBER   DEFAULT NULL,
495                          p_action_type     IN  VARCHAR2 DEFAULT NULL,
496                          p_asg_action      IN  NUMBER   DEFAULT NULL)
497 AS
498 
499 l_year NUMBER(4);
500 
501 BEGIN
502   p_start_date :=NULL;
503   l_year := TO_NUMBER (TO_CHAR(p_effective_date,'YYYY'));
504 
505   IF p_effective_date >= TO_DATE('01-04-'||TO_CHAR(l_year),'DD-MM-YYYY') THEN
506      p_start_date:=TO_DATE('01-04-'||TO_CHAR(l_year),'DD-MM-YYYY');
507   ELSE
508      p_start_date:=TO_DATE('01-04-'||TO_CHAR(l_year-1),'DD-MM-YYYY');
509   END IF;
510 END fbt_ytd_start;
511 
512 begin
513 	g_fin_year_start  := '01-07-';
514 	g_fbt_year_start  := '01-04-';
515 	g_cal_year_start  := '01-01-';
516 	--
517 	-- get offset of fbt year start with reference to calender year in months and days
518 	l_fbtyr_months_offset := to_char(to_date(g_fbt_year_start,'DD-MM-'), 'MM') - 1;
519 	l_fbtyr_days_offset   := to_char(to_date(g_fbt_year_start,'DD-MM-'), 'DD') - 1;
520 end pay_au_exc;
521