DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_KR_YEA_PKG

Source


1 package body pay_kr_yea_pkg as
2 /* $Header: pykryea.pkb 120.60.12020000.18 2013/01/15 12:20:48 scireddy ship $ */
3 ------------------------------------------------------------------------
4 -- Constants
5 ------------------------------------------------------------------------
6 c_00010101	constant date := fnd_date.canonical_to_date('0001/01/01');
7 c_20020101      constant date := fnd_date.canonical_to_date('2002/01/01');
8 c_20030101      constant date := fnd_date.canonical_to_date('2003/01/01');
9 c_20040101      constant date := fnd_date.canonical_to_date('2004/01/01');
10 c_20050101      constant date := fnd_date.canonical_to_date('2005/01/01');
11 c_20060101      constant date := fnd_date.canonical_to_date('2006/01/01');
12 c_20070101      constant date := fnd_date.canonical_to_date('2007/01/01');   -- Bug 5734313
13 c_20080101      constant date := fnd_date.canonical_to_date('2008/01/01');   -- Bug 6705170
14 c_20090101      constant date := fnd_date.canonical_to_date('2009/01/01');   -- Bug 7676136
15 c_20100101      constant date := fnd_date.canonical_to_date('2010/01/01');   -- Bug 9231094
16 c_20110101      constant date := fnd_date.canonical_to_date('2011/01/01');   -- Bug 9393732
17 c_20120101      constant date := fnd_date.canonical_to_date('2012/01/01');   -- Bug 14219478
18 ------------------------------------------------------------------------
19 -- Global Variables
20 ------------------------------------------------------------------------
21 g_package constant varchar2(31) := '  pay_kr_yea_pkg.';
22 ------------------------------------------------------------------------
23 -- Defined Balance and Balance Value Cache
24 ------------------------------------------------------------------------
25 g_balance_value_tab  	pay_balance_pkg.t_balance_value_tab;
26 g_tax_adj_balance_tab   pay_balance_pkg.t_balance_value_tab;
27 ------------------------------------------------------------------------
28 -- Bug 8644512
29 ------------------------------------------------------------------------
30 type t_ntax_rec is record
31 (
32  business_reg_num	varchar2(255),
33  ntax_earn_code  varchar2(255),
34  ntax_earning	number
35 );
36 --
37 type t_ntax_tab is table of t_ntax_rec index by binary_integer;
38 --
39 g_ntax_detail_tbl 	t_ntax_tab;
40 g_ntax_value_tbl	t_number_tbl;
41 g_contexts_tab		t_varchar2_tbl;
42 --
43 
44  cursor csr_contexts is
45        select lookup_code from hr_lookups
46         where lookup_type = 'KR_NON_TAXABLE_EARNINGS_CODE'
47 	and   enabled_flag = 'Y'
48 	order by 1;
49 --
50 ------------------------------------------------------------------------
51 -- Element Cache
52 ------------------------------------------------------------------------
53 type t_element is record(
54 	element_type_id		number,
55 	input_value_id_tbl	hr_entry.number_table,
56 	input_value_name_tbl	t_varchar2_tbl);
57 --
58 g_tax		t_element;
59 g_itax_adj	t_element;
60 g_rtax_adj	t_element;
61 g_stax_adj	t_element;
62 ------------------------------------------------------------------------
63 -- User Entity Cache
64 ------------------------------------------------------------------------
65 type t_user_entity_id is record(
66 	non_resident_flag		number,
67 	foreign_residency_flag          number, -- Bug 6615356
68         fw_fixed_tax_rate               number, -- 3546993
69 	nationality			number, -- Bug 7595082
70 	cur_taxable_mth			number,
71 	cur_taxable_bon			number,
72 	cur_sp_irreg_bonus		number,
73 	cur_stck_pur_opt_exec_earn      number, -- Bug 6012258
74 	cur_esop_withd_earn		number, -- Bug 8644512
75 	cur_taxable			number,
76 	cur_non_taxable_ovt		number, -- Bug 8644512
77 	cur_birth_raising_allowance	number,	-- Bug 8644512
78 	cur_fw_income_exem		number,	-- Bug 8644512
79 	prev_taxable_mth		number,
80         prev_foreign_wrkr_inc_exem      number, -- Bug 8341054
81 	prev_taxable_bon		number,
82 	prev_sp_irreg_bonus		number,
83 	prev_stck_pur_opt_exec_earn     number, -- Bug 6024342
84 	prev_birth_raising_allowance	number,	-- Bug 8644512
85 	prev_esop_withd_earn		number, -- Bug 8644512
86 	prev_non_taxable_ovt		number, -- Bug 8644512
87         prev_taxable			number,
88 	taxable_mth			number,
89 	taxable_bon			number,
90 	sp_irreg_bonus			number,
91 	stck_pur_opt_exec_earn          number, -- Bug 6024342
92 	esop_withd_earn			number, -- Bug 8644512
93   	research_payment		number, -- Bug 6012258
94 	taxable				number,
95 	taxable1			number, --Bug 7615517
96 	non_taxable_ovs			number,
97 	non_taxable_ovt			number,
98 	non_taxable_ovs_frgn		number,	-- Bug 7439803
99 	non_taxable_oth			number,
100 	non_rep_non_taxable		number, -- Bug 9079450
101 	non_taxable			number,
102         foreign_worker_income_exem      number, -- 3546993
103 	basic_income_exem		number,
104 	taxable_income			number,
105 	ee_tax_exem			number,
106 	dpnt_spouse_flag		number,
107 	dpnt_spouse_tax_exem		number,
108 	num_of_aged_dpnts		number,
109 	num_of_adult_dpnts		number,
110 	num_of_underaged_dpnts		number,
111 	num_of_dpnts			number,
112 	dpnt_tax_exem			number,
113 	num_of_ageds			number,
114 	-- Bug 3172960
115 	num_of_super_ageds		number,
116 	num_of_new_born_adopted         number, -- Bug 6705170
117         new_born_adopted_tax_exem       number, -- Bug 6705170
118   single_parent_flag number,  -- Bug 16010775
119   single_parent_tax_exem number, -- Bug 16010775
120 	aged_tax_exem			number,
121 	num_of_disableds		number,
122 	disabled_tax_exem		number,
123 	female_ee_flag			number,
124 	female_ee_tax_exem		number,
125 	num_of_children			number,
126 	child_tax_exem			number,
127 	num_of_addtl_child		number, -- Bug 6784288
128 	addl_child_tax_exem             number, -- Bug 5756690
129 	house_holder_flag		number, -- Bug 9737699
130 	house_holder_exception_flag	number,  -- Bug 13247926
131 	tot_num_dpnts			number, -- Bug 9737699
132 	sep_pen_exem_amt1		number, -- Bug 9737699
133 	sep_pen_exem_amt2		number, -- Bug 9737699
134 	pen_sav_exem_amt1		number, -- Bug 9737699
135 	pen_sav_exem_amt2		number, -- Bug 9737699
136 	hou_sav_exem_amt1		number, -- Bug 9737699
137 	hou_sav_exem_amt2		number, -- Bug 9737699
138 	hou_sav_exem_amt3		number, -- Bug 9737699
139 	lt_stck_sav_exem_amt1		number, -- Bug 9737699
140 	lt_stck_sav_exem_amt2		number, -- Bug 9737699
141 	lt_stck_sav_exem_amt3		number, -- Bug 9737699
142 	sep_pen_exem_amt_archive        number, -- Bug 9737699
143 	pen_sav_amt_archive		number, -- Bug 9737699
144 	hou_sav_amt_archive		number, -- Bug 9737699
145 	lt_stck_sav_amt_archive		number, -- Bug 9737699
146 	supp_tax_exem			number,
147 	hi_prem				number,
148 	hi_prem_tax_exem		number,
149 	long_term_ins_prem		number, -- Bug 7164589
150 	long_term_ins_prem_tax_exem	number, -- Bug 7164589
151 	ei_prem				number,
152 	ei_prem_tax_exem		number,
153 	pers_ins_name			number,
154 	pers_ins_prem			number,
155 	pers_ins_prem_tax_exem		number,
156 	disabled_ins_prem		number,
157 	disabled_ins_prem_tax_exem	number,
158 	ins_prem_tax_exem		number,
159 	med_exp				number,
160 	med_exp_disabled		number,
161 	med_exp_aged			number,
162 	-- Bug 3172960
163 	med_exp_emp			number,
164 	max_med_exp_tax_exem		number,
165 	med_exp_tax_exem		number,
166 	ee_educ_exp			number,
167 	spouse_educ_exp			number,
168 	disabled_educ_exp		number,
169 	dpnt_educ_exp			number,
170 	educ_exp_tax_exem		number,
171 	housing_saving_type		number,
172 	housing_saving			number,
173 	housing_purchase_date		number,
174 	housing_loan_date		number,
175 	housing_loan_repay		number,
176 	-- Bug 9393732
177 	housing_prv_date_moved		number,
178 	housing_prv_loan_date		number,
179 	housing_prv_loan_repay		number,
180 	--
181 	lt_housing_loan_date		number,
182 	lt_housing_loan_interest_repay	number,
183 	lt_housing_loan_date_1		number,
184 	lt_housing_loan_intr_repay_1	number,
185 	 lt_housing_loan_date_2		number,   -- Bug 8237227
186 	lt_housing_loan_intr_repay_2	number,   -- Bug 8237227
187 	lt_2012_fixed_intr_wo_grace number, --14754836
188 	lt_2012_housing_other_intr number, --14754836
189 	lt_2012_house_fixed_intr_exem number,  --14754836
190 	lt_2012_house_othr_intr_exem number,  --14754836
191 	housing_rent_exp		number,
192 	max_housing_exp_tax_exem	number,
193 	housing_rent_exp_tax_exem	number,   -- Bug 9737699
194 	housing_exp_tax_exem		number,
195 	-- Bug 9737699
196 	housing_sub_saving_exem         number,
197 	total_housing_saving_exem       number,
198 	lt_hou_pro_saving_exem          number,
199 	emp_hou_pro_saving_exem          number,
200 	-- End of bug 9737699
201 	--- Bug 7142620
202 	housing_saving_exem		number,
203 	housing_loan_repay_exem	        number,
204 -- Bug 12807687 Start
205 	housing_prv_loan_repay_exem		number,
206 	housing_inst_loan_repay_exem  number,
207 	lt_housing_loan_int_rep_exem1	number,
208 	lt_housing_loan_int_rep_exem2	number,
209 	lt_housing_loan_int_rep_exem3	number,
210 -- Bug 12807687 End
211 	lt_housing_loan_intr_exem	number,
212 	birth_raising_allowance		number,
213 	--- End of Bug 7142620
214 	donation1			number,
215 	political_donation1		number,
216 	political_donation2		number,
217 	political_donation3		number,
218 	donation1_tax_exem		number,
219 	donation2			number,
220         donation3               	number,
221         donation4               	number,  -- Bug 7142612
222         religious_donation             	number,  -- Bug 7142612
223 	max_donation2_tax_exem		number,
224         max_donation3_tax_exem          number,
225 	donation2_tax_exem		number,
226 	donation3_tax_exem		number,
227 	donation_tax_exem		number,
228         marriage_exemption              number,
229         funeral_exemption               number,
230         relocation_exemption            number,
231         marr_fun_relo_exemption         number,
232 	sp_tax_exem			number,
233 	std_sp_tax_exem			number,
234 	np_prem				number,
235 	np_prem_tax_exem		number,
236 	pen_prem			number,    -- Bug 6024342
237 	military_pen_prem		number,    -- Bug 9737699
238 	private_school_pen_prem		number,    -- Bug 9737699
239 	post_office_pen_prem		number,    -- Bug 9737699
240 	taxable_income2			number,
241 	pers_pension_prem		number,
242 	pers_pension_prem_tax_exem	number,
243 	-- Bug 4750653
244 	corp_pension_prem		number,
245 	corp_pension_prem_tax_exem	number,
246 	scientific_technician_tax_exem number, -- Bug 9737699
247 	pers_pension_saving		number,
248 	pers_pension_saving_tax_exem	number,
249 	invest_partner_fin1		number,
250 	invest_partner_fin2		number,
251         	invest_partner_fin3		number,  -- 8237227
252 	invest_partner_fin4 		number,  -- BUG 14219478
253 	invest_partner_fin5 		number,  -- BUG 14219478
254 	invest_partner_fin6 		number,  -- BUG 14219478
255 	invest_partner_fin_tax_exem	number,
256 	small_bus_install		number, -- Bug 6895093
257 	small_bus_install_exem		number, -- Bug 6895093
258 	credit_card_exp			number,
259 	credit_card_exp_tax_exem	number,
260         	emp_stk_own_contri              number,
261         	emp_stk_own_contri_tax_exem     number,
262 	taxation_base			number,
263 	calc_tax			number,
264 	-- Bug 14754822
265 	tax_reduction_smb  number,
266 	tax_reduction_teachers  number,
267 	tax_reduction_marine  number,
268 	basic_tax_break			number,
269 	housing_loan_interest_repay	number,
270 	housing_exp_tax_break		number,
271 	stock_saving			number,
272 	stock_saving_tax_break		number,
273 	lt_stock_saving1		number,
274 	lt_stock_saving2		number,
275 	lt_stock_saving_tax_break	number,
276 	ovstb_tax_paid_date		number,
277 	ovstb_territory_code		number,
278 	ovstb_currency_code		number,
279 	ovstb_taxable			number,
280 	ovstb_taxable_subj_tax_break	number,
281 	ovstb_tax_break_rate		number,
282 	ovstb_tax_foreign_currency	number,
283 	ovstb_tax			number,
284 	ovstb_application_date		number,
285 	ovstb_submission_date		number,
286 	ovs_tax_break			number,
287 	total_tax_break			number,
288 	fwtb_immigration_purpose	number,
289 	fwtb_contract_date		number,
290 	fwtb_expiry_date		number,
291 	fwtb_application_date		number,
292 	fwtb_submission_date		number,
293 	foreign_worker_tax_break1	number,
294 	foreign_worker_tax_break2	number,
295 	foreign_worker_tax_break	number,
296 	annual_itax			number,
297 	annual_rtax			number,
298 	annual_stax			number,
299 	prev_itax			number,
300 	prev_rtax			number,
301 	prev_stax			number,
302 	cur_itax			number,
303 	cur_rtax			number,
304 	cur_stax			number,
305 	itax_adj			number,
306 	rtax_adj			number,
307 	stax_adj			number,
308 	-- Bug 3966549
309 	don_tax_break2004		number,
310 	-- End of 3966549
311         cash_receipt_expense            number, -- 4738717
312 	-- Bug 6630135
313         tot_med_exp_cards               number,
314 	med_exp_paid_not_inc_med_exem   number,
315 	-- End of 6630135
316         double_exem_amt                 number, -- 6716401
317         tax_grp_bus_reg_num             number, -- Bug 7361372
318         tax_grp_name                    number, -- Bug 7361372
319 	tax_grp_wkpd_from		number,	-- Bug 8644512
320 	tax_grp_wkpd_to			number,	-- Bug 8644512
321 	tax_grp_tax_brk_pd_from		number,	-- Bug 8644512
322 	tax_grp_tax_brk_pd_to		number,	-- Bug 8644512
323         tax_grp_taxable_mth             number, -- Bug 7361372
324         tax_grp_taxable_bon             number, -- Bug 7361372
325         tax_grp_sp_irreg_bonus          number, -- Bug 7361372
326         tax_grp_stck_pur_opt_exec_earn  number, -- Bug 7361372
327 	tax_grp_esop_withd_earn		number, -- Bug 8644512
328 	tax_grp_esop_withd_earn_ne	number, -- Bug 8644512
329         tax_grp_itax  	                number, -- Bug 7361372
330         tax_grp_rtax        	        number, -- Bug 7361372
331         tax_grp_stax             	number, -- Bug 7361372
332         tax_grp_taxable                 number, -- Bug 7361372
333         tax_grp_post_tax_deduc          number, -- Bug 7361372
334 	tax_grp_taxable_mth_ne          number, -- Bug 7508706
335         tax_grp_taxable_bon_ne          number, -- Bug 7508706
336         tax_grp_sp_irreg_bonus_ne       number, -- Bug 7508706
337         tax_grp_stck_pur_ne 		number, -- Bug 7508706
338         tax_grp_taxable_ne              number, -- Bug 7508706
339 	tax_grp_non_taxable_ovt		number, -- Bug 8644512
340 	tax_grp_bir_raising_allw	number, -- Bug 8644512
341 	tax_grp_fw_income_exem		number, -- Bug 8644512
342 	company_related_exp		number, -- Bug 7615517
343 	long_term_stck_fund_1year	number, -- Bug 7615517
344 	long_term_stck_fund_2year	number, -- Bug 7615517
345 	long_term_stck_fund_3year	number, -- Bug 7615517
346 	long_term_stck_fund_tax_exem	number, -- Bug 7615517
347 	--
348 	cur_ntax_R10			number, --Bug 12807687
349 	cur_ntax_G01			number, -- Bug 8644512
350 	cur_ntax_H01			number, -- Bug 8644512
351 	cur_ntax_H05			number, -- Bug 8644512
352 	cur_ntax_H06			number, -- Bug 8644512
353 	cur_ntax_H07			number, -- Bug 8644512
354 	cur_ntax_H08			number, -- Bug 8644512
355 	cur_ntax_H09			number, -- Bug 8644512
356 	cur_ntax_H10			number, -- Bug 8644512
357 	cur_ntax_H11			number, -- Bug 8644512
358 	cur_ntax_H12			number, -- Bug 8644512
359 	cur_ntax_H13			number, -- Bug 8644512
360 	cur_ntax_I01			number, -- Bug 8644512
361 	cur_ntax_K01			number, -- Bug 8644512
362 	cur_ntax_M01			number, -- Bug 8644512
363 	cur_ntax_M02			number, -- Bug 8644512
364 	cur_ntax_M03			number, -- Bug 8644512
365 	cur_ntax_S01			number, -- Bug 8644512
366 	cur_ntax_T01			number, -- Bug 8644512
367 	cur_ntax_Y01			number, -- Bug 8644512
368 	cur_ntax_Y02			number, -- Bug 8644512
369 	cur_ntax_Y03			number, -- Bug 8644512
370 	cur_ntax_Y20			number, -- Bug 8644512
371 	cur_ntax_Y21			number, -- Bug 9737699
372 	cur_ntax_ZZ                     number, -- Bug 9737699
373 	cur_ntax_Z01			number, -- Bug 8644512
374 	cur_ntax_frgn_M01		number, -- Bug 8880364
375 	cur_ntax_frgn_M02		number, -- Bug 8880364
376 	cur_ntax_frgn_M03		number, -- Bug 8880364
377 	cur_ntax_tax_brk		number, -- Bug 9737699
378 	cur_ntax_H14			number, --Bug 14754822
379 	cur_ntax_H15			number,
380 	cur_ntax_T10			number,
381 	cur_ntax_T20			number,
382 	--
383 	prev_ntax_R10			number, --Bug 12807687
384 	prev_ntax_G01			number, -- Bug 8644512
385 	prev_ntax_H01			number, -- Bug 8644512
386 	prev_ntax_H05			number, -- Bug 8644512
387 	prev_ntax_H06			number, -- Bug 8644512
388 	prev_ntax_H07			number, -- Bug 8644512
389 	prev_ntax_H08			number, -- Bug 8644512
390 	prev_ntax_H09			number, -- Bug 8644512
391 	prev_ntax_H10			number, -- Bug 8644512
392 	prev_ntax_H11			number, -- Bug 8644512
393 	prev_ntax_H12			number, -- Bug 8644512
394 	prev_ntax_H13			number, -- Bug 8644512
395 	prev_ntax_I01			number, -- Bug 8644512
396 	prev_ntax_K01			number, -- Bug 8644512
397 	prev_ntax_M01			number, -- Bug 8644512
398 	prev_ntax_M02			number, -- Bug 8644512
399 	prev_ntax_M03			number, -- Bug 8644512
400 	prev_ntax_S01			number, -- Bug 8644512
401 	prev_ntax_T01			number, -- Bug 8644512
402 	prev_ntax_Y01			number, -- Bug 8644512
403 	prev_ntax_Y02			number, -- Bug 8644512
404 	prev_ntax_Y03			number, -- Bug 8644512
405 	prev_ntax_Y20			number, -- Bug 8644512
406 	prev_ntax_Y21			number, -- Bug 9737699
407 	prev_ntax_ZZ                    number, -- Bug 9737699
408 	prev_ntax_Z01			number, -- Bug 8644512
409 	prev_ntax_tax_brk		number, -- Bug 9737699
410 	prev_ntax_H14			number, --Bug 14754822
411 	prev_ntax_H15			number,
412 	prev_ntax_T10			number,
413 	prev_ntax_T20			number,
414 
415 	--
416 	tax_grp_ntax_R10		number, --Bug 12807687
417 	tax_grp_ntax_G01		number, -- Bug 8644512
418 	tax_grp_ntax_H01		number, -- Bug 8644512
419 	tax_grp_ntax_H05		number, -- Bug 8644512
420 	tax_grp_ntax_H06		number, -- Bug 8644512
421 	tax_grp_ntax_H07		number, -- Bug 8644512
422 	tax_grp_ntax_H08		number, -- Bug 8644512
423 	tax_grp_ntax_H09		number, -- Bug 8644512
424 	tax_grp_ntax_H10		number, -- Bug 8644512
425 	tax_grp_ntax_H11		number, -- Bug 8644512
426 	tax_grp_ntax_H12		number, -- Bug 8644512
427 	tax_grp_ntax_H13		number, -- Bug 8644512
428 	tax_grp_ntax_I01		number, -- Bug 8644512
429 	tax_grp_ntax_K01		number, -- Bug 8644512
430 	tax_grp_ntax_M01		number, -- Bug 8644512
431 	tax_grp_ntax_M02		number, -- Bug 8644512
432 	tax_grp_ntax_M03		number, -- Bug 8644512
433 	tax_grp_ntax_S01		number, -- Bug 8644512
434 	tax_grp_ntax_T01		number, -- Bug 8644512
435 	tax_grp_ntax_Y01		number, -- Bug 8644512
436 	tax_grp_ntax_Y02		number, -- Bug 8644512
437 	tax_grp_ntax_Y03		number, -- Bug 8644512
438 	tax_grp_ntax_Y20		number, -- Bug 8644512
439 	tax_grp_ntax_Y21		number, -- Bug 9737699
440 	tax_grp_ntax_ZZ		  number, -- Bug 9737699
441 	tax_grp_ntax_Z01		number, -- Bug 8644512
442 	tax_grp_ntax_tax_brk		number, -- Bug 9737699
443 	tax_grp_ntax_H14		number, -- Bug 14754822
444 	tax_grp_ntax_H15		number,
445 	tax_grp_ntax_T10		number,
446 	tax_grp_ntax_T20		number,
447 
448 	--
449 	total_ntax_R10			number, --Bug 12807687
450 	total_ntax_G01			number, -- Bug 8644512
451 	total_ntax_H01			number, -- Bug 8644512
452 	total_ntax_H05			number, -- Bug 8644512
453 	total_ntax_H06			number, -- Bug 8644512
454 	total_ntax_H07			number, -- Bug 8644512
455 	total_ntax_H08			number, -- Bug 8644512
456 	total_ntax_H09			number, -- Bug 8644512
457 	total_ntax_H10			number, -- Bug 8644512
458 	total_ntax_H11			number, -- Bug 8644512
459 	total_ntax_H12			number, -- Bug 8644512
460 	total_ntax_H13			number, -- Bug 8644512
461 	total_ntax_I01			number, -- Bug 8644512
462 	total_ntax_K01			number, -- Bug 8644512
463 	total_ntax_M01			number, -- Bug 8644512
464 	total_ntax_M02			number, -- Bug 8644512
465 	total_ntax_M03			number, -- Bug 8644512
466 	total_ntax_S01			number, -- Bug 8644512
467 	total_ntax_T01			number, -- Bug 8644512
468 	total_ntax_Y01			number, -- Bug 8644512
469 	total_ntax_Y02			number, -- Bug 8644512
470 	total_ntax_Y03			number, -- Bug 8644512
471 	total_ntax_Y20			number, -- Bug 8644512
472 	total_ntax_Y21			number, -- Bug 9737699
473         total_ntax_ZZ			number, -- Bug 9737699
474 	total_ntax_Z01			number, -- Bug 8644512
475 	total_ntax_tax_brk		number, -- Bug 9737699
476 	total_ntax_H14			number, -- Bug 14754822
477 	total_ntax_H15			number,
478 	total_ntax_T10			number,
479 	total_ntax_T20			number,
480 	--
481 	cur_total_ntax_earn		number,	-- Bug 8644512
482 	tax_grp_total_ntax_earn		number, -- Bug 8644512
483 	--
484 	smb_income_exem			number, -- Bug 9079450
485 	cur_smb_days_worked 		number, -- Bug 9079450
486 	prev_smb_days_worked 		number, -- Bug 9079450
487 	cur_smb_eligible_income		number, -- Bug 9079450
488 	prev_smb_eligible_income	number, -- Bug 9079450
489 	emp_join_prev_year		number,	-- Bug 9079450
490 	emp_leave_cur_year		number,	-- Bug 9079450
491 	smb_eligibility_flag		number  -- Bug 9079450
492 	) ;
493 --
494 g_user_entity_id	t_user_entity_id;
495 ------------------------------------------------------------------------
496 -- PAY_REPORT_FORMAT_ITEMS_F Cache
497 ------------------------------------------------------------------------
498 type t_archive_item is record(
499 	report_type		pay_report_format_mappings_f.report_type%TYPE,
500 	report_qualifier	pay_report_format_mappings_f.report_qualifier%TYPE,
501 	report_category		pay_report_format_mappings_f.report_category%TYPE,
502 	effective_date		date,
503 	archive_item_tbl	t_varchar2_tbl); -- user_entity_id indexed PL/SQL table
504 g_archive_item	t_archive_item;
505 ------------------------------------------------------------------------
506 -- Global variable for debugging
507 ------------------------------------------------------------------------
508 g_debug   constant    boolean  := hr_utility.debug_enabled;
509 l_pay_periods_per_year constant number := 12;
510 ------------------------------------------------------------------------
511 function convert_to_rec(
512 	p_user_entity_id_tbl		in t_number_tbl,
513 	p_archive_item_value_tbl	in t_varchar2_tbl) return t_yea_info
514 ------------------------------------------------------------------------
515 is
516 	l_yea_info			t_yea_info;
517 	l_archive_item_value_tbl	t_varchar2_tbl;
518 	----------------------------------------------------------------
519 	procedure set_archive_item(
520 		p_user_entity_id	in number,
521 		p_archive_item_value	in out nocopy varchar2)
522 	----------------------------------------------------------------
523 	is
524 	begin
525 		if l_archive_item_value_tbl.exists(p_user_entity_id) then
526 			p_archive_item_value := l_archive_item_value_tbl(p_user_entity_id);
527 		end if;
528 	end set_archive_item;
529 	----------------------------------------------------------------
530 	procedure set_archive_item(
531 		p_user_entity_id	in number,
532 		p_archive_item_value	in out nocopy number)
533 	----------------------------------------------------------------
534 	is
535 	begin
536 		if l_archive_item_value_tbl.exists(p_user_entity_id) then
537 			p_archive_item_value := fnd_number.canonical_to_number(l_archive_item_value_tbl(p_user_entity_id)); -- Bug 7149878
538 		end if;
539 	end set_archive_item;
540 	----------------------------------------------------------------
541 	procedure set_archive_item(
542 		p_user_entity_id	in number,
543 		p_archive_item_value	in out nocopy date)
544 	----------------------------------------------------------------
545 	is
546 	begin
547 		if l_archive_item_value_tbl.exists(p_user_entity_id) then
548 			p_archive_item_value := fnd_date.canonical_to_date(l_archive_item_value_tbl(p_user_entity_id));
549 		end if;
550 	end set_archive_item;
551 begin
552 	------------------------------------------------------------------------
553 	-- Re-construct above PL/SQL table to user_entity_id indexed PL/SQL table.
554 	------------------------------------------------------------------------
555 	for i in 1..p_user_entity_id_tbl.count loop
556 		l_archive_item_value_tbl(p_user_entity_id_tbl(i)) := p_archive_item_value_tbl(i);
557 	end loop;
558 	------------------------------------------------------------------------
559 	-- Convert user_entity_id indexed PL/SQL table to PL/SQL record
560 	------------------------------------------------------------------------
561 	set_archive_item(g_user_entity_id.non_resident_flag, l_yea_info.non_resident_flag);
562 	set_archive_item(g_user_entity_id.foreign_residency_flag, l_yea_info.foreign_residency_flag); -- Bug 6615356
563 	set_archive_item(g_user_entity_id.fw_fixed_tax_rate, l_yea_info.fixed_tax_rate); -- 3546993
564 	set_archive_item(g_user_entity_id.nationality, l_yea_info.nationality); -- Bug 7595082
565 	set_archive_item(g_user_entity_id.cur_taxable_mth, l_yea_info.cur_taxable_mth);
566 	set_archive_item(g_user_entity_id.cur_taxable_bon, l_yea_info.cur_taxable_bon);
567 	set_archive_item(g_user_entity_id.cur_sp_irreg_bonus, l_yea_info.cur_sp_irreg_bonus);
568 	set_archive_item(g_user_entity_id.cur_taxable, l_yea_info.cur_taxable);
569 	set_archive_item(g_user_entity_id.cur_non_taxable_ovt, l_yea_info.cur_non_taxable_ovt);		-- Bug 8644512
570 	set_archive_item(g_user_entity_id.prev_non_taxable_ovt, l_yea_info.prev_non_taxable_ovt);	-- Bug 8644512
571 	set_archive_item(g_user_entity_id.cur_fw_income_exem, l_yea_info.cur_fw_income_exem);		-- Bug 8644512
572 	set_archive_item(g_user_entity_id.prev_taxable_mth, l_yea_info.prev_taxable_mth);
573 	set_archive_item(g_user_entity_id.prev_taxable_bon, l_yea_info.prev_taxable_bon);
574 	set_archive_item(g_user_entity_id.prev_sp_irreg_bonus, l_yea_info.prev_sp_irreg_bonus);
575 	set_archive_item(g_user_entity_id.prev_foreign_wrkr_inc_exem, l_yea_info.prev_foreign_wrkr_inc_exem); -- Bug 8341054
576 	--Bug 6024342
577 	set_archive_item(g_user_entity_id.prev_stck_pur_opt_exec_earn, l_yea_info.prev_stck_pur_opt_exec_earn);
578 	--
579 	-- Bug 8644512
580 	set_archive_item(g_user_entity_id.prev_esop_withd_earn,l_yea_info.prev_esop_withd_earn);
581 	set_archive_item(g_user_entity_id.cur_esop_withd_earn,l_yea_info.cur_esop_withd_earn);
582 	set_archive_item(g_user_entity_id.esop_withd_earn,l_yea_info.esop_withd_earn);
583 	--
584 	-- bug 6012258
585 	set_archive_item(g_user_entity_id.cur_stck_pur_opt_exec_earn, l_yea_info.cur_stck_pur_opt_exec_earn);
586 	set_archive_item(g_user_entity_id.research_payment, l_yea_info.research_payment);
587 	--
588 	-- Bug 6024342
589 	set_archive_item(g_user_entity_id.stck_pur_opt_exec_earn, l_yea_info.stck_pur_opt_exec_earn);
590 	--
591 	set_archive_item(g_user_entity_id.prev_taxable, l_yea_info.prev_taxable);
592 	set_archive_item(g_user_entity_id.taxable_mth, l_yea_info.taxable_mth);
593 	set_archive_item(g_user_entity_id.taxable_bon, l_yea_info.taxable_bon);
594 	set_archive_item(g_user_entity_id.sp_irreg_bonus, l_yea_info.sp_irreg_bonus);
595 	set_archive_item(g_user_entity_id.taxable, l_yea_info.taxable);
596 	set_archive_item(g_user_entity_id.taxable1, l_yea_info.taxable1); --Bug 7615517
597 	set_archive_item(g_user_entity_id.non_taxable_ovs, l_yea_info.non_taxable_ovs);
598 	set_archive_item(g_user_entity_id.non_taxable_ovt, l_yea_info.non_taxable_ovt);
599 	-- Bug 7439803
600 	set_archive_item(g_user_entity_id.non_taxable_ovs_frgn, l_yea_info.non_taxable_ovs_frgn);
601 	--
602 	set_archive_item(g_user_entity_id.non_taxable_oth, l_yea_info.non_taxable_oth);
603 	set_archive_item(g_user_entity_id.non_rep_non_taxable, l_yea_info.non_rep_non_taxable); -- Bug 9079450
604 	set_archive_item(g_user_entity_id.non_taxable, l_yea_info.non_taxable);
605 	set_archive_item(g_user_entity_id.foreign_worker_income_exem, l_yea_info.foreign_worker_income_exem);  -- 3546993
606 	set_archive_item(g_user_entity_id.basic_income_exem, l_yea_info.basic_income_exem);
607 	set_archive_item(g_user_entity_id.taxable_income, l_yea_info.taxable_income);
608 	set_archive_item(g_user_entity_id.ee_tax_exem, l_yea_info.ee_tax_exem);
609 	set_archive_item(g_user_entity_id.dpnt_spouse_flag, l_yea_info.dpnt_spouse_flag);
610 	set_archive_item(g_user_entity_id.dpnt_spouse_tax_exem, l_yea_info.dpnt_spouse_tax_exem);
611 	set_archive_item(g_user_entity_id.num_of_aged_dpnts, l_yea_info.num_of_aged_dpnts);
612 	set_archive_item(g_user_entity_id.num_of_adult_dpnts, l_yea_info.num_of_adult_dpnts);
613 	set_archive_item(g_user_entity_id.num_of_underaged_dpnts, l_yea_info.num_of_underaged_dpnts);
614 	set_archive_item(g_user_entity_id.num_of_dpnts, l_yea_info.num_of_dpnts);
615 	set_archive_item(g_user_entity_id.dpnt_tax_exem, l_yea_info.dpnt_tax_exem);
616 	set_archive_item(g_user_entity_id.num_of_ageds, l_yea_info.num_of_ageds);
617 	-- Bug 3172960
618 	set_archive_item(g_user_entity_id.num_of_super_ageds, l_yea_info.num_of_super_ageds);
619 	-- Bug 6705170
620         set_archive_item(g_user_entity_id.num_of_new_born_adopted, l_yea_info.num_of_new_born_adopted);
621         set_archive_item(g_user_entity_id.new_born_adopted_tax_exem, l_yea_info.new_born_adopted_tax_exem);
622 	--
623 	-- Bug 6784288
624   -- Bug 16010775
625   set_archive_item(g_user_entity_id.single_parent_flag, l_yea_info.single_parent_flag);
626   set_archive_item(g_user_entity_id.single_parent_tax_exem, l_yea_info.single_parent_tax_exem);
627   -- Bug 16010775
628         set_archive_item(g_user_entity_id.num_of_addtl_child, l_yea_info.num_of_addtl_child);
629 	--
630 	-- Bug 9737699
631 	 set_archive_item(g_user_entity_id.house_holder_flag, l_yea_info.house_holder_flag);
632 	 set_archive_item(g_user_entity_id.tot_num_dpnts, l_yea_info.tot_num_dpnts);
633 	 set_archive_item(g_user_entity_id.house_holder_exception_flag, l_yea_info.house_holder_exception_flag); -- Bug 13247926
634 	--
635 	set_archive_item(g_user_entity_id.aged_tax_exem, l_yea_info.aged_tax_exem);
636 	set_archive_item(g_user_entity_id.num_of_disableds, l_yea_info.num_of_disableds);
637 	set_archive_item(g_user_entity_id.disabled_tax_exem, l_yea_info.disabled_tax_exem);
638 	set_archive_item(g_user_entity_id.female_ee_flag, l_yea_info.female_ee_flag);
639 	set_archive_item(g_user_entity_id.female_ee_tax_exem, l_yea_info.female_ee_tax_exem);
640 	set_archive_item(g_user_entity_id.num_of_children, l_yea_info.num_of_children);
641 	set_archive_item(g_user_entity_id.child_tax_exem, l_yea_info.child_tax_exem);
642 	-- Bug 5756690
643 	set_archive_item(g_user_entity_id.addl_child_tax_exem, l_yea_info.addl_child_tax_exem);
644 	set_archive_item(g_user_entity_id.supp_tax_exem, l_yea_info.supp_tax_exem);
645 	set_archive_item(g_user_entity_id.hi_prem, l_yea_info.hi_prem);
646 	set_archive_item(g_user_entity_id.hi_prem_tax_exem, l_yea_info.hi_prem_tax_exem);
647 	-- Bug 7164589
648 	set_archive_item(g_user_entity_id.long_term_ins_prem, l_yea_info.long_term_ins_prem);
649 	set_archive_item(g_user_entity_id.long_term_ins_prem_tax_exem, l_yea_info.long_term_ins_prem_tax_exem);
650 	-- End of Bug 7164589
651 	set_archive_item(g_user_entity_id.ei_prem, l_yea_info.ei_prem);
652 	set_archive_item(g_user_entity_id.ei_prem_tax_exem, l_yea_info.ei_prem_tax_exem);
653 	set_archive_item(g_user_entity_id.pers_ins_name, l_yea_info.pers_ins_name);
654 	set_archive_item(g_user_entity_id.pers_ins_prem, l_yea_info.pers_ins_prem);
655 	set_archive_item(g_user_entity_id.pers_ins_prem_tax_exem, l_yea_info.pers_ins_prem_tax_exem);
656 	set_archive_item(g_user_entity_id.disabled_ins_prem, l_yea_info.disabled_ins_prem);
657 	set_archive_item(g_user_entity_id.disabled_ins_prem_tax_exem, l_yea_info.disabled_ins_prem_tax_exem);
658 	set_archive_item(g_user_entity_id.ins_prem_tax_exem, l_yea_info.ins_prem_tax_exem);
659 	set_archive_item(g_user_entity_id.med_exp, l_yea_info.med_exp);
660 	set_archive_item(g_user_entity_id.med_exp_disabled, l_yea_info.med_exp_disabled);
661 	set_archive_item(g_user_entity_id.med_exp_aged, l_yea_info.med_exp_aged);
662 	-- Bug 3172960
663 	set_archive_item(g_user_entity_id.med_exp_emp, l_yea_info.med_exp_emp);
664 	set_archive_item(g_user_entity_id.max_med_exp_tax_exem, l_yea_info.max_med_exp_tax_exem);
665 	set_archive_item(g_user_entity_id.med_exp_tax_exem, l_yea_info.med_exp_tax_exem);
666 	set_archive_item(g_user_entity_id.ee_educ_exp, l_yea_info.ee_educ_exp);
667 	set_archive_item(g_user_entity_id.spouse_educ_exp, l_yea_info.spouse_educ_exp);
668 	set_archive_item(g_user_entity_id.disabled_educ_exp, l_yea_info.disabled_educ_exp);
669 	set_archive_item(g_user_entity_id.dpnt_educ_exp, l_yea_info.dpnt_educ_exp);
670 	set_archive_item(g_user_entity_id.educ_exp_tax_exem, l_yea_info.educ_exp_tax_exem);
671 	set_archive_item(g_user_entity_id.housing_saving_type, l_yea_info.housing_saving_type);
672 	set_archive_item(g_user_entity_id.housing_saving, l_yea_info.housing_saving);
673 	set_archive_item(g_user_entity_id.housing_purchase_date, l_yea_info.housing_purchase_date);
674 	set_archive_item(g_user_entity_id.housing_loan_date, l_yea_info.housing_loan_date);
675 	set_archive_item(g_user_entity_id.housing_loan_repay, l_yea_info.housing_loan_repay);
676 	-- bug 9393732
677 	set_archive_item(g_user_entity_id.housing_prv_date_moved, l_yea_info.housing_prv_date_moved);
678 	set_archive_item(g_user_entity_id.housing_prv_loan_date, l_yea_info.housing_prv_loan_date);
679 	set_archive_item(g_user_entity_id.housing_prv_loan_repay, l_yea_info.housing_prv_loan_repay);
680 	--
681 	set_archive_item(g_user_entity_id.lt_housing_loan_date, l_yea_info.lt_housing_loan_date);
682 	set_archive_item(g_user_entity_id.lt_housing_loan_interest_repay, l_yea_info.lt_housing_loan_interest_repay);
683 	set_archive_item(g_user_entity_id.max_housing_exp_tax_exem, l_yea_info.max_housing_exp_tax_exem);
684 	set_archive_item(g_user_entity_id.housing_exp_tax_exem, l_yea_info.housing_exp_tax_exem);
685 	-- Bug 9737699
686 	set_archive_item(g_user_entity_id.housing_rent_exp_tax_exem, l_yea_info.housing_rent_exp_tax_exem);
687         set_archive_item(g_user_entity_id.housing_sub_saving_exem, l_yea_info.housing_sub_saving_exem);
688 	set_archive_item(g_user_entity_id.total_housing_saving_exem, l_yea_info.total_housing_saving_exem);
689 	set_archive_item(g_user_entity_id.lt_hou_pro_saving_exem, l_yea_info.lt_hou_pro_saving_exem);
690 	set_archive_item(g_user_entity_id.emp_hou_pro_saving_exem, l_yea_info.emp_hou_pro_saving_exem);
691 	--
692 	set_archive_item(g_user_entity_id.donation1, l_yea_info.donation1);
693 	set_archive_item(g_user_entity_id.political_donation1, l_yea_info.political_donation1);
694 	set_archive_item(g_user_entity_id.political_donation2, l_yea_info.political_donation2);
695 	set_archive_item(g_user_entity_id.political_donation3, l_yea_info.political_donation3);
696 	set_archive_item(g_user_entity_id.donation1_tax_exem, l_yea_info.donation1_tax_exem);
697 	set_archive_item(g_user_entity_id.donation2, l_yea_info.donation2);
698 	set_archive_item(g_user_entity_id.donation3, l_yea_info.donation3);
699 	set_archive_item(g_user_entity_id.donation4, l_yea_info.donation4);  -- Bug 7142612
700 	set_archive_item(g_user_entity_id.religious_donation, l_yea_info.religious_donation);  -- Bug 7142612
701 	set_archive_item(g_user_entity_id.max_donation2_tax_exem, l_yea_info.max_donation2_tax_exem);
702 	set_archive_item(g_user_entity_id.max_donation3_tax_exem, l_yea_info.max_donation3_tax_exem);
703 	set_archive_item(g_user_entity_id.donation2_tax_exem, l_yea_info.donation2_tax_exem);
704 	set_archive_item(g_user_entity_id.donation3_tax_exem, l_yea_info.donation3_tax_exem);
705 	set_archive_item(g_user_entity_id.donation_tax_exem, l_yea_info.donation_tax_exem);
706 	-- Bug 3966549
707 	set_archive_item(g_user_entity_id.don_tax_break2004, l_yea_info.don_tax_break2004) ;
708 	-- End of 3966549
709         set_archive_item(g_user_entity_id.marriage_exemption, l_yea_info.marriage_exemption);
710         set_archive_item(g_user_entity_id.funeral_exemption, l_yea_info.funeral_exemption);
711         set_archive_item(g_user_entity_id.relocation_exemption, l_yea_info.relocation_exemption);
712         set_archive_item(g_user_entity_id.marr_fun_relo_exemption, l_yea_info.marr_fun_relo_exemption);
713 	set_archive_item(g_user_entity_id.sp_tax_exem, l_yea_info.sp_tax_exem);
714 	-- Bug 7142620
715 	set_archive_item(g_user_entity_id.housing_saving_exem, l_yea_info.housing_saving_exem);
716 	set_archive_item(g_user_entity_id.housing_loan_repay_exem, l_yea_info.housing_loan_repay_exem);
717 	--Bug 12807687 Start
718 	set_archive_item(g_user_entity_id.housing_prv_loan_repay_exem, l_yea_info.housing_prv_loan_repay_exem);
719 	set_archive_item(g_user_entity_id.housing_inst_loan_repay_exem, l_yea_info.housing_inst_loan_repay_exem);
720 	set_archive_item(g_user_entity_id.lt_housing_loan_int_rep_exem1, l_yea_info.lt_housing_loan_int_rep_exem1);
721 	set_archive_item(g_user_entity_id.lt_housing_loan_int_rep_exem2, l_yea_info.lt_housing_loan_int_rep_exem2);
722 	set_archive_item(g_user_entity_id.lt_housing_loan_int_rep_exem3, l_yea_info.lt_housing_loan_int_rep_exem3);
723 	-- Bug 12807687 End
724 	-- Bug 14754836 START
725 		set_archive_item(g_user_entity_id.lt_2012_fixed_intr_wo_grace, l_yea_info.lt_2012_fixed_intr_wo_grace); --14754836
726 		set_archive_item(g_user_entity_id.lt_2012_housing_other_intr, l_yea_info.lt_2012_housing_other_intr); --14754836
727 		set_archive_item(g_user_entity_id.lt_2012_house_fixed_intr_exem,l_yea_info.lt_2012_house_fixed_intr_exem); -- 14754836
728 		set_archive_item(g_user_entity_id.lt_2012_house_othr_intr_exem,l_yea_info.lt_2012_house_othr_intr_exem);  -- 14754836
729  -- Bug 14754836 End
730 	set_archive_item(g_user_entity_id.lt_housing_loan_intr_exem, l_yea_info.lt_housing_loan_intr_exem);
731 	set_archive_item(g_user_entity_id.birth_raising_allowance,l_yea_info.birth_raising_allowance);
732 	set_archive_item(g_user_entity_id.cur_birth_raising_allowance,l_yea_info.cur_birth_raising_allowance); -- Bug 8644512
733 	set_archive_item(g_user_entity_id.prev_birth_raising_allowance,l_yea_info.prev_birth_raising_allowance); -- Bug 8644512
734 	--End of 7142620
735 	set_archive_item(g_user_entity_id.std_sp_tax_exem, l_yea_info.std_sp_tax_exem);
736 	set_archive_item(g_user_entity_id.np_prem, l_yea_info.np_prem);
737 	set_archive_item(g_user_entity_id.np_prem_tax_exem, l_yea_info.np_prem_tax_exem);
738 	-- Bug 6024342
739 	set_archive_item(g_user_entity_id.pen_prem, l_yea_info.pen_prem);
740 	--
741 	-- Bug 9737699
742 	set_archive_item(g_user_entity_id.military_pen_prem, l_yea_info.military_pen_prem);
743 	set_archive_item(g_user_entity_id.private_school_pen_prem, l_yea_info.private_school_pen_prem);
744 	set_archive_item(g_user_entity_id.post_office_pen_prem, l_yea_info.post_office_pen_prem);
745 	--
746 	set_archive_item(g_user_entity_id.taxable_income2, l_yea_info.taxable_income2);
747 	set_archive_item(g_user_entity_id.pers_pension_prem, l_yea_info.pers_pension_prem);
748 	set_archive_item(g_user_entity_id.pers_pension_prem_tax_exem, l_yea_info.pers_pension_prem_tax_exem);
749 	-- Bug 4750653
750 	set_archive_item(g_user_entity_id.corp_pension_prem, l_yea_info.corp_pension_prem);
751 	set_archive_item(g_user_entity_id.corp_pension_prem_tax_exem, l_yea_info.corp_pension_prem_tax_exem);
752 	-- End of Bug 4750653
753 	-- Bug 9737699
754 	set_archive_item(g_user_entity_id.scientific_technician_tax_exem, l_yea_info.scientific_technician_tax_exem);
755 
756 	set_archive_item(g_user_entity_id.sep_pen_exem_amt1, l_yea_info.sep_pen_exem_amt1);
757 	set_archive_item(g_user_entity_id.sep_pen_exem_amt2, l_yea_info.sep_pen_exem_amt2);
758 	set_archive_item(g_user_entity_id.pen_sav_exem_amt1, l_yea_info.pen_sav_exem_amt1);
759 	set_archive_item(g_user_entity_id.pen_sav_exem_amt2, l_yea_info.pen_sav_exem_amt2);
760 	set_archive_item(g_user_entity_id.hou_sav_exem_amt1, l_yea_info.hou_sav_exem_amt1);
761 	set_archive_item(g_user_entity_id.hou_sav_exem_amt2, l_yea_info.hou_sav_exem_amt2);
762 	set_archive_item(g_user_entity_id.hou_sav_exem_amt3, l_yea_info.hou_sav_exem_amt3);
763 	set_archive_item(g_user_entity_id.sep_pen_exem_amt_archive,l_yea_info.sep_pen_exem_amt_archive);
764 	set_archive_item(g_user_entity_id.pen_sav_amt_archive,l_yea_info.pen_sav_amt_archive);
765 	set_archive_item(g_user_entity_id.hou_sav_amt_archive,l_yea_info.hou_sav_amt_archive);
766 	set_archive_item(g_user_entity_id.lt_stck_sav_amt_archive,l_yea_info.lt_stck_sav_amt_archive);
767 	set_archive_item(g_user_entity_id.lt_stck_sav_exem_amt1, l_yea_info.lt_stck_sav_exem_amt1);
768 	set_archive_item(g_user_entity_id.lt_stck_sav_exem_amt2, l_yea_info.lt_stck_sav_exem_amt2);
769 	set_archive_item(g_user_entity_id.lt_stck_sav_exem_amt3, l_yea_info.lt_stck_sav_exem_amt3);
770 	--
771 	set_archive_item(g_user_entity_id.pers_pension_saving, l_yea_info.pers_pension_saving);
772 	set_archive_item(g_user_entity_id.pers_pension_saving_tax_exem, l_yea_info.pers_pension_saving_tax_exem);
773 	set_archive_item(g_user_entity_id.invest_partner_fin1, l_yea_info.invest_partner_fin1);
774 	set_archive_item(g_user_entity_id.invest_partner_fin2, l_yea_info.invest_partner_fin2);
775        	set_archive_item(g_user_entity_id.invest_partner_fin3, l_yea_info.invest_partner_fin3);  -- Bug 8237227
776 	set_archive_item(g_user_entity_id.invest_partner_fin_tax_exem, l_yea_info.invest_partner_fin_tax_exem);
777 	-- Bug 6895093
778 	set_archive_item(g_user_entity_id.small_bus_install, l_yea_info.small_bus_install);
779 	set_archive_item(g_user_entity_id.small_bus_install_exem, l_yea_info.small_bus_install_exem);
780 	-- End of Bug 6895093
781 	set_archive_item(g_user_entity_id.credit_card_exp, l_yea_info.credit_card_exp);
782 	set_archive_item(g_user_entity_id.credit_card_exp_tax_exem, l_yea_info.credit_card_exp_tax_exem);
783         set_archive_item(g_user_entity_id.emp_stk_own_contri, l_yea_info.emp_stk_own_contri);
784         set_archive_item(g_user_entity_id.emp_stk_own_contri_tax_exem, l_yea_info.emp_stk_own_contri_tax_exem);
785 	set_archive_item(g_user_entity_id.taxation_base, l_yea_info.taxation_base);
786 	set_archive_item(g_user_entity_id.calc_tax, l_yea_info.calc_tax);
787 	set_archive_item(g_user_entity_id.basic_tax_break, l_yea_info.basic_tax_break);
788 	set_archive_item(g_user_entity_id.housing_loan_interest_repay, l_yea_info.housing_loan_interest_repay);
789 	set_archive_item(g_user_entity_id.housing_exp_tax_break, l_yea_info.housing_exp_tax_break);
790 	set_archive_item(g_user_entity_id.stock_saving, l_yea_info.stock_saving);
791 	set_archive_item(g_user_entity_id.stock_saving_tax_break, l_yea_info.stock_saving_tax_break);
792 	set_archive_item(g_user_entity_id.lt_stock_saving1, l_yea_info.lt_stock_saving1);
793 	set_archive_item(g_user_entity_id.lt_stock_saving2, l_yea_info.lt_stock_saving2);
794 	set_archive_item(g_user_entity_id.lt_stock_saving_tax_break, l_yea_info.lt_stock_saving_tax_break);
795 	set_archive_item(g_user_entity_id.ovstb_tax_paid_date, l_yea_info.ovstb_tax_paid_date);
796 	set_archive_item(g_user_entity_id.ovstb_territory_code, l_yea_info.ovstb_territory_code);
797 	set_archive_item(g_user_entity_id.ovstb_currency_code, l_yea_info.ovstb_currency_code);
798 	set_archive_item(g_user_entity_id.ovstb_taxable, l_yea_info.ovstb_taxable);
799 	set_archive_item(g_user_entity_id.ovstb_taxable_subj_tax_break, l_yea_info.ovstb_taxable_subj_tax_break);
800 	set_archive_item(g_user_entity_id.ovstb_tax_break_rate, l_yea_info.ovstb_tax_break_rate);
801 	set_archive_item(g_user_entity_id.ovstb_tax_foreign_currency, l_yea_info.ovstb_tax_foreign_currency);
802 	set_archive_item(g_user_entity_id.ovstb_tax, l_yea_info.ovstb_tax);
803 	set_archive_item(g_user_entity_id.ovstb_application_date, l_yea_info.ovstb_application_date);
804 	set_archive_item(g_user_entity_id.ovstb_submission_date, l_yea_info.ovstb_submission_date);
805 	set_archive_item(g_user_entity_id.ovs_tax_break, l_yea_info.ovs_tax_break);
806 	set_archive_item(g_user_entity_id.total_tax_break, l_yea_info.total_tax_break);
807 	set_archive_item(g_user_entity_id.fwtb_immigration_purpose, l_yea_info.fwtb_immigration_purpose);
808 	set_archive_item(g_user_entity_id.fwtb_contract_date, l_yea_info.fwtb_contract_date);
809 	set_archive_item(g_user_entity_id.fwtb_expiry_date, l_yea_info.fwtb_expiry_date);
810 	set_archive_item(g_user_entity_id.fwtb_application_date, l_yea_info.fwtb_application_date);
811 	set_archive_item(g_user_entity_id.fwtb_submission_date, l_yea_info.fwtb_submission_date);
812 	set_archive_item(g_user_entity_id.foreign_worker_tax_break1, l_yea_info.foreign_worker_tax_break1);
813 	set_archive_item(g_user_entity_id.foreign_worker_tax_break2, l_yea_info.foreign_worker_tax_break2);
814 	set_archive_item(g_user_entity_id.foreign_worker_tax_break, l_yea_info.foreign_worker_tax_break);
815 	set_archive_item(g_user_entity_id.annual_itax, l_yea_info.annual_itax);
816 	set_archive_item(g_user_entity_id.annual_rtax, l_yea_info.annual_rtax);
817 	set_archive_item(g_user_entity_id.annual_stax, l_yea_info.annual_stax);
818 	set_archive_item(g_user_entity_id.prev_itax, l_yea_info.prev_itax);
819 	set_archive_item(g_user_entity_id.prev_rtax, l_yea_info.prev_rtax);
820 	set_archive_item(g_user_entity_id.prev_stax, l_yea_info.prev_stax);
821 	set_archive_item(g_user_entity_id.cur_itax, l_yea_info.cur_itax);
822 	set_archive_item(g_user_entity_id.cur_rtax, l_yea_info.cur_rtax);
823 	set_archive_item(g_user_entity_id.cur_stax, l_yea_info.cur_stax);
824 	set_archive_item(g_user_entity_id.itax_adj, l_yea_info.itax_adj);
825 	set_archive_item(g_user_entity_id.rtax_adj, l_yea_info.rtax_adj);
826 	set_archive_item(g_user_entity_id.stax_adj, l_yea_info.stax_adj);
827 	-- BUG 14754822
828 	set_archive_item(g_user_entity_id.tax_reduction_smb, l_yea_info.tax_reduction_smb);
829 	set_archive_item(g_user_entity_id.tax_reduction_teachers, l_yea_info.tax_reduction_teachers);
830 	set_archive_item(g_user_entity_id.tax_reduction_marine, l_yea_info.tax_reduction_marine);
831 
832 
833         -- Bug 6630135
834         set_archive_item(g_user_entity_id.tot_med_exp_cards,l_yea_info.tot_med_exp_cards);
835         set_archive_item(g_user_entity_id.med_exp_paid_not_inc_med_exem,l_yea_info.med_exp_paid_not_inc_med_exem);
836         -- End of Bug 6630135
837         -- Bug 6716401
838         set_archive_item(g_user_entity_id.double_exem_amt,l_yea_info.double_exem_amt);
839         -- End of Bug 6716401
840         -- Bug 7361372
841         set_archive_item(g_user_entity_id.tax_grp_bus_reg_num,l_yea_info.tax_grp_bus_reg_num);
842         set_archive_item(g_user_entity_id.tax_grp_name,l_yea_info.tax_grp_name);
843 	-- Bug 8644512
844 	set_archive_item(g_user_entity_id.tax_grp_wkpd_from,l_yea_info.tax_grp_wkpd_from);
845 	set_archive_item(g_user_entity_id.tax_grp_wkpd_to,l_yea_info.tax_grp_wkpd_to);
846 	set_archive_item(g_user_entity_id.tax_grp_tax_brk_pd_from,l_yea_info.tax_grp_tax_brk_pd_from);
847 	set_archive_item(g_user_entity_id.tax_grp_tax_brk_pd_to,l_yea_info.tax_grp_tax_brk_pd_to);
848 	--
849         set_archive_item(g_user_entity_id.tax_grp_taxable_mth,l_yea_info.tax_grp_taxable_mth);
850         set_archive_item(g_user_entity_id.tax_grp_taxable_bon,l_yea_info.tax_grp_taxable_bon);
851         set_archive_item(g_user_entity_id.tax_grp_sp_irreg_bonus,l_yea_info.tax_grp_sp_irreg_bonus);
852         set_archive_item(g_user_entity_id.tax_grp_stck_pur_opt_exec_earn,l_yea_info.tax_grp_stck_pur_opt_exec_earn);
853 	-- Bug 8644512
854 	set_archive_item(g_user_entity_id.tax_grp_esop_withd_earn,l_yea_info.tax_grp_esop_withd_earn);
855 	--
856         set_archive_item(g_user_entity_id.tax_grp_itax,l_yea_info.tax_grp_itax);
857         set_archive_item(g_user_entity_id.tax_grp_rtax,l_yea_info.tax_grp_rtax);
858         set_archive_item(g_user_entity_id.tax_grp_stax,l_yea_info.tax_grp_stax);
859         set_archive_item(g_user_entity_id.tax_grp_taxable,l_yea_info.tax_grp_taxable);
860         set_archive_item(g_user_entity_id.tax_grp_post_tax_deduc,l_yea_info.tax_grp_post_tax_deduc);
861         -- End of Bug 7361372
862 	-- Bug 7508706
863 	set_archive_item(g_user_entity_id.tax_grp_taxable_mth_ne,l_yea_info.tax_grp_taxable_mth_ne);
864         set_archive_item(g_user_entity_id.tax_grp_taxable_bon_ne,l_yea_info.tax_grp_taxable_bon_ne);
865         set_archive_item(g_user_entity_id.tax_grp_sp_irreg_bonus_ne,l_yea_info.tax_grp_sp_irreg_bonus_ne);
866         set_archive_item(g_user_entity_id.tax_grp_stck_pur_ne,l_yea_info.tax_grp_stck_pur_ne);
867 	-- Bug 8644512
868 	set_archive_item(g_user_entity_id.tax_grp_esop_withd_earn_ne,l_yea_info.tax_grp_esop_withd_earn_ne);
869 	set_archive_item(g_user_entity_id.tax_grp_non_taxable_ovt,l_yea_info.tax_grp_non_taxable_ovt);
870 	set_archive_item(g_user_entity_id.tax_grp_bir_raising_allw,l_yea_info.tax_grp_bir_raising_allw);
871 	set_archive_item(g_user_entity_id.tax_grp_fw_income_exem,l_yea_info.tax_grp_fw_income_exem);
872 	--
873         set_archive_item(g_user_entity_id.tax_grp_taxable_ne,l_yea_info.tax_grp_taxable_ne);
874 	-- End of Bug 7508706
875 	-- Bug 7615517
876 	set_archive_item(g_user_entity_id.company_related_exp,l_yea_info.company_related_exp);
877 	set_archive_item(g_user_entity_id.long_term_stck_fund_1year,l_yea_info.long_term_stck_fund_1year);
878 	set_archive_item(g_user_entity_id.long_term_stck_fund_2year,l_yea_info.long_term_stck_fund_2year);
879 	set_archive_item(g_user_entity_id.long_term_stck_fund_3year,l_yea_info.long_term_stck_fund_3year);
880 	set_archive_item(g_user_entity_id.long_term_stck_fund_tax_exem,l_yea_info.long_term_stck_fund_tax_exem);
881 	-- End of bug 7615517
882 	--
883 	-- Bug 8644512
884 
885 	set_archive_item(g_user_entity_id.cur_ntax_R10,l_yea_info.cur_ntax_R10); --Bug 12807687
886 	set_archive_item(g_user_entity_id.cur_ntax_G01,l_yea_info.cur_ntax_G01);
887 	set_archive_item(g_user_entity_id.cur_ntax_H01,l_yea_info.cur_ntax_H01);
888 	set_archive_item(g_user_entity_id.cur_ntax_H05,l_yea_info.cur_ntax_H05);
889 	set_archive_item(g_user_entity_id.cur_ntax_H06,l_yea_info.cur_ntax_H06);
890 	set_archive_item(g_user_entity_id.cur_ntax_H07,l_yea_info.cur_ntax_H07);
891 	set_archive_item(g_user_entity_id.cur_ntax_H08,l_yea_info.cur_ntax_H08);
892 	set_archive_item(g_user_entity_id.cur_ntax_H09,l_yea_info.cur_ntax_H09);
893 	set_archive_item(g_user_entity_id.cur_ntax_H10,l_yea_info.cur_ntax_H10);
894 	set_archive_item(g_user_entity_id.cur_ntax_H11,l_yea_info.cur_ntax_H11);
895 	set_archive_item(g_user_entity_id.cur_ntax_H12,l_yea_info.cur_ntax_H12);
896 	set_archive_item(g_user_entity_id.cur_ntax_H13,l_yea_info.cur_ntax_H13);
897 	set_archive_item(g_user_entity_id.cur_ntax_I01,l_yea_info.cur_ntax_I01);
898 	set_archive_item(g_user_entity_id.cur_ntax_K01,l_yea_info.cur_ntax_K01);
899 	set_archive_item(g_user_entity_id.cur_ntax_M01,l_yea_info.cur_ntax_M01);
900 	set_archive_item(g_user_entity_id.cur_ntax_M02,l_yea_info.cur_ntax_M02);
901 	set_archive_item(g_user_entity_id.cur_ntax_M03,l_yea_info.cur_ntax_M03);
902 	set_archive_item(g_user_entity_id.cur_ntax_S01,l_yea_info.cur_ntax_S01);
903 	set_archive_item(g_user_entity_id.cur_ntax_T01,l_yea_info.cur_ntax_T01);
904 	set_archive_item(g_user_entity_id.cur_ntax_Y01,l_yea_info.cur_ntax_Y01);
905 	set_archive_item(g_user_entity_id.cur_ntax_Y02,l_yea_info.cur_ntax_Y02);
906 	set_archive_item(g_user_entity_id.cur_ntax_Y03,l_yea_info.cur_ntax_Y03);
907 	set_archive_item(g_user_entity_id.cur_ntax_Y20,l_yea_info.cur_ntax_Y20);
908 	set_archive_item(g_user_entity_id.cur_ntax_Y21,l_yea_info.cur_ntax_Y21); --Bug 9737699
909 	set_archive_item(g_user_entity_id.cur_ntax_ZZ,l_yea_info.cur_ntax_ZZ); --Bug 9737699
910 	set_archive_item(g_user_entity_id.cur_ntax_tax_brk,l_yea_info.cur_ntax_tax_brk); --Bug 9737699
911 	set_archive_item(g_user_entity_id.cur_ntax_Z01,l_yea_info.cur_ntax_Z01);
912 	set_archive_item(g_user_entity_id.cur_ntax_frgn_M01,l_yea_info.cur_ntax_frgn_M01); /* Bug 8880364 */
913 	set_archive_item(g_user_entity_id.cur_ntax_frgn_M02,l_yea_info.cur_ntax_frgn_M02); /* Bug 8880364 */
914 	set_archive_item(g_user_entity_id.cur_ntax_frgn_M03,l_yea_info.cur_ntax_frgn_M03); /* Bug 8880364 */
915 	set_archive_item(g_user_entity_id.cur_ntax_H14,l_yea_info.cur_ntax_H14); --Bug 14754822
916 	set_archive_item(g_user_entity_id.cur_ntax_H15,l_yea_info.cur_ntax_H15);
917 	set_archive_item(g_user_entity_id.cur_ntax_T10,l_yea_info.cur_ntax_T10);
918 	set_archive_item(g_user_entity_id.cur_ntax_T20,l_yea_info.cur_ntax_T20);
919 	--
920 	set_archive_item(g_user_entity_id.prev_ntax_R10,l_yea_info.prev_ntax_R10); --Bug 12807687
921 	set_archive_item(g_user_entity_id.prev_ntax_G01,l_yea_info.prev_ntax_G01);
922 	set_archive_item(g_user_entity_id.prev_ntax_H01,l_yea_info.prev_ntax_H01);
923 	set_archive_item(g_user_entity_id.prev_ntax_H05,l_yea_info.prev_ntax_H05);
924 	set_archive_item(g_user_entity_id.prev_ntax_H06,l_yea_info.prev_ntax_H06);
925 	set_archive_item(g_user_entity_id.prev_ntax_H07,l_yea_info.prev_ntax_H07);
926 	set_archive_item(g_user_entity_id.prev_ntax_H08,l_yea_info.prev_ntax_H08);
927 	set_archive_item(g_user_entity_id.prev_ntax_H09,l_yea_info.prev_ntax_H09);
928 	set_archive_item(g_user_entity_id.prev_ntax_H10,l_yea_info.prev_ntax_H10);
929 	set_archive_item(g_user_entity_id.prev_ntax_H11,l_yea_info.prev_ntax_H11);
930 	set_archive_item(g_user_entity_id.prev_ntax_H12,l_yea_info.prev_ntax_H12);
931 	set_archive_item(g_user_entity_id.prev_ntax_H13,l_yea_info.prev_ntax_H13);
932 	set_archive_item(g_user_entity_id.prev_ntax_I01,l_yea_info.prev_ntax_I01);
933 	set_archive_item(g_user_entity_id.prev_ntax_K01,l_yea_info.prev_ntax_K01);
934 	set_archive_item(g_user_entity_id.prev_ntax_M01,l_yea_info.prev_ntax_M01);
935 	set_archive_item(g_user_entity_id.prev_ntax_M02,l_yea_info.prev_ntax_M02);
936 	set_archive_item(g_user_entity_id.prev_ntax_M03,l_yea_info.prev_ntax_M03);
937 	set_archive_item(g_user_entity_id.prev_ntax_S01,l_yea_info.prev_ntax_S01);
938 	set_archive_item(g_user_entity_id.prev_ntax_T01,l_yea_info.prev_ntax_T01);
939 	set_archive_item(g_user_entity_id.prev_ntax_Y01,l_yea_info.prev_ntax_Y01);
940 	set_archive_item(g_user_entity_id.prev_ntax_Y02,l_yea_info.prev_ntax_Y02);
941 	set_archive_item(g_user_entity_id.prev_ntax_Y03,l_yea_info.prev_ntax_Y03);
942 	set_archive_item(g_user_entity_id.prev_ntax_Y20,l_yea_info.prev_ntax_Y20);
943 	set_archive_item(g_user_entity_id.prev_ntax_Y21,l_yea_info.prev_ntax_Y21); -- Bug 9737699.
944 	set_archive_item(g_user_entity_id.prev_ntax_ZZ,l_yea_info.prev_ntax_ZZ); -- Bug 9737699
945 	set_archive_item(g_user_entity_id.prev_ntax_tax_brk,l_yea_info.prev_ntax_tax_brk); -- Bug 9737699
946 	set_archive_item(g_user_entity_id.prev_ntax_Z01,l_yea_info.prev_ntax_Z01);
947 	set_archive_item(g_user_entity_id.prev_ntax_H14,l_yea_info.prev_ntax_H14); --Bug 14754822
948 	set_archive_item(g_user_entity_id.prev_ntax_H15,l_yea_info.prev_ntax_H15);
949 	set_archive_item(g_user_entity_id.prev_ntax_T10,l_yea_info.prev_ntax_T10);
950 	set_archive_item(g_user_entity_id.prev_ntax_T20,l_yea_info.prev_ntax_T20);
951 	--
952 	set_archive_item(g_user_entity_id.tax_grp_ntax_R10,l_yea_info.tax_grp_ntax_R10); --Bug 12807687
953 	set_archive_item(g_user_entity_id.tax_grp_ntax_G01,l_yea_info.tax_grp_ntax_G01);
954 	set_archive_item(g_user_entity_id.tax_grp_ntax_H01,l_yea_info.tax_grp_ntax_H01);
955 	set_archive_item(g_user_entity_id.tax_grp_ntax_H05,l_yea_info.tax_grp_ntax_H05);
956 	set_archive_item(g_user_entity_id.tax_grp_ntax_H06,l_yea_info.tax_grp_ntax_H06);
957 	set_archive_item(g_user_entity_id.tax_grp_ntax_H07,l_yea_info.tax_grp_ntax_H07);
958 	set_archive_item(g_user_entity_id.tax_grp_ntax_H08,l_yea_info.tax_grp_ntax_H08);
959 	set_archive_item(g_user_entity_id.tax_grp_ntax_H09,l_yea_info.tax_grp_ntax_H09);
960 	set_archive_item(g_user_entity_id.tax_grp_ntax_H10,l_yea_info.tax_grp_ntax_H10);
961 	set_archive_item(g_user_entity_id.tax_grp_ntax_H11,l_yea_info.tax_grp_ntax_H11);
962 	set_archive_item(g_user_entity_id.tax_grp_ntax_H12,l_yea_info.tax_grp_ntax_H12);
963 	set_archive_item(g_user_entity_id.tax_grp_ntax_H13,l_yea_info.tax_grp_ntax_H13);
964 	set_archive_item(g_user_entity_id.tax_grp_ntax_I01,l_yea_info.tax_grp_ntax_I01);
965 	set_archive_item(g_user_entity_id.tax_grp_ntax_K01,l_yea_info.tax_grp_ntax_K01);
966 	set_archive_item(g_user_entity_id.tax_grp_ntax_M01,l_yea_info.tax_grp_ntax_M01);
967 	set_archive_item(g_user_entity_id.tax_grp_ntax_M02,l_yea_info.tax_grp_ntax_M02);
968 	set_archive_item(g_user_entity_id.tax_grp_ntax_M03,l_yea_info.tax_grp_ntax_M03);
969 	set_archive_item(g_user_entity_id.tax_grp_ntax_S01,l_yea_info.tax_grp_ntax_S01);
970 	set_archive_item(g_user_entity_id.tax_grp_ntax_T01,l_yea_info.tax_grp_ntax_T01);
971 	set_archive_item(g_user_entity_id.tax_grp_ntax_Y01,l_yea_info.tax_grp_ntax_Y01);
972 	set_archive_item(g_user_entity_id.tax_grp_ntax_Y02,l_yea_info.tax_grp_ntax_Y02);
973 	set_archive_item(g_user_entity_id.tax_grp_ntax_Y03,l_yea_info.tax_grp_ntax_Y03);
974 	set_archive_item(g_user_entity_id.tax_grp_ntax_Y20,l_yea_info.tax_grp_ntax_Y20);
975 	-- Bug 9737699
976 	set_archive_item(g_user_entity_id.tax_grp_ntax_Y21,l_yea_info.tax_grp_ntax_Y21);
977 	set_archive_item(g_user_entity_id.tax_grp_ntax_ZZ,l_yea_info.tax_grp_ntax_ZZ);
978 	set_archive_item(g_user_entity_id.tax_grp_ntax_tax_brk,l_yea_info.tax_grp_ntax_tax_brk);
979 	--
980 	set_archive_item(g_user_entity_id.tax_grp_ntax_Z01,l_yea_info.tax_grp_ntax_Z01);
981 	set_archive_item(g_user_entity_id.tax_grp_ntax_H14,l_yea_info.tax_grp_ntax_H14); --Bug 14754822
982 	set_archive_item(g_user_entity_id.tax_grp_ntax_H15,l_yea_info.tax_grp_ntax_H15);
983 	set_archive_item(g_user_entity_id.tax_grp_ntax_T10,l_yea_info.tax_grp_ntax_T10);
984 	set_archive_item(g_user_entity_id.tax_grp_ntax_T20,l_yea_info.tax_grp_ntax_T20);
985 	--
986 	set_archive_item(g_user_entity_id.total_ntax_R10,l_yea_info.total_ntax_R10); --Bug 12807687
987 	set_archive_item(g_user_entity_id.total_ntax_G01,l_yea_info.total_ntax_G01);
988 	set_archive_item(g_user_entity_id.total_ntax_H01,l_yea_info.total_ntax_H01);
989 	set_archive_item(g_user_entity_id.total_ntax_H05,l_yea_info.total_ntax_H05);
990 	set_archive_item(g_user_entity_id.total_ntax_H06,l_yea_info.total_ntax_H06);
991 	set_archive_item(g_user_entity_id.total_ntax_H07,l_yea_info.total_ntax_H07);
992 	set_archive_item(g_user_entity_id.total_ntax_H08,l_yea_info.total_ntax_H08);
993 	set_archive_item(g_user_entity_id.total_ntax_H09,l_yea_info.total_ntax_H09);
994 	set_archive_item(g_user_entity_id.total_ntax_H10,l_yea_info.total_ntax_H10);
995 	set_archive_item(g_user_entity_id.total_ntax_H11,l_yea_info.total_ntax_H11);
996 	set_archive_item(g_user_entity_id.total_ntax_H12,l_yea_info.total_ntax_H12);
997 	set_archive_item(g_user_entity_id.total_ntax_H13,l_yea_info.total_ntax_H13);
998 	set_archive_item(g_user_entity_id.total_ntax_I01,l_yea_info.total_ntax_I01);
999 	set_archive_item(g_user_entity_id.total_ntax_K01,l_yea_info.total_ntax_K01);
1000 	set_archive_item(g_user_entity_id.total_ntax_M01,l_yea_info.total_ntax_M01);
1001 	set_archive_item(g_user_entity_id.total_ntax_M02,l_yea_info.total_ntax_M02);
1002 	set_archive_item(g_user_entity_id.total_ntax_M03,l_yea_info.total_ntax_M03);
1003 	set_archive_item(g_user_entity_id.total_ntax_S01,l_yea_info.total_ntax_S01);
1004 	set_archive_item(g_user_entity_id.total_ntax_T01,l_yea_info.total_ntax_T01);
1005 	set_archive_item(g_user_entity_id.total_ntax_Y01,l_yea_info.total_ntax_Y01);
1006 	set_archive_item(g_user_entity_id.total_ntax_Y02,l_yea_info.total_ntax_Y02);
1007 	set_archive_item(g_user_entity_id.total_ntax_Y03,l_yea_info.total_ntax_Y03);
1008 	set_archive_item(g_user_entity_id.total_ntax_Y20,l_yea_info.total_ntax_Y20);
1009 	set_archive_item(g_user_entity_id.total_ntax_Y21,l_yea_info.total_ntax_Y21); -- Bug 9737699
1010 	set_archive_item(g_user_entity_id.total_ntax_ZZ,l_yea_info.total_ntax_ZZ); -- Bug 9737699
1011 	set_archive_item(g_user_entity_id.total_ntax_tax_brk,l_yea_info.total_ntax_tax_brk); -- Bug 9737699
1012 	set_archive_item(g_user_entity_id.total_ntax_Z01,l_yea_info.total_ntax_Z01);
1013 	set_archive_item(g_user_entity_id.total_ntax_H14,l_yea_info.total_ntax_H14); --Bug 14754822
1014 	set_archive_item(g_user_entity_id.total_ntax_H15,l_yea_info.total_ntax_H15);
1015 	set_archive_item(g_user_entity_id.total_ntax_T10,l_yea_info.total_ntax_T10);
1016 	set_archive_item(g_user_entity_id.total_ntax_T20,l_yea_info.total_ntax_T20);
1017 	--
1018 	set_archive_item(g_user_entity_id.cur_total_ntax_earn,l_yea_info.cur_total_ntax_earn);
1019 	set_archive_item(g_user_entity_id.tax_grp_total_ntax_earn,l_yea_info.tax_grp_total_ntax_earn);
1020 	--
1021 	set_archive_item(g_user_entity_id.smb_income_exem,l_yea_info.smb_income_exem); -- Bug 9079450
1022 	set_archive_item(g_user_entity_id.cur_smb_days_worked,l_yea_info.cur_smb_days_worked);		 -- Bug 9079450
1023 	set_archive_item(g_user_entity_id.prev_smb_days_worked,l_yea_info.prev_smb_days_worked); 	 -- Bug 9079450
1024 	set_archive_item(g_user_entity_id.cur_smb_eligible_income,l_yea_info.cur_smb_eligible_income);	 -- Bug 9079450
1025 	set_archive_item(g_user_entity_id.prev_smb_eligible_income,l_yea_info.prev_smb_eligible_income); -- Bug 9079450
1026 	set_archive_item(g_user_entity_id.emp_join_prev_year,l_yea_info.emp_join_prev_year);	  	 -- Bug 9079450
1027 	set_archive_item(g_user_entity_id.emp_leave_cur_year,l_yea_info.emp_leave_cur_year);	  	 -- Bug 9079450
1028 	set_archive_item(g_user_entity_id.smb_eligibility_flag,l_yea_info.smb_eligibility_flag);	 -- Bug 9079450
1029 	--
1030 	-- End of bug 8644512
1031 
1032 	return l_yea_info;
1033 end convert_to_rec;
1034 ------------------------------------------------------------------------
1035 procedure convert_to_tbl(
1036 	p_report_type			in varchar2,
1037 	p_report_qualifier		in varchar2,
1038 	p_report_category		in varchar2,
1039 	p_effective_date		in date,
1040 	p_yea_info			in t_yea_info,
1041 	p_user_entity_id_tbl		out nocopy t_number_tbl,
1042 	p_archive_item_value_tbl	out nocopy t_varchar2_tbl)
1043 ------------------------------------------------------------------------
1044 is
1045 	l_user_entity_id_tbl		t_number_tbl;
1046 	----------------------------------------------------------------
1047 	procedure set_archive_item(
1048 		p_user_entity_id	in number,
1049 		p_archive_item_value	in varchar2)
1050 	----------------------------------------------------------------
1051 	is
1052 		l_index	number;
1053 	begin
1054 		--------------------------------------------------------
1055 		-- If ARCHIVE_ITEM is available in current report_type
1056 		--------------------------------------------------------
1057 		if g_archive_item.archive_item_tbl.exists(p_user_entity_id) then
1058 			l_index := p_user_entity_id_tbl.count + 1;
1059 			p_user_entity_id_tbl(l_index)     := p_user_entity_id;
1060 			p_archive_item_value_tbl(l_index) := p_archive_item_value;
1061 		end if;
1062 	end set_archive_item;
1063 	----------------------------------------------------------------
1064 	procedure set_archive_item(
1065 		p_user_entity_id	in number,
1066 		p_archive_item_value	in number)
1067 	----------------------------------------------------------------
1068 	is
1069 	begin
1070 		set_archive_item(p_user_entity_id, to_char(p_archive_item_value));
1071 	end set_archive_item;
1072 	----------------------------------------------------------------
1073 	procedure set_archive_item(
1074 		p_user_entity_id	in number,
1075 		p_archive_item_value	in date)
1076 	----------------------------------------------------------------
1077 	is
1078 	begin
1079 		set_archive_item(p_user_entity_id, fnd_date.date_to_canonical(p_archive_item_value));
1080 	end set_archive_item;
1081 begin
1082 	if p_report_type = g_archive_item.report_type
1083 	and p_report_qualifier = g_archive_item.report_qualifier
1084 	and p_report_category = g_archive_item.report_category
1085 	and p_effective_date = g_archive_item.effective_date then
1086 		null;
1087 	else
1088 		------------------------------------------------------------------------
1089 		-- Refresh PAY_REPORT_FORMAT_ITEMS_F cache information
1090 		------------------------------------------------------------------------
1091 		select	user_entity_id
1092 		bulk collect into
1093 			l_user_entity_id_tbl
1094 		from	pay_report_format_items_f
1095 		where	report_type = p_report_type
1096 		and	report_qualifier = p_report_qualifier
1097 		and	report_category = p_report_category
1098 		and	p_effective_date
1099 			between effective_start_date and effective_end_date;
1100 		-----------------------------------------------------------------------
1101 		g_archive_item.report_type	:= p_report_type;
1102 		g_archive_item.report_qualifier	:= p_report_qualifier;
1103 		g_archive_item.report_category	:= p_report_category;
1104 		g_archive_item.effective_date	:= p_effective_date;
1105 		------------------------------------------------------------------------
1106 		-- Re-construct above PL/SQL table to user_entity_id indexed PL/SQL table.
1107 		------------------------------------------------------------------------
1108 		g_archive_item.archive_item_tbl.delete;
1109 		for i in 1..l_user_entity_id_tbl.count loop
1110 			g_archive_item.archive_item_tbl(l_user_entity_id_tbl(i)) := null;
1111 		end loop;
1112 	end if;
1113 	--
1114 	set_archive_item(g_user_entity_id.non_resident_flag, p_yea_info.non_resident_flag);
1115 	set_archive_item(g_user_entity_id.foreign_residency_flag, p_yea_info.foreign_residency_flag); -- Bug 6615356
1116 	set_archive_item(g_user_entity_id.fw_fixed_tax_rate, p_yea_info.fixed_tax_rate); -- 3546993
1117 	set_archive_item(g_user_entity_id.nationality, p_yea_info.nationality); -- Bug 7595082
1118 	set_archive_item(g_user_entity_id.cur_taxable_mth, p_yea_info.cur_taxable_mth);
1119 	set_archive_item(g_user_entity_id.cur_taxable_bon, p_yea_info.cur_taxable_bon);
1120 	set_archive_item(g_user_entity_id.cur_sp_irreg_bonus, p_yea_info.cur_sp_irreg_bonus);
1121 	set_archive_item(g_user_entity_id.cur_taxable, p_yea_info.cur_taxable);
1122 	set_archive_item(g_user_entity_id.cur_non_taxable_ovt, p_yea_info.cur_non_taxable_ovt);		-- Bug 8644512
1123 	set_archive_item(g_user_entity_id.prev_non_taxable_ovt, p_yea_info.prev_non_taxable_ovt);	-- Bug 8644512
1124 	set_archive_item(g_user_entity_id.cur_fw_income_exem, p_yea_info.cur_fw_income_exem);		-- Bug 8644512
1125 	--
1126 	if p_yea_info.prev_termination_date_tbl.count > 0 then
1127 		set_archive_item(g_user_entity_id.prev_taxable_mth, p_yea_info.prev_taxable_mth);
1128 		set_archive_item(g_user_entity_id.prev_taxable_bon, p_yea_info.prev_taxable_bon);
1129 		set_archive_item(g_user_entity_id.prev_sp_irreg_bonus, p_yea_info.prev_sp_irreg_bonus);
1130 		--Bug 6024342
1131 		set_archive_item(g_user_entity_id.prev_stck_pur_opt_exec_earn, p_yea_info.prev_stck_pur_opt_exec_earn);
1132 		--
1133 		-- Bug 8644512
1134 		set_archive_item(g_user_entity_id.prev_esop_withd_earn,p_yea_info.prev_esop_withd_earn);
1135 		--
1136 		set_archive_item(g_user_entity_id.prev_taxable, p_yea_info.prev_taxable);
1137 		set_archive_item(g_user_entity_id.prev_itax, p_yea_info.prev_itax);
1138 		set_archive_item(g_user_entity_id.prev_rtax, p_yea_info.prev_rtax);
1139 		set_archive_item(g_user_entity_id.prev_stax, p_yea_info.prev_stax);
1140 		set_archive_item(g_user_entity_id.prev_foreign_wrkr_inc_exem,p_yea_info.prev_foreign_wrkr_inc_exem); -- Bug 8341054
1141 	end if;
1142 	--
1143 	-- bug 6012258
1144 	set_archive_item(g_user_entity_id.cur_stck_pur_opt_exec_earn, p_yea_info.cur_stck_pur_opt_exec_earn);
1145 	-- Bug 8644512
1146 	set_archive_item(g_user_entity_id.cur_esop_withd_earn,p_yea_info.cur_esop_withd_earn);
1147 	set_archive_item(g_user_entity_id.esop_withd_earn,p_yea_info.esop_withd_earn);
1148 	--
1149 	set_archive_item(g_user_entity_id.research_payment, p_yea_info.research_payment);
1150 	--
1151 	set_archive_item(g_user_entity_id.taxable_mth, p_yea_info.taxable_mth);
1152 	set_archive_item(g_user_entity_id.taxable_bon, p_yea_info.taxable_bon);
1153 	set_archive_item(g_user_entity_id.sp_irreg_bonus, p_yea_info.sp_irreg_bonus);
1154 	-- Bug 6024342
1155 	set_archive_item(g_user_entity_id.stck_pur_opt_exec_earn, p_yea_info.stck_pur_opt_exec_earn);
1156 	--
1157 	set_archive_item(g_user_entity_id.taxable, p_yea_info.taxable);
1158 	set_archive_item(g_user_entity_id.taxable1, p_yea_info.taxable1); --Bug 7615517
1159 	set_archive_item(g_user_entity_id.non_taxable_ovs, p_yea_info.non_taxable_ovs);
1160 	set_archive_item(g_user_entity_id.non_taxable_ovt, p_yea_info.non_taxable_ovt);
1161 	-- Bug 7439803
1162 	set_archive_item(g_user_entity_id.non_taxable_ovs_frgn, p_yea_info.non_taxable_ovs_frgn);
1163 	--
1164 	set_archive_item(g_user_entity_id.non_taxable_oth, p_yea_info.non_taxable_oth);
1165 	set_archive_item(g_user_entity_id.non_rep_non_taxable, p_yea_info.non_rep_non_taxable); -- Bug 9079450
1166 	set_archive_item(g_user_entity_id.non_taxable, p_yea_info.non_taxable);
1167 	set_archive_item(g_user_entity_id.foreign_worker_income_exem, p_yea_info.foreign_worker_income_exem);  --3546993
1168 	set_archive_item(g_user_entity_id.basic_income_exem, p_yea_info.basic_income_exem);
1169 	set_archive_item(g_user_entity_id.taxable_income, p_yea_info.taxable_income);
1170 	set_archive_item(g_user_entity_id.ee_tax_exem, p_yea_info.ee_tax_exem);
1171 	set_archive_item(g_user_entity_id.dpnt_spouse_flag, p_yea_info.dpnt_spouse_flag);
1172 	set_archive_item(g_user_entity_id.dpnt_spouse_tax_exem, p_yea_info.dpnt_spouse_tax_exem);
1173 	set_archive_item(g_user_entity_id.num_of_aged_dpnts, p_yea_info.num_of_aged_dpnts);
1174 	set_archive_item(g_user_entity_id.num_of_adult_dpnts, p_yea_info.num_of_adult_dpnts);
1175 	set_archive_item(g_user_entity_id.num_of_underaged_dpnts, p_yea_info.num_of_underaged_dpnts);
1176 	set_archive_item(g_user_entity_id.num_of_dpnts, p_yea_info.num_of_dpnts);
1177 	set_archive_item(g_user_entity_id.dpnt_tax_exem, p_yea_info.dpnt_tax_exem);
1178 	set_archive_item(g_user_entity_id.num_of_ageds, p_yea_info.num_of_ageds);
1179 	-- Bug 3172960
1180 	set_archive_item(g_user_entity_id.num_of_super_ageds, p_yea_info.num_of_super_ageds);
1181 	-- Bug 6705170
1182         set_archive_item(g_user_entity_id.num_of_new_born_adopted, p_yea_info.num_of_new_born_adopted);
1183         set_archive_item(g_user_entity_id.new_born_adopted_tax_exem, p_yea_info.new_born_adopted_tax_exem);
1184 	--
1185   -- Bug 16010775
1186   set_archive_item(g_user_entity_id.single_parent_flag, p_yea_info.single_parent_flag);
1187   set_archive_item(g_user_entity_id.single_parent_tax_exem, p_yea_info.single_parent_tax_exem);
1188   -- Bug 16010775
1189 	-- Bug 7142620
1190 	set_archive_item(g_user_entity_id.housing_saving_exem, p_yea_info.housing_saving_exem);
1191 	set_archive_item(g_user_entity_id.housing_loan_repay_exem, p_yea_info.housing_loan_repay_exem);
1192 	--Bug 12807687 Start
1193 	set_archive_item(g_user_entity_id.housing_prv_loan_repay_exem, p_yea_info.housing_prv_loan_repay_exem);
1194 	set_archive_item(g_user_entity_id.housing_inst_loan_repay_exem, p_yea_info.housing_inst_loan_repay_exem);
1195 	set_archive_item(g_user_entity_id.lt_housing_loan_int_rep_exem1, p_yea_info.lt_housing_loan_int_rep_exem1);
1196 	set_archive_item(g_user_entity_id.lt_housing_loan_int_rep_exem2, p_yea_info.lt_housing_loan_int_rep_exem2);
1197 	set_archive_item(g_user_entity_id.lt_housing_loan_int_rep_exem3, p_yea_info.lt_housing_loan_int_rep_exem3);
1198 	-- Bug 12807687 End
1199 	set_archive_item(g_user_entity_id.lt_housing_loan_intr_exem, p_yea_info.lt_housing_loan_intr_exem);
1200 	set_archive_item(g_user_entity_id.birth_raising_allowance,p_yea_info.birth_raising_allowance);
1201 	set_archive_item(g_user_entity_id.cur_birth_raising_allowance,p_yea_info.cur_birth_raising_allowance); -- Bug 8644512
1202 	set_archive_item(g_user_entity_id.prev_birth_raising_allowance,p_yea_info.prev_birth_raising_allowance); -- Bug 8644512
1203 	-- End of Bug 7142620
1204 	-- Bug 6784288
1205         set_archive_item(g_user_entity_id.num_of_addtl_child, p_yea_info.num_of_addtl_child);
1206 	--
1207 	-- Bug 9737699
1208 	 set_archive_item(g_user_entity_id.house_holder_flag, p_yea_info.house_holder_flag);
1209 	 set_archive_item(g_user_entity_id.house_holder_exception_flag, p_yea_info.house_holder_exception_flag); -- Bug 13247926
1210 	 set_archive_item(g_user_entity_id.tot_num_dpnts, p_yea_info.tot_num_dpnts);
1211 	 set_archive_item(g_user_entity_id.sep_pen_exem_amt1, p_yea_info.sep_pen_exem_amt1);
1212 	 set_archive_item(g_user_entity_id.sep_pen_exem_amt2, p_yea_info.sep_pen_exem_amt2);
1213 	 set_archive_item(g_user_entity_id.pen_sav_exem_amt1, p_yea_info.pen_sav_exem_amt1);
1214 	 set_archive_item(g_user_entity_id.pen_sav_exem_amt2, p_yea_info.pen_sav_exem_amt2);
1215 	 set_archive_item(g_user_entity_id.hou_sav_exem_amt1, p_yea_info.hou_sav_exem_amt1);
1216 	set_archive_item(g_user_entity_id.hou_sav_exem_amt2, p_yea_info.hou_sav_exem_amt2);
1217 	set_archive_item(g_user_entity_id.hou_sav_exem_amt3, p_yea_info.hou_sav_exem_amt3);
1218 	set_archive_item(g_user_entity_id.lt_stck_sav_exem_amt1, p_yea_info.lt_stck_sav_exem_amt1);
1219 	set_archive_item(g_user_entity_id.lt_stck_sav_exem_amt2, p_yea_info.lt_stck_sav_exem_amt2);
1220 	set_archive_item(g_user_entity_id.lt_stck_sav_exem_amt3, p_yea_info.lt_stck_sav_exem_amt3);
1221 	set_archive_item(g_user_entity_id.sep_pen_exem_amt_archive,p_yea_info.sep_pen_exem_amt_archive);
1222 	set_archive_item(g_user_entity_id.pen_sav_amt_archive,p_yea_info.pen_sav_amt_archive);
1223 	set_archive_item(g_user_entity_id.hou_sav_amt_archive,p_yea_info.hou_sav_amt_archive);
1224 	set_archive_item(g_user_entity_id.lt_stck_sav_amt_archive,p_yea_info.lt_stck_sav_amt_archive);
1225 
1226 	 --
1227 	set_archive_item(g_user_entity_id.aged_tax_exem, p_yea_info.aged_tax_exem);
1228 	set_archive_item(g_user_entity_id.num_of_disableds, p_yea_info.num_of_disableds);
1229 	set_archive_item(g_user_entity_id.disabled_tax_exem, p_yea_info.disabled_tax_exem);
1230 	set_archive_item(g_user_entity_id.female_ee_flag, p_yea_info.female_ee_flag);
1231 	set_archive_item(g_user_entity_id.female_ee_tax_exem, p_yea_info.female_ee_tax_exem);
1232 	set_archive_item(g_user_entity_id.num_of_children, p_yea_info.num_of_children);
1233 	set_archive_item(g_user_entity_id.child_tax_exem, p_yea_info.child_tax_exem);
1234 	-- Bug 5756690
1235 	set_archive_item(g_user_entity_id.addl_child_tax_exem, p_yea_info.addl_child_tax_exem);
1236 	set_archive_item(g_user_entity_id.supp_tax_exem, p_yea_info.supp_tax_exem);
1237 	set_archive_item(g_user_entity_id.hi_prem, p_yea_info.hi_prem);
1238 	set_archive_item(g_user_entity_id.hi_prem_tax_exem, p_yea_info.hi_prem_tax_exem);
1239 	-- Bug 7164589
1240 	set_archive_item(g_user_entity_id.long_term_ins_prem, p_yea_info.long_term_ins_prem);
1241 	set_archive_item(g_user_entity_id.long_term_ins_prem_tax_exem, p_yea_info.long_term_ins_prem_tax_exem);
1242 	-- End of Bug 7164589
1243 	set_archive_item(g_user_entity_id.ei_prem, p_yea_info.ei_prem);
1244 	set_archive_item(g_user_entity_id.ei_prem_tax_exem, p_yea_info.ei_prem_tax_exem);
1245 	set_archive_item(g_user_entity_id.pers_ins_name, p_yea_info.pers_ins_name);
1246 	set_archive_item(g_user_entity_id.pers_ins_prem, p_yea_info.pers_ins_prem);
1247 	set_archive_item(g_user_entity_id.pers_ins_prem_tax_exem, p_yea_info.pers_ins_prem_tax_exem);
1248 	set_archive_item(g_user_entity_id.disabled_ins_prem, p_yea_info.disabled_ins_prem);
1249 	set_archive_item(g_user_entity_id.disabled_ins_prem_tax_exem, p_yea_info.disabled_ins_prem_tax_exem);
1250 	set_archive_item(g_user_entity_id.ins_prem_tax_exem, p_yea_info.ins_prem_tax_exem);
1251 	set_archive_item(g_user_entity_id.med_exp, p_yea_info.med_exp);
1252 	set_archive_item(g_user_entity_id.med_exp_disabled, p_yea_info.med_exp_disabled);
1253 	set_archive_item(g_user_entity_id.med_exp_aged, p_yea_info.med_exp_aged);
1254 	-- Bug 3172960
1255 	set_archive_item(g_user_entity_id.med_exp_emp, p_yea_info.med_exp_emp);
1256 	set_archive_item(g_user_entity_id.max_med_exp_tax_exem, p_yea_info.max_med_exp_tax_exem);
1257 	set_archive_item(g_user_entity_id.med_exp_tax_exem, p_yea_info.med_exp_tax_exem);
1258 	set_archive_item(g_user_entity_id.ee_educ_exp, p_yea_info.ee_educ_exp);
1259 	set_archive_item(g_user_entity_id.spouse_educ_exp, p_yea_info.spouse_educ_exp);
1260 	set_archive_item(g_user_entity_id.disabled_educ_exp, p_yea_info.disabled_educ_exp);
1261 	set_archive_item(g_user_entity_id.dpnt_educ_exp, p_yea_info.dpnt_educ_exp);
1262 	set_archive_item(g_user_entity_id.educ_exp_tax_exem, p_yea_info.educ_exp_tax_exem);
1263 	set_archive_item(g_user_entity_id.housing_saving_type, p_yea_info.housing_saving_type);
1264 	set_archive_item(g_user_entity_id.housing_saving, p_yea_info.housing_saving);
1265 	set_archive_item(g_user_entity_id.housing_purchase_date, p_yea_info.housing_purchase_date);
1266 	set_archive_item(g_user_entity_id.housing_loan_date, p_yea_info.housing_loan_date);
1267 	set_archive_item(g_user_entity_id.housing_loan_repay, p_yea_info.housing_loan_repay);
1268 	set_archive_item(g_user_entity_id.lt_housing_loan_date, p_yea_info.lt_housing_loan_date);
1269 	-- bug 9393732
1270 	set_archive_item(g_user_entity_id.housing_prv_date_moved, p_yea_info.housing_prv_date_moved);
1271 	set_archive_item(g_user_entity_id.housing_prv_loan_date, p_yea_info.housing_prv_loan_date);
1272 	set_archive_item(g_user_entity_id.housing_prv_loan_repay, p_yea_info.housing_prv_loan_repay);
1273 	--
1274 	set_archive_item(g_user_entity_id.lt_housing_loan_interest_repay, p_yea_info.lt_housing_loan_interest_repay);
1275 	set_archive_item(g_user_entity_id.lt_housing_loan_date_1, p_yea_info.lt_housing_loan_date_1);
1276 	set_archive_item(g_user_entity_id.lt_housing_loan_intr_repay_1, p_yea_info.lt_housing_loan_intr_repay_1);
1277        	set_archive_item(g_user_entity_id.lt_housing_loan_date_2, p_yea_info.lt_housing_loan_date_2);    -- Bug 8237227
1278 		set_archive_item(g_user_entity_id.lt_2012_fixed_intr_wo_grace, p_yea_info.lt_2012_fixed_intr_wo_grace); --14754836
1279 		set_archive_item(g_user_entity_id.lt_2012_housing_other_intr, p_yea_info.lt_2012_housing_other_intr); --14754836
1280 		set_archive_item(g_user_entity_id.lt_2012_house_fixed_intr_exem,p_yea_info.lt_2012_house_fixed_intr_exem); -- 14754836
1281 		set_archive_item(g_user_entity_id.lt_2012_house_othr_intr_exem,p_yea_info.lt_2012_house_othr_intr_exem);  -- 14754836
1282         set_archive_item(g_user_entity_id.lt_housing_loan_intr_repay_2, p_yea_info.lt_housing_loan_intr_repay_2); -- Bug 8237227
1283         set_archive_item(g_user_entity_id.housing_rent_exp, p_yea_info.housing_rent_exp); -- Bug 9737699
1284 	set_archive_item(g_user_entity_id.max_housing_exp_tax_exem, p_yea_info.max_housing_exp_tax_exem);
1285 	set_archive_item(g_user_entity_id.housing_exp_tax_exem, p_yea_info.housing_exp_tax_exem);
1286 	-- Bug 9737699
1287 	set_archive_item(g_user_entity_id.housing_rent_exp_tax_exem, p_yea_info.housing_rent_exp_tax_exem);
1288         set_archive_item(g_user_entity_id.housing_sub_saving_exem, p_yea_info.housing_sub_saving_exem);
1289 	set_archive_item(g_user_entity_id.total_housing_saving_exem, p_yea_info.total_housing_saving_exem);
1290 	set_archive_item(g_user_entity_id.lt_hou_pro_saving_exem, p_yea_info.lt_hou_pro_saving_exem);
1291 	set_archive_item(g_user_entity_id.emp_hou_pro_saving_exem, p_yea_info.emp_hou_pro_saving_exem);
1292 	--
1293 	set_archive_item(g_user_entity_id.donation1, p_yea_info.donation1);
1294 	set_archive_item(g_user_entity_id.political_donation1, p_yea_info.political_donation1);
1295 	set_archive_item(g_user_entity_id.political_donation2, p_yea_info.political_donation2);
1296 	set_archive_item(g_user_entity_id.political_donation3, p_yea_info.political_donation3);
1297 	set_archive_item(g_user_entity_id.donation1_tax_exem, p_yea_info.donation1_tax_exem);
1298 	set_archive_item(g_user_entity_id.donation2, p_yea_info.donation2);
1299         set_archive_item(g_user_entity_id.donation3, p_yea_info.donation3);
1300         set_archive_item(g_user_entity_id.donation4, p_yea_info.donation4);  -- Bug 7142612
1301 	set_archive_item(g_user_entity_id.religious_donation, p_yea_info.religious_donation);  -- Bug 7142612
1302 	set_archive_item(g_user_entity_id.max_donation2_tax_exem, p_yea_info.max_donation2_tax_exem);
1303 	set_archive_item(g_user_entity_id.max_donation3_tax_exem, p_yea_info.max_donation3_tax_exem);
1304 	set_archive_item(g_user_entity_id.donation2_tax_exem, p_yea_info.donation2_tax_exem);
1305 	set_archive_item(g_user_entity_id.donation3_tax_exem, p_yea_info.donation3_tax_exem);
1306 	set_archive_item(g_user_entity_id.donation_tax_exem, p_yea_info.donation_tax_exem);
1307 	-- Bug 3966549
1308 	set_archive_item(g_user_entity_id.don_tax_break2004, p_yea_info.don_tax_break2004) ;
1309 	-- End of 3966549
1310 	set_archive_item(g_user_entity_id.marriage_exemption, p_yea_info.marriage_exemption);
1311 	set_archive_item(g_user_entity_id.funeral_exemption, p_yea_info.funeral_exemption);
1312 	set_archive_item(g_user_entity_id.relocation_exemption, p_yea_info.relocation_exemption);
1313 	set_archive_item(g_user_entity_id.marr_fun_relo_exemption, p_yea_info.marr_fun_relo_exemption);
1314 	set_archive_item(g_user_entity_id.sp_tax_exem, p_yea_info.sp_tax_exem);
1315 	set_archive_item(g_user_entity_id.std_sp_tax_exem, p_yea_info.std_sp_tax_exem);
1316 	set_archive_item(g_user_entity_id.np_prem, p_yea_info.np_prem);
1317 	set_archive_item(g_user_entity_id.np_prem_tax_exem, p_yea_info.np_prem_tax_exem);
1318 	-- Bug 6024342
1319 	set_archive_item(g_user_entity_id.pen_prem, p_yea_info.pen_prem);
1320 	--
1321 	-- Bug 9737699
1322 	set_archive_item(g_user_entity_id.military_pen_prem, p_yea_info.military_pen_prem);
1323 	set_archive_item(g_user_entity_id.private_school_pen_prem, p_yea_info.private_school_pen_prem);
1324 	set_archive_item(g_user_entity_id.post_office_pen_prem, p_yea_info.post_office_pen_prem);
1325 	--
1326 	set_archive_item(g_user_entity_id.taxable_income2, p_yea_info.taxable_income2);
1327 	set_archive_item(g_user_entity_id.pers_pension_prem, p_yea_info.pers_pension_prem);
1328 	set_archive_item(g_user_entity_id.pers_pension_prem_tax_exem, p_yea_info.pers_pension_prem_tax_exem);
1329 	-- Bug 4750653
1330 	set_archive_item(g_user_entity_id.corp_pension_prem, p_yea_info.corp_pension_prem);
1331 	set_archive_item(g_user_entity_id.corp_pension_prem_tax_exem, p_yea_info.corp_pension_prem_tax_exem);
1332 	set_archive_item(g_user_entity_id.scientific_technician_tax_exem, p_yea_info.scientific_technician_tax_exem); -- Bug 9737699
1333 	--End of Bug 4750653
1334 	set_archive_item(g_user_entity_id.pers_pension_saving, p_yea_info.pers_pension_saving);
1335 	set_archive_item(g_user_entity_id.pers_pension_saving_tax_exem, p_yea_info.pers_pension_saving_tax_exem);
1336 	set_archive_item(g_user_entity_id.invest_partner_fin1, p_yea_info.invest_partner_fin1);
1337 	set_archive_item(g_user_entity_id.invest_partner_fin2, p_yea_info.invest_partner_fin2);
1338         	set_archive_item(g_user_entity_id.invest_partner_fin3, p_yea_info.invest_partner_fin3);   -- Bug 8237227
1339 	set_archive_item(g_user_entity_id.invest_partner_fin_tax_exem, p_yea_info.invest_partner_fin_tax_exem);
1340 	-- Bug 6895093
1341 	set_archive_item(g_user_entity_id.small_bus_install, p_yea_info.small_bus_install);
1342 	set_archive_item(g_user_entity_id.small_bus_install_exem, p_yea_info.small_bus_install_exem);
1343 	-- End of Bug 6895093
1344 	set_archive_item(g_user_entity_id.credit_card_exp, p_yea_info.credit_card_exp);
1345 	set_archive_item(g_user_entity_id.credit_card_exp_tax_exem, p_yea_info.credit_card_exp_tax_exem);
1346 	-- BUG 14219478
1347 --		set_archive_item(g_user_entity_id.traditional_market_exp, p_yea_info.traditional_market_exp);
1348 --		set_archive_item(g_user_entity_id.total_cards_amount, p_yea_info.total_cards_amount);
1349 --		set_archive_item(g_user_entity_id.credit_card_expense, p_yea_info.credit_card_expense);
1350 	-- End of BUG 14219478
1351 	--
1352         -- Bug 3201332
1353 	-- Bug 3374792 added nvl
1354         set_archive_item(g_user_entity_id.emp_stk_own_contri, p_yea_info.emp_stk_own_contri + nvl(p_yea_info.fw_educ_expense,0) + nvl(p_yea_info.fw_house_rent,0));
1355 	set_archive_item(g_user_entity_id.emp_stk_own_contri_tax_exem, p_yea_info.emp_stk_own_contri_tax_exem);
1356 	set_archive_item(g_user_entity_id.taxation_base, p_yea_info.taxation_base);
1357 	set_archive_item(g_user_entity_id.calc_tax, p_yea_info.calc_tax);
1358 	-- Bug 14754822
1359 	set_archive_item(g_user_entity_id.tax_reduction_smb, p_yea_info.tax_reduction_smb);
1360 	set_archive_item(g_user_entity_id.tax_reduction_teachers, p_yea_info.tax_reduction_teachers);
1361 	set_archive_item(g_user_entity_id.tax_reduction_marine, p_yea_info.tax_reduction_marine);
1362 	set_archive_item(g_user_entity_id.basic_tax_break, p_yea_info.basic_tax_break);
1363 	set_archive_item(g_user_entity_id.housing_loan_interest_repay, p_yea_info.housing_loan_interest_repay);
1364 	set_archive_item(g_user_entity_id.housing_exp_tax_break, p_yea_info.housing_exp_tax_break);
1365 	set_archive_item(g_user_entity_id.stock_saving, p_yea_info.stock_saving);
1366 	set_archive_item(g_user_entity_id.stock_saving_tax_break, p_yea_info.stock_saving_tax_break);
1367 	set_archive_item(g_user_entity_id.lt_stock_saving1, p_yea_info.lt_stock_saving1);
1368 	set_archive_item(g_user_entity_id.lt_stock_saving2, p_yea_info.lt_stock_saving2);
1369 	set_archive_item(g_user_entity_id.lt_stock_saving_tax_break, p_yea_info.lt_stock_saving_tax_break);
1370 	--
1371 	if p_yea_info.ovstb_tax_paid_date is not null then
1372 		set_archive_item(g_user_entity_id.ovstb_tax_paid_date, p_yea_info.ovstb_tax_paid_date);
1373 		set_archive_item(g_user_entity_id.ovstb_territory_code, p_yea_info.ovstb_territory_code);
1374 		set_archive_item(g_user_entity_id.ovstb_currency_code, p_yea_info.ovstb_currency_code);
1375 		set_archive_item(g_user_entity_id.ovstb_taxable, p_yea_info.ovstb_taxable);
1376 		set_archive_item(g_user_entity_id.ovstb_taxable_subj_tax_break, p_yea_info.ovstb_taxable_subj_tax_break);
1377 		set_archive_item(g_user_entity_id.ovstb_tax_break_rate, p_yea_info.ovstb_tax_break_rate);
1378 		set_archive_item(g_user_entity_id.ovstb_tax_foreign_currency, p_yea_info.ovstb_tax_foreign_currency);
1379 		set_archive_item(g_user_entity_id.ovstb_tax, p_yea_info.ovstb_tax);
1380 		set_archive_item(g_user_entity_id.ovstb_application_date, p_yea_info.ovstb_application_date);
1381 		set_archive_item(g_user_entity_id.ovstb_submission_date, p_yea_info.ovstb_submission_date);
1382 		set_archive_item(g_user_entity_id.ovs_tax_break, p_yea_info.ovs_tax_break);
1383 	end if;
1384 	--
1385 	set_archive_item(g_user_entity_id.total_tax_break, p_yea_info.total_tax_break);
1386 	--
1387 	if p_yea_info.fwtb_immigration_purpose is not null then
1388 		set_archive_item(g_user_entity_id.fwtb_immigration_purpose, p_yea_info.fwtb_immigration_purpose);
1389 		set_archive_item(g_user_entity_id.fwtb_contract_date, p_yea_info.fwtb_contract_date);
1390 		set_archive_item(g_user_entity_id.fwtb_expiry_date, p_yea_info.fwtb_expiry_date);
1391 		set_archive_item(g_user_entity_id.fwtb_application_date, p_yea_info.fwtb_application_date);
1392 		set_archive_item(g_user_entity_id.fwtb_submission_date, p_yea_info.fwtb_submission_date);
1393 		set_archive_item(g_user_entity_id.foreign_worker_tax_break1, p_yea_info.foreign_worker_tax_break1);
1394 	end if;
1395 		set_archive_item(g_user_entity_id.foreign_worker_tax_break2, p_yea_info.foreign_worker_tax_break2);
1396 		set_archive_item(g_user_entity_id.foreign_worker_tax_break, p_yea_info.foreign_worker_tax_break);
1397 
1398 	--
1399 	set_archive_item(g_user_entity_id.annual_itax, p_yea_info.annual_itax);
1400 	set_archive_item(g_user_entity_id.annual_rtax, p_yea_info.annual_rtax);
1401 	set_archive_item(g_user_entity_id.annual_stax, p_yea_info.annual_stax);
1402 	set_archive_item(g_user_entity_id.cur_itax, p_yea_info.cur_itax);
1403 	set_archive_item(g_user_entity_id.cur_rtax, p_yea_info.cur_rtax);
1404 	set_archive_item(g_user_entity_id.cur_stax, p_yea_info.cur_stax);
1405 	set_archive_item(g_user_entity_id.itax_adj, p_yea_info.itax_adj);
1406 	set_archive_item(g_user_entity_id.rtax_adj, p_yea_info.rtax_adj);
1407 	set_archive_item(g_user_entity_id.stax_adj, p_yea_info.stax_adj);
1408         -- 4738717
1409         set_archive_item(g_user_entity_id.cash_receipt_expense, p_yea_info.cash_receipt_exp2005);
1410         -- Bug 6630135
1411         set_archive_item(g_user_entity_id.tot_med_exp_cards,p_yea_info.tot_med_exp_cards);
1412         set_archive_item(g_user_entity_id.med_exp_paid_not_inc_med_exem,p_yea_info.med_exp_paid_not_inc_med_exem);
1413         -- End of Bug 6630135
1414         -- Bug 6716401
1415         set_archive_item(g_user_entity_id.double_exem_amt,p_yea_info.double_exem_amt);
1416         -- End of Bug 6716401
1417         -- Bug 7361372
1418 	if p_yea_info.tax_grp_bus_reg_num is not null then
1419 	        set_archive_item(g_user_entity_id.tax_grp_bus_reg_num,p_yea_info.tax_grp_bus_reg_num);
1420  	        set_archive_item(g_user_entity_id.tax_grp_name,p_yea_info.tax_grp_name);
1421 		-- Bug 8644512
1422 		set_archive_item(g_user_entity_id.tax_grp_wkpd_from,p_yea_info.tax_grp_wkpd_from);
1423 		set_archive_item(g_user_entity_id.tax_grp_wkpd_to,p_yea_info.tax_grp_wkpd_to);
1424 		set_archive_item(g_user_entity_id.tax_grp_tax_brk_pd_from,p_yea_info.tax_grp_tax_brk_pd_from);
1425 		set_archive_item(g_user_entity_id.tax_grp_tax_brk_pd_to,p_yea_info.tax_grp_tax_brk_pd_to);
1426 		--
1427         	set_archive_item(g_user_entity_id.tax_grp_taxable_mth,p_yea_info.tax_grp_taxable_mth);
1428         	set_archive_item(g_user_entity_id.tax_grp_taxable_bon,p_yea_info.tax_grp_taxable_bon);
1429         	set_archive_item(g_user_entity_id.tax_grp_sp_irreg_bonus,p_yea_info.tax_grp_sp_irreg_bonus);
1430         	set_archive_item(g_user_entity_id.tax_grp_stck_pur_opt_exec_earn,p_yea_info.tax_grp_stck_pur_opt_exec_earn);
1431 		-- Bug 8644512
1432 		set_archive_item(g_user_entity_id.tax_grp_esop_withd_earn,p_yea_info.tax_grp_esop_withd_earn);
1433 		set_archive_item(g_user_entity_id.tax_grp_non_taxable_ovt,p_yea_info.tax_grp_non_taxable_ovt);
1434 		set_archive_item(g_user_entity_id.tax_grp_bir_raising_allw,p_yea_info.tax_grp_bir_raising_allw);
1435 		set_archive_item(g_user_entity_id.tax_grp_fw_income_exem,p_yea_info.tax_grp_fw_income_exem);
1436 		--
1437         	set_archive_item(g_user_entity_id.tax_grp_itax,p_yea_info.tax_grp_itax);
1438         	set_archive_item(g_user_entity_id.tax_grp_rtax,p_yea_info.tax_grp_rtax);
1439         	set_archive_item(g_user_entity_id.tax_grp_stax,p_yea_info.tax_grp_stax);
1440         	set_archive_item(g_user_entity_id.tax_grp_taxable,p_yea_info.tax_grp_taxable);
1441         	set_archive_item(g_user_entity_id.tax_grp_post_tax_deduc,p_yea_info.tax_grp_post_tax_deduc);
1442 	-- Bug 7508706
1443 	set_archive_item(g_user_entity_id.tax_grp_taxable_mth_ne,p_yea_info.tax_grp_taxable_mth_ne);
1444         set_archive_item(g_user_entity_id.tax_grp_taxable_bon_ne,p_yea_info.tax_grp_taxable_bon_ne);
1445         set_archive_item(g_user_entity_id.tax_grp_sp_irreg_bonus_ne,p_yea_info.tax_grp_sp_irreg_bonus_ne);
1446         set_archive_item(g_user_entity_id.tax_grp_stck_pur_ne,p_yea_info.tax_grp_stck_pur_ne);
1447 	-- Bug 8644512
1448 	set_archive_item(g_user_entity_id.tax_grp_esop_withd_earn_ne,p_yea_info.tax_grp_esop_withd_earn_ne);
1449 	--
1450        	set_archive_item(g_user_entity_id.tax_grp_taxable_ne,p_yea_info.tax_grp_taxable_ne);
1451 	-- End of Bug 7508706
1452 	end if;
1453         -- End of Bug 7361372
1454 	-- Bug 7615517
1455 		set_archive_item(g_user_entity_id.company_related_exp,p_yea_info.company_related_exp);
1456 		set_archive_item(g_user_entity_id.long_term_stck_fund_1year,p_yea_info.long_term_stck_fund_1year);
1457 		set_archive_item(g_user_entity_id.long_term_stck_fund_2year,p_yea_info.long_term_stck_fund_2year);
1458 		set_archive_item(g_user_entity_id.long_term_stck_fund_3year,p_yea_info.long_term_stck_fund_3year);
1459 		set_archive_item(g_user_entity_id.long_term_stck_fund_tax_exem,p_yea_info.long_term_stck_fund_tax_exem);
1460 	-- End of bug 7615517
1461 	--
1462 	-- Bug 8644512
1463 	set_archive_item(g_user_entity_id.cur_ntax_R10,p_yea_info.cur_ntax_R10); --Bug 12807687
1464 	set_archive_item(g_user_entity_id.cur_ntax_G01,p_yea_info.cur_ntax_G01);
1465 	set_archive_item(g_user_entity_id.cur_ntax_H01,p_yea_info.cur_ntax_H01);
1466 	set_archive_item(g_user_entity_id.cur_ntax_H05,p_yea_info.cur_ntax_H05);
1467 	set_archive_item(g_user_entity_id.cur_ntax_H06,p_yea_info.cur_ntax_H06);
1468 	set_archive_item(g_user_entity_id.cur_ntax_H07,p_yea_info.cur_ntax_H07);
1469 	set_archive_item(g_user_entity_id.cur_ntax_H08,p_yea_info.cur_ntax_H08);
1470 	set_archive_item(g_user_entity_id.cur_ntax_H09,p_yea_info.cur_ntax_H09);
1471 	set_archive_item(g_user_entity_id.cur_ntax_H10,p_yea_info.cur_ntax_H10);
1472 	set_archive_item(g_user_entity_id.cur_ntax_H11,p_yea_info.cur_ntax_H11);
1473 	set_archive_item(g_user_entity_id.cur_ntax_H12,p_yea_info.cur_ntax_H12);
1474 	set_archive_item(g_user_entity_id.cur_ntax_H13,p_yea_info.cur_ntax_H13);
1475 	set_archive_item(g_user_entity_id.cur_ntax_I01,p_yea_info.cur_ntax_I01);
1476 	set_archive_item(g_user_entity_id.cur_ntax_K01,p_yea_info.cur_ntax_K01);
1477 	set_archive_item(g_user_entity_id.cur_ntax_M01,p_yea_info.cur_ntax_M01);
1478 	set_archive_item(g_user_entity_id.cur_ntax_M02,p_yea_info.cur_ntax_M02);
1479 	set_archive_item(g_user_entity_id.cur_ntax_M03,p_yea_info.cur_ntax_M03);
1480 	set_archive_item(g_user_entity_id.cur_ntax_S01,p_yea_info.cur_ntax_S01);
1481 	set_archive_item(g_user_entity_id.cur_ntax_T01,p_yea_info.cur_ntax_T01);
1482 	set_archive_item(g_user_entity_id.cur_ntax_Y01,p_yea_info.cur_ntax_Y01);
1483 	set_archive_item(g_user_entity_id.cur_ntax_Y02,p_yea_info.cur_ntax_Y02);
1484 	set_archive_item(g_user_entity_id.cur_ntax_Y03,p_yea_info.cur_ntax_Y03);
1485 	set_archive_item(g_user_entity_id.cur_ntax_Y20,p_yea_info.cur_ntax_Y20);
1486 	set_archive_item(g_user_entity_id.cur_ntax_Y21,p_yea_info.cur_ntax_Y21); -- Bug 9737699
1487 	set_archive_item(g_user_entity_id.cur_ntax_ZZ,p_yea_info.cur_ntax_ZZ); -- Bug 9737699
1488 	set_archive_item(g_user_entity_id.cur_ntax_tax_brk,p_yea_info.cur_ntax_tax_brk); -- Bug 9737699
1489 	set_archive_item(g_user_entity_id.cur_ntax_Z01,p_yea_info.cur_ntax_Z01);
1490 	set_archive_item(g_user_entity_id.cur_ntax_frgn_M01,p_yea_info.cur_ntax_frgn_M01); /* Bug 8880364 */
1491 	set_archive_item(g_user_entity_id.cur_ntax_frgn_M02,p_yea_info.cur_ntax_frgn_M02); /* Bug 8880364 */
1492 	set_archive_item(g_user_entity_id.cur_ntax_frgn_M03,p_yea_info.cur_ntax_frgn_M03); /* Bug 8880364 */
1493 	set_archive_item(g_user_entity_id.cur_ntax_H14,p_yea_info.cur_ntax_H14); --Bug 14754822
1494 	set_archive_item(g_user_entity_id.cur_ntax_H15,p_yea_info.cur_ntax_H15);
1495 	set_archive_item(g_user_entity_id.cur_ntax_T10,p_yea_info.cur_ntax_T10);
1496 	set_archive_item(g_user_entity_id.cur_ntax_T20,p_yea_info.cur_ntax_T20);
1497 	--
1498 	set_archive_item(g_user_entity_id.prev_ntax_R10,p_yea_info.prev_ntax_R10); --Bug 12807687
1499 	set_archive_item(g_user_entity_id.prev_ntax_G01,p_yea_info.prev_ntax_G01);
1500 	set_archive_item(g_user_entity_id.prev_ntax_H01,p_yea_info.prev_ntax_H01);
1501 	set_archive_item(g_user_entity_id.prev_ntax_H05,p_yea_info.prev_ntax_H05);
1502 	set_archive_item(g_user_entity_id.prev_ntax_H06,p_yea_info.prev_ntax_H06);
1503 	set_archive_item(g_user_entity_id.prev_ntax_H07,p_yea_info.prev_ntax_H07);
1504 	set_archive_item(g_user_entity_id.prev_ntax_H08,p_yea_info.prev_ntax_H08);
1505 	set_archive_item(g_user_entity_id.prev_ntax_H09,p_yea_info.prev_ntax_H09);
1506 	set_archive_item(g_user_entity_id.prev_ntax_H10,p_yea_info.prev_ntax_H10);
1507 	set_archive_item(g_user_entity_id.prev_ntax_H11,p_yea_info.prev_ntax_H11);
1508 	set_archive_item(g_user_entity_id.prev_ntax_H12,p_yea_info.prev_ntax_H12);
1509 	set_archive_item(g_user_entity_id.prev_ntax_H13,p_yea_info.prev_ntax_H13);
1510 	set_archive_item(g_user_entity_id.prev_ntax_I01,p_yea_info.prev_ntax_I01);
1511 	set_archive_item(g_user_entity_id.prev_ntax_K01,p_yea_info.prev_ntax_K01);
1512 	set_archive_item(g_user_entity_id.prev_ntax_M01,p_yea_info.prev_ntax_M01);
1513 	set_archive_item(g_user_entity_id.prev_ntax_M02,p_yea_info.prev_ntax_M02);
1514 	set_archive_item(g_user_entity_id.prev_ntax_M03,p_yea_info.prev_ntax_M03);
1515 	set_archive_item(g_user_entity_id.prev_ntax_S01,p_yea_info.prev_ntax_S01);
1516 	set_archive_item(g_user_entity_id.prev_ntax_T01,p_yea_info.prev_ntax_T01);
1517 	set_archive_item(g_user_entity_id.prev_ntax_Y01,p_yea_info.prev_ntax_Y01);
1518 	set_archive_item(g_user_entity_id.prev_ntax_Y02,p_yea_info.prev_ntax_Y02);
1519 	set_archive_item(g_user_entity_id.prev_ntax_Y03,p_yea_info.prev_ntax_Y03);
1520 	set_archive_item(g_user_entity_id.prev_ntax_Y20,p_yea_info.prev_ntax_Y20);
1521 	set_archive_item(g_user_entity_id.prev_ntax_Y21,p_yea_info.prev_ntax_Y21); -- Bug 9737699
1522 	set_archive_item(g_user_entity_id.prev_ntax_ZZ,p_yea_info.prev_ntax_ZZ); -- Bug 9737699
1523 	set_archive_item(g_user_entity_id.prev_ntax_tax_brk,p_yea_info.prev_ntax_tax_brk); -- Bug 9737699
1524 	set_archive_item(g_user_entity_id.prev_ntax_Z01,p_yea_info.prev_ntax_Z01);
1525 	set_archive_item(g_user_entity_id.prev_ntax_H14,p_yea_info.prev_ntax_H14); --Bug 14754822
1526 	set_archive_item(g_user_entity_id.prev_ntax_H15,p_yea_info.prev_ntax_H15);
1527 	set_archive_item(g_user_entity_id.prev_ntax_T10,p_yea_info.prev_ntax_T10);
1528 	set_archive_item(g_user_entity_id.prev_ntax_T20,p_yea_info.prev_ntax_T20);
1529 	--
1530 	set_archive_item(g_user_entity_id.tax_grp_ntax_R10,p_yea_info.tax_grp_ntax_R10); --Bug 12807687
1531 	set_archive_item(g_user_entity_id.tax_grp_ntax_G01,p_yea_info.tax_grp_ntax_G01);
1532 	set_archive_item(g_user_entity_id.tax_grp_ntax_H01,p_yea_info.tax_grp_ntax_H01);
1533 	set_archive_item(g_user_entity_id.tax_grp_ntax_H05,p_yea_info.tax_grp_ntax_H05);
1534 	set_archive_item(g_user_entity_id.tax_grp_ntax_H06,p_yea_info.tax_grp_ntax_H06);
1535 	set_archive_item(g_user_entity_id.tax_grp_ntax_H07,p_yea_info.tax_grp_ntax_H07);
1536 	set_archive_item(g_user_entity_id.tax_grp_ntax_H08,p_yea_info.tax_grp_ntax_H08);
1537 	set_archive_item(g_user_entity_id.tax_grp_ntax_H09,p_yea_info.tax_grp_ntax_H09);
1538 	set_archive_item(g_user_entity_id.tax_grp_ntax_H10,p_yea_info.tax_grp_ntax_H10);
1539 	set_archive_item(g_user_entity_id.tax_grp_ntax_H11,p_yea_info.tax_grp_ntax_H11);
1540 	set_archive_item(g_user_entity_id.tax_grp_ntax_H12,p_yea_info.tax_grp_ntax_H12);
1541 	set_archive_item(g_user_entity_id.tax_grp_ntax_H13,p_yea_info.tax_grp_ntax_H13);
1542 	set_archive_item(g_user_entity_id.tax_grp_ntax_I01,p_yea_info.tax_grp_ntax_I01);
1543 	set_archive_item(g_user_entity_id.tax_grp_ntax_K01,p_yea_info.tax_grp_ntax_K01);
1544 	set_archive_item(g_user_entity_id.tax_grp_ntax_M01,p_yea_info.tax_grp_ntax_M01);
1545 	set_archive_item(g_user_entity_id.tax_grp_ntax_M02,p_yea_info.tax_grp_ntax_M02);
1546 	set_archive_item(g_user_entity_id.tax_grp_ntax_M03,p_yea_info.tax_grp_ntax_M03);
1547 	set_archive_item(g_user_entity_id.tax_grp_ntax_S01,p_yea_info.tax_grp_ntax_S01);
1548 	set_archive_item(g_user_entity_id.tax_grp_ntax_T01,p_yea_info.tax_grp_ntax_T01);
1549 	set_archive_item(g_user_entity_id.tax_grp_ntax_Y01,p_yea_info.tax_grp_ntax_Y01);
1550 	set_archive_item(g_user_entity_id.tax_grp_ntax_Y02,p_yea_info.tax_grp_ntax_Y02);
1551 	set_archive_item(g_user_entity_id.tax_grp_ntax_Y03,p_yea_info.tax_grp_ntax_Y03);
1552 	set_archive_item(g_user_entity_id.tax_grp_ntax_Y20,p_yea_info.tax_grp_ntax_Y20);
1553 	set_archive_item(g_user_entity_id.tax_grp_ntax_Y21,p_yea_info.tax_grp_ntax_Y21); -- Bug 9737699
1554 	set_archive_item(g_user_entity_id.tax_grp_ntax_ZZ,p_yea_info.tax_grp_ntax_ZZ); -- Bug 9737699
1555 	set_archive_item(g_user_entity_id.tax_grp_ntax_tax_brk,p_yea_info.tax_grp_ntax_tax_brk); -- Bug 9737699
1556 	set_archive_item(g_user_entity_id.tax_grp_ntax_Z01,p_yea_info.tax_grp_ntax_Z01);
1557 	set_archive_item(g_user_entity_id.tax_grp_ntax_H14,p_yea_info.tax_grp_ntax_H14); --Bug 14754822
1558 	set_archive_item(g_user_entity_id.tax_grp_ntax_H15,p_yea_info.tax_grp_ntax_H15);
1559 	set_archive_item(g_user_entity_id.tax_grp_ntax_T10,p_yea_info.tax_grp_ntax_T10);
1560 	set_archive_item(g_user_entity_id.tax_grp_ntax_T20,p_yea_info.tax_grp_ntax_T20);
1561 	--
1562 	set_archive_item(g_user_entity_id.total_ntax_R10,p_yea_info.total_ntax_R10); --Bug 12807687
1563 	set_archive_item(g_user_entity_id.total_ntax_G01,p_yea_info.total_ntax_G01);
1564 	set_archive_item(g_user_entity_id.total_ntax_H01,p_yea_info.total_ntax_H01);
1565 	set_archive_item(g_user_entity_id.total_ntax_H05,p_yea_info.total_ntax_H05);
1566 	set_archive_item(g_user_entity_id.total_ntax_H06,p_yea_info.total_ntax_H06);
1567 	set_archive_item(g_user_entity_id.total_ntax_H07,p_yea_info.total_ntax_H07);
1568 	set_archive_item(g_user_entity_id.total_ntax_H08,p_yea_info.total_ntax_H08);
1569 	set_archive_item(g_user_entity_id.total_ntax_H09,p_yea_info.total_ntax_H09);
1570 	set_archive_item(g_user_entity_id.total_ntax_H10,p_yea_info.total_ntax_H10);
1571 	set_archive_item(g_user_entity_id.total_ntax_H11,p_yea_info.total_ntax_H11);
1572 	set_archive_item(g_user_entity_id.total_ntax_H12,p_yea_info.total_ntax_H12);
1573 	set_archive_item(g_user_entity_id.total_ntax_H13,p_yea_info.total_ntax_H13);
1574 	set_archive_item(g_user_entity_id.total_ntax_I01,p_yea_info.total_ntax_I01);
1575 	set_archive_item(g_user_entity_id.total_ntax_K01,p_yea_info.total_ntax_K01);
1576 	set_archive_item(g_user_entity_id.total_ntax_M01,p_yea_info.total_ntax_M01);
1577 	set_archive_item(g_user_entity_id.total_ntax_M02,p_yea_info.total_ntax_M02);
1578 	set_archive_item(g_user_entity_id.total_ntax_M03,p_yea_info.total_ntax_M03);
1579 	set_archive_item(g_user_entity_id.total_ntax_S01,p_yea_info.total_ntax_S01);
1580 	set_archive_item(g_user_entity_id.total_ntax_T01,p_yea_info.total_ntax_T01);
1581 	set_archive_item(g_user_entity_id.total_ntax_Y01,p_yea_info.total_ntax_Y01);
1582 	set_archive_item(g_user_entity_id.total_ntax_Y02,p_yea_info.total_ntax_Y02);
1583 	set_archive_item(g_user_entity_id.total_ntax_Y03,p_yea_info.total_ntax_Y03);
1584 	set_archive_item(g_user_entity_id.total_ntax_Y20,p_yea_info.total_ntax_Y20);
1585 	set_archive_item(g_user_entity_id.total_ntax_Y21,p_yea_info.total_ntax_Y21); -- Bug 9737699
1586 	set_archive_item(g_user_entity_id.total_ntax_ZZ,p_yea_info.total_ntax_ZZ); -- Bug 9737699
1587 	set_archive_item(g_user_entity_id.total_ntax_tax_brk,p_yea_info.total_ntax_tax_brk); -- Bug 9737699
1588 	set_archive_item(g_user_entity_id.total_ntax_Z01,p_yea_info.total_ntax_Z01);
1589 	set_archive_item(g_user_entity_id.total_ntax_H14,p_yea_info.total_ntax_H14); --Bug 14754822
1590 	set_archive_item(g_user_entity_id.total_ntax_H15,p_yea_info.total_ntax_H15);
1591 	set_archive_item(g_user_entity_id.total_ntax_T10,p_yea_info.total_ntax_T10);
1592 	set_archive_item(g_user_entity_id.total_ntax_T20,p_yea_info.total_ntax_T20);
1593 	--
1594 	set_archive_item(g_user_entity_id.cur_total_ntax_earn,p_yea_info.cur_total_ntax_earn);
1595 	set_archive_item(g_user_entity_id.tax_grp_total_ntax_earn,p_yea_info.tax_grp_total_ntax_earn);
1596 	set_archive_item(g_user_entity_id.smb_income_exem,p_yea_info.smb_income_exem); -- Bug 9079450
1597 	set_archive_item(g_user_entity_id.cur_smb_days_worked,p_yea_info.cur_smb_days_worked);		 -- Bug 9079450
1598 	set_archive_item(g_user_entity_id.prev_smb_days_worked,p_yea_info.prev_smb_days_worked); 	 -- Bug 9079450
1599 	set_archive_item(g_user_entity_id.cur_smb_eligible_income,p_yea_info.cur_smb_eligible_income);	 -- Bug 9079450
1600 	set_archive_item(g_user_entity_id.prev_smb_eligible_income,p_yea_info.prev_smb_eligible_income); -- Bug 9079450
1601 	set_archive_item(g_user_entity_id.emp_join_prev_year,p_yea_info.emp_join_prev_year);	  	 -- Bug 9079450
1602 	set_archive_item(g_user_entity_id.emp_leave_cur_year,p_yea_info.emp_leave_cur_year);	  	 -- Bug 9079450
1603 	set_archive_item(g_user_entity_id.smb_eligibility_flag,p_yea_info.smb_eligibility_flag);	 -- Bug 9079450
1604 	--
1605 	-- End of Bug 8644512
1606 
1607 end convert_to_tbl;
1608 ------------------------------------------------------------------------
1609 -- Bug 7361372
1610 procedure tax_group_info(
1611         p_assignment_id		 in number,
1612 	p_effective_date	 in date,
1613 	p_bus_reg_num            out nocopy varchar2,
1614 	p_tax_grp_name           out nocopy varchar2,
1615 	p_wkpd_from		 out nocopy date,	-- Bug 8644512
1616 	p_wkpd_to		 out nocopy date,	-- Bug 8644512
1617 	p_tax_brk_pd_from	 out nocopy date,	-- Bug 8644512
1618 	p_tax_brk_pd_to		 out nocopy date,	-- Bug 8644512
1619 	p_taxable_mth            out nocopy number,
1620 	p_taxable_bon            out nocopy number,
1621 	p_sp_irreg_bonus         out nocopy number,
1622 	p_stck_pur_opt_exec_earn out nocopy number,
1623 	p_esop_withd_earn	 out nocopy number,	-- Bug 8644512
1624 	p_taxable_mth_ne         out nocopy number,	-- Bug 7508706
1625 	p_taxable_bon_ne         out nocopy number,	-- Bug 7508706
1626 	p_sp_irreg_bonus_ne      out nocopy number,	-- Bug 7508706
1627 	p_stck_pur_ne 		 out nocopy number,	-- Bug 7508706
1628 	p_esop_withd_earn_ne	 out nocopy number,	-- Bug 8644512
1629 	p_non_taxable_ovt	 out nocopy number,	-- Bug 8644512
1630 	p_bir_raising_allw	 out nocopy number,	-- Bug 8644512
1631 	p_fw_income_exem	 out nocopy number,	-- Bug 8644512
1632 	p_itax  	         out nocopy number,
1633 	p_rtax           	 out nocopy number,
1634 	p_stax           	 out nocopy number,
1635 	p_tax_grp_ntax_R10	 out nocopy number,	 -- Bug 12807687
1636 	p_tax_grp_ntax_G01	 out nocopy number,	-- Bug 8644512
1637 	p_tax_grp_ntax_H01	 out nocopy number,	-- Bug 8644512
1638 	p_tax_grp_ntax_H05	 out nocopy number,	-- Bug 8644512
1639 	p_tax_grp_ntax_H06	 out nocopy number,	-- Bug 8644512
1640 	p_tax_grp_ntax_H07	 out nocopy number,	-- Bug 8644512
1641 	p_tax_grp_ntax_H08	 out nocopy number,	-- Bug 8644512
1642 	p_tax_grp_ntax_H09	 out nocopy number,	-- Bug 8644512
1643 	p_tax_grp_ntax_H10	 out nocopy number,	-- Bug 8644512
1644 	p_tax_grp_ntax_H11	 out nocopy number,	-- Bug 8644512
1645 	p_tax_grp_ntax_H12	 out nocopy number,	-- Bug 8644512
1646 	p_tax_grp_ntax_H13	 out nocopy number,	-- Bug 8644512
1647 	p_tax_grp_ntax_I01	 out nocopy number,	-- Bug 8644512
1648 	p_tax_grp_ntax_K01	 out nocopy number,	-- Bug 8644512
1649 	p_tax_grp_ntax_M01	 out nocopy number,	-- Bug 8644512
1650 	p_tax_grp_ntax_M02	 out nocopy number,	-- Bug 8644512
1651 	p_tax_grp_ntax_M03	 out nocopy number,	-- Bug 8644512
1652 	p_tax_grp_ntax_S01	 out nocopy number,	-- Bug 8644512
1653 	p_tax_grp_ntax_T01	 out nocopy number,	-- Bug 8644512
1654 	p_tax_grp_ntax_Y01	 out nocopy number,	-- Bug 8644512
1655 	p_tax_grp_ntax_Y02	 out nocopy number,	-- Bug 8644512
1656 	p_tax_grp_ntax_Y03	 out nocopy number,	-- Bug 8644512
1657 	p_tax_grp_ntax_Y20	 out nocopy number,	-- Bug 8644512
1658 	p_tax_grp_ntax_Y21	 out nocopy number,	-- Bug 9737699
1659         p_tax_grp_ntax_ZZ	 out nocopy number,	-- Bug 9737699
1660 	p_tax_grp_ntax_Z01	 out nocopy number,	-- Bug 8644512
1661 	p_tax_grp_ntax_tax_brk	 out nocopy number,	-- Bug 8644512
1662 	p_tax_grp_ntax_H14	 out nocopy number,	 -- Bug 14754822
1663 	p_tax_grp_ntax_H15	 out nocopy number,
1664 	p_tax_grp_ntax_T10	 out nocopy number,
1665 	p_tax_grp_ntax_T20	 out nocopy number
1666 )
1667 ------------------------------------------------------------------------
1668 is
1669         cursor csr_aei is
1670                 select 	hr_ni_chk_pkg.chk_nat_id_format(aei_information2, 'DDD-DD-DDDDD'),
1671                 	aei_information3,
1672 			fnd_date.canonical_to_date(aei_information15),	-- Bug 8644512
1673 			fnd_date.canonical_to_date(aei_information16),	-- Bug 8644512
1674 			fnd_date.canonical_to_date(aei_information17),	-- Bug 8644512
1675 			fnd_date.canonical_to_date(aei_information18),	-- Bug 8644512
1676                 	nvl(to_number(aei_information4), 0),
1677 		        nvl(to_number(aei_information5), 0),
1678 			nvl(to_number(aei_information6), 0),
1679 			nvl(to_number(aei_information7), 0),
1680 			nvl(to_number(aei_information19), 0),	-- Bug 8644512
1681 			nvl(to_number(aei_information8), 0),
1682 			nvl(to_number(aei_information9), 0),
1683 			nvl(to_number(aei_information10), 0),
1684 			nvl(to_number(aei_information11), 0),	-- Bug 7508706
1685 			nvl(to_number(aei_information12), 0),	-- Bug 7508706
1686 			nvl(to_number(aei_information13), 0),	-- Bug 7508706
1687 			nvl(to_number(aei_information14), 0),	-- Bug 7508706
1688 			nvl(to_number(aei_information20), 0),	-- Bug 8644512
1689 			nvl(to_number(aei_information21), 0),	-- Bug 8644512
1690 			nvl(to_number(aei_information22), 0),	-- Bug 8644512
1691 			nvl(to_number(aei_information23), 0)	-- Bug 8644512
1692 		from	per_assignment_extra_info
1693 		where	assignment_id = p_assignment_id
1694 		and	information_type = 'KR_YEA_TAX_GROUP_INFO'
1695 		and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY');
1696 l_dummy number;
1697 begin
1698 	open csr_aei;
1699 	fetch csr_aei into
1700 	  p_bus_reg_num,
1701 	  p_tax_grp_name,
1702 	  p_wkpd_from,			-- Bug 8644512
1703 	  p_wkpd_to,			-- Bug 8644512
1704 	  p_tax_brk_pd_from,		-- Bug 8644512
1705 	  p_tax_brk_pd_to,		-- Bug 8644512
1706 	  p_taxable_mth,
1707 	  p_taxable_bon,
1708 	  p_sp_irreg_bonus,
1709 	  p_stck_pur_opt_exec_earn,
1710 	  p_esop_withd_earn,		-- Bug 8644512
1711 	  p_itax,
1712 	  p_rtax,
1713 	  p_stax,
1714 	  p_taxable_mth_ne,	-- Bug 7508706
1715 	  p_taxable_bon_ne,	-- Bug 7508706
1716 	  p_sp_irreg_bonus_ne,	-- Bug 7508706
1717 	  p_stck_pur_ne,	-- Bug 7508706
1718 	  p_esop_withd_earn_ne,	-- Bug 8644512
1719 	  p_non_taxable_ovt,	-- Bug 8644512
1720 	  p_bir_raising_allw,	-- Bug 8644512
1721 	  p_fw_income_exem;	-- Bug 8644512
1722 	close csr_aei;
1723 	--
1724 	-- Bug 9539550
1725 
1726 	--
1727 	if p_effective_date >= c_20100101 then
1728 	   if p_fw_income_exem is not null then
1729 	      p_fw_income_exem := 0;
1730 	   end if;
1731 	end if;
1732 	--
1733 	--
1734 	-- Bug 8644512
1735 	--
1736 	for rec in 1..g_contexts_tab.count loop
1737 	    g_ntax_value_tbl(rec)	:= 0;
1738 	end loop;
1739 	--
1740 	for i in 1..g_ntax_detail_tbl.count loop
1741 	--
1742       		if g_ntax_detail_tbl(i).business_reg_num = p_bus_reg_num then
1743         	--
1744                 	for k in 1..g_contexts_tab.count loop
1745                 	--
1746 	   	    		if g_contexts_tab(k) = g_ntax_detail_tbl(i).ntax_earn_code then
1747 	   	    		--
1748 	   	       			g_ntax_value_tbl(k) := g_ntax_detail_tbl(i).ntax_earning;
1749 	   	    		--
1750 	   	    		end if;
1751 	   		--
1752 	        	end loop;
1753 	   	--
1754 	   	End if;
1755 	--
1756 	end loop;
1757 	--
1758 	if p_effective_date < c_20110101 then
1759 		p_tax_grp_ntax_G01 := g_ntax_value_tbl(1);
1760 		p_tax_grp_ntax_H01 := g_ntax_value_tbl(2);
1761 		p_tax_grp_ntax_H05 := g_ntax_value_tbl(3);
1762 		p_tax_grp_ntax_H06 := g_ntax_value_tbl(4);
1763 		p_tax_grp_ntax_H07 := g_ntax_value_tbl(5);
1764 		p_tax_grp_ntax_H08 := g_ntax_value_tbl(6);
1765 		p_tax_grp_ntax_H09 := g_ntax_value_tbl(7);
1766 		p_tax_grp_ntax_H10 := g_ntax_value_tbl(8);
1767 		p_tax_grp_ntax_H11 := g_ntax_value_tbl(9);
1768 		p_tax_grp_ntax_H12 := g_ntax_value_tbl(10);
1769 		p_tax_grp_ntax_H13 := g_ntax_value_tbl(11);
1770 		p_tax_grp_ntax_I01 := g_ntax_value_tbl(12);
1771 		p_tax_grp_ntax_K01 := g_ntax_value_tbl(13);
1772 		p_tax_grp_ntax_M01 := g_ntax_value_tbl(14);
1773 		p_tax_grp_ntax_M02 := g_ntax_value_tbl(15);
1774 		p_tax_grp_ntax_M03 := g_ntax_value_tbl(16);
1775 		p_tax_grp_ntax_R10 := g_ntax_value_tbl(17);  -- Bug 12807687
1776 		p_tax_grp_ntax_S01 := g_ntax_value_tbl(18);
1777 		p_tax_grp_ntax_T01 := g_ntax_value_tbl(19);
1778 		p_tax_grp_ntax_Y01 := g_ntax_value_tbl(20);
1779 		p_tax_grp_ntax_Y02 := g_ntax_value_tbl(21);
1780 		p_tax_grp_ntax_Y03 := g_ntax_value_tbl(22);
1781 		p_tax_grp_ntax_Y20 := g_ntax_value_tbl(23);
1782 		p_tax_grp_ntax_Y21 := g_ntax_value_tbl(24); -- Bug 9737699
1783 		l_dummy		   := g_ntax_value_tbl(25); -- Bug 12807687
1784 		p_tax_grp_ntax_Z01 := g_ntax_value_tbl(26);
1785 		p_tax_grp_ntax_ZZ  := g_ntax_value_tbl(27); -- Bug 9737699
1786 		p_tax_grp_ntax_tax_brk := nvl(p_tax_grp_ntax_T01,0) + nvl(p_tax_grp_ntax_Z01,0); -- Bug 9737699
1787 	end if;
1788 
1789 	------- BUG 12807687 Start ------
1790 	if p_effective_date >= c_20110101 then
1791 		p_tax_grp_ntax_G01 := g_ntax_value_tbl(1);
1792 		p_tax_grp_ntax_H01 := g_ntax_value_tbl(2);
1793 		p_tax_grp_ntax_H05 := g_ntax_value_tbl(3);
1794 		p_tax_grp_ntax_H06 := g_ntax_value_tbl(4);
1795 		p_tax_grp_ntax_H07 := g_ntax_value_tbl(5);
1796 		p_tax_grp_ntax_H08 := g_ntax_value_tbl(6);
1797 		p_tax_grp_ntax_H09 := g_ntax_value_tbl(7);
1798 		p_tax_grp_ntax_H10 := g_ntax_value_tbl(8);
1799 		p_tax_grp_ntax_H11 := g_ntax_value_tbl(9);
1800 		p_tax_grp_ntax_H12 := g_ntax_value_tbl(10);
1801 		p_tax_grp_ntax_H13 := g_ntax_value_tbl(11);
1802 		p_tax_grp_ntax_H14 := g_ntax_value_tbl(12);  -- Bug 14754822
1803 		p_tax_grp_ntax_H15 := g_ntax_value_tbl(13);  -- Bug 14754822
1804 		p_tax_grp_ntax_I01 := g_ntax_value_tbl(14);
1805 		p_tax_grp_ntax_K01 := g_ntax_value_tbl(15);
1806 		p_tax_grp_ntax_M01 := g_ntax_value_tbl(16);
1807 		p_tax_grp_ntax_M02 := g_ntax_value_tbl(17);
1808 		p_tax_grp_ntax_M03 := g_ntax_value_tbl(18);
1809 		p_tax_grp_ntax_R10 := g_ntax_value_tbl(19);  -- Bug 12807687
1810 		p_tax_grp_ntax_S01 := g_ntax_value_tbl(20);
1811 		p_tax_grp_ntax_T01 := g_ntax_value_tbl(21);
1812 		p_tax_grp_ntax_T10 := g_ntax_value_tbl(22);  -- Bug 14754822
1813 		p_tax_grp_ntax_T20 := g_ntax_value_tbl(23);  -- Bug 14754822
1814 		p_tax_grp_ntax_Y01 := g_ntax_value_tbl(24);
1815 		p_tax_grp_ntax_Y02 := g_ntax_value_tbl(25);
1816 		p_tax_grp_ntax_Y03 := g_ntax_value_tbl(26);
1817 		p_tax_grp_ntax_Y20 := g_ntax_value_tbl(27);  -- Bug 12807687
1818 		p_tax_grp_ntax_Y21 := g_ntax_value_tbl(28); -- Bug 9737699
1819 		p_tax_grp_ntax_ZZ  := g_ntax_value_tbl(29); -- Bug 12807687
1820 		p_tax_grp_ntax_Z01 := g_ntax_value_tbl(30);
1821 		l_dummy		   := g_ntax_value_tbl(31); -- Bug 12807687
1822 		p_tax_grp_ntax_tax_brk := nvl(p_tax_grp_ntax_T01,0) + nvl(p_tax_grp_ntax_Z01,0) + nvl(p_tax_grp_ntax_T10,0) + nvl(p_tax_grp_ntax_T20,0); -- Bug 14754822
1823 	end if;
1824 	----- Bug 12807687 END  -----
1825 	--
1826 end tax_group_info;
1827 -- End of Bug 7361372
1828 ------------------------------------------------------------------------
1829 procedure prev_er_info(
1830 	p_assignment_id		in number,
1831 	p_effective_date	in date,
1832 	p_hire_date_tbl		out nocopy t_date_tbl,		-- Bug 8644512
1833 	p_termination_date_tbl	out nocopy t_date_tbl,
1834 	p_corp_name_tbl		out nocopy t_varchar2_tbl,
1835 	p_bp_number_tbl		out nocopy t_varchar2_tbl,
1836 	p_tax_brk_pd_from_tbl	out nocopy t_date_tbl,		-- Bug 8644512
1837 	p_tax_brk_pd_to_tbl	out nocopy t_date_tbl,		-- Bug 8644512
1838 	p_taxable_mth_tbl	out nocopy t_number_tbl,
1839 	p_taxable_bon_tbl	out nocopy t_number_tbl,
1840 	p_sp_irreg_bonus_tbl	out nocopy t_number_tbl,
1841 	p_stck_pur_opt_exec_earn_tbl out nocopy t_number_tbl,  -- Bug 6024342
1842 	p_non_taxable_ovs_tbl	out nocopy t_number_tbl,
1843 	p_non_taxable_ovt_tbl	out nocopy t_number_tbl,
1844 	p_non_taxable_oth_tbl	out nocopy t_number_tbl,
1845 	p_hi_prem_tbl		out nocopy t_number_tbl,
1846 	p_ltci_prem_tbl		out nocopy t_number_tbl,  -- Bug 7260606
1847 	p_ei_prem_tbl		out nocopy t_number_tbl,
1848 	p_np_prem_tbl		out nocopy t_number_tbl,
1849 	p_pen_prem_tbl		out nocopy t_number_tbl,  -- Bug 6024342
1850 	p_military_pen_prem_tbl out nocopy t_number_tbl,  -- Bug 9737699
1851 	p_private_school_pen_prem_tbl out nocopy t_number_tbl,  -- Bug 9737699
1852 	p_post_office_pen_prem_tbl out nocopy t_number_tbl,  -- Bug 9737699
1853 	p_separation_pension_tbl out nocopy t_number_tbl,  -- Bug 7508706
1854 	p_itax_tbl		out nocopy t_number_tbl,
1855 	p_rtax_tbl		out nocopy t_number_tbl,
1856 	p_stax_tbl		out nocopy t_number_tbl,
1857 	p_research_payment_tbl	out nocopy t_number_tbl,        -- Bug 8341054
1858 	p_bir_raising_allowance_tbl out nocopy t_number_tbl,    -- Bug 8341054
1859 	p_foreign_worker_exem_tbl out nocopy t_number_tbl,      -- Bug 8341054
1860 	p_esop_withd_earn_tbl	out nocopy t_number_tbl,	-- Bug 8644512
1861 	p_prev_ntax_R10_tbl	out nocopy t_number_tbl,	--Bug 12807687
1862 	p_prev_ntax_G01_tbl	out nocopy t_number_tbl,	-- Bug 8644512
1863 	p_prev_ntax_H01_tbl	out nocopy t_number_tbl,	-- Bug 8644512
1864 	p_prev_ntax_H05_tbl	out nocopy t_number_tbl,	-- Bug 8644512
1865 	p_prev_ntax_H06_tbl	out nocopy t_number_tbl,	-- Bug 8644512
1866 	p_prev_ntax_H07_tbl	out nocopy t_number_tbl,	-- Bug 8644512
1867 	p_prev_ntax_H08_tbl	out nocopy t_number_tbl,	-- Bug 8644512
1868 	p_prev_ntax_H09_tbl	out nocopy t_number_tbl,	-- Bug 8644512
1869 	p_prev_ntax_H10_tbl	out nocopy t_number_tbl,	-- Bug 8644512
1870 	p_prev_ntax_H11_tbl	out nocopy t_number_tbl,	-- Bug 8644512
1871 	p_prev_ntax_H12_tbl	out nocopy t_number_tbl,	-- Bug 8644512
1872 	p_prev_ntax_H13_tbl	out nocopy t_number_tbl,	-- Bug 8644512
1873 	p_prev_ntax_I01_tbl	out nocopy t_number_tbl,	-- Bug 8644512
1874 	p_prev_ntax_K01_tbl	out nocopy t_number_tbl,	-- Bug 8644512
1875 	p_prev_ntax_M01_tbl	out nocopy t_number_tbl,	-- Bug 8644512
1876 	p_prev_ntax_M02_tbl	out nocopy t_number_tbl,	-- Bug 8644512
1877 	p_prev_ntax_M03_tbl	out nocopy t_number_tbl,	-- Bug 8644512
1878 	p_prev_ntax_S01_tbl	out nocopy t_number_tbl,	-- Bug 8644512
1879 	p_prev_ntax_T01_tbl	out nocopy t_number_tbl,	-- Bug 8644512
1880 	p_prev_ntax_Y01_tbl	out nocopy t_number_tbl,	-- Bug 8644512
1881 	p_prev_ntax_Y02_tbl	out nocopy t_number_tbl,	-- Bug 8644512
1882 	p_prev_ntax_Y03_tbl	out nocopy t_number_tbl,	-- Bug 8644512
1883 	p_prev_ntax_Y20_tbl	out nocopy t_number_tbl,	-- Bug 8644512
1884 	p_prev_ntax_Y21_tbl	out nocopy t_number_tbl,	-- Bug 9737699
1885 	p_prev_ntax_ZZ_tbl	out nocopy t_number_tbl,	-- Bug 9737699
1886 	p_prev_ntax_Z01_tbl	out nocopy t_number_tbl,	-- Bug 8644512
1887 	p_prev_ntax_tax_brk_tbl	out nocopy t_number_tbl,		-- Bug 9737699
1888 	p_prev_ntax_H14_tbl	out nocopy t_number_tbl,	--Bug 14754822
1889 	p_prev_ntax_H15_tbl	out nocopy t_number_tbl,
1890 	p_prev_ntax_T10_tbl	out nocopy t_number_tbl,
1891 	p_prev_ntax_T20_tbl	out nocopy t_number_tbl
1892 )
1893 ------------------------------------------------------------------------
1894 is
1895 	cursor csr_aei is
1896 		select	fnd_date.canonical_to_date(aei_information23) aei23,	-- Bug 8644512
1897 			fnd_date.canonical_to_date(aei_information1) aei1,
1898 			aei_information2 aei2,
1899 			hr_ni_chk_pkg.chk_nat_id_format(aei_information3, 'DDD-DD-DDDDD') aei3,
1900 			fnd_date.canonical_to_date(aei_information24) aei24,	-- Bug 8644512
1901 			fnd_date.canonical_to_date(aei_information25) aei25,	-- Bug 8644512
1902 			nvl(to_number(aei_information4), 0) aei4,
1903 			nvl(to_number(aei_information5), 0) aei5,
1904 			nvl(to_number(aei_information6), 0) aei6,
1905 			nvl(to_number(aei_information7), 0) aei7,
1906 			nvl(to_number(aei_information8), 0) aei8,
1907 			nvl(to_number(aei_information9), 0) aei9,
1908 			nvl(to_number(aei_information10), 0) aei10,
1909 			nvl(to_number(aei_information18), 0) aei18,   -- Bug 7260606
1910 			nvl(to_number(aei_information11), 0) aei11,
1911 			nvl(to_number(aei_information12), 0) aei12,
1912 			nvl(to_number(aei_information13), 0) aei13,
1913 			nvl(to_number(aei_information14), 0) aei14,
1914 			nvl(to_number(aei_information15), 0) aei15,
1915 			nvl(to_number(aei_information16), 0) aei16,	-- Bug 6024342
1916 			nvl(to_number(aei_information28), 0) aei28,	-- Bug 9737699
1917 			nvl(to_number(aei_information29), 0) aei29,	-- Bug 9737699
1918 			nvl(to_number(aei_information30), 0) aei30,	-- Bug 9737699
1919 			nvl(to_number(aei_information17), 0) aei17,   -- Bug 6024342
1920 			nvl(to_number(aei_information19), 0) aei19,	-- Bug 7508706
1921 			nvl(to_number(aei_information20), 0) aei20,	-- Bug 8341054
1922 			nvl(to_number(aei_information21), 0) aei21,	-- Bug 8341054
1923 			nvl(to_number(aei_information22), 0) aei22,	-- Bug 8341054
1924 			nvl(to_number(aei_information26), 0) aei26,	-- Bug 8644512
1925 			assignment_extra_info_id asg_ex_info_id         -- Bug 9737699
1926 		from	per_assignment_extra_info
1927 		where	assignment_id = p_assignment_id
1928 		and	information_type = 'KR_YEA_PREV_ER_INFO'
1929 		and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY')
1930 		order by 1;
1931    cursor csr_aei2(p_assignment_extra_info_id in number)is
1932 		select	nvl(to_number(aei_information4), 0) aei4,
1933 			nvl(to_number(aei_information5), 0) aei5,
1934 			nvl(to_number(aei_information6), 0) aei6
1935 		from	per_assignment_extra_info
1936 		where	assignment_id = p_assignment_id
1937 		and	information_type = 'KR_YEA_PREV_ER_INFO2'
1938 		and     aei_information2 = p_assignment_extra_info_id
1939 		and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY')
1940 		order by 1;
1941 	cnt number;
1942 l_assignment_extra_info_id number;
1943 l_dummy number;
1944 
1945 
1946 begin
1947 	-- Bug 8644512
1948 	--
1949 	cnt := 1;
1950 	for i in csr_aei loop
1951 		p_hire_date_tbl(cnt)			:= i.aei23;	-- Bug 8644512
1952 		p_termination_date_tbl(cnt)		:= i.aei1;
1953 		p_corp_name_tbl(cnt)			:= i.aei2;
1954 		p_bp_number_tbl(cnt)			:= i.aei3;
1955 		p_tax_brk_pd_from_tbl(cnt)		:= i.aei24;	-- Bug 8644512
1956 		p_tax_brk_pd_to_tbl(cnt)		:= i.aei25;	-- Bug 8644512
1957 		p_taxable_mth_tbl(cnt)			:= i.aei4;
1958 		p_taxable_bon_tbl(cnt)			:= i.aei5;
1959 		p_sp_irreg_bonus_tbl(cnt)		:= i.aei6;
1960 		p_non_taxable_ovs_tbl(cnt)		:= i.aei7;
1961 		p_non_taxable_ovt_tbl(cnt)		:= i.aei8;
1962 		p_non_taxable_oth_tbl(cnt)		:= i.aei9;
1963 		p_hi_prem_tbl(cnt)			:= i.aei10;
1964 		p_ltci_prem_tbl(cnt)			:= i.aei18;	-- Bug 7260606
1965 		p_ei_prem_tbl(cnt)			:= i.aei11;
1966 		p_np_prem_tbl(cnt)			:= i.aei12;
1967 		p_itax_tbl(cnt)				:= i.aei13;
1968 		p_rtax_tbl(cnt)				:= i.aei14;
1969 		p_stax_tbl(cnt)				:= i.aei15;
1970 		p_pen_prem_tbl(cnt)			:= i.aei16;	-- Bug 6024342
1971 		p_stck_pur_opt_exec_earn_tbl(cnt)	:= i.aei17;	-- Bug 6024342
1972 		p_separation_pension_tbl(cnt)		:= i.aei19;	-- Bug 7508706
1973 		p_research_payment_tbl(cnt)		:= i.aei20;     -- Bug 8341054
1974 		p_bir_raising_allowance_tbl(cnt)	:= i.aei21;   	-- Bug 8341054
1975 		--
1976 		l_assignment_extra_info_id              := i.asg_ex_info_id; -- Bug 9737699
1977 		-- Bug 9539550
1978 		--
1979 		-- Bug 9737699
1980 		open csr_aei2(l_assignment_extra_info_id);
1981 		fetch csr_aei2 into
1982 		p_military_pen_prem_tbl(cnt),
1983 		p_private_school_pen_prem_tbl(cnt),
1984 		p_post_office_pen_prem_tbl(cnt);
1985 		if csr_aei2%NOTFOUND then
1986 		p_military_pen_prem_tbl(cnt) := 0;  -- Bug 14078390
1987 		p_private_school_pen_prem_tbl(cnt) := 0;  -- Bug 14078390
1988 		p_post_office_pen_prem_tbl(cnt)   := 0;  -- Bug 14078390
1989 		end if;
1990 		close csr_aei2;
1991 
1992 		if p_effective_date >= c_20100101 then
1993                    p_foreign_worker_exem_tbl(cnt)	:= 0;
1994 		else
1995                    p_foreign_worker_exem_tbl(cnt)	:= i.aei22;    	-- Bug 8341054
1996 		end if;
1997 		--
1998 		p_esop_withd_earn_tbl(cnt)		:= i.aei26;	-- Bug 8644512
1999 
2000 		--
2001 		for rec in 1..g_contexts_tab.count loop
2002 		    g_ntax_value_tbl(rec)	:= 0;
2003 		end loop;
2004 		--
2005 		for j in 1..g_ntax_detail_tbl.count loop
2006 		--
2007             		if g_ntax_detail_tbl(j).business_reg_num = p_bp_number_tbl(cnt) then
2008             		--
2009                 		for k in 1..g_contexts_tab.count loop
2010                 		--
2011 	   	    			if g_contexts_tab(k) = g_ntax_detail_tbl(j).ntax_earn_code then
2012 	   	    			--
2013 	   	       				g_ntax_value_tbl(k) := g_ntax_detail_tbl(j).ntax_earning;
2014 	   	    			--
2015 	   	    			end if;
2016 	   			--
2017 	        		end loop;
2018 	   		--
2019 	   		End if;
2020 		--
2021 		end loop;
2022 		--
2023 
2024 	if p_effective_date < c_20110101 then
2025 		p_prev_ntax_G01_tbl(cnt) := g_ntax_value_tbl(1);
2026 		p_prev_ntax_H01_tbl(cnt) := g_ntax_value_tbl(2);
2027 		p_prev_ntax_H05_tbl(cnt) := g_ntax_value_tbl(3);
2028 		p_prev_ntax_H06_tbl(cnt) := g_ntax_value_tbl(4);
2029 		p_prev_ntax_H07_tbl(cnt) := g_ntax_value_tbl(5);
2030 		p_prev_ntax_H08_tbl(cnt) := g_ntax_value_tbl(6);
2031 		p_prev_ntax_H09_tbl(cnt) := g_ntax_value_tbl(7);
2032 		p_prev_ntax_H10_tbl(cnt) := g_ntax_value_tbl(8);
2033 		p_prev_ntax_H11_tbl(cnt) := g_ntax_value_tbl(9);
2034 		p_prev_ntax_H12_tbl(cnt) := g_ntax_value_tbl(10);
2035 		p_prev_ntax_H13_tbl(cnt) := g_ntax_value_tbl(11);
2036 		p_prev_ntax_I01_tbl(cnt) := g_ntax_value_tbl(12);
2037 		p_prev_ntax_K01_tbl(cnt) := g_ntax_value_tbl(13);
2038 		p_prev_ntax_M01_tbl(cnt) := g_ntax_value_tbl(14);
2039 		p_prev_ntax_M02_tbl(cnt) := g_ntax_value_tbl(15);
2040 		p_prev_ntax_M03_tbl(cnt) := g_ntax_value_tbl(16);
2041 		p_prev_ntax_R10_tbl(cnt) := g_ntax_value_tbl(17); -- Bug 12807687
2042 		p_prev_ntax_S01_tbl(cnt) := g_ntax_value_tbl(18);
2043 		p_prev_ntax_T01_tbl(cnt) := g_ntax_value_tbl(19);
2044 		p_prev_ntax_Y01_tbl(cnt) := g_ntax_value_tbl(20);
2045 		p_prev_ntax_Y02_tbl(cnt) := g_ntax_value_tbl(21);
2046 		p_prev_ntax_Y03_tbl(cnt) := g_ntax_value_tbl(22);
2047 		p_prev_ntax_Y20_tbl(cnt) := g_ntax_value_tbl(23);
2048 		p_prev_ntax_Y21_tbl(cnt) := g_ntax_value_tbl(24); -- Bug 9737699
2049 		l_dummy		         := g_ntax_value_tbl(25); -- Bug 12807687
2050 		p_prev_ntax_Z01_tbl(cnt) := g_ntax_value_tbl(26);
2051 		p_prev_ntax_ZZ_tbl(cnt)  := g_ntax_value_tbl(27); -- Bug 9737699
2052 		-- Bug 9737699
2053 		p_prev_ntax_tax_brk_tbl(cnt)  := nvl(p_prev_ntax_T01_tbl(cnt),0) + nvl(p_prev_ntax_Z01_tbl(cnt),0);
2054 	end if;
2055 
2056 		---- Bug 12807687 Start, Added If condition----
2057 	if p_effective_date >= c_20110101 then
2058 		p_prev_ntax_G01_tbl(cnt) := g_ntax_value_tbl(1);
2059 		p_prev_ntax_H01_tbl(cnt) := g_ntax_value_tbl(2);
2060 		p_prev_ntax_H05_tbl(cnt) := g_ntax_value_tbl(3);
2061 		p_prev_ntax_H06_tbl(cnt) := g_ntax_value_tbl(4);
2062 		p_prev_ntax_H07_tbl(cnt) := g_ntax_value_tbl(5);
2063 		p_prev_ntax_H08_tbl(cnt) := g_ntax_value_tbl(6);
2064 		p_prev_ntax_H09_tbl(cnt) := g_ntax_value_tbl(7);
2065 		p_prev_ntax_H10_tbl(cnt) := g_ntax_value_tbl(8);
2066 		p_prev_ntax_H11_tbl(cnt) := g_ntax_value_tbl(9);
2067 		p_prev_ntax_H12_tbl(cnt) := g_ntax_value_tbl(10);
2068 		p_prev_ntax_H13_tbl(cnt) := g_ntax_value_tbl(11);
2069 		p_prev_ntax_H14_tbl(cnt) := g_ntax_value_tbl(12); -- Bug 14754822
2070 		p_prev_ntax_H15_tbl(cnt) := g_ntax_value_tbl(13); -- Bug 14754822
2071 		p_prev_ntax_I01_tbl(cnt) := g_ntax_value_tbl(14);
2072 		p_prev_ntax_K01_tbl(cnt) := g_ntax_value_tbl(15);
2073 		p_prev_ntax_M01_tbl(cnt) := g_ntax_value_tbl(16);
2074 		p_prev_ntax_M02_tbl(cnt) := g_ntax_value_tbl(17);
2075 		p_prev_ntax_M03_tbl(cnt) := g_ntax_value_tbl(18);
2076 		p_prev_ntax_R10_tbl(cnt) := g_ntax_value_tbl(19); -- Bug 12807687
2077 		p_prev_ntax_S01_tbl(cnt) := g_ntax_value_tbl(20);
2078 		p_prev_ntax_T01_tbl(cnt) := g_ntax_value_tbl(21);
2079 		p_prev_ntax_T10_tbl(cnt) := g_ntax_value_tbl(22); -- Bug 14754822
2080 		p_prev_ntax_T20_tbl(cnt) := g_ntax_value_tbl(23); -- Bug 14754822
2081 		p_prev_ntax_Y01_tbl(cnt) := g_ntax_value_tbl(24);
2082 		p_prev_ntax_Y02_tbl(cnt) := g_ntax_value_tbl(25);
2083 		p_prev_ntax_Y03_tbl(cnt) := g_ntax_value_tbl(26);
2084 		p_prev_ntax_Y20_tbl(cnt) := g_ntax_value_tbl(27); -- Bug 12807687
2085 		p_prev_ntax_Y21_tbl(cnt) := g_ntax_value_tbl(28); -- Bug 9737699
2086 		p_prev_ntax_ZZ_tbl(cnt)  := g_ntax_value_tbl(29);
2087 		p_prev_ntax_Z01_tbl(cnt) := g_ntax_value_tbl(30);
2088 		l_dummy		         := g_ntax_value_tbl(31); -- Bug 12807687
2089 		p_prev_ntax_tax_brk_tbl(cnt)  := nvl(p_prev_ntax_T01_tbl(cnt),0) + nvl(p_prev_ntax_Z01_tbl(cnt),0)
2090 				                              + nvl(p_prev_ntax_T10_tbl(cnt),0) + nvl(p_prev_ntax_T20_tbl(cnt),0);
2091 	end if;
2092 	----- Bug 12807687 End ----
2093 	--
2094 	cnt := cnt + 1;
2095 
2096 	end loop;
2097 
2098 
2099 end prev_er_info;
2100 ------------------------------------------------------------------------
2101 -- Bug 9737699
2102 ------------------------------------------------------------------------
2103 procedure sep_pen_details( p_assignment_id	in number,
2104 	p_effective_date	in date,
2105 	p_priority_tbl          out nocopy t_number_tbl,
2106 	p_fin_institute_tbl     out nocopy t_varchar2_tbl,
2107 	p_acc_number_tbl        out nocopy t_varchar2_tbl,
2108 	p_cont_amount_tbl       out nocopy t_number_tbl,
2109 	p_type_tbl		out nocopy t_number_tbl,
2110 	p_exem_amount_tbl	in out nocopy t_number_tbl)
2111 is
2112      cursor csr is
2113      select
2114 		aei_information6 priority,
2115 		aei_information2 type,
2116 		aei_information3 fin_institute,
2117 		aei_information4 acc_number,
2118 		to_number(aei_information5) cont_amount
2119 	from 	per_assignment_extra_info
2120 	where	assignment_id = p_assignment_id
2121 	and	information_type = 'KR_YEA_SEP_PEN_DETAILS'
2122 	and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY')
2123 	order by to_number(aei_information6);
2124 	cnt number;
2125 begin
2126 
2127     open csr;
2128     fetch csr bulk collect into
2129         p_priority_tbl,
2130 	p_type_tbl,
2131         p_fin_institute_tbl,
2132 	p_acc_number_tbl,
2133 	p_cont_amount_tbl;
2134     close csr;
2135 
2136 end sep_pen_details;
2137 
2138 procedure pen_saving_details( p_assignment_id	in number,
2139 	p_effective_date	in date,
2140 	p_priority_tbl          out nocopy t_number_tbl,
2141 	p_fin_institute_tbl     out nocopy t_varchar2_tbl,
2142 	p_acc_number_tbl        out nocopy t_varchar2_tbl,
2143 	p_cont_amount_tbl       out nocopy t_number_tbl,
2144 	p_type_tbl		out nocopy t_number_tbl,
2145 	p_exem_amount_tbl	in out nocopy t_number_tbl)
2146 is
2147      cursor csr is
2148      select
2149 		aei_information6 priority,
2150 		aei_information2 type,
2151 		aei_information3 fin_institute,
2152 		aei_information4 acc_number,
2153 		to_number(aei_information5) cont_amount
2154 	from 	per_assignment_extra_info
2155 	where	assignment_id = p_assignment_id
2156 	and	information_type = 'KR_YEA_PEN_SAVING_DETAILS'
2157 	and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY')
2158 	order by to_number(aei_information6);
2159 	cnt number;
2160 begin
2161     open csr;
2162     fetch csr bulk collect into
2163         p_priority_tbl,
2164 	p_type_tbl,
2165         p_fin_institute_tbl,
2166 	p_acc_number_tbl,
2167 	p_cont_amount_tbl;
2168     close csr;
2169 end pen_saving_details;
2170 
2171 procedure hou_saving_details( p_assignment_id	in number,
2172 	p_effective_date	in date,
2173 	p_priority_tbl          out nocopy t_number_tbl,
2174 	p_fin_institute_tbl     out nocopy t_varchar2_tbl,
2175 	p_acc_number_tbl        out nocopy t_varchar2_tbl,
2176 	p_cont_amount_tbl       out nocopy t_number_tbl,
2177 	p_type_tbl		out nocopy t_varchar2_tbl,
2178 	p_exem_amount_tbl	in out nocopy t_number_tbl)
2179 is
2180      cursor csr is
2181      select
2182 		aei_information6 priority,
2183 		aei_information2 type,
2184 		aei_information3 fin_institute,
2185 		aei_information4 acc_number,
2186 		to_number(aei_information5) cont_amount
2187 	from 	per_assignment_extra_info
2188 	where	assignment_id = p_assignment_id
2189 	and	information_type = 'KR_YEA_HOU_SAVING_DETAILS'
2190 	and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY')
2191 	order by to_number(aei_information6);
2192 	cnt number;
2193 begin
2194      open csr;
2195     fetch csr bulk collect into
2196         p_priority_tbl,
2197 	p_type_tbl,
2198         p_fin_institute_tbl,
2199 	p_acc_number_tbl,
2200 	p_cont_amount_tbl;
2201     close csr;
2202 end hou_saving_details;
2203 
2204 procedure lt_stock_saving_details( p_assignment_id	in number,
2205 	p_effective_date	in date,
2206 	p_priority_tbl          out nocopy t_number_tbl,
2207 	p_fin_institute_tbl     out nocopy t_varchar2_tbl,
2208 	p_acc_number_tbl        out nocopy t_varchar2_tbl,
2209 	p_cont_amount_tbl       out nocopy t_number_tbl,
2210 	p_type_tbl		out nocopy t_number_tbl,
2211 	p_exem_amount_tbl	in out nocopy t_number_tbl)
2212 is
2213      cursor csr is
2214      select
2215 		aei_information6 priority,
2216 		aei_information2 type,
2217 		aei_information3 fin_institute,
2218 		aei_information4 acc_number,
2219 		to_number(aei_information5) cont_amount
2220 	from 	per_assignment_extra_info
2221 	where	assignment_id = p_assignment_id
2222 	and	information_type = 'KR_YEA_LT_STOCK_SAVING_DETAILS'
2223 	and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY')
2224 	order by to_number(aei_information6);
2225 	cnt number;
2226 begin
2227       open csr;
2228       fetch csr bulk collect into
2229         p_priority_tbl,
2230 	p_type_tbl,
2231         p_fin_institute_tbl,
2232 	p_acc_number_tbl,
2233 	p_cont_amount_tbl;
2234     close csr;
2235 end lt_stock_saving_details;
2236 
2237 ------------------------------------------------------------------------
2238 -- Bug 8644512
2239 ------------------------------------------------------------------------
2240 procedure ntax_earnings(
2241 	p_assignment_id		in number,
2242 	p_effective_date	in date,
2243 	p_ntax_detail_tbl	out nocopy t_ntax_tab)
2244 is
2245 --
2246 	cursor csr_ntax_details is
2247 	select 	aei_information4 bus_reg_num,
2248 		aei_information2 code,
2249 		nvl(aei_information5,0) value
2250 	from 	per_assignment_extra_info
2251 	where	assignment_id = p_assignment_id
2252 	and	information_type = 'KR_YEA_NON_TAXABLE_EARN_DETAIL'
2253 	and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY')
2254 	order by 1;
2255 
2256 	j number;
2257 --
2258 begin
2259 --
2260 	j := 1;
2261 	for i in csr_ntax_details loop
2262 	      p_ntax_detail_tbl(j).business_reg_num := i.bus_reg_num;
2263 	      p_ntax_detail_tbl(j).ntax_earn_code   := i.code;
2264 	      p_ntax_detail_tbl(j).ntax_earning     := i.value;
2265 	      j := j + 1;
2266 	end loop;
2267 
2268 end ntax_earnings;
2269 --
2270 ------------------------------------------------------------------------
2271 -- Bug 9393732
2272 ------------------------------------------------------------------------
2273 procedure pledt_donation_details(
2274 	p_assignment_id			in number,
2275 	p_effective_date		in date,
2276 	p_don_priority_flag             in varchar2,
2277 	p_pledt_asg_info_id_tbl		out nocopy t_number_tbl,
2278       	p_pledt_amt_sub_to_exem_tbl	out nocopy t_number_tbl,
2279       	p_pledt_donated_year_tbl	out nocopy t_number_tbl)
2280 --
2281 ------------------------------------------------------------------------
2282 is
2283 	cursor csr_pledt_details_ordby_prev is
2284 	select
2285 	      assignment_extra_info_id	asg_info_id,
2286 	      nvl(to_number(aei_information10),0) 	amt_sub_to_exem,
2287 	      nvl(to_number(aei_information2),0)	donated_year
2288 	from	per_assignment_extra_info
2289 	where	assignment_id = p_assignment_id
2290 	and	information_type = 'KR_YEA_DONATION_TYPE_DETAIL'
2291 	and 	aei_information8 = '31'
2292 	and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY')
2293 	order by aei_information2;
2294 
2295 	cursor csr_pledt_details_ordby_latest is
2296 	select
2297 	      assignment_extra_info_id	asg_info_id,
2298 	      nvl(to_number(aei_information10),0) 	amt_sub_to_exem,
2299 	      nvl(to_number(aei_information2),0)	donated_year
2300 	from	per_assignment_extra_info
2301 	where	assignment_id = p_assignment_id
2302 	and	information_type = 'KR_YEA_DONATION_TYPE_DETAIL'
2303 	and 	aei_information8 = '31'
2304 	and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY')
2305 	order by aei_information2 desc;
2306 
2307 -- Bug 16094871
2308 	cursor csr_pledt_don_current is
2309 	select  assignment_extra_info_id	  asg_info_id,
2310 	      nvl(to_number(aei_information10),0) amt_sub_to_exem,
2311 	      to_number(aei_information2) 	  donated_year
2312 	from	per_assignment_extra_info
2313 	where	assignment_id = p_assignment_id
2314 	and	information_type = 'KR_YEA_DONATION_TYPE_DETAIL'
2315 	and 	aei_information8 = '31'
2316 	and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY')
2317  	and to_number(aei_information2) = to_number(to_char(p_effective_date, 'YYYY'))
2318 	order by   donated_year;
2319 
2320 	cursor csr_pledt_don_carry_over is
2321 	select  assignment_extra_info_id	  asg_info_id,
2322 	      nvl(to_number(aei_information10),0) amt_sub_to_exem,
2323 	      to_number(aei_information2) 	  donated_year
2324 	from	per_assignment_extra_info
2325 	where	assignment_id = p_assignment_id
2326 	and	information_type = 'KR_YEA_DONATION_TYPE_DETAIL'
2327 	and 	aei_information8 = '31'
2328 	and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY')
2329  	and to_number(aei_information2) <> to_number(to_char(p_effective_date, 'YYYY'))
2330 	order by  donated_year;
2331 
2332  cnt number := 1;
2333 --
2334 begin
2335 --
2336    if g_debug then
2337         hr_utility.trace('Ora Inside procedure pledt_donation_details');
2338    end if;
2339 -- Bug 16094871
2340 if p_effective_date >= c_20120101 then
2341 	 for irec in csr_pledt_don_current loop
2342 	   if irec.donated_year = to_number(to_char(p_effective_date, 'YYYY') ) then
2343 	    p_pledt_asg_info_id_tbl(cnt) := irec.asg_info_id;
2344 	    p_pledt_amt_sub_to_exem_tbl(cnt) := irec.amt_sub_to_exem;
2345 	    p_pledt_donated_year_tbl(cnt) := irec.donated_year;
2346 	   cnt := cnt+1;
2347 	  end if;
2348 	 end loop;
2349 	 for jrec in csr_pledt_don_carry_over loop
2350 	   p_pledt_asg_info_id_tbl(cnt) := jrec.asg_info_id;
2351 	   p_pledt_amt_sub_to_exem_tbl(cnt) := jrec.amt_sub_to_exem;
2352 	   p_pledt_donated_year_tbl(cnt) := jrec.donated_year;
2353 	 cnt := cnt+1;
2354 	 end loop;
2355 else
2356    if p_don_priority_flag = 'Y' then
2357 	open csr_pledt_details_ordby_prev;
2358 	fetch csr_pledt_details_ordby_prev bulk collect into
2359 		p_pledt_asg_info_id_tbl,
2360 		p_pledt_amt_sub_to_exem_tbl,
2361 		p_pledt_donated_year_tbl;
2362 	close csr_pledt_details_ordby_prev;
2363    else
2364       open csr_pledt_details_ordby_latest;
2365 	fetch csr_pledt_details_ordby_latest bulk collect into
2366 		p_pledt_asg_info_id_tbl,
2367 		p_pledt_amt_sub_to_exem_tbl,
2368 		p_pledt_donated_year_tbl;
2369 	close csr_pledt_details_ordby_latest;
2370    end if;
2371 end if;
2372    if g_debug then
2373         hr_utility.trace('Ora After procedure pledt_donation_details');
2374    end if;
2375 --
2376 end;
2377 ------------------------------------------------------------------------
2378 -- Bug 9393732
2379 ------------------------------------------------------------------------
2380 procedure tlaw_donation_details(
2381 	p_assignment_id			in number,
2382 	p_effective_date		in date,
2383 	p_don_priority_flag             in varchar2,
2384 	p_tlaw_asg_info_id_tbl		out nocopy t_number_tbl,
2385       	p_tlaw_amt_sub_to_exem_tbl	out nocopy t_number_tbl,
2386       	p_tlaw_donated_year_tbl		out nocopy t_number_tbl)
2387 --
2388 ------------------------------------------------------------------------
2389 is
2390 	cursor csr_tlaw_details_ordby_prev is
2391 	select
2392 	      assignment_extra_info_id	asg_info_id,
2393 	      nvl(to_number(aei_information10),0) 	amt_sub_to_exem,
2394 	      nvl(to_number(aei_information2),0)	donated_year
2395 	from	per_assignment_extra_info
2396 	where	assignment_id = p_assignment_id
2397 	and	information_type = 'KR_YEA_DONATION_TYPE_DETAIL'
2398 	and 	aei_information8 = '30'
2399 	and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY')
2400 	order by aei_information2;
2401 
2402 	cursor csr_tlaw_details_ordby_latest is
2403 	select
2404 	      assignment_extra_info_id	asg_info_id,
2405 	      nvl(to_number(aei_information10),0) 	amt_sub_to_exem,
2406 	      nvl(to_number(aei_information2),0)	donated_year
2407 	from	per_assignment_extra_info
2408 	where	assignment_id = p_assignment_id
2409 	and	information_type = 'KR_YEA_DONATION_TYPE_DETAIL'
2410 	and 	aei_information8 = '30'
2411 	and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY')
2412 	order by aei_information2 desc;
2413 
2414 -- Bug 16094871
2415 	cursor csr_tlaw_don_current is
2416 	select  assignment_extra_info_id	  asg_info_id,
2417 	      nvl(to_number(aei_information10),0) amt_sub_to_exem,
2418 	      to_number(aei_information2) 	  donated_year
2419 	from	per_assignment_extra_info
2420 	where	assignment_id = p_assignment_id
2421 	and	information_type = 'KR_YEA_DONATION_TYPE_DETAIL'
2422 	and 	aei_information8 = '30'
2423 	and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY')
2424  	and to_number(aei_information2) = to_number(to_char(p_effective_date, 'YYYY'))
2425 	order by   donated_year;
2426 
2427 	cursor csr_tlaw_don_carry_over is
2428 	select  assignment_extra_info_id	  asg_info_id,
2429 	      nvl(to_number(aei_information10),0) amt_sub_to_exem,
2430 	      to_number(aei_information2) 	  donated_year
2431 	from	per_assignment_extra_info
2432 	where	assignment_id = p_assignment_id
2433 	and	information_type = 'KR_YEA_DONATION_TYPE_DETAIL'
2434 	and 	aei_information8 = '30'
2435 	and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY')
2436  	and to_number(aei_information2) <> to_number(to_char(p_effective_date, 'YYYY'))
2437 	order by  donated_year;
2438 
2439  cnt number := 1;
2440 --
2441 begin
2442 --
2443    if g_debug then
2444         hr_utility.trace('Ora Inside procedure tlaw_donation_details');
2445    end if;
2446 -- Bug 16094871
2447 if p_effective_date >= c_20120101 then
2448 	 for irec in csr_tlaw_don_current loop
2449 	   if irec.donated_year = to_number(to_char(p_effective_date, 'YYYY') ) then
2450 	    p_tlaw_asg_info_id_tbl(cnt) := irec.asg_info_id;
2451 	    p_tlaw_amt_sub_to_exem_tbl(cnt) := irec.amt_sub_to_exem;
2452 	    p_tlaw_donated_year_tbl(cnt) := irec.donated_year;
2453 	   cnt := cnt+1;
2454 	  end if;
2455 	 end loop;
2456 	 for jrec in csr_tlaw_don_carry_over loop
2457 	   p_tlaw_asg_info_id_tbl(cnt) := jrec.asg_info_id;
2458 	   p_tlaw_amt_sub_to_exem_tbl(cnt) := jrec.amt_sub_to_exem;
2459 	   p_tlaw_donated_year_tbl(cnt) := jrec.donated_year;
2460 	 cnt := cnt+1;
2461 	 end loop;
2462 else
2463    if p_don_priority_flag = 'Y' then
2464 	open csr_tlaw_details_ordby_prev;
2465 	fetch csr_tlaw_details_ordby_prev bulk collect into
2466 		p_tlaw_asg_info_id_tbl,
2467 		p_tlaw_amt_sub_to_exem_tbl,
2468 		p_tlaw_donated_year_tbl;
2469 	close csr_tlaw_details_ordby_prev;
2470    else
2471       open csr_tlaw_details_ordby_latest;
2472 	fetch csr_tlaw_details_ordby_latest bulk collect into
2473 		p_tlaw_asg_info_id_tbl,
2474 		p_tlaw_amt_sub_to_exem_tbl,
2475 		p_tlaw_donated_year_tbl;
2476 	close csr_tlaw_details_ordby_latest;
2477    end if;
2478 end if;
2479    if g_debug then
2480         hr_utility.trace('Ora After procedure tlaw_donation_details');
2481    end if;
2482 --
2483 end;
2484 ------------------------------------------------------------------------
2485 -- Bug 9393732
2486 ------------------------------------------------------------------------
2487 procedure stat_donation_details(
2488 	p_assignment_id			in number,
2489 	p_effective_date		in date,
2490 	p_don_priority_flag             in varchar2,
2491 	p_stat_asg_info_id_tbl		out nocopy t_number_tbl,
2492       	p_stat_amt_sub_to_exem_tbl	out nocopy t_number_tbl,
2493       	p_stat_donated_year_tbl 	out nocopy t_number_tbl)
2494 --
2495 ------------------------------------------------------------------------
2496 is
2497 	cursor csr_stat_details_ordby_prev is
2498 	select
2499 	      assignment_extra_info_id	asg_info_id,
2500 	      nvl(to_number(aei_information10),0) 	amt_sub_to_exem,
2501 	      nvl(to_number(aei_information2),0)	donated_year
2502 	from	per_assignment_extra_info
2503 	where	assignment_id = p_assignment_id
2504 	and	information_type = 'KR_YEA_DONATION_TYPE_DETAIL'
2505 	and 	aei_information8 = '10'
2506 	and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY')
2507 	order by aei_information2;
2508 
2509 	cursor csr_stat_details_ordby_latest is
2510 	select
2511 	      assignment_extra_info_id	asg_info_id,
2512 	      nvl(to_number(aei_information10),0) 	amt_sub_to_exem,
2513 	      nvl(to_number(aei_information2),0)	donated_year
2514 	from	per_assignment_extra_info
2515 	where	assignment_id = p_assignment_id
2516 	and	information_type = 'KR_YEA_DONATION_TYPE_DETAIL'
2517 	and 	aei_information8 = '10'
2518 	and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY')
2519 	order by aei_information2 desc;
2520 -- Bug 16094871
2521 	cursor csr_stat_don_current is
2522 	select  assignment_extra_info_id	  asg_info_id,
2523 	      nvl(to_number(aei_information10),0) amt_sub_to_exem,
2524 	      to_number(aei_information2) 	  donated_year
2525 	from	per_assignment_extra_info
2526 	where	assignment_id = p_assignment_id
2527 	and	information_type = 'KR_YEA_DONATION_TYPE_DETAIL'
2528 	and 	aei_information8 = '10'
2529 	and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY')
2530  	and to_number(aei_information2) = to_number(to_char(p_effective_date, 'YYYY'))
2531 	order by   donated_year;
2532 
2533 	cursor csr_stat_don_carry_over is
2534 	select  assignment_extra_info_id	  asg_info_id,
2535 	      nvl(to_number(aei_information10),0) amt_sub_to_exem,
2536 	      to_number(aei_information2) 	  donated_year
2537 	from	per_assignment_extra_info
2538 	where	assignment_id = p_assignment_id
2539 	and	information_type = 'KR_YEA_DONATION_TYPE_DETAIL'
2540 	and 	aei_information8 = '10'
2541 	and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY')
2542  	and to_number(aei_information2) <> to_number(to_char(p_effective_date, 'YYYY'))
2543 	order by  donated_year;
2544 
2545  cnt number := 1;
2546 --
2547 begin
2548 --
2549    if g_debug then
2550         hr_utility.trace('Ora Inside procedure stat_donation_details');
2551    end if;
2552 -- Bug 16094871
2553 if p_effective_date >= c_20120101 then
2554 	 for irec in csr_stat_don_current loop
2555 	   if irec.donated_year = to_number(to_char(p_effective_date, 'YYYY') ) then
2556 	    p_stat_asg_info_id_tbl(cnt) := irec.asg_info_id;
2557 	    p_stat_amt_sub_to_exem_tbl(cnt) := irec.amt_sub_to_exem;
2558 	    p_stat_donated_year_tbl(cnt) := irec.donated_year;
2559 	   cnt := cnt+1;
2560 	  end if;
2561 	 end loop;
2562 	 for jrec in csr_stat_don_carry_over loop
2563 	   p_stat_asg_info_id_tbl(cnt) := jrec.asg_info_id;
2564 	   p_stat_amt_sub_to_exem_tbl(cnt) := jrec.amt_sub_to_exem;
2565 	   p_stat_donated_year_tbl(cnt) := jrec.donated_year;
2566 	 cnt := cnt+1;
2567 	 end loop;
2568 else
2569    if p_don_priority_flag = 'Y' then
2570 	open csr_stat_details_ordby_prev;
2571 	fetch csr_stat_details_ordby_prev bulk collect into
2572 		p_stat_asg_info_id_tbl,
2573 		p_stat_amt_sub_to_exem_tbl,
2574 		p_stat_donated_year_tbl;
2575 	close csr_stat_details_ordby_prev;
2576    else
2577         open csr_stat_details_ordby_latest;
2578 	fetch csr_stat_details_ordby_latest bulk collect into
2579 		p_stat_asg_info_id_tbl,
2580 		p_stat_amt_sub_to_exem_tbl,
2581 		p_stat_donated_year_tbl;
2582 	close csr_stat_details_ordby_latest;
2583    end if;
2584 end if;
2585    if g_debug then
2586         hr_utility.trace('Ora After procedure stat_donation_details');
2587    end if;
2588 --
2589 end;
2590 ------------------------------------------------------------------------
2591 -- Bug 9393732
2592 ------------------------------------------------------------------------
2593 procedure specified_donation_details(
2594 	p_assignment_id			in number,
2595 	p_effective_date		in date,
2596 	p_spec_asg_info_id_tbl		out nocopy t_number_tbl,
2597 	p_spec_donated_year_tbl		out nocopy t_number_tbl,
2598       	p_spec_amt_sub_to_exem_tbl	out nocopy t_number_tbl)
2599 --
2600 ------------------------------------------------------------------------
2601 is
2602 	cursor csr_spec_details is
2603 	select
2604 	      assignment_extra_info_id	asg_info_id,
2605 	      to_number(aei_information2) 		donated_year,
2606 	      nvl(to_number(aei_information10),0) 	amt_sub_to_exem
2607 	from	per_assignment_extra_info
2608 	where	assignment_id = p_assignment_id
2609 	and	information_type = 'KR_YEA_DONATION_TYPE_DETAIL'
2610 	and 	aei_information8 = '40'
2611 	and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY')
2612 	order by aei_information2;
2613 --
2614 begin
2615 --
2616    if g_debug then
2617         hr_utility.trace('Ora Inside procedure specified_donation_details');
2618    end if;
2619 	open csr_spec_details;
2620 	fetch csr_spec_details bulk collect into
2621 		p_spec_asg_info_id_tbl,
2622 		p_spec_donated_year_tbl,
2623 		p_spec_amt_sub_to_exem_tbl;
2624 	close csr_spec_details;
2625    if g_debug then
2626         hr_utility.trace('Ora After procedure specified_donation_details');
2627    end if;
2628 --
2629 end;
2630 ------------------------------------------------------------------------
2631 -- Bug 9393732
2632 ------------------------------------------------------------------------
2633 procedure religious_donation_details(
2634 	p_assignment_id			in number,
2635 	p_effective_date		in date,
2636 	p_rel_asg_info_id_tbl		out nocopy t_number_tbl,
2637 	p_rel_donated_year_tbl		out nocopy t_number_tbl,
2638       	p_rel_amt_sub_to_exem_tbl	out nocopy t_number_tbl)
2639 --
2640 ------------------------------------------------------------------------
2641 is
2642 	cursor csr_rel_details is
2643 	select
2644 	      assignment_extra_info_id	asg_info_id,
2645 	      to_number(aei_information2) 		donated_year,
2646 	      nvl(to_number(aei_information10),0) 	amt_sub_to_exem
2647 	from	per_assignment_extra_info
2648 	where	assignment_id = p_assignment_id
2649 	and	information_type = 'KR_YEA_DONATION_TYPE_DETAIL'
2650 	and 	aei_information8 = '41'
2651 	and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY')
2652 	order by aei_information2;
2653 --
2654 begin
2655 --
2656    if g_debug then
2657         hr_utility.trace('Ora Inside procedure religious_donation_details');
2658    end if;
2659 	open csr_rel_details;
2660 	fetch csr_rel_details bulk collect into
2661 		p_rel_asg_info_id_tbl,
2662 		p_rel_donated_year_tbl,
2663 		p_rel_amt_sub_to_exem_tbl;
2664 	close csr_rel_details;
2665    if g_debug then
2666         hr_utility.trace('Ora After procedure religious_donation_details');
2667    end if;
2668 --
2669 end;
2670 
2671 function chk_valid_donation(p_donation_year   in varchar2,
2672 	    			    p_donation_code  in varchar2,
2673 	    			    p_effective_date in date) return varchar2
2674 	is
2675 	--
2676 
2677 	begin
2678 	--
2679 	       if p_donation_code = '31' then
2680 	           if (p_donation_year + 3) >= to_number(to_char(p_effective_date, 'YYYY')) then
2681 	               return 'Y';
2682 	           else
2683 	               return 'N';
2684 	           end if;
2685 	        elsif p_donation_code = '10' then
2686 	           if (p_donation_year + 3) >= to_number(to_char(p_effective_date, 'YYYY')) then
2687 	               return 'Y';
2688 	           else
2689 	               return 'N';
2690 	           end if;
2691 	        elsif p_donation_code = '30' then
2692 		   if (p_donation_year + 2) >= to_number(to_char(p_effective_date, 'YYYY')) then
2693 	               return 'Y';
2694 	           else
2695 	               return 'N';
2696 	           end if;
2697 	        elsif p_donation_code = '40' then
2698 		   if (p_donation_year + 5) >= to_number(to_char(p_effective_date, 'YYYY')) then
2699 	               return 'Y';
2700 	           else
2701 	               return 'N';
2702 	           end if;
2703 	        elsif p_donation_code = '41' then
2704 		   if (p_donation_year + 5) >= to_number(to_char(p_effective_date, 'YYYY')) then
2705 	               return 'Y';
2706 	           else
2707 	               return 'N';
2708 	           end if;
2709 	        end if;
2710     	end;
2711 
2712 
2713 ------------------------------------------------------------------------
2714 -- Bug 9393732
2715 ------------------------------------------------------------------------
2716 procedure spec_don_details_grpby_year(
2717 	p_assignment_id			in number,
2718 	p_effective_date		in date,
2719 	p_business_group_id             in number,
2720 	p_new_donation_calc_flag        out nocopy varchar2 ,
2721         p_don_priority_flag             out nocopy varchar2 ,
2722 	p_spec_rel_amt_grpby_year_tbl   out nocopy t_number_tbl,
2723 	p_spec_rel_grpby_don_year_tbl	out nocopy t_number_tbl,
2724 	p_rel_amt_exem_grpby_year_tbl   out nocopy t_number_tbl,
2725 	p_rel_grpby_don_year_tbl        out nocopy t_number_tbl)
2726 --
2727 ------------------------------------------------------------------------
2728 is
2729 
2730 
2731 cursor csr_rel_spec_details is
2732 	select
2733               sum(decode(chk_valid_donation(to_number(aei_information10),aei_information8,p_effective_date),'Y',nvl(to_number(aei_information10),0),0)),
2734 	      to_number(aei_information2)
2735 
2736 	from	per_assignment_extra_info
2737 	where	assignment_id = p_assignment_id
2738 	and	information_type = 'KR_YEA_DONATION_TYPE_DETAIL'
2739 	and 	aei_information8 in ('40','41')
2740 	and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY')
2741 	group by to_number(aei_information2)
2742 	order by to_number(aei_information2);
2743 --
2744 cursor csr_rel_details is
2745 	select
2746               sum(decode(chk_valid_donation(to_number(aei_information10),aei_information8,p_effective_date),'Y',nvl(to_number(aei_information10),0),0)),
2747 	      to_number(aei_information2)
2748 
2749 	from	per_assignment_extra_info
2750 	where	assignment_id = p_assignment_id
2751 	and	information_type = 'KR_YEA_DONATION_TYPE_DETAIL'
2752 	and 	aei_information8 = ('41')
2753 	and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY')
2754 	group by to_number(aei_information2)
2755 	order by to_number(aei_information2);
2756 
2757 
2758 cursor csr_get_don_calc_flag(p_business_group_id in number) is
2759 		select
2760         		nvl(hoi.org_information1,'Y'),
2761 			nvl(hoi.org_information2,'Y')
2762 		from 	hr_all_organization_units hou,
2763         		hr_organization_information hoi
2764 		where 	hoi.organization_id = hou.organization_id
2765 		and 	hou.business_group_id = p_business_group_id
2766 		and 	hoi.org_information_context = 'KR_YEA_DON_CARRY_OVER_CALC';
2767 
2768 
2769 
2770 begin
2771 --
2772    if g_debug then
2773         hr_utility.trace('Ora Inside procedure spec_don_details_grpby_year');
2774    end if;
2775 	open csr_rel_spec_details;
2776 	fetch csr_rel_spec_details bulk collect into
2777 		p_spec_rel_amt_grpby_year_tbl,
2778 		p_spec_rel_grpby_don_year_tbl;
2779 	close csr_rel_spec_details;
2780 
2781         open csr_rel_details;
2782 	fetch csr_rel_details bulk collect into
2783 	      p_rel_amt_exem_grpby_year_tbl,
2784 	      p_rel_grpby_don_year_tbl;
2785 	close csr_rel_details;
2786 
2787   open csr_get_don_calc_flag(p_business_group_id);
2788 	fetch csr_get_don_calc_flag into
2789 	      p_new_donation_calc_flag,
2790 	      p_don_priority_flag;
2791 	  if csr_get_don_calc_flag%notfound then
2792 	   p_new_donation_calc_flag := 'Y';
2793 	   p_don_priority_flag      := 'Y';
2794 	  end if;
2795 	close csr_get_don_calc_flag;
2796 
2797 if p_effective_date >= c_20120101 then
2798 	p_new_donation_calc_flag := 'N';
2799 	p_don_priority_flag      := 'N';
2800 end if;
2801 
2802    if g_debug then
2803         hr_utility.trace('Ora After procedure spec_don_details_grpby_year');
2804    end if;
2805 --
2806 end;
2807 
2808 
2809 ------------------------------------------------------------------------
2810 -- Bug 9393732
2811 ------------------------------------------------------------------------
2812 procedure spec_rel_donation_details(
2813 	p_assignment_id			in number,
2814 	p_effective_date		in date,
2815         p_don_priority_flag             in varchar2,
2816 	p_spec_rel_asg_info_id_tbl	out nocopy t_number_tbl,
2817 	p_spec_rel_donated_year_tbl	out nocopy t_number_tbl,
2818       	p_spec_rel_amt_sub_to_exem_tbl	out nocopy t_number_tbl,
2819 	p_spec_rel_don_code_tbl             out nocopy t_varchar2_tbl)
2820 --
2821 ------------------------------------------------------------------------
2822 is
2823 	cursor csr_spec_rel_ordby_prev_don is
2824 	select
2825 	      assignment_extra_info_id	asg_info_id,
2826 	      to_number(aei_information2) 		donated_year,
2827 	      nvl(to_number(aei_information10),0) 	amt_sub_to_exem,
2828               aei_information8                          donation_code
2829 	from	per_assignment_extra_info
2830 	where	assignment_id = p_assignment_id
2831 	and	information_type = 'KR_YEA_DONATION_TYPE_DETAIL'
2832 	and 	aei_information8 in ('41','40')
2833 	and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY')
2834 	order by  to_number(aei_information8), aei_information2;
2835 
2836 	cursor csr_spec_rel_ordby_new_don is
2837 	select
2838 	      assignment_extra_info_id	asg_info_id,
2839 	      to_number(aei_information2) 		donated_year,
2840 	      nvl(to_number(aei_information10),0) 	amt_sub_to_exem,
2841               aei_information8                          donation_code
2842 	from	per_assignment_extra_info
2843 	where	assignment_id = p_assignment_id
2844 	and	information_type = 'KR_YEA_DONATION_TYPE_DETAIL'
2845 	and 	aei_information8 in ('41','40')
2846 	and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY')
2847 	order by to_number(aei_information8) , aei_information2 desc;
2848 --
2849 -- to select current and carryover years..
2850 	cursor csr_spec_rel_year is
2851 	select donated_year  from (
2852 	select  distinct aei_information2  donated_year
2853 	from	per_assignment_extra_info
2854 	where	assignment_id = p_assignment_id
2855 	and	information_type = 'KR_YEA_DONATION_TYPE_DETAIL'
2856 	and 	aei_information8 in ('41','40')
2857 	and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY')
2858 	order by  aei_information2 desc) where rownum <=2;
2859 
2860 	cursor csr_spec_rel_don_current is
2861 	select  assignment_extra_info_id	asg_info_id,
2862               aei_information8     donation_code,
2863 	      to_number(aei_information2) 		donated_year,
2864 	      nvl(to_number(aei_information10),0) 	amt_sub_to_exem
2865 	from	per_assignment_extra_info
2866 	where	assignment_id = p_assignment_id
2867 	and	information_type = 'KR_YEA_DONATION_TYPE_DETAIL'
2868 	and 	aei_information8 in ('41','40')
2869 	and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY')
2870  	and to_number(aei_information2) = to_number(to_char(p_effective_date, 'YYYY'))
2871 	order by   donation_code;
2872 
2873 	cursor csr_spec_rel_don_carry_over is
2874 	select  assignment_extra_info_id	asg_info_id,
2875               aei_information8     donation_code,
2876 	      to_number(aei_information2) 		donated_year,
2877 	      nvl(to_number(aei_information10),0) 	amt_sub_to_exem
2878 	from	per_assignment_extra_info
2879 	where	assignment_id = p_assignment_id
2880 	and	information_type = 'KR_YEA_DONATION_TYPE_DETAIL'
2881 	and 	aei_information8 in ('41','40')
2882 	and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY')
2883  	and to_number(aei_information2) <> to_number(to_char(p_effective_date, 'YYYY'))
2884 	order by  donation_code, donated_year;
2885 
2886  l_flag varchar(1) := 'N';
2887  cnt number := 1;
2888  l_year number := 2012;
2889 begin
2890 --
2891    if g_debug then
2892         hr_utility.trace('Ora Inside procedure spec_rel_donation_details');
2893 	hr_utility.trace('p_don_priority_flag'||p_don_priority_flag);
2894    end if;
2895 if p_effective_date < c_20120101 then
2896   if p_don_priority_flag = 'Y' then
2897 	open csr_spec_rel_ordby_prev_don;
2898 	fetch csr_spec_rel_ordby_prev_don bulk collect into
2899 		p_spec_rel_asg_info_id_tbl,
2900 		p_spec_rel_donated_year_tbl,
2901 		p_spec_rel_amt_sub_to_exem_tbl,
2902 		p_spec_rel_don_code_tbl;
2903 	close csr_spec_rel_ordby_prev_don;
2904   else
2905      open csr_spec_rel_ordby_new_don;
2906 	fetch csr_spec_rel_ordby_new_don bulk collect into
2907 		p_spec_rel_asg_info_id_tbl,
2908 		p_spec_rel_donated_year_tbl,
2909 		p_spec_rel_amt_sub_to_exem_tbl,
2910 		p_spec_rel_don_code_tbl;
2911 	close csr_spec_rel_ordby_new_don;
2912   end if;
2913 end if;
2914 --
2915 if p_effective_date >= c_20120101 then
2916   l_flag := 'N';
2917   for i in csr_spec_rel_year loop
2918     if i.donated_year = to_number(to_char(p_effective_date, 'YYYY') ) then
2919       for irec in csr_spec_rel_don_current loop
2920 	   p_spec_rel_asg_info_id_tbl(cnt) := irec.asg_info_id;
2921 	   p_spec_rel_donated_year_tbl(cnt) := irec.donated_year;
2922 	   p_spec_rel_amt_sub_to_exem_tbl(cnt) := irec.amt_sub_to_exem;
2923 	   p_spec_rel_don_code_tbl(cnt) := irec.donation_code;
2924 	  cnt := cnt+1;
2925       end loop;
2926     elsif l_flag = 'N' then
2927       for jrec in csr_spec_rel_don_carry_over loop
2928            p_spec_rel_asg_info_id_tbl(cnt) := jrec.asg_info_id;
2929 	   p_spec_rel_donated_year_tbl(cnt) := jrec.donated_year;
2930 	   p_spec_rel_amt_sub_to_exem_tbl(cnt) := jrec.amt_sub_to_exem;
2931 	   p_spec_rel_don_code_tbl(cnt) := jrec.donation_code;
2932 	 cnt := cnt+1;
2933  	 l_flag := 'Y';
2934       end loop;
2935     end if;
2936   end loop;
2937 end if;
2938 
2939    if g_debug then
2940         hr_utility.trace('Ora After procedure spec_rel_donation_details');
2941    end if;
2942 end;
2943 
2944 ------------------------------------------------------------------------
2945 procedure sp_tax_exem_info(
2946 	p_assignment_id			in number,
2947 	p_effective_date		in date,
2948 	p_hi_prem			in out nocopy number,
2949 	p_ltci_prem			in out nocopy number, -- Bug 7260606
2950 	p_ei_prem			in out nocopy number,
2951 	p_pers_ins_name			in out nocopy varchar2,
2952 	p_pers_ins_prem			in out nocopy number,
2953 	p_disabled_ins_prem		in out nocopy number,
2954 	p_med_exp			in out nocopy number,
2955         p_med_exp_card_emp              in out nocopy number, -- Bug 4704848
2956 	p_med_exp_disabled		in out nocopy number,
2957 	p_med_exp_aged			in out nocopy number,
2958 	p_ee_educ_exp			in out nocopy number,
2959 	p_ee_occupation_educ_exp2005 	in out nocopy number, -- Bug 3971542
2960 	p_housing_purchase_date		in out nocopy date,
2961 	p_housing_loan_date		in out nocopy date,
2962 	p_housing_loan_repay		in out nocopy number,
2963 	-- Bug 9393732
2964 	p_housing_prv_date_moved	in out nocopy date,
2965 	p_housing_prv_loan_date		in out nocopy date,
2966 	p_housing_prv_loan_repay	in out nocopy number,
2967 	p_house_holder_exception_flag	in out nocopy varchar2, -- Bug 13247926
2968 	--
2969 	p_lt_housing_loan_date		in out nocopy date,
2970 	p_lt_housing_loan_intr_repay	in out nocopy number,
2971 	p_lt_housing_loan_date_1	in out nocopy date,
2972 	p_lt_housing_loan_intr_repay_1	in out nocopy number,
2973         p_lt_housing_loan_date_2	in out nocopy date,      -- Bug 8237227
2974         p_lt_housing_loan_intr_repay_2	in out nocopy number,    -- Bug 8237227
2975 	p_lt_2012_fixed_intr_wo_grace  in out nocopy number,   --Bug 14754836
2976   p_lt_2012_housing_other_intr   in out nocopy number,   --Bug 14754836
2977 	p_housing_rent_exp		in out nocopy number,    -- Bug 9737699
2978 	p_donation1			in out nocopy number,
2979 	p_political_donation1		in out nocopy number,
2980 	p_political_donation2		in out nocopy number,
2981 	p_political_donation3		in out nocopy number,
2982 	p_donation2			in out nocopy number,
2983 	p_donation3			in out nocopy number,
2984 	p_donation4			in out nocopy number,  -- Bug 7142612: Public Legal Entity Donation Trust
2985 	p_religious_donation		in out nocopy number,  -- Bug 7142612: Religious Donation
2986 	-- Bug 3966549
2987 	p_esoa_don2004			in out nocopy number,
2988 	-- End of 3966549
2989         p_marriage_exemption            in out nocopy varchar2,
2990         p_funeral_exemption             in out nocopy varchar2,
2991         p_relocation_exemption          in out nocopy varchar2,
2992 	-- Bug 3172960
2993 	p_med_exp_emp			in out nocopy number,
2994 	p_create_don_rec_flag		in out nocopy varchar2)
2995 ------------------------------------------------------------------------
2996 is
2997 	l_promotional_fund_donation	NUMBER	:= 0 ;
2998 	l_religious_donation		NUMBER	:= 0 ;
2999 	-- Bug 5255234
3000 	l_dpnt_pers_ins_nts		NUMBER	:= 0 ;
3001 	l_dpnt_pers_ins_oth		NUMBER	:= 0 ;
3002 	-- Bug 5667762
3003 	l_dpnt_dis_ins_nts		NUMBER	:= 0 ;
3004 	l_dpnt_dis_ins_oth		NUMBER	:= 0 ;
3005         l_chk_box_med_tot_det           VARCHAR2(1);  -- Bug 6737106
3006         l_med_det_emp_tot               NUMBER  := 0; -- Bug 6737106
3007         l_med_det_dis_tot               NUMBER  := 0; -- Bug 6737106
3008         l_med_det_aged_tot              NUMBER  := 0; -- Bug 6737106
3009         l_med_det_dep_tot               NUMBER  := 0; -- Bug 6737106
3010 
3011 	cursor csr_aei is
3012 		select	nvl(to_number(aei_information2), 0),
3013 			nvl(to_number(aei_information3), 0),
3014 			aei_information4,
3015 			nvl(to_number(aei_information5), 0),
3016 			nvl(to_number(aei_information6), 0),
3017 			nvl(to_number(aei_information7), 0),
3018 			nvl(to_number(aei_information8), 0),
3019 			nvl(to_number(aei_information9), 0),
3020 			nvl(to_number(aei_information10), 0),
3021 			fnd_date.canonical_to_date(aei_information13),
3022 			fnd_date.canonical_to_date(aei_information14),
3023 			nvl(to_number(aei_information15), 0),
3024 			fnd_date.canonical_to_date(aei_information16),
3025 			nvl(to_number(aei_information17), 0),
3026 			fnd_date.canonical_to_date(aei_information25),
3027 			nvl(to_number(aei_information26), 0),
3028 			nvl(to_number(aei_information18), 0),	-- Statutory (100%)
3029 			nvl(to_number(aei_information19), 0),	-- Political (100,000 Limit)
3030 			nvl(to_number(aei_information20), 0),   -- Political (100%)
3031 			nvl(to_number(aei_information21), 0),   -- Political (Obsolete)
3032 			nvl(to_number(aei_information22), 0),
3033 			nvl(to_number(aei_information23), 0),
3034 			-- Bug 3966549
3035 			nvl(to_number(aei_information30), 0), -- ESOA Donation
3036 			-- End of 3966549
3037 			aei_information27,
3038 			aei_information28,
3039 			aei_information29,
3040 			-- Bug 3172960
3041 			nvl(to_number(aei_information24), 0)
3042 		from	per_assignment_extra_info
3043 		where	assignment_id = p_assignment_id
3044 		and	information_type = 'KR_YEA_SP_TAX_EXEM_INFO'
3045 		and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY');
3046 
3047 	cursor csr_aei2 is
3048 		select	nvl(to_number(aei_information2), 0) -- Bug 3971542 Employee's occupational training (educational) expense
3049                        ,nvl(to_number(aei_information3), 0) -- Bug 4704848
3050 	               ,nvl(to_number(aei_information4), 0)
3051 	               ,nvl(to_number(aei_information5), 0)
3052 		       ,nvl(aei_information10,'N')           -- Bug 6737106 Check Box Medical Total and Details
3053 		       ,nvl(to_number(aei_information11), 0) -- Bug 7260606
3054 		       ,nvl(to_number(aei_information7), 0)  -- Bug 7142612: Public Legal Entity Donation Trust
3055                        ,fnd_date.canonical_to_date(aei_information12)  -- Bug 8237227
3056                        ,nvl(to_number(aei_information13), 0)  -- Bug 8237227
3057 		from	per_assignment_extra_info
3058 		where	assignment_id = p_assignment_id
3059 		and	information_type = 'KR_YEA_SP_TAX_EXEM_INFO2'
3060 		and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY');
3061 
3062 	cursor csr_sp3 is
3063 		select
3064 			fnd_date.canonical_to_date(aei_information2),
3065 			fnd_date.canonical_to_date(aei_information3),
3066 			nvl(to_number(aei_information4), 0),
3067 			aei_information5,  -- Bug 13247926
3068 			nvl(to_number(aei_information6),0), -- Bug 14754836
3069 			nvl(to_number(aei_information7),0)  -- Bug 14754836
3070 		from	per_assignment_extra_info
3071 		where	assignment_id = p_assignment_id
3072 		and	information_type = 'KR_YEA_SP_TAX_EXEM_INFO3'
3073 		and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY');
3074 	--
3075 	-- Bug 5255234 Cursor to get the dependent Insurnace Expenses.
3076 	--
3077         -- Bug 5879106
3078 	cursor csr_get_dpnt_insurance_prem is
3079 	 select sum(cei_information1),
3080 		sum(cei_information2),
3081 		sum(cei_information10),
3082 		sum(cei_information11)
3083 	   from pay_kr_cont_details_v pkc,
3084 		per_contact_extra_info_f cei
3085 	  where assignment_id = p_assignment_id
3086 	    -- Bug 5879106
3087 	    and cei.information_type(+) = 'KR_DPNT_EXPENSE_INFO'
3088 	    and cei.contact_relationship_id(+) = pkc.contact_relationship_id
3089 	    and to_char(cei.effective_start_date(+), 'YYYY') = to_char(p_effective_date, 'YYYY')
3090 	    --
3091 	    and  p_effective_date between emp_start_date and emp_end_date
3092 	    and  p_effective_date between cont_start_date and cont_end_date
3093 	    and  p_effective_date between nvl(ADDRESS_START_DATE,p_effective_date) and nvl(ADDRESS_END_DATE, p_effective_date)
3094 	    and  p_effective_date between nvl(pkc.date_start, p_effective_date)
3095 				     and decode(pkc.cont_information9, 'D', trunc(add_months(nvl(pkc.date_end, p_effective_date),12),'YYYY')-1, nvl(pkc.date_end, p_effective_date) )
3096 	    and  pay_kr_ff_functions_pkg.is_exempted_dependent( pkc.contact_type,
3097 								pkc.cont_information11,  -- Bug 7661820
3098 								pkc.national_identifier,
3099 								pkc.cont_information2,
3100 								pkc.cont_information3,
3101 								pkc.cont_information4,
3102 								pkc.cont_information7,
3103 								pkc.cont_information8,
3104 								p_effective_date,
3105 								pkc.cont_information10,
3106 								pkc.cont_information12,
3107 								pkc.cont_information13,
3108 								pkc.cont_information14,
3109 								cei.contact_extra_info_id
3110 							       ) = 'Y';
3111 
3112 /* Bug 6737106 Added cursor csr_aei3 to get Detailed Information from 'KR_YEA_DETAIL_MEDICAL_EXP_INFO' */
3113       	cursor csr_aei3 is
3114         select nvl(sum(decode(aei_information7,0,(nvl(aei_information3,0) + nvl(aei_information11,0)))),0) --  Employee Total
3115               ,nvl(sum(decode(aei_information7,0,0,decode(aei_information9,'A',(nvl(aei_information3,0) + nvl(aei_information11,0))))),0) -- Disabled Total
3116               --
3117               -- Bug 9079450: The medical expense exemption for aged dependents
3118               --              will be given if age is 65 or older.
3119               ,nvl(sum(decode(aei_information7,0,0,decode(aei_information9,'B',
3120                                  decode(sign(to_char(p_effective_date, 'YYYY')-2008),1,
3121                                     decode(pay_kr_ff_functions_pkg.aged_flag(aei_information8, fnd_date.canonical_to_date(to_char(p_effective_date, 'YYYY')||'/12/31')),'Y', (nvl(aei_information3,0) + nvl(aei_information11,0)),0
3122                                           ),(nvl(aei_information3,0) + nvl(aei_information11,0))
3123                                         )
3124                                                          )
3125                              )
3126                        ),0
3127                    ) -- Aged Total
3128 	      ,nvl(sum(decode(aei_information9,'A',0,'B',0,
3129                              decode(aei_information7,0,0,(nvl(aei_information3,0) + nvl(aei_information11,0))))),0) -- Dependent Total
3130 	from per_assignment_extra_info
3131 	where assignment_id = p_assignment_id
3132 	and information_type = 'KR_YEA_DETAIL_MEDICAL_EXP_INFO'
3133 	and trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY');
3134 
3135 	-- Bug 9393732
3136 	cursor csr_get_termination_info is
3137 	Select decode(sign(to_number(to_char(nvl(pds.actual_termination_date,fnd_date.canonical_to_date('4712/12/31')),'YYYY')) -
3138 	       to_number(to_char(p_effective_date,'YYYY')) ),1,'Y',0,'N','N') create_donation_record
3139 	from	per_periods_of_service	pds,
3140 		per_assignments_f	asg
3141 	where	asg.assignment_id = p_assignment_id
3142 	and	p_effective_date between asg.effective_start_date and asg.effective_end_date
3143 	and	pds.period_of_service_id = asg.period_of_service_id;
3144 	--
3145 -- Bug 9393732
3146 	cursor csr_hou_rent is
3147 		select	sum(nvl(to_number(aei_information6), 0))
3148 		from	per_assignment_extra_info
3149 		where	assignment_id = p_assignment_id
3150 		and	information_type = 'KR_YEA_HOU_RENT_DETAILS'
3151 		and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY');
3152 
3153 begin
3154 	--
3155 	if g_debug then
3156 	      hr_utility.trace('*** Inside SP_TAX_EXEM_INFO() ***');
3157 	end if;
3158 	--
3159 	open csr_aei;
3160 	fetch csr_aei into
3161 		p_hi_prem,
3162 		p_ei_prem,
3163 		p_pers_ins_name,
3164 		p_pers_ins_prem,
3165 		p_disabled_ins_prem,
3166 		p_med_exp,
3167 		p_med_exp_disabled,
3168 		p_med_exp_aged,
3169 		p_ee_educ_exp,
3170 		p_housing_purchase_date,
3171 		p_housing_loan_date,
3172 		p_housing_loan_repay,
3173 		p_lt_housing_loan_date,
3174 		p_lt_housing_loan_intr_repay,
3175 		p_lt_housing_loan_date_1,
3176 		p_lt_housing_loan_intr_repay_1,
3177 		p_donation1,
3178 		p_political_donation1,
3179 		p_political_donation2,
3180 		p_political_donation3,
3181 		p_donation2,
3182 		p_donation3,
3183 		-- Bug 3966549
3184 		p_esoa_don2004,
3185 		-- End of 3966549
3186                 p_marriage_exemption,
3187                 p_funeral_exemption,
3188                 p_relocation_exemption,
3189 		-- Bug 3172960
3190 		p_med_exp_emp;
3191 	close csr_aei;
3192 	--
3193 	-- Bug 9393732
3194 	open csr_sp3;
3195 	fetch csr_sp3 into
3196 		p_housing_prv_date_moved,
3197 		p_housing_prv_loan_date,
3198 		p_housing_prv_loan_repay,
3199 		p_house_holder_exception_flag, --Bug 13247926
3200 		p_lt_2012_fixed_intr_wo_grace,  --Bug 14754836
3201 		p_lt_2012_housing_other_intr; --Bug 14754836
3202 	close csr_sp3;
3203 	--
3204 	open csr_get_termination_info;
3205 	fetch csr_get_termination_info into p_create_don_rec_flag;
3206 	close csr_get_termination_info;
3207 	--
3208 	--
3209 	open  csr_aei2 ;
3210 	fetch csr_aei2 into
3211 		p_ee_occupation_educ_exp2005  -- Bug 3971542
3212                ,p_med_exp_card_emp
3213 	       ,l_promotional_fund_donation
3214 	       ,l_religious_donation
3215 	       ,l_chk_box_med_tot_det        -- Bug 6737106
3216 	       ,p_ltci_prem                  -- Bug 7260606
3217 	       ,p_donation4                 -- Bug 7142612: Public Legal Entity Donation Trust
3218                ,p_lt_housing_loan_date_2      -- Bug 8237227
3219  	       ,p_lt_housing_loan_intr_repay_2;  -- Bug 8237227
3220 	close csr_aei2 ;
3221 
3222 /* Bug 6737106 Added cursor csr_aei3 to get Detailed Information from 'KR_YEA_DETAIL_MEDICAL_EXP_INFO' */
3223 
3224       	   open csr_aei3;
3225 	   fetch csr_aei3
3226 	   into l_med_det_emp_tot,
3227 	        l_med_det_dis_tot,
3228 		l_med_det_aged_tot,
3229                 l_med_det_dep_tot ;
3230            close csr_aei3;
3231 	   --
3232 	   -- Bug 9393732
3233 	   open csr_hou_rent;
3234            fetch csr_hou_rent into p_housing_rent_exp;
3235 	   close csr_hou_rent;
3236 
3237 
3238         if (nvl(l_med_det_emp_tot,0) > 0) or (nvl(l_med_det_dis_tot,0) > 0) or (nvl(l_med_det_aged_tot,0) > 0) or (nvl(l_med_det_dep_tot,0) > 0) then
3239             if l_chk_box_med_tot_det ='Y' then
3240 
3241 	     p_med_exp_emp      := p_med_exp_emp + l_med_det_emp_tot;
3242              p_med_exp_disabled := p_med_exp_disabled + l_med_det_dis_tot;
3243              p_med_exp_aged     := p_med_exp_aged + l_med_det_aged_tot;
3244              p_med_exp          := p_med_exp + l_med_det_dep_tot;
3245 
3246             else
3247 	     p_med_exp_emp      := l_med_det_emp_tot;
3248              p_med_exp_disabled := l_med_det_dis_tot;
3249              p_med_exp_aged     := l_med_det_aged_tot;
3250              p_med_exp          := l_med_det_dep_tot;
3251             end if;
3252 	end if;
3253 /*End Bug 6737106 */
3254 	-- Bug 5255234
3255 	open csr_get_dpnt_insurance_prem;
3256 	fetch csr_get_dpnt_insurance_prem into l_dpnt_pers_ins_nts,l_dpnt_pers_ins_oth
3257                                               ,l_dpnt_dis_ins_nts,l_dpnt_dis_ins_oth ;
3258 	close csr_get_dpnt_insurance_prem;
3259 
3260 	-- Bug 5667762
3261 	-- Dependent Insurance Expense amounts are now classified as Personal Insurance
3262 	-- and Disabled Insurance. Therefore they are no more added to Health Insurance Premium.
3263 
3264 	-- p_hi_prem := p_hi_prem + nvl(l_dpnt_ins_nts,0) + nvl(l_dpnt_ins_oth,0);
3265 
3266 	p_pers_ins_prem := p_pers_ins_prem + nvl(l_dpnt_pers_ins_nts,0) + nvl(l_dpnt_pers_ins_oth,0);
3267 	p_disabled_ins_prem := p_disabled_ins_prem + nvl(l_dpnt_dis_ins_nts,0) + nvl(l_dpnt_dis_ins_oth,0);
3268 
3269         ------------------------------------------------------------------------
3270 	-- Bug : 4776711
3271         -- Since Promotional fund donation receives 100% exeption,it is added to the
3272 	-- Statutory donation. Religious donation receives 10% exemption,it is
3273 	-- added with Specified donation.
3274         ------------------------------------------------------------------------
3275         p_donation1 := nvl(p_donation1,0) + nvl(l_promotional_fund_donation,0);
3276         p_donation2 := nvl(p_donation2,0) + nvl(l_religious_donation,0);
3277 	p_religious_donation := nvl(l_religious_donation,0);            -- Bug 7142612
3278 end sp_tax_exem_info;
3279 ------------------------------------------------------------------------
3280 procedure dpnt_educ_tax_exem_info(
3281 	p_assignment_id		in number,
3282 	p_effective_date	in date,
3283 	p_contact_name_tbl	out nocopy t_varchar2_tbl,	-- Bug 9079450
3284 	p_contact_ni_tbl	out nocopy t_varchar2_tbl,	-- Bug 9079450
3285 	p_contact_type_tbl	out nocopy t_varchar2_tbl,
3286 	p_school_type_tbl	out nocopy t_varchar2_tbl,
3287 	p_exp_tbl		out nocopy t_number_tbl)
3288 ------------------------------------------------------------------------
3289 is
3290 	cursor csr_aei is
3291 		select	aei_information2,
3292 			aei_information3,
3293 			sum(nvl(to_number(aei_information4), 0)),	  -- Bug 9348911
3294 			aei_information7,	-- Bug 9079450: Contact Name
3295 			aei_information5 	-- Bug 9079450: Contact National Identifier
3296 		from	per_assignment_extra_info
3297 		where	assignment_id = p_assignment_id
3298 		and	information_type = 'KR_YEA_DPNT_EDUC_TAX_EXEM_INFO'
3299 		and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY')
3300                 group by aei_information5,aei_information7,aei_information3,aei_information2;  -- Bug 9348911
3301 begin
3302 	open csr_aei;
3303 	fetch csr_aei bulk collect into
3304 		p_contact_type_tbl,
3305 		p_school_type_tbl,
3306 		p_exp_tbl,
3307 		p_contact_name_tbl,	-- Bug 9079450
3308 		p_contact_ni_tbl;	-- Bug 9079450
3309 	close csr_aei;
3310 end dpnt_educ_tax_exem_info;
3311 ------------------------------------------------------------------------
3312 /* Changes for Bug 3201332 */
3313 ------------------------------------------------------------------------
3314 procedure fw_tax_exem_info(
3315 	p_assignment_id		in number,
3316 	p_effective_date	in date,
3317 	p_educ_expense		out nocopy number,
3318 	p_house_rent		out nocopy number)
3319 ------------------------------------------------------------------------
3320 is
3321 	cursor csr_aei is
3322 		select	nvl(to_number(aei_information2), 0),
3323 			nvl(to_number(aei_information3), 0)
3324 		from	per_assignment_extra_info
3325 		where	assignment_id = p_assignment_id
3326 		and	information_type = 'KR_YEA_FW_TAX_EXEM_INFO'
3327 		and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY');
3328 begin
3329 	open csr_aei;
3330 	fetch csr_aei into
3331 		p_educ_expense,
3332 		p_house_rent;
3333 	close csr_aei;
3334 end fw_tax_exem_info;
3335 ------------------------------------------------------------------------
3336 /* Changes for Bug 2523481 */
3337 
3338 procedure hous_exp_tax_exem_info(
3339 	p_assignment_id		in number,
3340 	p_effective_date	in date,
3341 	p_saving_type_tbl	out nocopy t_varchar2_tbl,
3342 	p_saving_tbl		out nocopy t_number_tbl)
3343 ------------------------------------------------------------------------
3344 is
3345 	cursor csr_aei is
3346 		select	aei_information2,
3347 			nvl(to_number(aei_information3), 0)
3348 		from	per_assignment_extra_info
3349 		where	assignment_id = p_assignment_id
3350 		and	information_type = 'KR_YEA_HOU_EXP_TAX_EXEM_INFO'
3351 		and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY');
3352 begin
3353 	open csr_aei;
3354 	fetch csr_aei bulk collect into
3355 		p_saving_type_tbl,
3356 		p_saving_tbl;
3357 	close csr_aei;
3358 end hous_exp_tax_exem_info;
3359 ------------------------------------------------------------------------
3360 procedure tax_exem_info(
3361 	p_assignment_id			in number,
3362 	p_effective_date		in date,
3363 	p_np_prem			in out nocopy number,
3364 	p_pen_prem			in out nocopy number, -- Bug 6024342
3365 	p_military_pen_prem		in out nocopy number, -- Bug 9737699
3366 	p_private_school_pen_prem	in out nocopy number, -- Bug 9737699
3367 	p_post_office_pen_prem		in out nocopy number, -- Bug 9737699
3368 	p_pers_pension_prem		in out nocopy number,
3369 	p_corp_pension_prem             in out nocopy number, -- Bug : 4750653
3370 	p_pers_pension_saving		in out nocopy number,
3371 	p_invest_partner_fin1		in out nocopy number,
3372 	p_invest_partner_fin2		in out nocopy number,
3373         	p_invest_partner_fin3		in out nocopy number, -- Bug 8237227
3374 	p_invest_partner_fin4		in out nocopy number, -- BUG 14219478
3375 	p_invest_partner_fin5		in out nocopy number, -- BUG 14219478
3376 	p_invest_partner_fin6		in out nocopy number, -- BUG 14219478
3377 	p_small_bus_install		in out nocopy number, -- Bug 6895093
3378 	p_credit_card_exp		in out nocopy number,
3379         	p_direct_card_exp		in out nocopy number,
3380 	-- Bug 3966549
3381 	p_emp_cre_card_direct_exp2004	in out nocopy number,
3382 	p_dpnt_cre_card_dir_exp2004	in out nocopy number,
3383 	p_giro_tuition_paid_exp2004	in out nocopy number,
3384 	-- End of 3966549
3385 	-- Bug No 3506168
3386 	p_cash_receipt_exp2005          in out nocopy number,
3387 	-- Bug 14219478
3388 	 p_traditional_market_exp	 in out nocopy number,
3389 	 p_total_cards_amount	 in out nocopy number,
3390 	 p_credit_card_expense	 in out nocopy number,
3391 	-- End of 14219478
3392         p_emp_stk_own_contri    	in out nocopy number,
3393 	--Bug 6630135
3394         p_tot_med_exp_cards     	in out nocopy number,
3395         p_dpnt_med_exp_cards    	in out nocopy number,
3396 	--End of Bug 6630135
3397 	-- Bug 7615517
3398 	p_company_related_exp		in out nocopy number,
3399 	p_long_term_stck_fund_1year	in out nocopy number,
3400 	p_long_term_stck_fund_2year	in out nocopy number,
3401 	p_long_term_stck_fund_3year	in out nocopy number,
3402 	p_cur_smb_days_worked		in out nocopy number,	-- Bug 9079450
3403 	p_prev_smb_days_worked		in out nocopy number,	-- Bug 9079450
3404 	p_emp_join_prev_year		in out nocopy varchar2,	-- Bug 9079450
3405 	p_emp_leave_cur_year		in out nocopy varchar2,	-- Bug 9079450
3406 	p_smb_eligibility_flag		in out nocopy varchar2	-- Bug 9079450
3407 	-- End of Bug 7615517
3408 	)
3409 ------------------------------------------------------------------------
3410 is
3411 	-- Bug 5255234
3412 	l_dpnt_card_nts		NUMBER;
3413 	l_dpnt_card_oth		NUMBER;
3414 	l_dpnt_cash_nts		NUMBER;
3415 	-- Bug 9737699
3416 	l_dpnt_direct_nts		NUMBER;
3417 	l_dpnt_direct_oth		NUMBER;
3418 	l_tm_dpnt_card_nts		NUMBER;
3419 	l_tm_dpnt_card_oth		NUMBER;
3420 	l_tm_dpnt_cash_nts		NUMBER;
3421 	l_tm_dpnt_direct_nts		NUMBER;
3422 	l_tm_dpnt_direct_oth		NUMBER;
3423 	l_dpnt_giro_tution_paid_nts	 NUMBER;
3424 	l_dpnt_giro_tution_paid_oth	 NUMBER;
3425 		l_credit_card_exp_tm	 NUMBER;
3426 		l_direct_card_exp_tm	 NUMBER;
3427 		l_emp_cre_card_direct_tm	 NUMBER;
3428 		l_dpnt_cre_card_dir_tm	 NUMBER;
3429 		l_cash_receipt_exp_tm	 NUMBER;
3430 		l_giro_tuition_paid_exp_dpnt	 NUMBER;
3431 		l_giro_tuition_paid_exp	 NUMBER;
3432 
3433 	--
3434 	l_business_group_id 	NUMBER; -- Bug 9079450
3435 
3436 	cursor csr_aei is
3437 		select	nvl(to_number(aei_information2), 0),
3438 			nvl(to_number(aei_information3), 0),
3439 			nvl(to_number(aei_information14), 0), -- Bug 4750653
3440 			nvl(to_number(aei_information4), 0),
3441 			nvl(to_number(aei_information5), 0),
3442 			nvl(to_number(aei_information6), 0),
3443                         nvl(to_number(aei_information25), 0),  -- Bug 8237227
3444                         -- Modified for Bug# 2706537
3445 			nvl(to_number(aei_information7), 0) + nvl(to_number(aei_information9), 0), -- emp credit card + dpnt credit card
3446 	                -- Added for fix 2879008
3447 			-- Bug 3966549
3448 			-- Added second term for Bug 3966549
3449 			nvl(to_number(aei_information10),0) + nvl(to_number(aei_information11), 0), -- employee's direct payment + dependents' direct payments
3450 			nvl(to_number(aei_information7), 0) + nvl(to_number(aei_information10), 0), -- emp credit card + emp direct payment
3451 			nvl(to_number(aei_information9), 0) + nvl(to_number(aei_information11), 0), -- dpdnt credit card + dpdnt direct payment
3452 			nvl(to_number(aei_information12), 0), -- giro tuition paid
3453 			-- End of 3966549
3454 			-- Bug No 3506168
3455 			nvl(to_number(aei_information13), 0), -- Cash Receipt expenses
3456 			--
3457                         nvl(to_number(aei_information8), 0),
3458 			nvl(to_number(aei_information15), 0),
3459 			nvl(to_number(aei_information28), 0), -- Bug 9737699
3460 			nvl(to_number(aei_information29), 0), -- Bug 9737699
3461 			nvl(to_number(aei_information30), 0), -- Bug 9737699
3462 			nvl(to_number(aei_information16), 0), -- Total Medical Expense Paid in Cards Bug 6630135
3463 			nvl(to_number(aei_information17), 0), -- Medical Expense Paid in Cards For Dependents who are not eligible for Basic Exemption Bug 6630135
3464 			nvl(to_number(aei_information20), 0), -- Small Business Installment Amount Bug 6895093
3465 			nvl(to_number(aei_information21), 0), -- Bug 7615517: Company Related Expense
3466 			nvl(to_number(aei_information22), 0), -- Bug 7615517: Long Term Stock Fund for 1st Year
3467 			nvl(to_number(aei_information23), 0), -- Bug 7615517: Long Term Stock Fund for 2nd Year
3468 			nvl(to_number(aei_information24), 0), -- Bug 7615517: Long Term Stock Fund for 3rd Year
3469 			nvl(to_number(aei_information26), 0), -- Bug 9079450: Working Days for the Current Period
3470 			nvl(to_number(aei_information27), 0)  -- Bug 9079450: Working Days for the Previous Period
3471 		from	per_assignment_extra_info
3472 		where	assignment_id = p_assignment_id
3473 		and	information_type = 'KR_YEA_TAX_EXEM_INFO'
3474 		and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY');
3475 
3476 -- Bug 14219478 Start
3477 	            cursor csr_aei2 is
3478 		select
3479 		nvl(to_number(aei_information3), 0) + nvl(to_number(aei_information4), 0), -- TM emp credit card + TM dpnt credit card
3480 		nvl(to_number(aei_information7),0) + nvl(to_number(aei_information8), 0), -- TM emp direct payment + TM dpnt direct payments
3481 		nvl(to_number(aei_information3), 0) + nvl(to_number(aei_information7), 0), -- TM emp credit card + TM emp direct card
3482 		nvl(to_number(aei_information4), 0) + nvl(to_number(aei_information8), 0), -- TM dpdnt credit card + TM dpdnt direct card
3483 		nvl(to_number(aei_information5), 0) + nvl(to_number(aei_information6), 0), -- TM emp Cash Receipt + TM dpnt Cash Receipt
3484 		nvl(to_number(aei_information9), 0), -- giro tuition paid
3485 		nvl(to_number(aei_information10), 0), -- Invest_Partner_Fin_2011
3486 		nvl(to_number(aei_information11), 0), -- Invest_Partner_Fin_2012_Ordinary
3487 		nvl(to_number(aei_information12), 0)  -- Invest_Partner_Fin_2012_Venture
3488 		from	per_assignment_extra_info
3489 		where	assignment_id = p_assignment_id
3490 		and	information_type = 'KR_YEA_TAX_EXEM_INFO2'
3491 		and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY');
3492 -- Bug 14219478 End
3493 
3494 	-- Bug 9079450
3495 	cursor csr_get_join_leave_info is
3496 		Select decode(sign(to_number(to_char(pds.date_start,'YYYY')) -
3497                        (to_number(to_char(p_effective_date,'YYYY'))-1)),1,'X',0,'Y','N') Joined_last_year,
3498                        decode(sign(to_number(to_char(nvl(pds.actual_termination_date,fnd_date.canonical_to_date('4712/12/31')),'YYYY')) -
3499                        to_number(to_char(p_effective_date,'YYYY'))),1,'N',0,'Y','X') Leaving_cur_year,
3500 			asg.business_group_id bus_grp_id
3501 		from	per_periods_of_service	pds,
3502 			per_assignments_f	asg
3503 		where	asg.assignment_id = p_assignment_id
3504 		and	p_effective_date between asg.effective_start_date and asg.effective_end_date
3505 		and	pds.period_of_service_id = asg.period_of_service_id;
3506 	--
3507 	cursor csr_get_smb_eligibility_flag(p_business_group_id in number) is
3508 		select
3509         		nvl(hoi.org_information1,'N')
3510 		from 	hr_all_organization_units hou,
3511         		hr_organization_information hoi
3512 		where 	hoi.organization_id = hou.organization_id
3513 		and 	hou.business_group_id = p_business_group_id
3514 		and 	hoi.org_information_context = 'KR_YEA_ER_SMB_ELIGIBILITY_INFO';
3515 	--
3516 	-- End of Bug 9079450
3517 	--
3518 	--Bug 5255234
3519         -- Bug 5879106
3520 	cursor csr_get_dpnt_card_expense is
3521 		select  nvl(sum(cei_information7),0), -- Dependent Cards(NTS) Expense
3522 			nvl(sum(cei_information8),0), -- Dependent Cards(Other) Expense
3523 			nvl(sum(cei_information16),0), -- Dependent Direct(NTS) Expense
3524 			nvl(sum(cei_information17),0), -- Dependent Direct(Others) Expense
3525 			nvl(sum(cei_information9),0), -- Dependent Cash(NTS) Expense
3526 			nvl(sum(cei_information18),0), -- BUG 14219478  : Traditional Market Dpnt Credit Card(NTS)
3527 			nvl(sum(cei_information19),0), -- BUG 14219478  : Traditional Market Dpnt Credit Card(Others)
3528 			nvl(sum(cei_information20),0), -- BUG 14219478  : Traditional Market Dpnt Cash Receipt Expense(NTS)
3529 			nvl(sum(cei_information21),0), -- BUG 14219478  : Traditional Market Dpnt Direct Payment(NTS)
3530 			nvl(sum(cei_information22),0), -- BUG 14219478  : Traditional Market Dpnt Direct Payment(Others)
3531 			nvl(sum(cei_information23),0), --  BUG 14219478  : Dpnt Tution Paid in GIRO(NTS)
3532 			nvl(sum(cei_information24),0) --  BUG 14219478  : Dpnt Tution Paid in GIRO(Others)
3533 		  from  pay_kr_cont_details_v pkc,
3534 			per_contact_extra_info_f cei
3535 		  where assignment_id = p_assignment_id
3536 		    -- Bug 5879106
3537 		    and cei.information_type(+) = 'KR_DPNT_EXPENSE_INFO'
3538 		    and cei.contact_relationship_id(+) = pkc.contact_relationship_id
3539 		    and to_char(cei.effective_start_date(+), 'YYYY') = to_char(p_effective_date, 'YYYY')
3540 		    --
3541 		    and  p_effective_date between emp_start_date and emp_end_date
3542 		    and  p_effective_date between cont_start_date and cont_end_date
3543 		    and  p_effective_date between nvl(ADDRESS_START_DATE,p_effective_date) and nvl(ADDRESS_END_DATE, p_effective_date)
3544 		    and  p_effective_date between nvl(pkc.date_start, p_effective_date)
3545 					     and decode(pkc.cont_information9, 'D', trunc(add_months(nvl(pkc.date_end, p_effective_date),12),'YYYY')-1, nvl(pkc.date_end, p_effective_date) )
3546 		    and  pay_kr_ff_functions_pkg.is_exempted_dependent( pkc.contact_type,
3547 									pkc.cont_information11,  -- Bug 7661820
3548 									pkc.national_identifier,
3549 									pkc.cont_information2,
3550 									pkc.cont_information3,
3551 									pkc.cont_information4,
3552 									pkc.cont_information7,
3553 									pkc.cont_information8,
3554 									p_effective_date,
3555 									pkc.cont_information10,
3556 									pkc.cont_information12,
3557 									pkc.cont_information13,
3558 									pkc.cont_information14,
3559 									cei.contact_extra_info_id
3560 								       ) = 'Y';
3561 begin
3562 	open csr_aei;
3563 	fetch csr_aei into
3564 		p_np_prem,
3565 		p_pers_pension_prem,
3566 		p_corp_pension_prem, -- Bug : 4750653
3567 		p_pers_pension_saving,
3568 		p_invest_partner_fin1,
3569 		p_invest_partner_fin2,
3570                 p_invest_partner_fin3,  -- Bug 8237227
3571 		p_credit_card_exp,
3572 		p_direct_card_exp,
3573 		-- Bug 3966549
3574 		p_emp_cre_card_direct_exp2004,
3575 		p_dpnt_cre_card_dir_exp2004,
3576 		p_giro_tuition_paid_exp2004,
3577 		-- End of bug 3966549
3578 		-- Bug No 3506168
3579                 p_cash_receipt_exp2005,
3580 		--
3581                 p_emp_stk_own_contri,
3582 		p_pen_prem,  			-- Bug 6024342
3583 		p_military_pen_prem,		-- Bug 9737699
3584 		p_private_school_pen_prem,	-- Bug 9737699
3585 		p_post_office_pen_prem,		-- Bug 9737699
3586                 p_tot_med_exp_cards,            -- Bug 6630135
3587                 p_dpnt_med_exp_cards,           -- Bug 6630135
3588 		p_small_bus_install,		-- Bug 6895093
3589 		p_company_related_exp,		-- Bug 7615517
3590 		p_long_term_stck_fund_1year,	-- Bug 7615517
3591 		p_long_term_stck_fund_2year,	-- Bug 7615517
3592 		p_long_term_stck_fund_3year,	-- Bug 7615517
3593 		p_cur_smb_days_worked,		-- Bug 9079450
3594 		p_prev_smb_days_worked;		-- Bug 9079450
3595 	close csr_aei;
3596 	--
3597 -- BUG 14219478  Start
3598 	open csr_aei2;
3599 	  fetch csr_aei2 into
3600 		l_credit_card_exp_tm,
3601 		l_direct_card_exp_tm,
3602 		l_emp_cre_card_direct_tm,
3603 		l_dpnt_cre_card_dir_tm,
3604 		l_cash_receipt_exp_tm,
3605 		l_giro_tuition_paid_exp_dpnt,
3606 		p_invest_partner_fin4,
3607 		p_invest_partner_fin5,
3608 		p_invest_partner_fin6;
3609 	close csr_aei2;
3610 -- Bug 14219478 End
3611 	-- Bug 9079450
3612 	open csr_get_join_leave_info;
3613 	fetch csr_get_join_leave_info into p_emp_join_prev_year, p_emp_leave_cur_year,l_business_group_id;
3614 	close csr_get_join_leave_info;
3615 	--
3616 	open csr_get_smb_eligibility_flag(l_business_group_id);
3617 	fetch csr_get_smb_eligibility_flag into p_smb_eligibility_flag;
3618 	if csr_get_smb_eligibility_flag%NOTFOUND then
3619 	   p_smb_eligibility_flag := 'N';
3620 	end if;
3621 	close csr_get_smb_eligibility_flag;
3622 	--
3623 	-- End of Bug 9079450
3624 	--
3625 	-- Bug 5255234
3626 	-- Get Dependent Information from Contact Extra Information
3627 	-- and consolidate with the corresponding Employee Expenses
3628 	open csr_get_dpnt_card_expense;
3629 	fetch csr_get_dpnt_card_expense into l_dpnt_card_nts,
3630 					     l_dpnt_card_oth,
3631 					     l_dpnt_direct_nts, --Bug 9737699
3632 					     l_dpnt_direct_oth, --Bug 9737699
3633 					     l_dpnt_cash_nts,
3634 					     l_tm_dpnt_card_nts,  --  Bug 14219478
3635 					     l_tm_dpnt_card_oth,  --  Bug 14219478
3636 					     l_tm_dpnt_cash_nts, --  Bug 14219478
3637 					     l_tm_dpnt_direct_nts,  --  Bug 14219478
3638 					     l_tm_dpnt_direct_oth,  --  Bug 14219478
3639 					     l_dpnt_giro_tution_paid_nts,  --  Bug 14219478
3640 					     l_dpnt_giro_tution_paid_oth;  --  Bug 14219478
3641 	close csr_get_dpnt_card_expense;
3642 	--
3643 	p_dpnt_cre_card_dir_exp2004 := p_dpnt_cre_card_dir_exp2004 + nvl(l_dpnt_card_nts,0) + nvl(l_dpnt_card_oth,0) + nvl(l_dpnt_direct_nts,0) + nvl(l_dpnt_direct_oth,0); --Bug 13607235
3644 	p_credit_card_exp := p_credit_card_exp + nvl(l_dpnt_card_nts,0) + nvl(l_dpnt_card_oth,0);
3645 	p_direct_card_exp := p_direct_card_exp + nvl(l_dpnt_direct_nts,0) + nvl(l_dpnt_direct_oth,0); -- Bug 9737699
3646 	p_cash_receipt_exp2005 := p_cash_receipt_exp2005 + nvl(l_dpnt_cash_nts,0);
3647 --  Bug 14219478 Start
3648 	l_giro_tuition_paid_exp_dpnt := nvl(l_giro_tuition_paid_exp_dpnt,0) + nvl(l_dpnt_giro_tution_paid_nts,0) + nvl(l_dpnt_giro_tution_paid_oth,0);
3649 	l_giro_tuition_paid_exp := p_giro_tuition_paid_exp2004 + l_giro_tuition_paid_exp_dpnt; -- emp tution paid + dpnt tution paid
3650 	p_traditional_market_exp := nvl(l_credit_card_exp_tm,0) + nvl(l_direct_card_exp_tm,0) + nvl(l_cash_receipt_exp_tm,0)
3651 		                  + nvl(l_tm_dpnt_card_nts,0) + nvl(l_tm_dpnt_card_oth,0) + nvl(l_tm_dpnt_cash_nts,0)
3652 		                  + nvl(l_tm_dpnt_direct_nts,0) + nvl(l_tm_dpnt_direct_oth,0);
3653 	p_total_cards_amount := p_traditional_market_exp + p_credit_card_exp + p_cash_receipt_exp2005 + l_giro_tuition_paid_exp + p_direct_card_exp;
3654 	p_credit_card_expense:= p_total_cards_amount - p_traditional_market_exp - p_direct_card_exp;
3655 -- Bug 14219478 End
3656 	  hr_utility.trace('p_traditional_market_exp = '||to_char(p_traditional_market_exp));
3657   	  hr_utility.trace('p_total_cards_amount = '||to_char(p_total_cards_amount));
3658   	  hr_utility.trace('p_credit_card_expense = '||to_char(p_credit_card_expense));
3659 
3660 end tax_exem_info;
3661 ------------------------------------------------------------------------
3662 procedure tax_break_info(
3663 	p_assignment_id			in number,
3664 	p_effective_date		in date,
3665 	p_housing_loan_interest_repay	in out nocopy number,
3666 	p_stock_saving			in out nocopy number,
3667 	p_lt_stock_saving1		in out nocopy number,
3668 	p_lt_stock_saving2		in out nocopy number)
3669 ------------------------------------------------------------------------
3670 is
3671 	cursor csr_aei is
3672 		select  nvl(to_number(aei_information2), 0),
3673 			nvl(to_number(aei_information3), 0),
3674 			nvl(to_number(aei_information4), 0),
3675 			nvl(to_number(aei_information5), 0)
3676 		from	per_assignment_extra_info
3677 		where	assignment_id = p_assignment_id
3678 		and	information_type = 'KR_YEA_TAX_BREAK_INFO'
3679 		and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY');
3680 begin
3681 	open csr_aei;
3682 	fetch csr_aei into
3683 		p_housing_loan_interest_repay,
3684 		p_stock_saving,
3685 		p_lt_stock_saving1,
3686 		p_lt_stock_saving2;
3687 	close csr_aei;
3688 end tax_break_info;
3689 ------------------------------------------------------------------------
3690 procedure ovs_tax_break_info(
3691 	p_assignment_id			in number,
3692 	p_effective_date		in date,
3693 	p_tax_paid_date			in out nocopy date,
3694 	p_territory_code		in out nocopy varchar2,
3695 	p_currency_code			in out nocopy varchar2,
3696 	p_taxable			in out nocopy number,
3697 	p_taxable_subj_tax_break	in out nocopy number,
3698 	p_tax_break_rate		in out nocopy number,
3699 	p_tax_foreign_currency		in out nocopy number,
3700 	p_tax				in out nocopy number,
3701 	p_application_date		in out nocopy date,
3702 	p_submission_date		in out nocopy date)
3703 ------------------------------------------------------------------------
3704 is
3705 	cursor csr_aei is
3706 		select	fnd_date.canonical_to_date(aei_information1),
3707 			aei_information2,
3708 			aei_information3,
3709 			nvl(to_number(aei_information4), 0),
3710 			nvl(to_number(aei_information5), 0),
3711 			nvl(to_number(aei_information6), 0),
3712 			nvl(to_number(aei_information7), 0),
3713 			nvl(to_number(aei_information8), 0),
3714 			fnd_date.canonical_to_date(aei_information9),
3715 			fnd_date.canonical_to_date(aei_information10)
3716 		from	per_assignment_extra_info
3717 		where	assignment_id = p_assignment_id
3718 		and	information_type = 'KR_YEA_OVS_TAX_BREAK_INFO'
3719 		and	trunc(fnd_date.canonical_to_date(aei_information1), 'YYYY') = trunc(p_effective_date, 'YYYY');
3720 begin
3721 	open csr_aei;
3722 	fetch csr_aei into
3723 		p_tax_paid_date,
3724 		p_territory_code,
3725 		p_currency_code,
3726 		p_taxable,
3727 		p_taxable_subj_tax_break,
3728 		p_tax_break_rate,
3729 		p_tax_foreign_currency,
3730 		p_tax,
3731 		p_application_date,
3732 		p_submission_date;
3733 	close csr_aei;
3734 end ovs_tax_break_info;
3735 ------------------------------------------------------------------------
3736 -- Bug 5083240: Updated to calculate earnings during contract, new
3737 --              parameters p_assignment_action_id, p_contr_taxable_earn,
3738 --              p_contr_non_taxable_earn
3739 ------------------------------------------------------------------------
3740 procedure fw_tax_break_info(
3741         p_assignment_action_id          in number,
3742 	p_assignment_id			in number,
3743 	p_effective_date		in date,
3744 	p_immigration_purpose		in out nocopy varchar2,
3745 	p_contract_date			in out nocopy date,
3746 	p_expiry_date			in out nocopy date,
3747 	p_application_date		in out nocopy date,
3748 	p_submission_date		in out nocopy date,
3749         p_contr_taxable_earn            in out nocopy number,
3750         p_contr_non_taxable_earn        in out nocopy number)
3751 ------------------------------------------------------------------------
3752 is
3753 	cursor csr_aei is
3754 		select	aei_information1,
3755 			fnd_date.canonical_to_date(aei_information2),
3756 			fnd_date.canonical_to_date(aei_information3),
3757 			fnd_date.canonical_to_date(aei_information5),
3758 			fnd_date.canonical_to_date(aei_information6)
3759 		from	per_assignment_extra_info
3760 		where	assignment_id = p_assignment_id
3761 		and	information_type = 'KR_YEA_FW_TAX_BREAK_INFO'
3762 		and	p_effective_date between -- Bug 5083240: Consider end date to be last day of contract_expiry_date year
3763                                 fnd_date.canonical_to_date(aei_information2)
3764                                 and (add_months(trunc(fnd_date.canonical_to_date(aei_information3), 'YYYY'), 12) - 1) ;
3765         --
3766         --
3767         cursor csr_fw_contract_earn(
3768                 p_contr_start_date date,
3769                 p_contr_expiry_date date,
3770 		l_fw_tax_duration number
3771         ) is
3772                 select  BAL_TYPE.balance_name,
3773                         nvl(sum(fnd_number.canonical_to_number(TARGET.result_value) * FEED.scale), 0)
3774                 from    pay_balance_feeds_f             FEED,
3775                         pay_balance_types               BAL_TYPE,
3776                         pay_run_result_values           TARGET,
3777                         pay_run_results                 RR,
3778                         pay_payroll_actions             PACT,
3779                         pay_assignment_actions          ASSACT,
3780                         pay_payroll_actions             BACT,
3781                         pay_assignment_actions          BAL_ASSACT,
3782                         pay_run_types_f                 RTYPE
3783                 where   BAL_ASSACT.assignment_action_id         = p_assignment_action_id
3784                         and BAL_TYPE.balance_name               in ('TOTAL_TAXABLE_EARNINGS', 'TOTAL_NON_TAXABLE_EARNINGS')
3785                         and BAL_TYPE.legislation_code           = 'KR'
3786                         and FEED.balance_type_id                = BAL_TYPE.balance_type_id
3787                         and BACT.payroll_action_id              = BAL_ASSACT.payroll_action_id
3788                         and ASSACT.assignment_id                = BAL_ASSACT.assignment_id
3789                         and ASSACT.action_sequence              <= BAL_ASSACT.action_sequence
3790                         and PACT.payroll_action_id              = ASSACT.payroll_action_id
3791                         and trunc(PACT.effective_date, 'YYYY')  = trunc(BACT.effective_date, 'YYYY')
3792                         and PACT.effective_date                 between p_contr_start_date
3793                                                                 and
3794                                                                 (add_months(trunc(p_contr_expiry_date, 'MONTH'), 1) - 1 )
3795 			and  months_between(PACT.effective_date,p_contr_start_date)/l_pay_periods_per_year < l_fw_tax_duration
3796                         and (
3797                                 RTYPE.run_type_name             = 'MTH'
3798                                 or
3799                                 RTYPE.run_type_name             like 'BON\_%' escape '\'
3800                         )
3801                         and RTYPE.legislation_code              = 'KR'
3802                         and PACT.effective_date                 between RTYPE.effective_start_date
3803                                                                 and RTYPE.effective_end_date
3804                         and PACT.run_type_id                    = RTYPE.run_type_id
3805                         and RR.assignment_action_id             = ASSACT.assignment_action_id
3806                         and RR.status                           in ('P', 'PA')
3807                         and TARGET.run_result_id                = RR.run_result_id
3808                         and nvl(TARGET.result_value, '0')       <> '0'
3809                         and FEED.input_value_id                 = TARGET.input_value_id
3810                         and PACT.effective_date                 between FEED.effective_start_date
3811                                                                 and
3812                                                                 FEED.effective_end_date
3813                 group by
3814                         BAL_TYPE.balance_name ;
3815         --
3816 	l_bal_name      pay_balance_types.balance_name%type ;
3817         l_bal_value     number ;
3818 	l_fw_tax_reduction_duration  number;
3819 	function get_globalvalue(p_glbvar in varchar2,p_process_date in date) return number
3820         is
3821           --
3822           cursor csr_ff_global
3823           is
3824           select to_number(glb.global_value,'99999999999999999999.99999') -- Bug 5726158
3825           from   ff_globals_f glb
3826           where glb.global_name = p_glbvar
3827           and   p_process_date between glb.effective_start_date and glb.effective_end_date;
3828           --
3829           l_glbvalue number default 0;
3830         begin
3831           Open csr_ff_global;
3832           fetch csr_ff_global into l_glbvalue;
3833           close csr_ff_global;
3834           --
3835           if l_glbvalue is null then
3836              l_glbvalue := 0;
3837           end if;
3838           --
3839           return l_glbvalue;
3840         end;
3841 
3842         --
3843 begin
3844         --
3845         p_contr_taxable_earn := 0 ;
3846         p_contr_non_taxable_earn := 0 ;
3847         p_immigration_purpose := null ;
3848 	l_fw_tax_reduction_duration := 0;
3849         --
3850 	open  csr_aei;
3851 	fetch csr_aei into
3852 		p_immigration_purpose,
3853 		p_contract_date,
3854 		p_expiry_date,
3855 		p_application_date,
3856 		p_submission_date;
3857 	close csr_aei;
3858         --
3859 	-- Bug 9231094
3860         if p_immigration_purpose is not null then
3861 
3862 	l_fw_tax_reduction_duration     := get_globalvalue('KR_FW_TAX_REDUCTION_DURATION',p_contract_date);
3863 
3864                 l_bal_name := 'DUMMY' ;
3865                 l_bal_value := 0 ;
3866 
3867 		open csr_fw_contract_earn(
3868                         p_contr_start_date      => p_contract_date,
3869                         p_contr_expiry_date     => p_expiry_date,
3870 			l_fw_tax_duration	=> l_fw_tax_reduction_duration
3871                 ) ;
3872                 --
3873                 loop
3874 
3875                         fetch csr_fw_contract_earn into l_bal_name, l_bal_value ;
3876                         exit when csr_fw_contract_earn%notfound ;
3877 
3878                         if l_bal_name = 'TOTAL_TAXABLE_EARNINGS' then
3879                                 p_contr_taxable_earn := l_bal_value ;
3880                         elsif l_bal_name = 'TOTAL_NON_TAXABLE_EARNINGS' then
3881                                 p_contr_non_taxable_earn := l_bal_value ;
3882                         end if ;
3883                         l_bal_name := 'DUMMY' ;
3884                         l_bal_value := 0 ;
3885                 end loop ;
3886                 --
3887                 close csr_fw_contract_earn ;
3888                 --
3889         end if ;
3890         --
3891 end fw_tax_break_info;
3892 -- Bug 14754822 Start
3893 procedure tax_reduction_info(p_assignment_action_id		 in number,
3894 	p_assignment_id			in number,
3895 	p_effective_date		in date,
3896 	p_information_type	in varchar2,
3897 	p_balance_name in varchar2,
3898 	p_eligible_earnings   in out nocopy number)
3899 ------------------------------------------------------------------------
3900 is
3901 	cursor csr_aei
3902 	is
3903 		select	fnd_date.canonical_to_date(aei_information1),
3904 			fnd_date.canonical_to_date(aei_information2)
3905 		from	per_assignment_extra_info
3906 		where	assignment_id = p_assignment_id
3907 		and	information_type = p_information_type;
3908         --
3909 	cursor csr_get_emp_dates
3910 	is
3911 	select pds.DATE_START, pds.ACTUAL_TERMINATION_DATE
3912 		from	per_periods_of_service	pds,
3913 			per_assignments_f	asg
3914 		where	asg.assignment_id = p_assignment_id
3915 		and	p_effective_date between asg.effective_start_date and asg.effective_end_date
3916 		and	pds.period_of_service_id = asg.period_of_service_id;
3917 
3918 	cursor csr_get_def_bal_id
3919 	is
3920 	SELECT pdb.defined_balance_id
3921 	 FROM pay_balance_types        pbt,
3922 	      pay_defined_balances     pdb,
3923 	      pay_balance_dimensions   pbd
3924 	 WHERE pbt.balance_name  = p_balance_name
3925 	   and pbt.legislation_code     = 'KR'
3926            and pbd.legislation_code     = 'KR'
3927            and pdb.legislation_code     = 'KR'
3928 	   and pbt.balance_type_id      = pdb.balance_type_id
3929 	   and pbd.balance_dimension_id = pdb.balance_dimension_id
3930 	   and pbd.database_item_suffix = '_ASG_YTD';
3931         --
3932 	l_emp_hire_date date;
3933 	l_emp_term_date date;
3934  	l_fin_start_date date;
3935 	l_fin_end_date date;
3936 	l_start_date date;
3937 	l_expiry_date date;
3938 	l_calc_end_date date;
3939 	l_smb_earnings number ;
3940 	l_taxable_earnings number;
3941 	l_get_def_bal_id number;
3942 	l_20131231 date;
3943         --
3944 begin
3945         p_eligible_earnings := 0 ;
3946 	l_20131231 := to_date('31-12-2013','DD-MM-YYYY');
3947 	l_fin_start_date := to_date('01-01-'||extract(year from p_effective_date),'DD-MM-YYYY');
3948 	l_fin_end_date := to_date('31-12-'||extract(year from p_effective_date),'DD-MM-YYYY');
3949 
3950 	open  csr_aei;
3951 	fetch csr_aei into
3952 		l_start_date,
3953 		l_expiry_date;
3954 	close csr_aei;
3955 
3956 open csr_get_emp_dates;
3957 fetch csr_get_emp_dates into l_emp_hire_date,l_emp_term_date;
3958 close csr_get_emp_dates;
3959 
3960 if l_start_date is null then
3961 	l_start_date := greatest(least(l_emp_hire_date, l_fin_start_date),l_emp_hire_date);
3962 end if;
3963 l_calc_end_date := last_day(add_months(l_start_date, 3*12)-1);
3964 
3965 if l_expiry_date is not null then
3966     l_expiry_date := least(l_fin_end_date,last_day(l_expiry_date));
3967 end if;
3968 
3969 if l_expiry_date is null then
3970 	if l_emp_term_date is null then
3971 	l_expiry_date := least(l_fin_end_date,l_calc_end_date);
3972 	else
3973 	l_expiry_date := least(l_emp_term_date, l_fin_end_date, l_calc_end_date);
3974 	end if;
3975 end if;
3976 		   hr_utility.trace('l_calc_end_date '||to_char(l_calc_end_date,'DD-MON-YYYY'));
3977 		   hr_utility.trace('l_start_date '||to_char(l_start_date,'DD-MON-YYYY'));
3978 		   hr_utility.trace('l_expiry_date '||to_char(l_expiry_date,'DD-MON-YYYY'));
3979 		   hr_utility.trace('l_20131231 '||to_char(l_20131231,'DD-MON-YYYY'));
3980 if extract(year from p_effective_date) between extract(year from l_start_date) and extract(year from l_expiry_date) then
3981 	 if l_start_date between c_20120101 and l_20131231 then
3982  	 	 	 open  csr_get_def_bal_id;
3983 			   fetch csr_get_def_bal_id into l_get_def_bal_id;
3984 			   if csr_get_def_bal_id%found then
3985 			      p_eligible_earnings := pay_balance_pkg.get_value
3986 						       (p_defined_balance_id   => l_get_def_bal_id
3987 						       ,p_assignment_id        => p_assignment_id
3988 						       ,p_virtual_date         => l_expiry_date
3989 						       ,p_always_get_db_item   => FALSE);
3990 					else
3991 						p_eligible_earnings := 0;
3992 			   end if;
3993 			   close csr_get_def_bal_id;
3994 	 end if;
3995 end if;
3996 		   hr_utility.trace('p_eligible_earnings :='||to_char(p_eligible_earnings));
3997 end tax_reduction_info;
3998 -- BUg 14754822 end
3999 ------------------------------------------------------------------------
4000 procedure yea_info(
4001 	p_assignment_id			in number,
4002 	p_assignment_action_id		in number,
4003 	p_effective_date		in date,
4004 	p_business_group_id		in number,
4005 	p_payroll_id 			in number,
4006 	p_yea_info			out nocopy   t_yea_info,
4007 	p_taxable_earnings_warning	out nocopy boolean,
4008 	p_taxable_income_warning	out nocopy boolean,
4009 	p_taxation_base_warning		out nocopy boolean,
4010 	p_calc_tax_warning		out nocopy boolean,
4011 	p_itax_warning			out nocopy boolean,
4012 	p_rtax_warning			out nocopy boolean,
4013         -- Bug 2878937
4014         p_tax_adj_warning               out nocopy boolean)
4015 ------------------------------------------------------------------------
4016 is
4017 	l_dummy				number;
4018 	l_index				number;
4019 	l_assignment_action_id		number;
4020 	l_prev_asg_act_id		number;		-- Bug 9079450
4021 	l_cur_sp_irreg_bonus_mth	number := 0;
4022 	l_cur_sp_irreg_bonus_bon	number := 0;
4023 	l_cur_taxable_mth		number := 0;
4024 	l_cur_taxable_bon		number := 0;
4025 	l_hi_prem			number := 0;
4026 	l_ltci_prem			number := 0;  -- Bug 7260606
4027 	l_ei_prem			number := 0;
4028 	l_np_prem			number := 0;
4029 	l_pen_prem			number := 0;  -- Bug 6024342
4030 	l_military_pen_prem		number := 0;  -- Bug 9737699
4031 	l_private_school_pen_prem	number := 0;  -- Bug 9737699
4032 	l_post_office_pen_prem		number := 0;  -- Bug 9737699
4033 	-- Bug 4750653
4034 	l_corp_pension_prem_bal_value   number := 0;
4035 	-- Bug 3201332
4036 	l_ni				varchar2(14);
4037 	l_stock_pur_opt_exec_earn_mth   number := 0;
4038 	l_stock_pur_opt_exec_earn_bon   number := 0;
4039 	l_research_payment_mth		number := 0;
4040 	l_research_payment_bon		number := 0;
4041 	l_birth_raising_allowance_bon	 number := 0; --Bug 7142620
4042 	l_birth_raising_allowance_mth	 number := 0; --Bug 7142620
4043 	l_corp_pension_prem		number := 0; -- bug 7508706
4044 	l_fixed_tax_rate		varchar2(1);
4045 
4046 	cursor csr_assact(l_effective_date in date) is
4047 		select
4048 			paa.assignment_action_id
4049 		from	pay_payroll_actions	ppa,
4050 			pay_assignment_actions	paa
4051 		where	paa.assignment_id 	= p_assignment_id
4052 		and	paa.source_action_id 	is null
4053 		and     ppa.business_group_id 	= p_business_group_id
4054 		and     ppa.payroll_id        	= p_payroll_id
4055 		and	ppa.payroll_action_id 	= paa.payroll_action_id
4056 		and	ppa.action_type 	in ('B', 'I', 'V', 'R', 'Q')
4057 		and     paa.assignment_action_id <> p_assignment_action_id
4058 		and	ppa.effective_date	between trunc(l_effective_date, 'YYYY') and l_effective_date
4059 		order by paa.action_sequence desc;
4060 
4061 	l_input_value_id_tbl		t_number_tbl;
4062 	l_screen_entry_value_tbl	t_varchar2_tbl;
4063 
4064 	cursor csr_ee(p_element_type_id number) is
4065 		select
4066 			peev.input_value_id,
4067 			peev.screen_entry_value
4068 		from	pay_element_entry_values_f  peev,
4069 			pay_element_entries_f	    pee,
4070 			pay_element_links_f	    pel
4071 		where	pel.element_type_id = p_element_type_id
4072 		and	p_effective_date
4073 			between pel.effective_start_date and pel.effective_end_date
4074 		and	pee.element_link_id = pel.element_link_id
4075 		and	pee.assignment_id = p_assignment_id
4076 		and	nvl(pee.entry_type, 'E') = 'E'
4077 		and	p_effective_date
4078 			between pee.effective_start_date and pee.effective_end_date
4079 		and	peev.element_entry_id = pee.element_entry_id
4080 		and	peev.effective_start_date = pee.effective_start_date
4081 		and	peev.effective_end_date = pee.effective_end_date
4082 			order by peev.input_value_id; -- Bug 7142620
4083 	-- Bug 3172960
4084 	Cursor csr_fixed_tax_rate
4085 	IS
4086 		Select aei_information1
4087 		  From per_assignment_extra_info
4088 		 Where assignment_id = p_assignment_id
4089 		   And information_type = 'KR_YEA_FOREIGN_WORKER_TAX';
4090 begin
4091 	--
4092 	if g_debug then
4093 		hr_utility.set_location('pay_kr_yea_pkg.yea_info.',10);
4094 	end if;
4095 	--
4096 	------------------------------------------------------------------------
4097 	-- Derive Resident/Non-resident Information from element entry.
4098 	------------------------------------------------------------------------
4099 	open csr_ee(g_tax.element_type_id);
4100 	fetch csr_ee bulk collect into l_input_value_id_tbl, l_screen_entry_value_tbl;
4101 	close csr_ee;
4102 	p_yea_info.non_resident_flag := nvl(l_screen_entry_value_tbl(1), 'N');
4103 
4104 	/* Bug 6716506 */
4105 	begin
4106 
4107 	p_yea_info.foreign_residency_flag := nvl(l_screen_entry_value_tbl(2), 'N');
4108 
4109 	exception
4110 	when no_data_found then
4111         p_yea_info.foreign_residency_flag := 'N';
4112 	end;
4113 	/* End of Bug 6716506 */
4114 	--
4115 	if g_debug then
4116 		hr_utility.set_location('pay_kr_yea_pkg.yea_info.',15);
4117 	end if;
4118 	------------------------------------------------------------------------
4119 	-- Bug 3201332 Derive Nationality from national identifier
4120 	-- Bug 3172960 Calling pay_kr_ff_functions_pkg for nationality
4121 	-- Bug 6615356 Modified logic for Korean/Foreigner
4122 	------------------------------------------------------------------------
4123 	if (pay_kr_ff_functions_pkg.ni_nationality(p_assignment_id, p_effective_date) = 'F' or p_yea_info.foreign_residency_flag = 'Y') then
4124 	p_yea_info.nationality := 'F';
4125 	else
4126         p_yea_info.nationality := 'K';
4127 	end if;
4128 	--
4129 	if p_yea_info.nationality = 'F' then
4130 
4131 	   OPEN csr_fixed_tax_rate;
4132 	   FETCH csr_fixed_tax_rate INTO p_yea_info.fixed_tax_rate;
4133 
4134 	   if csr_fixed_tax_rate%NOTFOUND then
4135 	      p_yea_info.fixed_tax_rate := 'N';
4136 	   end if;
4137 
4138 	   CLOSE csr_fixed_tax_rate;
4139 	end if;
4140 	--
4141 	if g_debug then
4142 		hr_utility.set_location('pay_kr_yea_pkg.yea_info.',20);
4143 	end if;
4144 	--
4145 	------------------------------------------------------------------------
4146 	-- Get latest assignment action in previous calendar year.
4147 	------------------------------------------------------------------------
4148 	open csr_assact((trunc(p_effective_date,'YYYY')-1));
4149 	fetch csr_assact into l_prev_asg_act_id;
4150 	if csr_assact%FOUND then
4151 		p_yea_info.prev_smb_eligible_income := pay_balance_pkg.get_value (
4152 				 			p_defined_balance_id => g_balance_value_tab(88).defined_balance_id,
4153 				 			p_assignment_action_id => l_prev_asg_act_id)
4154 						     + pay_balance_pkg.get_value (
4155 				 			p_defined_balance_id => g_balance_value_tab(89).defined_balance_id,
4156 				 			p_assignment_action_id => l_prev_asg_act_id);
4157 	end if;
4158 	close csr_assact;
4159 	------------------------------------------------------------------------
4160 	-- Get latest assignment action in this calendar year.
4161 	------------------------------------------------------------------------
4162 	open csr_assact(p_effective_date);
4163 	fetch csr_assact into l_assignment_action_id;
4164 	if csr_assact%FOUND then
4165 		--
4166 		if g_debug then
4167 		   hr_utility.trace('l_assignment_action_id '||to_char(l_assignment_action_id));
4168 		end if;
4169 		--
4170 		------------------------------------------------------------------------
4171 		-- Current Employer's Information
4172 		-- Modified for Batch balance retrival, fix 3039649
4173 		------------------------------------------------------------------------
4174 		for i in 1..g_balance_value_tab.count loop
4175 			g_balance_value_tab(i).balance_value := null;
4176 		end loop;
4177 		--
4178 		pay_balance_pkg.get_value ( p_assignment_action_id => l_assignment_action_id
4179 		                           ,p_defined_balance_lst => g_balance_value_tab );
4180 		--
4181 		if g_debug then
4182 			hr_utility.set_location('pay_kr_yea_pkg.yea_info.',30);
4183 		end if;
4184 		-- End of bug 8644512
4185 		--
4186 		p_yea_info.cur_ntax_frgn_M01	:= g_balance_value_tab(82).balance_value
4187 						 + g_balance_value_tab(83).balance_value; -- Bug 8880364
4188 		p_yea_info.cur_ntax_frgn_M02	:= g_balance_value_tab(84).balance_value
4189 						 + g_balance_value_tab(85).balance_value; -- Bug 8880364
4190 		p_yea_info.cur_ntax_frgn_M03	:= g_balance_value_tab(86).balance_value
4191 						 + g_balance_value_tab(87).balance_value; -- Bug 8880364
4192 		--
4193 		-- Bug 8644512
4194 		--
4195 
4196 		p_yea_info.cur_ntax_R10	:= g_balance_value_tab(97).balance_value + g_balance_value_tab(98).balance_value; --Bug 12807687
4197 		p_yea_info.cur_ntax_G01	:= g_balance_value_tab(36).balance_value + g_balance_value_tab(37).balance_value;
4198 		p_yea_info.cur_ntax_H01	:= g_balance_value_tab(38).balance_value + g_balance_value_tab(39).balance_value;
4199 		p_yea_info.cur_ntax_H05	:= g_balance_value_tab(40).balance_value + g_balance_value_tab(41).balance_value;
4200 		p_yea_info.cur_ntax_H06	:= g_balance_value_tab(42).balance_value + g_balance_value_tab(43).balance_value;
4201 		p_yea_info.cur_ntax_H07	:= g_balance_value_tab(44).balance_value + g_balance_value_tab(45).balance_value;
4202 		p_yea_info.cur_ntax_H08	:= g_balance_value_tab(46).balance_value + g_balance_value_tab(47).balance_value;
4203 		p_yea_info.cur_ntax_H09	:= g_balance_value_tab(48).balance_value + g_balance_value_tab(49).balance_value;
4204 		p_yea_info.cur_ntax_H10	:= g_balance_value_tab(50).balance_value + g_balance_value_tab(51).balance_value;
4205 		p_yea_info.cur_ntax_H11	:= g_balance_value_tab(52).balance_value + g_balance_value_tab(53).balance_value;
4206 		p_yea_info.cur_ntax_H12	:= g_balance_value_tab(54).balance_value + g_balance_value_tab(55).balance_value;
4207 		p_yea_info.cur_ntax_H13	:= g_balance_value_tab(56).balance_value + g_balance_value_tab(57).balance_value;
4208 		p_yea_info.cur_ntax_I01	:= g_balance_value_tab(58).balance_value + g_balance_value_tab(59).balance_value;
4209 		p_yea_info.cur_ntax_K01	:= g_balance_value_tab(60).balance_value + g_balance_value_tab(61).balance_value;
4210 		p_yea_info.cur_ntax_M01	:= g_balance_value_tab(62).balance_value + g_balance_value_tab(63).balance_value;
4211 		p_yea_info.cur_ntax_M02	:= g_balance_value_tab(64).balance_value + g_balance_value_tab(65).balance_value;
4212 		p_yea_info.cur_ntax_M03	:= g_balance_value_tab(66).balance_value + g_balance_value_tab(67).balance_value;
4213 		p_yea_info.cur_ntax_S01	:= g_balance_value_tab(68).balance_value + g_balance_value_tab(69).balance_value;
4214 		-- Bug 9737699
4215 		-- p_yea_info.cur_ntax_T01	:= g_balance_value_tab(70).balance_value + g_balance_value_tab(71).balance_value;
4216 		p_yea_info.cur_ntax_Y01	:= g_balance_value_tab(72).balance_value + g_balance_value_tab(73).balance_value;
4217 		p_yea_info.cur_ntax_Y02	:= g_balance_value_tab(74).balance_value + g_balance_value_tab(75).balance_value;
4218 		p_yea_info.cur_ntax_Y03	:= g_balance_value_tab(76).balance_value + g_balance_value_tab(77).balance_value;
4219 		p_yea_info.cur_ntax_Y20	:= g_balance_value_tab(78).balance_value + g_balance_value_tab(79).balance_value;
4220 		p_yea_info.cur_ntax_Z01	:= g_balance_value_tab(80).balance_value + g_balance_value_tab(81).balance_value;
4221 		p_yea_info.cur_ntax_Y21	:= g_balance_value_tab(90).balance_value + g_balance_value_tab(91).balance_value; -- Bug 9737699
4222  		p_yea_info.cur_ntax_ZZ	:= g_balance_value_tab(95).balance_value + g_balance_value_tab(96).balance_value; -- Bug 9737699
4223 		p_yea_info.cur_ntax_H14	:= g_balance_value_tab(99).balance_value + g_balance_value_tab(100).balance_value; --Bug 14754822
4224 		p_yea_info.cur_ntax_H15	:= g_balance_value_tab(101).balance_value + g_balance_value_tab(102).balance_value;
4225 		p_yea_info.cur_ntax_T10	:= g_balance_value_tab(103).balance_value + g_balance_value_tab(104).balance_value;
4226 		p_yea_info.cur_ntax_T20	:= g_balance_value_tab(105).balance_value + g_balance_value_tab(106).balance_value;
4227 		--
4228 		p_yea_info.cur_smb_eligible_income	:= g_balance_value_tab(88).balance_value
4229 							 + g_balance_value_tab(89).balance_value;	-- Bug 9079450
4230 		--
4231 		l_cur_sp_irreg_bonus_mth	:= g_balance_value_tab(1).balance_value;
4232 		l_cur_sp_irreg_bonus_bon	:= g_balance_value_tab(2).balance_value;
4233 		l_cur_taxable_mth		:= g_balance_value_tab(3).balance_value;
4234 		l_cur_taxable_bon		:= g_balance_value_tab(4).balance_value;
4235 		p_yea_info.cur_taxable_mth	:= l_cur_taxable_mth - l_cur_sp_irreg_bonus_mth;
4236 		p_yea_info.cur_taxable_bon	:= l_cur_taxable_bon - l_cur_sp_irreg_bonus_bon;
4237 		p_yea_info.cur_sp_irreg_bonus	:= l_cur_sp_irreg_bonus_mth + l_cur_sp_irreg_bonus_bon;
4238 		p_yea_info.non_taxable_ovs	:= g_balance_value_tab(7).balance_value
4239 						 + g_balance_value_tab(8).balance_value;
4240 		p_yea_info.non_taxable_ovt	:= g_balance_value_tab(9).balance_value
4241 						 + g_balance_value_tab(10).balance_value;
4242 		p_yea_info.cur_non_taxable_ovt	:= p_yea_info.non_taxable_ovt;			-- Bug 8644512
4243 		p_yea_info.non_taxable_ovs_frgn	:= g_balance_value_tab(32).balance_value
4244 						 + g_balance_value_tab(33).balance_value; -- Bug 7439803
4245 		--
4246 		-- Bug 8644512
4247 		if p_effective_date >= c_20090101 then
4248 		  p_yea_info.non_taxable_oth	:= 0;
4249 		  p_yea_info.non_rep_non_taxable := g_balance_value_tab(22).balance_value
4250 						  + g_balance_value_tab(23).balance_value; -- Bug 9079450
4251 		--
4252 		elsif p_effective_date >= c_20060101 and p_effective_date < c_20090101 then
4253                   p_yea_info.non_taxable_oth	:= g_balance_value_tab(5).balance_value
4254 						 + g_balance_value_tab(6).balance_value
4255 						 + g_balance_value_tab(22).balance_value -- Bug 5756699
4256 						 + g_balance_value_tab(23).balance_value
4257 						 - p_yea_info.non_taxable_ovs
4258 						 - p_yea_info.non_taxable_ovt
4259 						 - g_balance_value_tab(30).balance_value -- Bug 7142620
4260 						 - g_balance_value_tab(31).balance_value -- Bug 7142620
4261 						 - p_yea_info.non_taxable_ovs_frgn;      -- Bug 7439803
4262 		else
4263                   p_yea_info.non_taxable_oth	:= g_balance_value_tab(5).balance_value
4264 						 + g_balance_value_tab(6).balance_value
4265 						 - p_yea_info.non_taxable_ovs
4266 						 - p_yea_info.non_taxable_ovt
4267 						 - p_yea_info.non_taxable_ovs_frgn;      -- Bug 7439803
4268 		end if;
4269 		--
4270 		-- bug 6012258
4271 		l_stock_pur_opt_exec_earn_mth   := g_balance_value_tab(24).balance_value;
4272 		l_stock_pur_opt_exec_earn_bon   := g_balance_value_tab(25).balance_value;
4273 		l_research_payment_mth		:= g_balance_value_tab(26).balance_value;
4274 		l_research_payment_bon		:= g_balance_value_tab(27).balance_value;
4275 		p_yea_info.cur_stck_pur_opt_exec_earn := l_stock_pur_opt_exec_earn_mth + l_stock_pur_opt_exec_earn_bon;
4276 		p_yea_info.research_payment        := l_research_payment_mth + l_research_payment_bon;
4277 		-- Bug 7142620
4278 		l_birth_raising_allowance_mth	:= g_balance_value_tab(30).balance_value;
4279 		l_birth_raising_allowance_bon	:= g_balance_value_tab(31).balance_value;
4280 		p_yea_info.birth_raising_allowance := l_birth_raising_allowance_mth +  l_birth_raising_allowance_bon ;
4281 		p_yea_info.cur_birth_raising_allowance := p_yea_info.birth_raising_allowance;
4282 		--End of Bug 7142620
4283                 --
4284 		-- Bug 8644512
4285 		p_yea_info.cur_esop_withd_earn	:= g_balance_value_tab(34).balance_value
4286 						 + g_balance_value_tab(35).balance_value;
4287 		--
4288 		p_yea_info.hi_prem		:= greatest(nvl(g_balance_value_tab(11).balance_value,0),0); -- Bug 6726096
4289 		p_yea_info.ei_prem		:= greatest(nvl(g_balance_value_tab(12).balance_value,0),0); -- Bug 6726096
4290 		p_yea_info.np_prem		:= g_balance_value_tab(13).balance_value;
4291 		p_yea_info.pen_prem		:= g_balance_value_tab(28).balance_value;    -- Bug 6024342
4292 		--
4293 		-- Bug 9737699
4294 		p_yea_info.military_pen_prem		:= g_balance_value_tab(92).balance_value;
4295 		p_yea_info.private_school_pen_prem	:= g_balance_value_tab(93).balance_value;
4296 		p_yea_info.post_office_pen_prem		:= g_balance_value_tab(94).balance_value;
4297 		--
4298 		p_yea_info.long_term_ins_prem := greatest(nvl(g_balance_value_tab(29).balance_value,0),0); -- Bug 7164589
4299 		--
4300                 -- need to add Adjustment Amounts because now run_type for YEA process is not MTH
4301                 --
4302 		p_yea_info.cur_itax		:= g_balance_value_tab(14).balance_value
4303 						 + g_balance_value_tab(15).balance_value;
4304 		p_yea_info.cur_rtax		:= g_balance_value_tab(16).balance_value
4305 						 + g_balance_value_tab(17).balance_value;
4306 		p_yea_info.cur_stax		:= g_balance_value_tab(18).balance_value
4307 						 + g_balance_value_tab(19).balance_value;
4308 		-- Added for bug 3201332
4309 		p_yea_info.monthly_reg_earning	:= g_balance_value_tab(20).balance_value;
4310                 --
4311 		--
4312 		-- Bug : 4750653
4313 		l_corp_pension_prem_bal_value    := g_balance_value_tab(21).balance_value+
4314 		                                   p_yea_info.corp_pension_prem;
4315 		--
4316                 if g_debug then
4317                    hr_utility.trace('p_yea_info.cur_itax '||to_char(p_yea_info.cur_itax));
4318                    hr_utility.trace('p_yea_info.cur_rtax '||to_char(p_yea_info.cur_rtax));
4319                    hr_utility.trace('p_yea_info.cur_stax '||to_char(p_yea_info.cur_stax));
4320                 end if;
4321                 --
4322 	end if;
4323 	close csr_assact;
4324 	------------------------------------------------------------------------
4325 	-- Derive Dependent Information.
4326 	-- This code will be changed in the near future by using PER_CONTACT_RELATIONSHIPS.
4327 	------------------------------------------------------------------------
4328 	--
4329 	if g_debug then
4330 		hr_utility.set_location('pay_kr_yea_pkg.yea_info.',40);
4331 	end if;
4332 	--
4333 	l_dummy := pay_kr_ff_functions_pkg.get_dependent_info(
4334 			p_assignment_id			=> p_assignment_id,
4335 			p_date_earned			=> p_effective_date,
4336 			p_non_resident_flag		=> p_yea_info.non_resident_flag,
4337 			p_dpnt_spouse_flag		=> p_yea_info.dpnt_spouse_flag,
4338 			p_num_of_aged_dpnts		=> p_yea_info.num_of_aged_dpnts,
4339 			p_num_of_adult_dpnts		=> p_yea_info.num_of_adult_dpnts,
4340 			p_num_of_underaged_dpnts	=> p_yea_info.num_of_underaged_dpnts,
4341 			p_num_of_dpnts			=> p_yea_info.num_of_dpnts,
4342 			p_num_of_ageds			=> p_yea_info.num_of_ageds,
4343 			p_num_of_disableds		=> p_yea_info.num_of_disableds,
4344 			p_female_ee_flag		=> p_yea_info.female_ee_flag,
4345 			p_num_of_children		=> p_yea_info.num_of_children,
4346 			-- Bug 3172960
4347 			p_num_of_super_ageds		=> p_yea_info.num_of_super_ageds,
4348 			-- Bug 6705170
4349 			p_num_of_new_born_adopted       => p_yea_info.num_of_new_born_adopted,
4350 			-- Bug 6784288
4351 			p_num_of_addtl_child            => p_yea_info.num_of_addtl_child,
4352 			-- Bug 9737699
4353       p_single_parent_flag          => p_yea_info.single_parent_flag,
4354 			p_house_holder_flag		=> p_yea_info.house_holder_flag,
4355 			p_tot_num_dpnts			=> p_yea_info.tot_num_dpnts
4356 		);
4357 	------------------------------------------------------------------------
4358 	-- Derive YEA Information from assignment EIT.
4359 	------------------------------------------------------------------------
4360 	if g_debug then
4361 		hr_utility.set_location('pay_kr_yea_pkg.yea_info.',50);
4362 	end if;
4363 	--
4364 	------------------------------------------------------------------------
4365 	-- Bug 8644512
4366 	------------------------------------------------------------------------
4367 	ntax_earnings(
4368 		p_assignment_id		=> p_assignment_id,
4369 		p_effective_date	=> p_effective_date,
4370 		p_ntax_detail_tbl	=> g_ntax_detail_tbl
4371 		);
4372 
4373 spec_don_details_grpby_year(
4374 	p_assignment_id			=> p_assignment_id,
4375 	p_effective_date		=> p_effective_date,
4376 	p_business_group_id             => p_business_group_id,
4377 	p_new_donation_calc_flag        => p_yea_info.new_donation_calc_flag,
4378 	p_don_priority_flag             => p_yea_info.don_priority_flag,
4379 	p_spec_rel_amt_grpby_year_tbl	=> p_yea_info.spec_rel_amt_grpby_year_tbl,
4380 	p_spec_rel_grpby_don_year_tbl	=> p_yea_info.spec_rel_grpby_don_year_tbl,
4381 	p_rel_amt_exem_grpby_year_tbl   => p_yea_info.rel_amt_exem_grpby_year_tbl,
4382 	p_rel_grpby_don_year_tbl        => p_yea_info.rel_grpby_don_year_tbl);
4383 
4384 	-- Bug 9393732
4385 	pledt_donation_details(
4386 		p_assignment_id			=> p_assignment_id,
4387 		p_effective_date		=> p_effective_date,
4388 		p_don_priority_flag             => p_yea_info.don_priority_flag,
4389 		p_pledt_asg_info_id_tbl		=> p_yea_info.pledt_asg_info_id_tbl,
4390 		p_pledt_amt_sub_to_exem_tbl	=> p_yea_info.pledt_amt_sub_to_exem_tbl,
4391 		p_pledt_donated_year_tbl	=> p_yea_info.pledt_donated_year_tbl);
4392 
4393 	-- Bug 9393732
4394 	tlaw_donation_details(
4395 		p_assignment_id			=> p_assignment_id,
4396 		p_effective_date		=> p_effective_date,
4397 		p_don_priority_flag             => p_yea_info.don_priority_flag,
4398 		p_tlaw_asg_info_id_tbl		=> p_yea_info.tlaw_asg_info_id_tbl,
4399 		p_tlaw_amt_sub_to_exem_tbl	=> p_yea_info.tlaw_amt_sub_to_exem_tbl,
4400 		p_tlaw_donated_year_tbl		=> p_yea_info.tlaw_donated_year_tbl);
4401 
4402 	-- Bug 9393732
4403 	stat_donation_details(
4404 		p_assignment_id			=> p_assignment_id,
4405 		p_effective_date		=> p_effective_date,
4406 		p_don_priority_flag             => p_yea_info.don_priority_flag,
4407 		p_stat_asg_info_id_tbl		=> p_yea_info.stat_asg_info_id_tbl,
4408 		p_stat_amt_sub_to_exem_tbl	=> p_yea_info.stat_amt_sub_to_exem_tbl,
4409 		p_stat_donated_year_tbl		=> p_yea_info.stat_donated_year_tbl);
4410 
4411 	-- Bug 9393732
4412 	specified_donation_details(
4413 		p_assignment_id			=> p_assignment_id,
4414 		p_effective_date		=> p_effective_date,
4415 		p_spec_asg_info_id_tbl		=> p_yea_info.spec_asg_info_id_tbl,
4416 		p_spec_donated_year_tbl		=> p_yea_info.spec_donated_year_tbl,
4417 		p_spec_amt_sub_to_exem_tbl	=> p_yea_info.spec_amt_sub_to_exem_tbl);
4418 
4419 	-- Bug 9393732
4420 	religious_donation_details(
4421 		p_assignment_id			=> p_assignment_id,
4422 		p_effective_date		=> p_effective_date,
4423 		p_rel_asg_info_id_tbl		=> p_yea_info.rel_asg_info_id_tbl,
4424 		p_rel_donated_year_tbl		=> p_yea_info.rel_donated_year_tbl,
4425 		p_rel_amt_sub_to_exem_tbl	=> p_yea_info.rel_amt_sub_to_exem_tbl);
4426 
4427 
4428 spec_rel_donation_details(
4429 	p_assignment_id			=> p_assignment_id,
4430 	p_effective_date		=> p_effective_date,
4431 	p_don_priority_flag             => p_yea_info.don_priority_flag,
4432 	p_spec_rel_asg_info_id_tbl	=> p_yea_info.spec_rel_asg_info_id_tbl,
4433 	p_spec_rel_donated_year_tbl	=> p_yea_info.spec_rel_donated_year_tbl,
4434       	p_spec_rel_amt_sub_to_exem_tbl	=> p_yea_info.spec_rel_amt_sub_to_exem_tbl,
4435 	p_spec_rel_don_code_tbl             => p_yea_info.spec_rel_don_code_tbl);
4436 --
4437 
4438 	sep_pen_details(
4439 	        p_assignment_id		=> p_assignment_id,
4440 		p_effective_date	=> p_effective_date,
4441 		p_priority_tbl          => p_yea_info.sep_pen_priority_tbl,
4442 		p_fin_institute_tbl     => p_yea_info.sep_pen_fin_institute_tbl,
4443 		p_acc_number_tbl	=> p_yea_info.sep_pen_acc_number_tbl,
4444 		p_cont_amount_tbl	=> p_yea_info.sep_pen_cont_amount_tbl,
4445 		p_type_tbl		=> p_yea_info.sep_pen_type_tbl,
4446 		p_exem_amount_tbl	=> p_yea_info.sep_pen_exem_amount_tbl);
4447 
4448 
4449 	for i in 1..p_yea_info.sep_pen_type_tbl.count loop
4450 	p_yea_info.sep_pen_exem_amount_tbl(i) := null;
4451 	end loop;
4452 	pen_saving_details(
4453 	        p_assignment_id		=> p_assignment_id,
4454 		p_effective_date	=> p_effective_date,
4455 		p_priority_tbl          => p_yea_info.pen_saving_priority_tbl,
4456 		p_fin_institute_tbl     => p_yea_info.pen_saving_fin_institute_tbl,
4457 		p_acc_number_tbl	=> p_yea_info.pen_saving_acc_number_tbl,
4458 		p_cont_amount_tbl	=> p_yea_info.pen_saving_cont_amount_tbl,
4459 		p_type_tbl		=> p_yea_info.pen_saving_type_tbl,
4460 		p_exem_amount_tbl	=> p_yea_info.pen_saving_exem_amount_tbl);
4461 	for i in 1..p_yea_info.pen_saving_type_tbl.count loop
4462 	p_yea_info.pen_saving_exem_amount_tbl(i) := null;
4463 	end loop;
4464 	hou_saving_details(
4465 	        p_assignment_id		=> p_assignment_id,
4466 		p_effective_date	=> p_effective_date,
4467 		p_priority_tbl          => p_yea_info.hou_saving_priority_tbl,
4468 		p_fin_institute_tbl     => p_yea_info.hou_saving_fin_institute_tbl,
4469 		p_acc_number_tbl	=> p_yea_info.hou_saving_acc_number_tbl,
4470 		p_cont_amount_tbl	=> p_yea_info.hou_saving_cont_amount_tbl,
4471 		p_type_tbl		=> p_yea_info.hou_saving_type_tbl,
4472 		p_exem_amount_tbl	=> p_yea_info.hou_saving_exem_amount_tbl);
4473 	for i in 1..p_yea_info.hou_saving_type_tbl.count loop
4474 	p_yea_info.hou_saving_exem_amount_tbl(i) := null;
4475 	end loop;
4476 	lt_stock_saving_details(
4477 	        p_assignment_id		=> p_assignment_id,
4478 		p_effective_date	=> p_effective_date,
4479 		p_priority_tbl          => p_yea_info.lt_stck_saving_priority_tbl,
4480 		p_fin_institute_tbl     => p_yea_info.lt_stck_saving_fin_inst_tbl,
4481 		p_acc_number_tbl	=> p_yea_info.lt_stck_saving_acc_number_tbl,
4482 		p_cont_amount_tbl	=> p_yea_info.lt_stck_saving_cont_amt_tbl,
4483 		p_type_tbl		=> p_yea_info.lt_stck_saving_type_tbl,
4484 		p_exem_amount_tbl	=> p_yea_info.lt_stck_saving_exem_amt_tbl);
4485 	for i in 1..p_yea_info.lt_stck_saving_type_tbl.count loop
4486 	p_yea_info.lt_stck_saving_exem_amt_tbl(i) := null;
4487 	end loop;
4488 	------------------------------------------------------------------------
4489 	-- Previous Employers' Information
4490 	------------------------------------------------------------------------
4491 	prev_er_info(
4492 		p_assignment_id			=> p_assignment_id,
4493 		p_effective_date		=> p_effective_date,
4494 		p_hire_date_tbl			=> p_yea_info.prev_hire_date_tbl,		-- Bug 8644512
4495 		p_termination_date_tbl		=> p_yea_info.prev_termination_date_tbl,
4496 		p_corp_name_tbl			=> p_yea_info.prev_corp_name_tbl,
4497 		p_bp_number_tbl			=> p_yea_info.prev_bp_number_tbl,
4498 		p_tax_brk_pd_from_tbl		=> p_yea_info.prev_tax_brk_pd_from_tbl,		-- Bug 8644512
4499 		p_tax_brk_pd_to_tbl		=> p_yea_info.prev_tax_brk_pd_to_tbl,		-- Bug 8644512
4500 		p_taxable_mth_tbl		=> p_yea_info.prev_taxable_mth_tbl,
4501 		p_taxable_bon_tbl		=> p_yea_info.prev_taxable_bon_tbl,
4502 		p_sp_irreg_bonus_tbl		=> p_yea_info.prev_sp_irreg_bonus_tbl,
4503 		p_stck_pur_opt_exec_earn_tbl    => p_yea_info.prev_stck_pur_opt_exe_earn_tbl,	-- Bug 6024342
4504 		p_non_taxable_ovs_tbl		=> p_yea_info.prev_non_taxable_ovs_tbl,
4505 		p_non_taxable_ovt_tbl		=> p_yea_info.prev_non_taxable_ovt_tbl,
4506 		p_non_taxable_oth_tbl		=> p_yea_info.prev_non_taxable_oth_tbl,
4507 		p_hi_prem_tbl			=> p_yea_info.prev_hi_prem_tbl,
4508 		p_ltci_prem_tbl			=> p_yea_info.prev_ltci_prem_tbl,  -- Bug 7260606
4509 		p_ei_prem_tbl			=> p_yea_info.prev_ei_prem_tbl,
4510 		p_np_prem_tbl			=> p_yea_info.prev_np_prem_tbl,
4511 		p_pen_prem_tbl			=> p_yea_info.prev_pen_prem_tbl,	-- Bug 6024342
4512 		p_military_pen_prem_tbl		=> p_yea_info.prev_military_pen_prem_tbl,	-- Bug 9737699
4513 		p_private_school_pen_prem_tbl	=> p_yea_info.prev_pri_school_pen_prem_tbl,	-- Bug 9737699
4514 		p_post_office_pen_prem_tbl	=> p_yea_info.prev_post_office_pen_prem_tbl,	-- Bug 9737699
4515 		p_separation_pension_tbl	=> p_yea_info.prev_separation_pension_tbl, 	-- Bug 7508706
4516 		p_itax_tbl			=> p_yea_info.prev_itax_tbl,
4517 		p_rtax_tbl			=> p_yea_info.prev_rtax_tbl,
4518 		p_stax_tbl			=> p_yea_info.prev_stax_tbl,
4519 		p_research_payment_tbl          => p_yea_info.prev_research_payment_tbl,         -- Bug 8341054
4520 		p_bir_raising_allowance_tbl     => p_yea_info.prev_bir_raising_allowance_tbl,      -- Bug 8341054
4521 		p_foreign_worker_exem_tbl       => p_yea_info.prev_foreign_wrkr_inc_exem_tbl,      -- Bug 8341054
4522 		p_esop_withd_earn_tbl		=> p_yea_info.prev_esop_withd_earn_tbl,		-- Bug 8644512
4523 		p_prev_ntax_R10_tbl		=> p_yea_info.prev_ntax_R10_tbl,	--Bug 12807687
4524 		p_prev_ntax_G01_tbl		=> p_yea_info.prev_ntax_G01_tbl,	-- Bug 8644512
4525 		p_prev_ntax_H01_tbl		=> p_yea_info.prev_ntax_H01_tbl,	-- Bug 8644512
4526 		p_prev_ntax_H05_tbl		=> p_yea_info.prev_ntax_H05_tbl,	-- Bug 8644512
4527 		p_prev_ntax_H06_tbl		=> p_yea_info.prev_ntax_H06_tbl,	-- Bug 8644512
4528 		p_prev_ntax_H07_tbl		=> p_yea_info.prev_ntax_H07_tbl,	-- Bug 8644512
4529 		p_prev_ntax_H08_tbl		=> p_yea_info.prev_ntax_H08_tbl,	-- Bug 8644512
4530 		p_prev_ntax_H09_tbl		=> p_yea_info.prev_ntax_H09_tbl,	-- Bug 8644512
4531 		p_prev_ntax_H10_tbl		=> p_yea_info.prev_ntax_H10_tbl,	-- Bug 8644512
4532 		p_prev_ntax_H11_tbl		=> p_yea_info.prev_ntax_H11_tbl,	-- Bug 8644512
4533 		p_prev_ntax_H12_tbl		=> p_yea_info.prev_ntax_H12_tbl,	-- Bug 8644512
4534 		p_prev_ntax_H13_tbl		=> p_yea_info.prev_ntax_H13_tbl,	-- Bug 8644512
4535 		p_prev_ntax_I01_tbl		=> p_yea_info.prev_ntax_I01_tbl,	-- Bug 8644512
4536 		p_prev_ntax_K01_tbl		=> p_yea_info.prev_ntax_K01_tbl,	-- Bug 8644512
4537 		p_prev_ntax_M01_tbl		=> p_yea_info.prev_ntax_M01_tbl,	-- Bug 8644512
4538 		p_prev_ntax_M02_tbl		=> p_yea_info.prev_ntax_M02_tbl,	-- Bug 8644512
4539 		p_prev_ntax_M03_tbl		=> p_yea_info.prev_ntax_M03_tbl,	-- Bug 8644512
4540 		p_prev_ntax_S01_tbl		=> p_yea_info.prev_ntax_S01_tbl,	-- Bug 8644512
4541 		p_prev_ntax_T01_tbl		=> p_yea_info.prev_ntax_T01_tbl,	-- Bug 8644512
4542 		p_prev_ntax_Y01_tbl		=> p_yea_info.prev_ntax_Y01_tbl,	-- Bug 8644512
4543 		p_prev_ntax_Y02_tbl		=> p_yea_info.prev_ntax_Y02_tbl,	-- Bug 8644512
4544 		p_prev_ntax_Y03_tbl		=> p_yea_info.prev_ntax_Y03_tbl,	-- Bug 8644512
4545 		p_prev_ntax_Y20_tbl		=> p_yea_info.prev_ntax_Y20_tbl,	-- Bug 8644512
4546 		p_prev_ntax_Y21_tbl		=> p_yea_info.prev_ntax_Y21_tbl,	-- Bug 9737699
4547 		p_prev_ntax_ZZ_tbl		=> p_yea_info.prev_ntax_ZZ_tbl,		-- Bug 9737699
4548 		p_prev_ntax_Z01_tbl		=> p_yea_info.prev_ntax_Z01_tbl,		-- Bug 8644512
4549 		p_prev_ntax_tax_brk_tbl		=> p_yea_info.prev_ntax_tax_brk_tbl,	-- Bug 9737699
4550 		p_prev_ntax_H14_tbl		=> p_yea_info.prev_ntax_H14_tbl,	--Bug 14754822
4551 		p_prev_ntax_H15_tbl		=> p_yea_info.prev_ntax_H15_tbl,
4552 		p_prev_ntax_T10_tbl		=> p_yea_info.prev_ntax_T10_tbl,
4553 		p_prev_ntax_T20_tbl		=> p_yea_info.prev_ntax_T20_tbl);
4554 
4555 	for i in 1..p_yea_info.prev_termination_date_tbl.count loop
4556 		p_yea_info.prev_taxable_mth	:= p_yea_info.prev_taxable_mth + p_yea_info.prev_taxable_mth_tbl(i);
4557 		p_yea_info.prev_taxable_bon	:= p_yea_info.prev_taxable_bon + p_yea_info.prev_taxable_bon_tbl(i);
4558 		p_yea_info.prev_sp_irreg_bonus	:= p_yea_info.prev_sp_irreg_bonus + p_yea_info.prev_sp_irreg_bonus_tbl(i);
4559 		-- Bug 6024342
4560 		p_yea_info.prev_stck_pur_opt_exec_earn := p_yea_info.prev_stck_pur_opt_exec_earn + p_yea_info.prev_stck_pur_opt_exe_earn_tbl(i);
4561 		--
4562 		p_yea_info.non_taxable_ovs	:= p_yea_info.non_taxable_ovs + p_yea_info.prev_non_taxable_ovs_tbl(i);
4563 		p_yea_info.prev_non_taxable_ovt	:= nvl(p_yea_info.prev_non_taxable_ovt,0) + p_yea_info.prev_non_taxable_ovt_tbl(i);
4564 		p_yea_info.non_taxable_oth	:= nvl(p_yea_info.non_taxable_oth,0) + p_yea_info.prev_non_taxable_oth_tbl(i);
4565 		p_yea_info.hi_prem		:= p_yea_info.hi_prem + p_yea_info.prev_hi_prem_tbl(i);
4566 		p_yea_info.long_term_ins_prem	:= p_yea_info.long_term_ins_prem + p_yea_info.prev_ltci_prem_tbl(i); -- Bug 7260606
4567 		p_yea_info.ei_prem		:= p_yea_info.ei_prem + p_yea_info.prev_ei_prem_tbl(i);
4568 		p_yea_info.np_prem		:= p_yea_info.np_prem + p_yea_info.prev_np_prem_tbl(i);
4569 		p_yea_info.pen_prem		:= p_yea_info.pen_prem + p_yea_info.prev_pen_prem_tbl(i);  -- Bug 6024342
4570 		p_yea_info.military_pen_prem	:= p_yea_info.military_pen_prem + p_yea_info.prev_military_pen_prem_tbl(i);  -- Bug 9737699
4571 		p_yea_info.private_school_pen_prem := p_yea_info.private_school_pen_prem + p_yea_info.prev_pri_school_pen_prem_tbl(i);  -- Bug 9737699
4572 		p_yea_info.post_office_pen_prem := p_yea_info.post_office_pen_prem + p_yea_info.prev_post_office_pen_prem_tbl(i);  -- Bug 9737699
4573 		--
4574 		p_yea_info.corp_pension_prem    := p_yea_info.corp_pension_prem + p_yea_info.prev_separation_pension_tbl(i); -- Bug 7508706
4575 		p_yea_info.prev_itax		:= p_yea_info.prev_itax + p_yea_info.prev_itax_tbl(i);
4576 		p_yea_info.prev_rtax		:= p_yea_info.prev_rtax + p_yea_info.prev_rtax_tbl(i);
4577 		p_yea_info.prev_stax		:= p_yea_info.prev_stax + p_yea_info.prev_stax_tbl(i);
4578                 p_yea_info.research_payment     := p_yea_info.research_payment + p_yea_info.prev_research_payment_tbl(i);                -- Bug 8341054
4579 		p_yea_info.prev_birth_raising_allowance := nvl(p_yea_info.prev_birth_raising_allowance,0) + p_yea_info.prev_bir_raising_allowance_tbl(i); -- Bug 8341054
4580 		p_yea_info.prev_foreign_wrkr_inc_exem := nvl(p_yea_info.prev_foreign_wrkr_inc_exem,0) + p_yea_info.prev_foreign_wrkr_inc_exem_tbl(i);
4581 		p_yea_info.prev_esop_withd_earn	:= nvl(p_yea_info.prev_esop_withd_earn,0) + p_yea_info.prev_esop_withd_earn_tbl(i); -- Bug 8644512
4582 		--
4583 		-- Bug 8644512
4584 		--
4585 		p_yea_info.prev_ntax_R10	:= nvl(p_yea_info.prev_ntax_R10,0) + p_yea_info.prev_ntax_R10_tbl(i); --Bug 12807687
4586 		p_yea_info.prev_ntax_G01	:= nvl(p_yea_info.prev_ntax_G01,0) + p_yea_info.prev_ntax_G01_tbl(i);
4587 		p_yea_info.prev_ntax_H01	:= nvl(p_yea_info.prev_ntax_H01,0) + p_yea_info.prev_ntax_H01_tbl(i);
4588 		p_yea_info.prev_ntax_H05	:= nvl(p_yea_info.prev_ntax_H05,0) + p_yea_info.prev_ntax_H05_tbl(i);
4589 		p_yea_info.prev_ntax_H06	:= nvl(p_yea_info.prev_ntax_H06,0) + p_yea_info.prev_ntax_H06_tbl(i);
4590 		p_yea_info.prev_ntax_H07	:= nvl(p_yea_info.prev_ntax_H07,0) + p_yea_info.prev_ntax_H07_tbl(i);
4591 		p_yea_info.prev_ntax_H08	:= nvl(p_yea_info.prev_ntax_H08,0) + p_yea_info.prev_ntax_H08_tbl(i);
4592 		p_yea_info.prev_ntax_H09	:= nvl(p_yea_info.prev_ntax_H09,0) + p_yea_info.prev_ntax_H09_tbl(i);
4593 		p_yea_info.prev_ntax_H10	:= nvl(p_yea_info.prev_ntax_H10,0) + p_yea_info.prev_ntax_H10_tbl(i);
4594 		p_yea_info.prev_ntax_H11	:= nvl(p_yea_info.prev_ntax_H11,0) + p_yea_info.prev_ntax_H11_tbl(i);
4595 		p_yea_info.prev_ntax_H12	:= nvl(p_yea_info.prev_ntax_H12,0) + p_yea_info.prev_ntax_H12_tbl(i);
4596 		p_yea_info.prev_ntax_H13	:= nvl(p_yea_info.prev_ntax_H13,0) + p_yea_info.prev_ntax_H13_tbl(i);
4597 		p_yea_info.prev_ntax_I01	:= nvl(p_yea_info.prev_ntax_I01,0) + p_yea_info.prev_ntax_I01_tbl(i);
4598 		p_yea_info.prev_ntax_K01	:= nvl(p_yea_info.prev_ntax_K01,0) + p_yea_info.prev_ntax_K01_tbl(i);
4599 		p_yea_info.prev_ntax_M01	:= nvl(p_yea_info.prev_ntax_M01,0) + p_yea_info.prev_ntax_M01_tbl(i);
4600 		p_yea_info.prev_ntax_M02	:= nvl(p_yea_info.prev_ntax_M02,0) + p_yea_info.prev_ntax_M02_tbl(i);
4601 		p_yea_info.prev_ntax_M03	:= nvl(p_yea_info.prev_ntax_M03,0) + p_yea_info.prev_ntax_M03_tbl(i);
4602 		p_yea_info.prev_ntax_S01	:= nvl(p_yea_info.prev_ntax_S01,0) + p_yea_info.prev_ntax_S01_tbl(i);
4603 		p_yea_info.prev_ntax_T01	:= nvl(p_yea_info.prev_ntax_T01,0) + p_yea_info.prev_ntax_T01_tbl(i);
4604 		p_yea_info.prev_ntax_Y01	:= nvl(p_yea_info.prev_ntax_Y01,0) + p_yea_info.prev_ntax_Y01_tbl(i);
4605 		p_yea_info.prev_ntax_Y02	:= nvl(p_yea_info.prev_ntax_Y02,0) + p_yea_info.prev_ntax_Y02_tbl(i);
4606 		p_yea_info.prev_ntax_Y03	:= nvl(p_yea_info.prev_ntax_Y03,0) + p_yea_info.prev_ntax_Y03_tbl(i);
4607 		p_yea_info.prev_ntax_Y20	:= nvl(p_yea_info.prev_ntax_Y20,0) + p_yea_info.prev_ntax_Y20_tbl(i);
4608 		p_yea_info.prev_ntax_Y21	:= nvl(p_yea_info.prev_ntax_Y21,0) + p_yea_info.prev_ntax_Y21_tbl(i); -- Bug 9737699
4609 		p_yea_info.prev_ntax_ZZ		:= nvl(p_yea_info.prev_ntax_ZZ,0) + p_yea_info.prev_ntax_ZZ_tbl(i); -- Bug 9737699
4610 		p_yea_info.prev_ntax_Z01	:= nvl(p_yea_info.prev_ntax_Z01,0) + p_yea_info.prev_ntax_Z01_tbl(i);
4611 		p_yea_info.prev_ntax_H14	:= nvl(p_yea_info.prev_ntax_H14,0) + p_yea_info.prev_ntax_H14_tbl(i); --Bug 14754822
4612 		p_yea_info.prev_ntax_H15	:= nvl(p_yea_info.prev_ntax_H15,0) + p_yea_info.prev_ntax_H15_tbl(i);
4613 		p_yea_info.prev_ntax_T10	:= nvl(p_yea_info.prev_ntax_T10,0) + p_yea_info.prev_ntax_T10_tbl(i);
4614 		p_yea_info.prev_ntax_T20	:= nvl(p_yea_info.prev_ntax_T20,0) + p_yea_info.prev_ntax_T20_tbl(i);
4615 		p_yea_info.prev_ntax_tax_brk	:= nvl(p_yea_info.prev_ntax_tax_brk,0) + p_yea_info.prev_ntax_tax_brk_tbl(i); -- Bug 9737699
4616 		--
4617 	end loop;
4618 	------------------------------------------------------------------------
4619 	-- Bug 7361372: Tax Group Information
4620 	------------------------------------------------------------------------
4621 	tax_group_info(
4622 	        p_assignment_id		 => p_assignment_id,
4623 		p_effective_date	 => p_effective_date,
4624 		p_bus_reg_num            => p_yea_info.tax_grp_bus_reg_num,
4625 		p_tax_grp_name           => p_yea_info.tax_grp_name,
4626 		p_wkpd_from		 => p_yea_info.tax_grp_wkpd_from,		-- Bug 8644512
4627 		p_wkpd_to		 => p_yea_info.tax_grp_wkpd_to,			-- Bug 8644512
4628 		p_tax_brk_pd_from	 => p_yea_info.tax_grp_tax_brk_pd_from,		-- Bug 8644512
4629 		p_tax_brk_pd_to		 => p_yea_info.tax_grp_tax_brk_pd_to,		-- Bug 8644512
4630 		p_taxable_mth            => p_yea_info.tax_grp_taxable_mth,
4631 		p_taxable_bon            => p_yea_info.tax_grp_taxable_bon,
4632 		p_sp_irreg_bonus         => p_yea_info.tax_grp_sp_irreg_bonus,
4633 		p_stck_pur_opt_exec_earn => p_yea_info.tax_grp_stck_pur_opt_exec_earn,
4634 		p_esop_withd_earn	 => p_yea_info.tax_grp_esop_withd_earn,		-- Bug 8644512
4635 		p_taxable_mth_ne         => p_yea_info.tax_grp_taxable_mth_ne,		-- Bug 7508706
4636 		p_taxable_bon_ne         => p_yea_info.tax_grp_taxable_bon_ne,		-- Bug 7508706
4637 		p_sp_irreg_bonus_ne      => p_yea_info.tax_grp_sp_irreg_bonus_ne,	-- Bug 7508706
4638 		p_stck_pur_ne 		 => p_yea_info.tax_grp_stck_pur_ne,		-- Bug 7508706
4639 		p_esop_withd_earn_ne	 => p_yea_info.tax_grp_esop_withd_earn_ne,	-- Bug 8644512
4640 		p_non_taxable_ovt	 => p_yea_info.tax_grp_non_taxable_ovt,		-- Bug 8644512
4641 		p_bir_raising_allw	 => p_yea_info.tax_grp_bir_raising_allw,	-- Bug 8644512
4642 		p_fw_income_exem	 => p_yea_info.tax_grp_fw_income_exem,		-- Bug 8644512
4643 		p_itax             	 => p_yea_info.tax_grp_itax,
4644 		p_rtax           	 => p_yea_info.tax_grp_rtax,
4645 		p_stax            	 => p_yea_info.tax_grp_stax,
4646 		p_tax_grp_ntax_R10	=> p_yea_info.tax_grp_ntax_R10,	 --Bug 12807687
4647 		p_tax_grp_ntax_G01	=> p_yea_info.tax_grp_ntax_G01,	-- Bug 8644512
4648 		p_tax_grp_ntax_H01	=> p_yea_info.tax_grp_ntax_H01,	-- Bug 8644512
4649 		p_tax_grp_ntax_H05	=> p_yea_info.tax_grp_ntax_H05,	-- Bug 8644512
4650 		p_tax_grp_ntax_H06	=> p_yea_info.tax_grp_ntax_H06,	-- Bug 8644512
4651 		p_tax_grp_ntax_H07	=> p_yea_info.tax_grp_ntax_H07,	-- Bug 8644512
4652 		p_tax_grp_ntax_H08	=> p_yea_info.tax_grp_ntax_H08,	-- Bug 8644512
4653 		p_tax_grp_ntax_H09	=> p_yea_info.tax_grp_ntax_H09,	-- Bug 8644512
4654 		p_tax_grp_ntax_H10	=> p_yea_info.tax_grp_ntax_H10,	-- Bug 8644512
4655 		p_tax_grp_ntax_H11	=> p_yea_info.tax_grp_ntax_H11,	-- Bug 8644512
4656 		p_tax_grp_ntax_H12	=> p_yea_info.tax_grp_ntax_H12,	-- Bug 8644512
4657 		p_tax_grp_ntax_H13	=> p_yea_info.tax_grp_ntax_H13,	-- Bug 8644512
4658 		p_tax_grp_ntax_I01	=> p_yea_info.tax_grp_ntax_I01,	-- Bug 8644512
4659 		p_tax_grp_ntax_K01	=> p_yea_info.tax_grp_ntax_K01,	-- Bug 8644512
4660 		p_tax_grp_ntax_M01	=> p_yea_info.tax_grp_ntax_M01,	-- Bug 8644512
4661 		p_tax_grp_ntax_M02	=> p_yea_info.tax_grp_ntax_M02,	-- Bug 8644512
4662 		p_tax_grp_ntax_M03	=> p_yea_info.tax_grp_ntax_M03,	-- Bug 8644512
4663 		p_tax_grp_ntax_S01	=> p_yea_info.tax_grp_ntax_S01,	-- Bug 8644512
4664 		p_tax_grp_ntax_T01	=> p_yea_info.tax_grp_ntax_T01,	-- Bug 8644512
4665 		p_tax_grp_ntax_Y01	=> p_yea_info.tax_grp_ntax_Y01,	-- Bug 8644512
4666 		p_tax_grp_ntax_Y02	=> p_yea_info.tax_grp_ntax_Y02,	-- Bug 8644512
4667 		p_tax_grp_ntax_Y03	=> p_yea_info.tax_grp_ntax_Y03,	-- Bug 8644512
4668 		p_tax_grp_ntax_Y20	=> p_yea_info.tax_grp_ntax_Y20,	-- Bug 8644512
4669 		p_tax_grp_ntax_Y21	=> p_yea_info.tax_grp_ntax_Y21,	-- Bug 9737699
4670 		p_tax_grp_ntax_ZZ	=> p_yea_info.tax_grp_ntax_ZZ,	-- Bug 9737699
4671 		p_tax_grp_ntax_Z01	=> p_yea_info.tax_grp_ntax_Z01, -- Bug 8644512
4672 		p_tax_grp_ntax_tax_brk	=> p_yea_info.tax_grp_ntax_tax_brk,
4673 		p_tax_grp_ntax_H14	=> p_yea_info.tax_grp_ntax_H14,	 --Bug 14754822
4674 		p_tax_grp_ntax_H15	=> p_yea_info.tax_grp_ntax_H15,
4675 		p_tax_grp_ntax_T10	=> p_yea_info.tax_grp_ntax_T10,
4676 		p_tax_grp_ntax_T20	=> p_yea_info.tax_grp_ntax_T20); -- Bug 9737699
4677 	--
4678 	-----------------------------------------------------------------------
4679 	-- Bug 8644512: Total Non Taxable Earnings
4680 	-----------------------------------------------------------------------
4681 		p_yea_info.non_taxable_ovt	:= p_yea_info.non_taxable_ovt
4682 						 + nvl(p_yea_info.prev_non_taxable_ovt,0)
4683 						 + nvl(p_yea_info.tax_grp_non_taxable_ovt,0);
4684 		p_yea_info.birth_raising_allowance := p_yea_info.birth_raising_allowance
4685 						    + nvl(p_yea_info.prev_birth_raising_allowance,0)
4686 						    + nvl(p_yea_info.tax_grp_bir_raising_allw,0);
4687 
4688 		p_yea_info.foreign_worker_income_exem := nvl(p_yea_info.prev_foreign_wrkr_inc_exem,0)
4689 						+ nvl(p_yea_info.tax_grp_fw_income_exem,0);
4690 		--
4691 		-- Bug 8644512
4692 		p_yea_info.total_ntax_R10	:= nvl(p_yea_info.cur_ntax_R10,0) + nvl(p_yea_info.prev_ntax_R10,0) + nvl(p_yea_info.tax_grp_ntax_R10,0); --Bug 12807687
4693 		p_yea_info.total_ntax_G01	:= nvl(p_yea_info.cur_ntax_G01,0) + nvl(p_yea_info.prev_ntax_G01,0) + nvl(p_yea_info.tax_grp_ntax_G01,0);
4694 		p_yea_info.total_ntax_H01	:= nvl(p_yea_info.cur_ntax_H01,0) + nvl(p_yea_info.prev_ntax_H01,0) + nvl(p_yea_info.tax_grp_ntax_H01,0);
4695 		p_yea_info.total_ntax_H05	:= nvl(p_yea_info.cur_ntax_H05,0) + nvl(p_yea_info.prev_ntax_H05,0) + nvl(p_yea_info.tax_grp_ntax_H05,0);
4696 		p_yea_info.total_ntax_H06	:= nvl(p_yea_info.cur_ntax_H06,0) + nvl(p_yea_info.prev_ntax_H06,0) + nvl(p_yea_info.tax_grp_ntax_H06,0);
4697 		p_yea_info.total_ntax_H07	:= nvl(p_yea_info.cur_ntax_H07,0) + nvl(p_yea_info.prev_ntax_H07,0) + nvl(p_yea_info.tax_grp_ntax_H07,0);
4698 		p_yea_info.total_ntax_H08	:= nvl(p_yea_info.cur_ntax_H08,0) + nvl(p_yea_info.prev_ntax_H08,0) + nvl(p_yea_info.tax_grp_ntax_H08,0);
4699 		p_yea_info.total_ntax_H09	:= nvl(p_yea_info.cur_ntax_H09,0) + nvl(p_yea_info.prev_ntax_H09,0) + nvl(p_yea_info.tax_grp_ntax_H09,0);
4700 		p_yea_info.total_ntax_H10	:= nvl(p_yea_info.cur_ntax_H10,0) + nvl(p_yea_info.prev_ntax_H10,0) + nvl(p_yea_info.tax_grp_ntax_H10,0);
4701 		p_yea_info.total_ntax_H11	:= nvl(p_yea_info.cur_ntax_H11,0) + nvl(p_yea_info.prev_ntax_H11,0) + nvl(p_yea_info.tax_grp_ntax_H11,0);
4702 		p_yea_info.total_ntax_H12	:= nvl(p_yea_info.cur_ntax_H12,0) + nvl(p_yea_info.prev_ntax_H12,0) + nvl(p_yea_info.tax_grp_ntax_H12,0);
4703 		p_yea_info.total_ntax_H13	:= nvl(p_yea_info.cur_ntax_H13,0) + nvl(p_yea_info.prev_ntax_H13,0) + nvl(p_yea_info.tax_grp_ntax_H13,0);
4704 		p_yea_info.total_ntax_I01	:= nvl(p_yea_info.cur_ntax_I01,0) + nvl(p_yea_info.prev_ntax_I01,0) + nvl(p_yea_info.tax_grp_ntax_I01,0);
4705 		p_yea_info.total_ntax_K01	:= nvl(p_yea_info.cur_ntax_K01,0) + nvl(p_yea_info.prev_ntax_K01,0) + nvl(p_yea_info.tax_grp_ntax_K01,0);
4706 		p_yea_info.total_ntax_M01	:= nvl(p_yea_info.cur_ntax_M01,0) + nvl(p_yea_info.cur_ntax_frgn_M01,0) + nvl(p_yea_info.prev_ntax_M01,0) + nvl(p_yea_info.tax_grp_ntax_M01,0);
4707 		p_yea_info.total_ntax_M02	:= nvl(p_yea_info.cur_ntax_M02,0) + nvl(p_yea_info.cur_ntax_frgn_M02,0) + nvl(p_yea_info.prev_ntax_M02,0) + nvl(p_yea_info.tax_grp_ntax_M02,0);
4708 		p_yea_info.total_ntax_M03	:= nvl(p_yea_info.cur_ntax_M03,0) + nvl(p_yea_info.cur_ntax_frgn_M03,0) + nvl(p_yea_info.prev_ntax_M03,0) + nvl(p_yea_info.tax_grp_ntax_M03,0);
4709 		p_yea_info.total_ntax_S01	:= nvl(p_yea_info.cur_ntax_S01,0) + nvl(p_yea_info.prev_ntax_S01,0) + nvl(p_yea_info.tax_grp_ntax_S01,0);
4710 		p_yea_info.total_ntax_Y01	:= nvl(p_yea_info.cur_ntax_Y01,0) + nvl(p_yea_info.prev_ntax_Y01,0) + nvl(p_yea_info.tax_grp_ntax_Y01,0);
4711 		p_yea_info.total_ntax_Y02	:= nvl(p_yea_info.cur_ntax_Y02,0) + nvl(p_yea_info.prev_ntax_Y02,0) + nvl(p_yea_info.tax_grp_ntax_Y02,0);
4712 		p_yea_info.total_ntax_Y03	:= nvl(p_yea_info.cur_ntax_Y03,0) + nvl(p_yea_info.prev_ntax_Y03,0) + nvl(p_yea_info.tax_grp_ntax_Y03,0);
4713 		p_yea_info.total_ntax_Y20	:= nvl(p_yea_info.cur_ntax_Y20,0) + nvl(p_yea_info.prev_ntax_Y20,0) + nvl(p_yea_info.tax_grp_ntax_Y20,0);
4714 		p_yea_info.total_ntax_Y21	:= nvl(p_yea_info.cur_ntax_Y21,0) + nvl(p_yea_info.prev_ntax_Y21,0) + nvl(p_yea_info.tax_grp_ntax_Y21,0); -- Bug 9737699
4715 		p_yea_info.total_ntax_ZZ	:= nvl(p_yea_info.cur_ntax_ZZ,0)  + nvl(p_yea_info.prev_ntax_ZZ,0) + nvl(p_yea_info.tax_grp_ntax_ZZ,0); -- Bug 9737699
4716 		p_yea_info.total_ntax_Z01	:= nvl(p_yea_info.cur_ntax_Z01,0) + nvl(p_yea_info.prev_ntax_Z01,0) + nvl(p_yea_info.tax_grp_ntax_Z01,0);
4717 		p_yea_info.total_ntax_H14	:= nvl(p_yea_info.cur_ntax_H14,0) + nvl(p_yea_info.prev_ntax_H14,0) + nvl(p_yea_info.tax_grp_ntax_H14,0); --Bug 14754822
4718 		p_yea_info.total_ntax_H15	:= nvl(p_yea_info.cur_ntax_H15,0) + nvl(p_yea_info.prev_ntax_H15,0) + nvl(p_yea_info.tax_grp_ntax_H15,0);
4719 		p_yea_info.total_ntax_T10	:= nvl(p_yea_info.cur_ntax_T10,0) + nvl(p_yea_info.prev_ntax_T10,0) + nvl(p_yea_info.tax_grp_ntax_T10,0);
4720 		p_yea_info.total_ntax_T20	:= nvl(p_yea_info.cur_ntax_T20,0) + nvl(p_yea_info.prev_ntax_T20,0) + nvl(p_yea_info.tax_grp_ntax_T20,0);
4721 
4722 		--
4723 		p_yea_info.cur_total_ntax_earn	:= nvl(p_yea_info.cur_ntax_G01,0) + nvl(p_yea_info.cur_ntax_R10,0) --Bug 12807687
4724 					 	+ nvl(p_yea_info.cur_ntax_H01,0)
4725 					 	+ nvl(p_yea_info.cur_ntax_H05,0)
4726 					 	+ nvl(p_yea_info.cur_ntax_H06,0)
4727 					 	+ nvl(p_yea_info.cur_ntax_H07,0)
4728 						+ nvl(p_yea_info.cur_ntax_H08,0)
4729 					 	+ nvl(p_yea_info.cur_ntax_H09,0)
4730 					 	+ nvl(p_yea_info.cur_ntax_H10,0)
4731 					 	+ nvl(p_yea_info.cur_ntax_H11,0)
4732 					 	+ nvl(p_yea_info.cur_ntax_H12,0)
4733 					 	+ nvl(p_yea_info.cur_ntax_H13,0)
4734 					 	+ nvl(p_yea_info.cur_ntax_I01,0)
4735 					 	+ nvl(p_yea_info.cur_ntax_K01,0)
4736 					 	+ nvl(p_yea_info.cur_ntax_M01,0)
4737 					 	+ nvl(p_yea_info.cur_ntax_M02,0)
4738 					 	+ nvl(p_yea_info.cur_ntax_M03,0)
4739 					 	+ nvl(p_yea_info.cur_ntax_S01,0)
4740 					 	-- + nvl(p_yea_info.cur_ntax_T01,0)
4741 					 	+ nvl(p_yea_info.cur_ntax_Y01,0)
4742 					 	+ nvl(p_yea_info.cur_ntax_Y02,0)
4743 					 	+ nvl(p_yea_info.cur_ntax_Y03,0)
4744 					 	+ nvl(p_yea_info.cur_ntax_Y20,0)
4745 						+ nvl(p_yea_info.cur_ntax_Y21,0) -- Bug 9737699
4746 						+ nvl(p_yea_info.cur_ntax_ZZ,0) -- Bug 9737699
4747 					 	-- + nvl(p_yea_info.cur_ntax_Z01,0)
4748 						+ nvl(p_yea_info.cur_non_taxable_ovt,0)
4749 						+ nvl(p_yea_info.cur_birth_raising_allowance,0)
4750 						+ nvl(p_yea_info.cur_ntax_frgn_M01,0)
4751 						+ nvl(p_yea_info.cur_ntax_frgn_M02,0)
4752 						+ nvl(p_yea_info.cur_ntax_frgn_M03,0)
4753 					 	+ nvl(p_yea_info.cur_ntax_H14,0) -- Bug 14754822
4754 					 	+ nvl(p_yea_info.cur_ntax_H15,0);
4755 		--
4756 		p_yea_info.tax_grp_total_ntax_earn	:= nvl(p_yea_info.tax_grp_ntax_G01,0)
4757 							+ nvl(p_yea_info.tax_grp_ntax_R10,0) --Bug 12807687
4758 					 		+ nvl(p_yea_info.tax_grp_ntax_H01,0)
4759 					 		+ nvl(p_yea_info.tax_grp_ntax_H05,0)
4760 					 		+ nvl(p_yea_info.tax_grp_ntax_H06,0)
4761 					 		+ nvl(p_yea_info.tax_grp_ntax_H07,0)
4762 					 		+ nvl(p_yea_info.tax_grp_ntax_H08,0)
4763 					 		+ nvl(p_yea_info.tax_grp_ntax_H09,0)
4764 					 		+ nvl(p_yea_info.tax_grp_ntax_H10,0)
4765 					 		+ nvl(p_yea_info.tax_grp_ntax_H11,0)
4766 					 		+ nvl(p_yea_info.tax_grp_ntax_H12,0)
4767 							+ nvl(p_yea_info.tax_grp_ntax_H13,0)
4768 							+ nvl(p_yea_info.tax_grp_ntax_I01,0)
4769 							+ nvl(p_yea_info.tax_grp_ntax_K01,0)
4770 							+ nvl(p_yea_info.tax_grp_ntax_M01,0)
4771 							+ nvl(p_yea_info.tax_grp_ntax_M02,0)
4772 					 		+ nvl(p_yea_info.tax_grp_ntax_M03,0)
4773 							+ nvl(p_yea_info.tax_grp_ntax_S01,0)
4774 					 		-- + nvl(p_yea_info.tax_grp_ntax_T01,0)
4775 					 		+ nvl(p_yea_info.tax_grp_ntax_Y01,0)
4776 					 		+ nvl(p_yea_info.tax_grp_ntax_Y02,0)
4777 					 		+ nvl(p_yea_info.tax_grp_ntax_Y03,0)
4778 					 		+ nvl(p_yea_info.tax_grp_ntax_Y20,0)
4779 							+ nvl(p_yea_info.tax_grp_ntax_Y21,0) -- Bug 9737699
4780 							+ nvl(p_yea_info.tax_grp_ntax_ZZ,0) -- Bug 9737699
4781 					 		-- + nvl(p_yea_info.tax_grp_ntax_Z01,0)
4782 							+ nvl(p_yea_info.tax_grp_non_taxable_ovt,0)
4783 							+ nvl(p_yea_info.tax_grp_bir_raising_allw,0)
4784 							+ nvl(p_yea_info.tax_grp_fw_income_exem,0)
4785 					 		+ nvl(p_yea_info.tax_grp_ntax_H14,0) -- Bug 14754822
4786 					 		+ nvl(p_yea_info.tax_grp_ntax_H15,0);
4787 		--
4788 
4789 	------------------------------------------------------------------------
4790 	-- Special Tax Exemption Information
4791 	------------------------------------------------------------------------
4792 	if g_debug then
4793 		hr_utility.set_location('pay_kr_yea_pkg.yea_info.',60);
4794 	end if;
4795 	--
4796 	sp_tax_exem_info(
4797 		p_assignment_id			=> p_assignment_id,
4798 		p_effective_date		=> p_effective_date,
4799 		p_hi_prem			=> l_hi_prem,
4800 		p_ltci_prem			=> l_ltci_prem, -- Bug 7260606
4801 		p_ei_prem			=> l_ei_prem,
4802 		p_pers_ins_name			=> p_yea_info.pers_ins_name,
4803 		p_pers_ins_prem			=> p_yea_info.pers_ins_prem,
4804 		p_disabled_ins_prem		=> p_yea_info.disabled_ins_prem,
4805 		p_med_exp			=> p_yea_info.med_exp,
4806 		p_med_exp_card_emp	        => p_yea_info.med_exp_card_emp,
4807 		p_med_exp_disabled		=> p_yea_info.med_exp_disabled,
4808 		p_med_exp_aged			=> p_yea_info.med_exp_aged,
4809 		p_ee_educ_exp			=> p_yea_info.ee_educ_exp,
4810 		p_ee_occupation_educ_exp2005 	=> p_yea_info.ee_occupation_educ_exp2005, -- Bug 3971542
4811 		p_housing_purchase_date		=> p_yea_info.housing_purchase_date,
4812 		p_housing_loan_date		=> p_yea_info.housing_loan_date,
4813 		p_housing_loan_repay		=> p_yea_info.housing_loan_repay,
4814 		-- Bug 9393732
4815 		p_housing_prv_date_moved	=> p_yea_info.housing_prv_date_moved,
4816 		p_housing_prv_loan_date		=> p_yea_info.housing_prv_loan_date,
4817 		p_housing_prv_loan_repay	=> p_yea_info.housing_prv_loan_repay,
4818 		p_house_holder_exception_flag => p_yea_info.house_holder_exception_flag, -- Bug 13247926
4819 		--
4820 		p_lt_housing_loan_date		=> p_yea_info.lt_housing_loan_date,
4821 		p_lt_housing_loan_intr_repay	=> p_yea_info.lt_housing_loan_interest_repay,
4822 		p_lt_housing_loan_date_1        => p_yea_info.lt_housing_loan_date_1,
4823 		p_lt_housing_loan_intr_repay_1	=> p_yea_info.lt_housing_loan_intr_repay_1,
4824                 p_lt_housing_loan_date_2	=> p_yea_info.lt_housing_loan_date_2,      -- Bug 8237227
4825                 p_lt_housing_loan_intr_repay_2	=> p_yea_info.lt_housing_loan_intr_repay_2,    -- Bug 8237227
4826 		p_lt_2012_fixed_intr_wo_grace => p_yea_info.lt_2012_fixed_intr_wo_grace, --Bug 14754836
4827 		p_lt_2012_housing_other_intr => p_yea_info.lt_2012_housing_other_intr, -- Bug 14754836
4828 		p_housing_rent_exp		=> p_yea_info.housing_rent_exp, -- Bug 9737699
4829 		p_donation1			=> p_yea_info.donation1,
4830 		p_political_donation1		=> p_yea_info.political_donation1,
4831 		p_political_donation2		=> p_yea_info.political_donation2,
4832 		p_political_donation3		=> p_yea_info.political_donation3,
4833 		p_donation2			=> p_yea_info.donation2,
4834                 p_donation3			=> p_yea_info.donation3,
4835                 p_donation4			=> p_yea_info.donation4, -- Bug 7142612: Public Legal Entity Donation Trust
4836 		p_religious_donation		=> p_yea_info.religious_donation, -- Bug 7142612: Religious Donation
4837 		-- Bug 3966549
4838 		p_esoa_don2004			=> p_yea_info.esoa_don2004,
4839 		-- End of 3966549
4840                 p_marriage_exemption            => p_yea_info.marriage_exemption,
4841                 p_funeral_exemption             => p_yea_info.funeral_exemption,
4842                 p_relocation_exemption          => p_yea_info.relocation_exemption,
4843 		-- Bug 3172960
4844 		p_med_exp_emp			=> p_yea_info.med_exp_emp,
4845 		p_create_don_rec_flag		=> p_yea_info.create_don_rec_flag); -- Bug 9393732
4846         ------------------------------------------------------------------------
4847 	p_yea_info.hi_prem := p_yea_info.hi_prem + l_hi_prem;
4848 	p_yea_info.long_term_ins_prem := p_yea_info.long_term_ins_prem + l_ltci_prem; -- Bug 7260606
4849 	p_yea_info.ei_prem := p_yea_info.ei_prem + l_ei_prem;
4850 	------------------------------------------------------------------------
4851 	-- Dependent Education Expense Tax Exemption Information
4852 	------------------------------------------------------------------------
4853 	if g_debug then
4854 		hr_utility.set_location('pay_kr_yea_pkg.yea_info.',70);
4855 	end if;
4856 	--
4857 	dpnt_educ_tax_exem_info(
4858 		p_assignment_id			=> p_assignment_id,
4859 		p_effective_date		=> p_effective_date,
4860 		p_contact_name_tbl		=> p_yea_info.dpnt_educ_contact_name_tbl,	-- Bug 9079450
4861 		p_contact_ni_tbl		=> p_yea_info.dpnt_educ_contact_ni_tbl,		-- Bug 9079450
4862 		p_contact_type_tbl		=> p_yea_info.dpnt_educ_contact_type_tbl,
4863 		p_school_type_tbl		=> p_yea_info.dpnt_educ_school_type_tbl,
4864 		p_exp_tbl			=> p_yea_info.dpnt_educ_exp_tbl);
4865 	------------------------------------------------------------------------
4866 	-- Changes for Bug 3201332
4867 	-- Foreign Worker PreTax Deduction Information
4868 	------------------------------------------------------------------------
4869 	if g_debug then
4870 		hr_utility.set_location('pay_kr_yea_pkg.yea_info.',75);
4871 	end if;
4872 	--
4873 	fw_tax_exem_info(
4874 		p_assignment_id			=> p_assignment_id,
4875 		p_effective_date		=> p_effective_date,
4876 		p_educ_expense			=> p_yea_info.fw_educ_expense,
4877 		p_house_rent			=> p_yea_info.fw_house_rent);
4878         ------------------------------------------------------------------------
4879 	-- Housing Expenses Tax Exemption
4880         -- Changed for Bug 2523481
4881         ------------------------------------------------------------------------
4882 	if g_debug then
4883 		hr_utility.set_location('pay_kr_yea_pkg.yea_info.',80);
4884 	end if;
4885 	--
4886         hous_exp_tax_exem_info(
4887 	        p_assignment_id         => p_assignment_id,
4888         	p_effective_date	=> p_effective_date,
4889 	        p_saving_type_tbl	=> p_yea_info.housing_saving_type_tbl,
4890 	        p_saving_tbl		=> p_yea_info.housing_saving_tbl);
4891 	------------------------------------------------------------------------
4892 	-- Tax Exemption Information
4893 	-- Direct card expenses introduced for fix 2879008
4894 	------------------------------------------------------------------------
4895 	if g_debug then
4896 		hr_utility.set_location('pay_kr_yea_pkg.yea_info.',90);
4897 	end if;
4898 	--
4899 	tax_exem_info(
4900 		p_assignment_id			=> p_assignment_id,
4901 		p_effective_date		=> p_effective_date,
4902 		p_np_prem			=> l_np_prem,
4903 		p_pen_prem			=> l_pen_prem,  		 -- Bug 6024342
4904 		p_military_pen_prem		=> l_military_pen_prem,  	 -- Bug 9737699
4905 		p_private_school_pen_prem	=> l_private_school_pen_prem,  	 -- Bug 9737699
4906 		p_post_office_pen_prem		=> l_post_office_pen_prem,  	 -- Bug 9737699
4907 		p_pers_pension_prem		=> p_yea_info.pers_pension_prem,
4908 		p_corp_pension_prem		=> l_corp_pension_prem,		-- bug 7508706
4909 		p_pers_pension_saving		=> p_yea_info.pers_pension_saving,
4910 		p_invest_partner_fin1		=> p_yea_info.invest_partner_fin1,
4911 		p_invest_partner_fin2		=> p_yea_info.invest_partner_fin2,
4912 		p_invest_partner_fin3		=> p_yea_info.invest_partner_fin3,   -- Bug 8237227
4913 		p_invest_partner_fin4		=> p_yea_info.invest_partner_fin4, -- BUG 14219478
4914 		p_invest_partner_fin5		=> p_yea_info.invest_partner_fin5, -- BUG 14219478
4915 		p_invest_partner_fin6		=> p_yea_info.invest_partner_fin6, -- BUG 14219478
4916 		p_small_bus_install		=> p_yea_info.small_bus_install,  -- Bug 6895093
4917 		p_credit_card_exp		=> p_yea_info.credit_card_exp,
4918 		p_direct_card_exp               => p_yea_info.direct_card_exp,
4919 		-- Bug 3966549
4920 		p_emp_cre_card_direct_exp2004	=> p_yea_info.emp_cre_card_direct_exp2004,
4921 		p_dpnt_cre_card_dir_exp2004 	=> p_yea_info.dpnt_cre_card_direct_exp2004,
4922 		p_giro_tuition_paid_exp2004	=> p_yea_info.giro_tuition_paid_exp2004,
4923                 -- Bug 3506168
4924                 p_cash_receipt_exp2005          => p_yea_info.cash_receipt_exp2005,
4925 	-- Bug 14219478
4926 	 p_traditional_market_exp	 => p_yea_info.traditional_market_exp,
4927 	 p_total_cards_amount	 => p_yea_info.total_cards_amount,
4928 	 p_credit_card_expense	 => p_yea_info.credit_card_expense,
4929 	-- End of 14219478
4930 		--
4931 		-- End of 3966549
4932                 p_emp_stk_own_contri            => p_yea_info.emp_stk_own_contri,
4933 		-- Bug 6630135
4934 		p_tot_med_exp_cards             => p_yea_info.tot_med_exp_cards,
4935                 p_dpnt_med_exp_cards            => p_yea_info.dpnt_med_exp_cards,
4936                 -- End of Bug 6630135
4937 		-- Bug 7615517
4938 		p_company_related_exp		=> p_yea_info.company_related_exp,
4939 		p_long_term_stck_fund_1year	=> p_yea_info.long_term_stck_fund_1year,
4940 		p_long_term_stck_fund_2year	=> p_yea_info.long_term_stck_fund_2year,
4941 		p_long_term_stck_fund_3year	=> p_yea_info.long_term_stck_fund_3year,
4942 		p_cur_smb_days_worked		=> p_yea_info.cur_smb_days_worked,	-- Bug 9079450
4943 		p_prev_smb_days_worked		=> p_yea_info.prev_smb_days_worked,	-- Bug 9079450
4944 		p_emp_join_prev_year		=> p_yea_info.emp_join_prev_year,	-- Bug 9079450
4945 		p_emp_leave_cur_year		=> p_yea_info.emp_leave_cur_year,	-- Bug 9079450
4946 		p_smb_eligibility_flag		=> p_yea_info.smb_eligibility_flag	-- Bug 9079450
4947 		-- End of Bug 7615517
4948 		);
4949         ------------------------------------------------------------------------
4950 	p_yea_info.np_prem	       := p_yea_info.np_prem + l_np_prem;
4951 	p_yea_info.pen_prem	       := p_yea_info.pen_prem + l_pen_prem;	-- Bug 6024342
4952 	p_yea_info.military_pen_prem   := p_yea_info.military_pen_prem + l_military_pen_prem;	-- Bug 9737699
4953 	p_yea_info.private_school_pen_prem := p_yea_info.private_school_pen_prem + l_private_school_pen_prem;	-- Bug 9737699
4954 	p_yea_info.post_office_pen_prem := p_yea_info.post_office_pen_prem + l_post_office_pen_prem;	-- Bug 9737699
4955         p_yea_info.corp_pension_prem   := p_yea_info.corp_pension_prem
4956 					+ l_corp_pension_prem 			-- Bug 7508706
4957 					+ l_corp_pension_prem_bal_value;  -- Bug 4750653
4958 	------------------------------------------------------------------------
4959 	-- Tax Break Information
4960 	------------------------------------------------------------------------
4961 	if g_debug then
4962 		hr_utility.set_location('pay_kr_yea_pkg.yea_info.',100);
4963 	end if;
4964 	--
4965 	tax_break_info(
4966 		p_assignment_id			=> p_assignment_id,
4967 		p_effective_date		=> p_effective_date,
4968 		p_housing_loan_interest_repay	=> p_yea_info.housing_loan_interest_repay,
4969 		p_stock_saving			=> p_yea_info.stock_saving,
4970 		p_lt_stock_saving1		=> p_yea_info.lt_stock_saving1,
4971 		p_lt_stock_saving2		=> p_yea_info.lt_stock_saving2);
4972 	------------------------------------------------------------------------
4973 	-- Overseas Tax Break Information
4974 	------------------------------------------------------------------------
4975 	if g_debug then
4976 		hr_utility.set_location('pay_kr_yea_pkg.yea_info.',110);
4977 	end if;
4978 	--
4979 	ovs_tax_break_info(
4980 		p_assignment_id			=> p_assignment_id,
4981 		p_effective_date		=> p_effective_date,
4982 		p_tax_paid_date			=> p_yea_info.ovstb_tax_paid_date,
4983 		p_territory_code		=> p_yea_info.ovstb_territory_code,
4984 		p_currency_code			=> p_yea_info.ovstb_currency_code,
4985 		p_taxable			=> p_yea_info.ovstb_taxable,
4986 		p_taxable_subj_tax_break	=> p_yea_info.ovstb_taxable_subj_tax_break,
4987 		p_tax_break_rate		=> p_yea_info.ovstb_tax_break_rate,
4988 		p_tax_foreign_currency		=> p_yea_info.ovstb_tax_foreign_currency,
4989 		p_tax				=> p_yea_info.ovstb_tax,
4990 		p_application_date		=> p_yea_info.ovstb_application_date,
4991 		p_submission_date		=> p_yea_info.ovstb_submission_date);
4992 	--
4993 	-- 2311505
4994 	--
4995 	p_yea_info.cur_taxable_mth := p_yea_info.cur_taxable_mth
4996 				    + p_yea_info.ovstb_taxable
4997 				    - trunc(p_yea_info.ovstb_taxable_subj_tax_break * p_yea_info.ovstb_tax_break_rate / 100);
4998 	------------------------------------------------------------------------
4999 	-- Foreign Worker Tax Break Information
5000 	------------------------------------------------------------------------
5001 	if g_debug then
5002 		hr_utility.set_location('pay_kr_yea_pkg.yea_info.',120);
5003 	end if;
5004 	--
5005         -- Bug 5083240: Update call for new parameters p_assignment_action_id, p_contr_taxable_earn, and p_contr_non_taxable_earn
5006 	fw_tax_break_info(
5007                 p_assignment_action_id          => p_assignment_action_id,
5008 		p_assignment_id			=> p_assignment_id,
5009 		p_effective_date		=> p_effective_date,
5010 		p_immigration_purpose		=> p_yea_info.fwtb_immigration_purpose,
5011 		p_contract_date			=> p_yea_info.fwtb_contract_date,
5012 		p_expiry_date			=> p_yea_info.fwtb_expiry_date,
5013 		p_application_date		=> p_yea_info.fwtb_application_date,
5014 		p_submission_date		=> p_yea_info.fwtb_submission_date,
5015                 p_contr_taxable_earn            => p_yea_info.fw_contr_taxable_earn,
5016                 p_contr_non_taxable_earn        => p_yea_info.fw_contr_non_taxable_earn);
5017         -- End of 5083240
5018 	--
5019 -- BUG 14754822 start
5020 if p_yea_info.fixed_tax_rate = 'N' then
5021 	if p_yea_info.nationality = 'F' then
5022 	 tax_reduction_info(
5023 		p_assignment_action_id		 => p_assignment_action_id,
5024 		p_assignment_id			=> p_assignment_id,
5025 		p_effective_date		=> p_effective_date,
5026 		p_information_type		=> 'KR_YEA_TAX_REDUCTION_TEACHERS',
5027 		p_balance_name		=> 'NON_TAXABLE_EARN_T20',
5028 		p_eligible_earnings	 => p_yea_info.taxable_earnings_teachers);
5029 	p_yea_info.taxable_earnings_teachers := p_yea_info.taxable_earnings_teachers + nvl(p_yea_info.prev_ntax_T20,0) + nvl(p_yea_info.tax_grp_ntax_T20,0);
5030 
5031 	 tax_reduction_info(
5032 		p_assignment_action_id		=> p_assignment_action_id,
5033 		p_assignment_id			=> p_assignment_id,
5034 		p_effective_date		=> p_effective_date,
5035 		p_information_type		=> 'KR_YEA_TAX_REDUCTION_MARINE',
5036 		p_balance_name		=> 'NON_TAXABLE_EARN_Z01',
5037 		p_eligible_earnings	 => p_yea_info.taxable_earnings_marine);
5038 	p_yea_info.taxable_earnings_marine := p_yea_info.taxable_earnings_marine + nvl(p_yea_info.prev_ntax_Z01,0) + nvl(p_yea_info.tax_grp_ntax_Z01,0);
5039 	else
5040 		tax_reduction_info(
5041 		p_assignment_action_id		 => p_assignment_action_id,
5042 		p_assignment_id			=> p_assignment_id,
5043 		p_effective_date		=> p_effective_date,
5044 		p_information_type		=> 'KR_YEA_TAX_REDUCTION_SMB',
5045 		p_balance_name		=> 'NON_TAXABLE_EARN_T10',
5046 		p_eligible_earnings	 => p_yea_info.taxable_earnings_smb);
5047 	p_yea_info.taxable_earnings_smb := p_yea_info.taxable_earnings_smb + nvl(p_yea_info.prev_ntax_T10,0) + nvl(p_yea_info.tax_grp_ntax_T10,0);
5048 	end if;
5049 else
5050 	p_yea_info.taxable_earnings_smb :=0;
5051 	p_yea_info.taxable_earnings_teachers :=0;
5052 	p_yea_info.taxable_earnings_marine :=0;
5053 end if;
5054 
5055 -- Bug 14754822 End
5056 	-- Bug 6012258, Bug 8644512
5057 	p_yea_info.cur_taxable		:= p_yea_info.cur_taxable_mth + p_yea_info.cur_taxable_bon
5058 					 + p_yea_info.cur_sp_irreg_bonus + p_yea_info.cur_stck_pur_opt_exec_earn
5059 					 + nvl(p_yea_info.cur_esop_withd_earn,0);
5060 	--
5061 	-- Bug 6024342, Bug 8644512
5062 	p_yea_info.prev_taxable		:= nvl(p_yea_info.prev_taxable_mth,0) + nvl(p_yea_info.prev_taxable_bon,0)
5063 					 + nvl(p_yea_info.prev_sp_irreg_bonus,0) + nvl(p_yea_info.prev_stck_pur_opt_exec_earn,0)
5064 					 + nvl(p_yea_info.prev_esop_withd_earn,0);
5065 	--
5066 	-- Bug 7361372, Bug 8644512
5067 	p_yea_info.tax_grp_taxable      := nvl(p_yea_info.tax_grp_taxable_mth,0) + nvl(p_yea_info.tax_grp_taxable_bon,0)
5068 					 + nvl(p_yea_info.tax_grp_sp_irreg_bonus,0) + nvl(p_yea_info.tax_grp_stck_pur_opt_exec_earn,0)
5069 					 + nvl(p_yea_info.tax_grp_esop_withd_earn,0);
5070 	-- Bug 7508706, Bug 8644512
5071 	p_yea_info.tax_grp_taxable_ne   := nvl(p_yea_info.tax_grp_taxable_mth_ne,0) + nvl(p_yea_info.tax_grp_taxable_bon_ne,0)
5072 					 + nvl(p_yea_info.tax_grp_sp_irreg_bonus_ne,0) + nvl(p_yea_info.tax_grp_stck_pur_ne,0)
5073 					 + nvl(p_yea_info.tax_grp_esop_withd_earn_ne,0);
5074 	--
5075 	p_yea_info.taxable_mth		:= p_yea_info.cur_taxable_mth + p_yea_info.prev_taxable_mth
5076 					 + nvl(p_yea_info.tax_grp_taxable_mth,0) + nvl(p_yea_info.tax_grp_taxable_mth_ne,0);
5077 	p_yea_info.taxable_bon		:= p_yea_info.cur_taxable_bon + p_yea_info.prev_taxable_bon
5078 					 + nvl(p_yea_info.tax_grp_taxable_bon,0) + nvl(p_yea_info.tax_grp_taxable_bon_ne,0);
5079 	p_yea_info.sp_irreg_bonus	:= p_yea_info.cur_sp_irreg_bonus + p_yea_info.prev_sp_irreg_bonus
5080 					 + nvl(p_yea_info.tax_grp_sp_irreg_bonus,0) + nvl(p_yea_info.tax_grp_sp_irreg_bonus_ne,0);
5081 	p_yea_info.stck_pur_opt_exec_earn := p_yea_info.cur_stck_pur_opt_exec_earn + p_yea_info.prev_stck_pur_opt_exec_earn
5082 					  + nvl(p_yea_info.tax_grp_stck_pur_opt_exec_earn,0) + nvl(p_yea_info.tax_grp_stck_pur_ne,0);
5083 	-- Bug 8644512
5084 	p_yea_info.esop_withd_earn	:= nvl(p_yea_info.cur_esop_withd_earn,0) + nvl(p_yea_info.prev_esop_withd_earn,0)
5085 					 + nvl(p_yea_info.tax_grp_esop_withd_earn,0) + nvl(p_yea_info.tax_grp_esop_withd_earn_ne,0);
5086 	--
5087 	p_yea_info.taxable		:= p_yea_info.cur_taxable + p_yea_info.prev_taxable
5088  					 + nvl(p_yea_info.tax_grp_taxable,0) + nvl(p_yea_info.tax_grp_taxable_ne,0);
5089 	p_yea_info.taxable1             := p_yea_info.taxable; -- bug 7615517
5090 	-- Bug 6012258
5091 	-- End of Bug 7361372,7508706
5092 	--
5093 	-- Bug 8644512
5094 	if p_effective_date >= c_20090101 then
5095 	p_yea_info.non_taxable_oth	:= 0;
5096 	p_yea_info.non_taxable		:= p_yea_info.non_taxable_ovt
5097 					 + p_yea_info.birth_raising_allowance
5098 	        				 + p_yea_info.foreign_worker_income_exem
5099 					 + nvl(p_yea_info.total_ntax_G01,0)
5100 					 + nvl(p_yea_info.total_ntax_H01,0)
5101 					 + nvl(p_yea_info.total_ntax_H05,0)
5102 					 + nvl(p_yea_info.total_ntax_H06,0)
5103 					 + nvl(p_yea_info.total_ntax_H07,0)
5104 					 + nvl(p_yea_info.total_ntax_H08,0)
5105 					 + nvl(p_yea_info.total_ntax_H09,0)
5106 					 + nvl(p_yea_info.total_ntax_H10,0)
5107 					 + nvl(p_yea_info.total_ntax_H11,0)
5108 					 + nvl(p_yea_info.total_ntax_H12,0)
5109 					 + nvl(p_yea_info.total_ntax_H13,0)
5110 					 + nvl(p_yea_info.total_ntax_I01,0)
5111 					 + nvl(p_yea_info.total_ntax_K01,0)
5112 					 + nvl(p_yea_info.total_ntax_M01,0)
5113 					 + nvl(p_yea_info.total_ntax_M02,0)
5114 					 + nvl(p_yea_info.total_ntax_M03,0)
5115 					 + nvl(p_yea_info.total_ntax_S01,0)
5116 					+ nvl(p_yea_info.total_ntax_R10,0)    -- Bug 12807687
5117 					-- + nvl(p_yea_info.total_ntax_T01,0)
5118 					 + nvl(p_yea_info.total_ntax_Y01,0)
5119 					 + nvl(p_yea_info.total_ntax_Y02,0)
5120 					 + nvl(p_yea_info.total_ntax_Y03,0)
5121 					 + nvl(p_yea_info.total_ntax_Y20,0)
5122 					 + nvl(p_yea_info.total_ntax_Y21,0) -- Bug 9737699
5123  					 + nvl(p_yea_info.total_ntax_ZZ,0) -- Bug 9737699
5124 					 + nvl(p_yea_info.total_ntax_H14,0)
5125 					 + nvl(p_yea_info.total_ntax_H15,0);   -- Bug 14754822
5126 					-- + nvl(p_yea_info.total_ntax_Z01,0)
5127 	else
5128 	p_yea_info.non_taxable		:= p_yea_info.non_taxable_ovs
5129 					 + p_yea_info.non_taxable_ovt
5130 					 + p_yea_info.non_taxable_ovs_frgn     -- Bug 7439803
5131 					 + p_yea_info.non_taxable_oth
5132 					 + p_yea_info.research_payment
5133 					 + p_yea_info.birth_raising_allowance -- Bug 7142620
5134 	                                 + nvl(p_yea_info.prev_foreign_wrkr_inc_exem,0)  -- Bug 8341054
5135 					 + nvl(p_yea_info.tax_grp_fw_income_exem,0);  -- Bug 8644512
5136 	end if;
5137 	--
5138 
5139 	--
5140 	------------------------------------------------------------------------
5141 	-- Derive Tax Exemption, Tax Break, Tax Adjustment etc.
5142 	-- which depends on effective_date.
5143 	------------------------------------------------------------------------
5144 	if g_debug then
5145 		hr_utility.set_location('pay_kr_yea_pkg.yea_info.',130);
5146 	end if;
5147 	--
5148 	-- Bug 9393732
5149         -- BUG 14219478
5150 	if p_effective_date >= c_20120101 then
5151                 pay_kr_yea20120101_pkg.yea(
5152 			p_assignment_id		=> p_assignment_id,
5153 			p_effective_date	=> p_effective_date,
5154 			p_business_group_id	=> p_business_group_id,
5155 			p_yea_info		=> p_yea_info,
5156                         p_tax_adj_warning       => p_tax_adj_warning);
5157 
5158 	elsif p_effective_date >= c_20110101 then
5159                 pay_kr_yea20110101_pkg.yea(
5160 			p_assignment_id		=> p_assignment_id,
5161 			p_effective_date	=> p_effective_date,
5162 			p_business_group_id	=> p_business_group_id,
5163 			p_yea_info		=> p_yea_info,
5164                         p_tax_adj_warning       => p_tax_adj_warning);
5165 	--
5166 
5167         elsif p_effective_date >= c_20100101 then
5168                 pay_kr_yea20100101_pkg.yea(
5169 			p_assignment_id		=> p_assignment_id,
5170 			p_effective_date	=> p_effective_date,
5171 			p_business_group_id	=> p_business_group_id,
5172 			p_yea_info		=> p_yea_info,
5173                         p_tax_adj_warning       => p_tax_adj_warning);
5174 	--
5175 
5176 	elsif p_effective_date >= c_20090101 then
5177                 pay_kr_yea20090101_pkg.yea(
5178 			p_assignment_id		=> p_assignment_id,
5179 			p_effective_date	=> p_effective_date,
5180 			p_business_group_id	=> p_business_group_id,
5181 			p_yea_info		=> p_yea_info,
5182                         p_tax_adj_warning       => p_tax_adj_warning);
5183 	--
5184 	-- Bug 6705170
5185         --
5186         elsif p_effective_date >= c_20080101 then
5187                 pay_kr_yea20080101_pkg.yea(
5188 			p_assignment_id		=> p_assignment_id,
5189 			p_effective_date	=> p_effective_date,
5190 			p_business_group_id	=> p_business_group_id,
5191 			p_yea_info		=> p_yea_info,
5192                         p_tax_adj_warning       => p_tax_adj_warning);
5193         --
5194         -- Bug 5734313
5195         --
5196         elsif p_effective_date >= c_20070101 then
5197                 pay_kr_yea20070101_pkg.yea(
5198 			p_assignment_id		=> p_assignment_id,
5199 			p_effective_date	=> p_effective_date,
5200 			p_business_group_id	=> p_business_group_id,
5201 			p_yea_info		=> p_yea_info,
5202                         p_tax_adj_warning       => p_tax_adj_warning);
5203         --
5204         elsif p_effective_date >= c_20060101 then
5205                 pay_kr_yea20060101_pkg.yea(
5206 			p_assignment_id		=> p_assignment_id,
5207 			p_effective_date	=> p_effective_date,
5208 			p_business_group_id	=> p_business_group_id,
5209 			p_yea_info		=> p_yea_info,
5210                         p_tax_adj_warning       => p_tax_adj_warning);
5211 
5212 	elsif p_effective_date >= c_20050101 then
5213                 pay_kr_yea20050101_pkg.yea(
5214 			p_assignment_id		=> p_assignment_id,
5215 			p_effective_date	=> p_effective_date,
5216 			p_business_group_id	=> p_business_group_id,
5217 			p_yea_info		=> p_yea_info,
5218                         p_tax_adj_warning       => p_tax_adj_warning);
5219 
5220         elsif p_effective_date >= c_20040101 then
5221                 pay_kr_yea20040101_pkg.yea(
5222 			p_assignment_id		=> p_assignment_id,
5223 			p_effective_date	=> p_effective_date,
5224 			p_business_group_id	=> p_business_group_id,
5225 			p_yea_info		=> p_yea_info,
5226                         p_tax_adj_warning       => p_tax_adj_warning);
5227 
5228 	elsif p_effective_date >= c_20030101 then
5229 		pay_kr_yea20030101_pkg.yea(
5230 			p_assignment_id		=> p_assignment_id,
5231 			p_effective_date	=> p_effective_date,
5232 			p_business_group_id	=> p_business_group_id,
5233 			p_yea_info		=> p_yea_info,
5234                         p_tax_adj_warning       => p_tax_adj_warning);
5235 
5236 	elsif p_effective_date >= c_20020101 then
5237 		pay_kr_yea20020101_pkg.yea(
5238 			p_assignment_id		=> p_assignment_id,
5239 			p_effective_date	=> p_effective_date,
5240 			p_business_group_id	=> p_business_group_id,
5241 			p_yea_info		=> p_yea_info,
5242                         -- Bug 2878937
5243                         p_tax_adj_warning       => p_tax_adj_warning);
5244 
5245         elsif p_effective_date >= c_00010101 then
5246 		pay_kr_yea00010101_pkg.yea(
5247 			p_assignment_id		=> p_assignment_id,
5248 			p_effective_date	=> p_effective_date,
5249 			p_business_group_id	=> p_business_group_id,
5250 			p_yea_info		=> p_yea_info);
5251 	end if;
5252 	p_yea_info.cur_ntax_tax_brk := p_yea_info.cur_ntax_T01 + p_yea_info.cur_ntax_Z01 + p_yea_info.cur_ntax_T10 + p_yea_info.cur_ntax_T20; -- Bug 14754822
5253 	p_yea_info.total_ntax_tax_brk	:= nvl(p_yea_info.cur_ntax_tax_brk,0) + nvl(p_yea_info.prev_ntax_tax_brk,0) + nvl(p_yea_info.tax_grp_ntax_tax_brk,0); -- Bug 9737699
5254 	p_yea_info.total_ntax_T01	:= nvl(p_yea_info.cur_ntax_T01,0) + nvl(p_yea_info.prev_ntax_T01,0) + nvl(p_yea_info.tax_grp_ntax_T01,0);
5255 
5256 	p_yea_info.sep_pen_exem_amt_archive := null;
5257 	p_yea_info.pen_sav_amt_archive := null;
5258 	p_yea_info.hou_sav_amt_archive := null;
5259 	p_yea_info.lt_stck_sav_amt_archive  := null;
5260 
5261 	for i in 1..p_yea_info.sep_pen_type_tbl.count loop
5262 	   if i=1 then
5263 	    p_yea_info.sep_pen_exem_amt1 := p_yea_info.sep_pen_exem_amount_tbl(i);
5264 	   else
5265 	    if i=2 then
5266              p_yea_info.sep_pen_exem_amt2 := p_yea_info.sep_pen_exem_amount_tbl(i);
5267 	    end if;
5268 	    end if;
5269 	    if i>=3 then
5270 	     p_yea_info.sep_pen_exem_amt_archive := p_yea_info.sep_pen_exem_amt_archive || to_char(p_yea_info.sep_pen_exem_amount_tbl(i))||'X';
5271 	    end if;
5272 	end loop;
5273 
5274 
5275 	for i in 1..p_yea_info.pen_saving_type_tbl.count loop
5276 	   if i=1 then
5277 	    p_yea_info.pen_sav_exem_amt1 := p_yea_info.pen_saving_exem_amount_tbl(i);
5278 	   else
5279 	    if i=2 then
5280              p_yea_info.pen_sav_exem_amt2 := p_yea_info.pen_saving_exem_amount_tbl(i);
5281 	    end if;
5282 	   end if;
5283 	   if i>=3 then
5284 	     p_yea_info.pen_sav_amt_archive := p_yea_info.pen_sav_amt_archive || to_char(p_yea_info.pen_saving_exem_amount_tbl(i))||'X';
5285 	    end if;
5286 	end loop;
5287 
5288 	for i in 1..p_yea_info.hou_saving_type_tbl.count loop
5289 	   if i=1 then
5290 	    p_yea_info.hou_sav_exem_amt1 := p_yea_info.hou_saving_exem_amount_tbl(i);
5291 	   else
5292 	    if i=2 then
5293              p_yea_info.hou_sav_exem_amt2 :=p_yea_info.hou_saving_exem_amount_tbl(i);
5294 	    end if;
5295 	    if i=3 then
5296              p_yea_info.hou_sav_exem_amt3 :=p_yea_info.hou_saving_exem_amount_tbl(i);
5297 	    end if;
5298 	   end if;
5299 	   if i>=4 then
5300 	     p_yea_info.hou_sav_amt_archive := p_yea_info.hou_sav_amt_archive || to_char(p_yea_info.hou_saving_exem_amount_tbl(i)) ||'X';
5301 	   end if;
5302 	end loop;
5303 
5304 	for i in 1..p_yea_info.lt_stck_saving_type_tbl.count loop
5305 	   if i=1 then
5306 	    p_yea_info.lt_stck_sav_exem_amt1 := p_yea_info.lt_stck_saving_exem_amt_tbl(i);
5307 	   else
5308 	    if i=2 then
5309              p_yea_info.lt_stck_sav_exem_amt2 := p_yea_info.lt_stck_saving_exem_amt_tbl(i);
5310 	    end if;
5311 	    if i=3 then
5312              p_yea_info.lt_stck_sav_exem_amt3 := p_yea_info.lt_stck_saving_exem_amt_tbl(i);
5313 	    end if;
5314 	   end if;
5315 	   if i>=4 then
5316 	     p_yea_info.lt_stck_sav_amt_archive := p_yea_info.lt_stck_sav_amt_archive || to_char(p_yea_info.lt_stck_saving_exem_amt_tbl(i))||'X';
5317 	   end if;
5318 	end loop;
5319 
5320         ---------------
5321         if g_debug then
5322         	hr_utility.trace('=====================================================');
5323         	hr_utility.trace('Current Taxable : '||to_char(p_yea_info.cur_taxable));
5324         	hr_utility.trace('Previous Taxable : '||to_char(p_yea_info.prev_taxable));
5325 		hr_utility.trace('Taxable : '||to_char(p_yea_info.taxable1)); --Bug 7615517
5326         	hr_utility.trace('Total Taxable : '||to_char(p_yea_info.taxable));
5327         	hr_utility.trace('Income Tax : '||to_char(p_yea_info.cur_itax));
5328         	hr_utility.trace('Resident Tax : '||to_char(p_yea_info.cur_itax));
5329         	hr_utility.trace('Income Tax Adjustment : '||to_char(p_yea_info.itax_adj));
5330         	hr_utility.trace('Resident Tax Adjustment : '||to_char(p_yea_info.rtax_adj));
5331         	hr_utility.trace('=====================================================');
5332         end if;
5333         ----------------
5334         ------------------------------------------------------------------------
5335 	-- Setup output warnings
5336 	------------------------------------------------------------------------
5337 	p_taxable_earnings_warning	:= false;
5338 	p_taxable_income_warning	:= false;
5339 	p_taxation_base_warning		:= false;
5340 	p_calc_tax_warning		:= false;
5341 	p_itax_warning			:= false;
5342 	p_rtax_warning			:= false;
5343 	if p_yea_info.taxable <= 0 then
5344 		p_taxable_earnings_warning := true;
5345 	else
5346 		if p_yea_info.taxable_income = 0 then
5347 			p_taxable_income_warning := true;
5348 		else
5349 			if p_yea_info.taxation_base = 0 then
5350 				p_taxation_base_warning := true;
5351 			else
5352 				if p_yea_info.calc_tax = 0 then
5353 					p_calc_tax_warning := true;
5354 				end if;
5355 			end if;
5356 		end if;
5357 	end if;
5358 	if p_yea_info.annual_itax = 0 then
5359 		p_itax_warning := true;
5360 	end if;
5361 	if p_yea_info.annual_rtax = 0 then
5362 		p_rtax_warning := true;
5363 	end if;
5364 end yea_info;
5365 ------------------------------------------------------------------------
5366 function yea_info(
5367 	p_assignment_action_id		in number) return t_yea_info
5368 ------------------------------------------------------------------------
5369 is
5370 	l_assignment_id			number;
5371 	l_effective_date		date;
5372 	l_user_entity_id_tbl		t_number_tbl;
5373 	l_archive_item_value_tbl	t_varchar2_tbl;
5374 	l_yea_info			t_yea_info;
5375 	--
5376 	cursor csr_archive is
5377 		select
5378 			u.user_entity_id,
5379 			a.value
5380 		from	pay_report_format_items_f	i,
5381 			ff_database_items		d,
5382 			ff_user_entities		u,
5383 			ff_archive_items		a,
5384 			pay_payroll_actions		ppa,
5385 			pay_assignment_actions		paa
5386 		where	paa.assignment_action_id = p_assignment_action_id
5387 		and	ppa.payroll_action_id = paa.payroll_action_id
5388 		and	a.context1 = paa.assignment_action_id
5389 		and	a.value is not null
5390 		and	u.user_entity_id = a.user_entity_id
5391 		and	d.user_entity_id = u.user_entity_id
5392 		--
5393 		-- Default value for data type number is "0" in t_yea_info
5394 		--
5395 		and	decode(a.value, '0', decode(d.data_type, 'N', 'N', 'Y'), 'Y') = 'Y'
5396 		and	i.report_type = nvl(ppa.report_type, u.user_entity_name)
5397 		and	i.report_qualifier = ppa.report_qualifier
5398 		and	i.report_category = ppa.report_category
5399 		and	i.user_entity_id = u.user_entity_id
5400 		and	ppa.effective_date
5401 			between i.effective_start_date and i.effective_end_date
5402 		order by i.display_sequence;
5403 begin
5404 	select	paa.assignment_id,
5405 		ppa.effective_date
5406 	into	l_assignment_id,
5407 		l_effective_date
5408 	from	pay_payroll_actions	ppa,
5409 		pay_assignment_actions	paa
5410 	where	paa.assignment_action_id = p_assignment_action_id
5411 	and	ppa.payroll_action_id = paa.payroll_action_id;
5412 	--
5413 	-- Bulk collect archive items. Bulk collect is for better performance.
5414 	--
5415 	open csr_archive;
5416 	fetch csr_archive bulk collect into l_user_entity_id_tbl, l_archive_item_value_tbl;
5417 	close csr_archive;
5418 	--
5419 	l_yea_info := convert_to_rec(
5420 			p_user_entity_id_tbl		=> l_user_entity_id_tbl,
5421 			p_archive_item_value_tbl	=> l_archive_item_value_tbl);
5422 	------------------------------------------------------------------------
5423 	-- Bug 8644512
5424 	------------------------------------------------------------------------
5425 	ntax_earnings(
5426 		p_assignment_id		=> l_assignment_id,
5427 		p_effective_date	=> l_effective_date,
5428 		p_ntax_detail_tbl	=> g_ntax_detail_tbl
5429 		);
5430 	------------------------------------------------------------------------
5431 	-- Previous Employers' Information
5432 	------------------------------------------------------------------------
5433 	prev_er_info(
5434 		p_assignment_id			=> l_assignment_id,
5435 		p_effective_date		=> l_effective_date,
5436 		p_hire_date_tbl			=> l_yea_info.prev_hire_date_tbl,		-- Bug 8644512
5437 		p_termination_date_tbl		=> l_yea_info.prev_termination_date_tbl,
5438 		p_corp_name_tbl			=> l_yea_info.prev_corp_name_tbl,
5439 		p_bp_number_tbl			=> l_yea_info.prev_bp_number_tbl,
5440 		p_tax_brk_pd_from_tbl		=> l_yea_info.prev_tax_brk_pd_from_tbl,		-- Bug 8644512
5441 		p_tax_brk_pd_to_tbl		=> l_yea_info.prev_tax_brk_pd_to_tbl,		-- Bug 8644512
5442 		p_taxable_mth_tbl		=> l_yea_info.prev_taxable_mth_tbl,
5443 		p_taxable_bon_tbl		=> l_yea_info.prev_taxable_bon_tbl,
5444 		p_sp_irreg_bonus_tbl		=> l_yea_info.prev_sp_irreg_bonus_tbl,
5445 		p_stck_pur_opt_exec_earn_tbl	=> l_yea_info.prev_stck_pur_opt_exe_earn_tbl,  -- Bug 6024342
5446 		p_non_taxable_ovs_tbl		=> l_yea_info.prev_non_taxable_ovs_tbl,
5447 		p_non_taxable_ovt_tbl		=> l_yea_info.prev_non_taxable_ovt_tbl,
5448 		p_non_taxable_oth_tbl		=> l_yea_info.prev_non_taxable_oth_tbl,
5449 		p_hi_prem_tbl			=> l_yea_info.prev_hi_prem_tbl,
5450 		p_ltci_prem_tbl			=> l_yea_info.prev_ltci_prem_tbl,  -- Bug 7260606
5451 		p_ei_prem_tbl			=> l_yea_info.prev_ei_prem_tbl,
5452 		p_np_prem_tbl			=> l_yea_info.prev_np_prem_tbl,
5453 		p_pen_prem_tbl			=> l_yea_info.prev_pen_prem_tbl,     --  Bug 6024342
5454 		p_military_pen_prem_tbl		=> l_yea_info.prev_military_pen_prem_tbl,     --  Bug 9737699
5455 		p_private_school_pen_prem_tbl	=> l_yea_info.prev_pri_school_pen_prem_tbl,     --  Bug 9737699
5456 		p_post_office_pen_prem_tbl	=> l_yea_info.prev_post_office_pen_prem_tbl,     --  Bug 9737699
5457 		p_separation_pension_tbl	=> l_yea_info.prev_separation_pension_tbl, 	-- Bug 7508706
5458 		p_itax_tbl			=> l_yea_info.prev_itax_tbl,
5459 		p_rtax_tbl			=> l_yea_info.prev_rtax_tbl,
5460 		p_stax_tbl			=> l_yea_info.prev_stax_tbl,
5461 		p_research_payment_tbl         =>  l_yea_info.prev_research_payment_tbl,         -- Bug 8341054
5462 		p_bir_raising_allowance_tbl     => l_yea_info.prev_bir_raising_allowance_tbl,    -- Bug 8341054
5463 		p_foreign_worker_exem_tbl       => l_yea_info.prev_foreign_wrkr_inc_exem_tbl,      -- Bug 8341054
5464 		p_esop_withd_earn_tbl		=> l_yea_info.prev_esop_withd_earn_tbl,		-- Bug 8644512
5465 		p_prev_ntax_R10_tbl		=> l_yea_info.prev_ntax_R10_tbl, --Bug 12807687
5466 		p_prev_ntax_G01_tbl		=> l_yea_info.prev_ntax_G01_tbl,	-- Bug 8644512
5467 		p_prev_ntax_H01_tbl		=> l_yea_info.prev_ntax_H01_tbl,	-- Bug 8644512
5468 		p_prev_ntax_H05_tbl		=> l_yea_info.prev_ntax_H05_tbl,	-- Bug 8644512
5469 		p_prev_ntax_H06_tbl		=> l_yea_info.prev_ntax_H06_tbl,	-- Bug 8644512
5470 		p_prev_ntax_H07_tbl		=> l_yea_info.prev_ntax_H07_tbl,	-- Bug 8644512
5471 		p_prev_ntax_H08_tbl		=> l_yea_info.prev_ntax_H08_tbl,	-- Bug 8644512
5472 		p_prev_ntax_H09_tbl		=> l_yea_info.prev_ntax_H09_tbl,	-- Bug 8644512
5473 		p_prev_ntax_H10_tbl		=> l_yea_info.prev_ntax_H10_tbl,	-- Bug 8644512
5474 		p_prev_ntax_H11_tbl		=> l_yea_info.prev_ntax_H11_tbl,	-- Bug 8644512
5475 		p_prev_ntax_H12_tbl		=> l_yea_info.prev_ntax_H12_tbl,	-- Bug 8644512
5476 		p_prev_ntax_H13_tbl		=> l_yea_info.prev_ntax_H13_tbl,	-- Bug 8644512
5477 		p_prev_ntax_I01_tbl		=> l_yea_info.prev_ntax_I01_tbl,	-- Bug 8644512
5478 		p_prev_ntax_K01_tbl		=> l_yea_info.prev_ntax_K01_tbl,	-- Bug 8644512
5479 		p_prev_ntax_M01_tbl		=> l_yea_info.prev_ntax_M01_tbl,	-- Bug 8644512
5480 		p_prev_ntax_M02_tbl		=> l_yea_info.prev_ntax_M02_tbl,	-- Bug 8644512
5481 		p_prev_ntax_M03_tbl		=> l_yea_info.prev_ntax_M03_tbl,	-- Bug 8644512
5482 		p_prev_ntax_S01_tbl		=> l_yea_info.prev_ntax_S01_tbl,	-- Bug 8644512
5483 		p_prev_ntax_T01_tbl		=> l_yea_info.prev_ntax_T01_tbl,	-- Bug 8644512
5484 		p_prev_ntax_Y01_tbl		=> l_yea_info.prev_ntax_Y01_tbl,	-- Bug 8644512
5485 		p_prev_ntax_Y02_tbl		=> l_yea_info.prev_ntax_Y02_tbl,	-- Bug 8644512
5486 		p_prev_ntax_Y03_tbl		=> l_yea_info.prev_ntax_Y03_tbl,	-- Bug 8644512
5487 		p_prev_ntax_Y20_tbl		=> l_yea_info.prev_ntax_Y20_tbl,	-- Bug 8644512
5488 		p_prev_ntax_Y21_tbl		=> l_yea_info.prev_ntax_Y21_tbl,	-- Bug 9737699
5489 		p_prev_ntax_ZZ_tbl		=> l_yea_info.prev_ntax_ZZ_tbl,		-- Bug 9737699
5490 		p_prev_ntax_Z01_tbl		=> l_yea_info.prev_ntax_Z01_tbl,	-- Bug 8644512
5491 		p_prev_ntax_tax_brk_tbl		=> l_yea_info.prev_ntax_tax_brk_tbl,	-- Bug 9737699
5492 		p_prev_ntax_H14_tbl		=> l_yea_info.prev_ntax_H14_tbl,	-- Bug 14754822
5493 		p_prev_ntax_H15_tbl		=> l_yea_info.prev_ntax_H15_tbl,
5494 		p_prev_ntax_T10_tbl		=> l_yea_info.prev_ntax_T10_tbl,
5495 		p_prev_ntax_T20_tbl		=> l_yea_info.prev_ntax_T20_tbl
5496 		);
5497 	------------------------------------------------------------------------
5498 	-- Bug 9767399
5499 	------------------------------------------------------------------------
5500 	sep_pen_details(
5501 	        p_assignment_id		=> l_assignment_id,
5502 		p_effective_date	=> l_effective_date,
5503 		p_priority_tbl          => l_yea_info.sep_pen_priority_tbl,
5504 		p_fin_institute_tbl     => l_yea_info.sep_pen_fin_institute_tbl,
5505 		p_acc_number_tbl	=> l_yea_info.sep_pen_acc_number_tbl,
5506 		p_cont_amount_tbl	=> l_yea_info.sep_pen_cont_amount_tbl,
5507 		p_type_tbl		=> l_yea_info.sep_pen_type_tbl,
5508 		p_exem_amount_tbl	=> l_yea_info.sep_pen_exem_amount_tbl);
5509 
5510 	pen_saving_details(
5511 	        p_assignment_id		=> l_assignment_id,
5512 		p_effective_date	=> l_effective_date,
5513 		p_priority_tbl          => l_yea_info.pen_saving_priority_tbl,
5514 		p_fin_institute_tbl     => l_yea_info.pen_saving_fin_institute_tbl,
5515 		p_acc_number_tbl	=> l_yea_info.pen_saving_acc_number_tbl,
5516 		p_cont_amount_tbl	=> l_yea_info.pen_saving_cont_amount_tbl,
5517 		p_type_tbl		=> l_yea_info.pen_saving_type_tbl,
5518 		p_exem_amount_tbl	=> l_yea_info.pen_saving_exem_amount_tbl);
5519 
5520 	hou_saving_details(
5521 	        p_assignment_id		=> l_assignment_id,
5522 		p_effective_date	=> l_effective_date,
5523 		p_priority_tbl          => l_yea_info.hou_saving_priority_tbl,
5524 		p_fin_institute_tbl     => l_yea_info.hou_saving_fin_institute_tbl,
5525 		p_acc_number_tbl	=> l_yea_info.hou_saving_acc_number_tbl,
5526 		p_cont_amount_tbl	=> l_yea_info.hou_saving_cont_amount_tbl,
5527 		p_type_tbl		=> l_yea_info.hou_saving_type_tbl,
5528 		p_exem_amount_tbl	=> l_yea_info.hou_saving_exem_amount_tbl);
5529 
5530 	lt_stock_saving_details(
5531 	        p_assignment_id		=> l_assignment_id,
5532 		p_effective_date	=> l_effective_date,
5533 		p_priority_tbl          => l_yea_info.lt_stck_saving_priority_tbl,
5534 		p_fin_institute_tbl     => l_yea_info.lt_stck_saving_fin_inst_tbl,
5535 		p_acc_number_tbl	=> l_yea_info.lt_stck_saving_acc_number_tbl,
5536 		p_cont_amount_tbl	=> l_yea_info.lt_stck_saving_cont_amt_tbl,
5537 		p_type_tbl		=> l_yea_info.lt_stck_saving_type_tbl,
5538 		p_exem_amount_tbl	=> l_yea_info.lt_stck_saving_exem_amt_tbl);
5539 	-----------------------------------------------------------------------
5540 	-- Dependent Education Expense Tax Exemption Information
5541 	------------------------------------------------------------------------
5542 	dpnt_educ_tax_exem_info(
5543 		p_assignment_id			=> l_assignment_id,
5544 		p_effective_date		=> l_effective_date,
5545 		p_contact_name_tbl		=> l_yea_info.dpnt_educ_contact_name_tbl,	-- Bug 9079450
5546 		p_contact_ni_tbl		=> l_yea_info.dpnt_educ_contact_ni_tbl,		-- Bug 9079450
5547 		p_contact_type_tbl		=> l_yea_info.dpnt_educ_contact_type_tbl,
5548 		p_school_type_tbl		=> l_yea_info.dpnt_educ_school_type_tbl,
5549 		p_exp_tbl			=> l_yea_info.dpnt_educ_exp_tbl);
5550 	--
5551 	return l_yea_info;
5552 end yea_info;
5553 --------------------------------------------------------------------------------
5554 procedure chk_assignment_id(
5555 		p_business_group_id	in number,
5556 		p_assignment_id		in number,
5557 		p_bal_asg_action_id	in number,
5558 		p_effective_date	in date,
5559 		p_payroll_id		in number,
5560 		p_report_category	in varchar2,
5561 		p_error                 out nocopy varchar2)
5562 --------------------------------------------------------------------------------
5563 is
5564 	l_proc	constant  varchar2(61) := g_package || 'chk_assignment_id';
5565 	l_business_group_id	number;
5566 	l_esd			date;
5567 	l_eed			date;
5568 	l_payroll_id		number;
5569 
5570 	cursor csr_asg is
5571 		select
5572 			pa.business_group_id,
5573 			pa.effective_start_date,
5574 			pa.effective_end_date,
5575 			pa.payroll_id
5576 		from	per_assignments_f	pa
5577 		where	pa.assignment_id = p_assignment_id
5578 		and	pa.assignment_type = 'E'
5579 		and	pa.effective_start_date <= p_effective_date
5580 		and	pa.effective_end_date >= trunc(p_effective_date, 'YYYY')
5581 		order by pa.effective_start_date desc
5582 		for update of pa.assignment_id;
5583 
5584 	l_exists		varchar2(1);
5585 
5586 	cursor csr_incomplete_exists is
5587 		select
5588 			'Y'
5589 		from	dual
5590 		where	exists(
5591 				select	null
5592 				from	pay_action_classifications	pac,
5593 					pay_payroll_actions		ppa,
5594 					pay_assignment_actions		paa
5595 				where	paa.assignment_id = p_assignment_id
5596 				and	paa.action_status not in ('C', 'S') -- Bug 4442484: A 'S'kipped assact is not an errored one
5597 				and     paa.assignment_action_id <> p_bal_asg_action_id
5598 				and	paa.source_action_id is null
5599 				and	ppa.payroll_action_id = paa.payroll_action_id
5600 				and	ppa.effective_date <= p_effective_date
5601 				and	pac.action_type = ppa.action_type
5602 				and	pac.classification_name = 'SEQUENCED');
5603 
5604 	l_effective_date	date;
5605 
5606 	cursor csr_archive_exists
5607 	is
5608 	   select  ppa.effective_date
5609 	     from  pay_payroll_actions			ppa,
5610 		   pay_assignment_actions		paa
5611 	    where  paa.assignment_id    	 =  p_assignment_id
5612 	      and  ppa.payroll_action_id	 =  paa.payroll_action_id
5613 	      and  paa.source_action_id 	 is null
5614 	      and  ppa.action_type      	 IN ('X','B')
5615 	      and  ppa.report_type 		 = 'YEA'
5616 	      and  ppa.report_qualifier		 = 'KR'
5617 	      and  ppa.report_category		 IN ('N','I')
5618 	      and  trunc(ppa.effective_date, 'YYYY') = trunc(p_effective_date, 'YYYY')
5619 	    order by paa.action_sequence desc;
5620 
5621 	cursor csr_bal_adj_exists(p_payroll_id pay_payroll_actions.payroll_id%type)
5622 	is
5623 	   select  ppa.effective_date
5624 	     from  pay_payroll_actions			ppa,
5625 		   pay_assignment_actions		paa
5626 	    where  paa.assignment_id    	 =  p_assignment_id
5627 	      and  ppa.payroll_action_id	 =  paa.payroll_action_id
5628               and  ppa.payroll_id                =  p_payroll_id -- Bug 5045110
5629 	      and  paa.assignment_action_id      <> p_bal_asg_action_id
5630 	      and  paa.source_action_id 	 is null
5631 	      and  ppa.action_type      	 =  'B'
5632 	      and  pay_kr_ff_functions_pkg.get_legislative_parameter(ppa.payroll_action_id, 'REPORT_TYPE', null) = 'YEA'
5633 	      and  pay_kr_ff_functions_pkg.get_legislative_parameter(ppa.payroll_action_id, 'REPORT_QUALIFIER', null) = 'KR'
5634 	      and  pay_kr_ff_functions_pkg.get_legislative_parameter(ppa.payroll_action_id, 'REPORT_CATEGORY', null) IN ('N','I')
5635 	      and  ppa.effective_date            between trunc(p_effective_date, 'YYYY')
5636                                                  and (trunc(add_months(p_effective_date, 12), 'YYYY') - 1) -- Bug 5045110
5637 	    order by paa.action_sequence desc;
5638 
5639 begin
5640 	--
5641 	if g_debug then
5642 		hr_utility.set_location('pay_kr_yea_pkg.chk_assignment_id.',10);
5643 	end if;
5644 	--
5645 	hr_api.mandatory_arg_error(
5646 		p_api_name		=> l_proc,
5647 		p_argument		=> 'business_group_id',
5648 		p_argument_value	=> p_business_group_id);
5649 	hr_api.mandatory_arg_error(
5650 		p_api_name		=> l_proc,
5651 		p_argument		=> 'assignment_id',
5652 		p_argument_value	=> p_assignment_id);
5653 	hr_api.mandatory_arg_error(
5654 		p_api_name		=> l_proc,
5655 		p_argument		=> 'effective_date',
5656 		p_argument_value	=> p_effective_date);
5657 	hr_api.mandatory_arg_error(
5658 		p_api_name		=> l_proc,
5659 		p_argument		=> 'payroll_id',
5660 		p_argument_value	=> p_payroll_id);
5661 	hr_api.mandatory_arg_error(
5662 		p_api_name		=> l_proc,
5663 		p_argument		=> 'report_category',
5664 		p_argument_value	=> p_report_category);
5665 	--
5666 	if g_debug then
5667 		hr_utility.set_location('pay_kr_yea_pkg.chk_assignment_id.',20);
5668 	end if;
5669 	--
5670 	open csr_asg;
5671 	fetch csr_asg into l_business_group_id, l_esd, l_eed, l_payroll_id;
5672 
5673 	if csr_asg%NOTFOUND then
5674 		--
5675 		close csr_asg;
5676 		--
5677 		if g_debug then
5678 			hr_utility.set_location('pay_kr_yea_pkg.chk_assignment_id.',30);
5679 		end if;
5680 		--
5681 		fnd_message.set_name('PAY', 'PAY_KR_INV_ASG');
5682 		p_error := fnd_message.get;
5683 		return;
5684 	else
5685 		--
5686 		close csr_asg;
5687 		--
5688 		if g_debug then
5689 			hr_utility.set_location('pay_kr_yea_pkg.chk_assignment_id.',40);
5690 		end if;
5691 		--
5692 		--
5693 		-- Business Group Validation
5694 		--
5695 		if l_business_group_id <> p_business_group_id then
5696 			fnd_message.set_name('PAY', 'PAY_KR_INV_ASG_BG');
5697 			p_error := fnd_message.get;
5698 			return;
5699 		end if;
5700 		--
5701 		-- Effective Date Validation
5702 		--
5703 		if p_effective_date not between l_esd and l_eed then
5704 			fnd_message.set_name('PAY', 'PAY_KR_INV_ASG');
5705 			p_error := fnd_message.get;
5706 			return;
5707 		end if;
5708 		--
5709 		-- Payroll Validation
5710 		--
5711 		if l_payroll_id <> p_payroll_id then
5712 			fnd_message.set_name('PAY', 'PAY_KR_INV_ASG_PAYROLL');
5713 			p_error := fnd_message.get;
5714 			return;
5715 		end if;
5716 	end if;
5717 	--
5718 	if g_debug then
5719 		hr_utility.set_location('pay_kr_yea_pkg.chk_assignment_id.',50);
5720 	end if;
5721 	------------------------------------------------------------------------
5722 	-- If invalid assacts exist before effective_date, raise error.
5723 	------------------------------------------------------------------------
5724 	open csr_incomplete_exists;
5725 	fetch csr_incomplete_exists into l_exists;
5726 
5727 	if csr_incomplete_exists%FOUND then
5728 		close csr_incomplete_exists;
5729 		fnd_message.set_name('PAY', 'PAY_KR_INCOMP_ASSACT_EXISTS');
5730 		p_error := fnd_message.get;
5731 		return;
5732 	end if;
5733 	--
5734 	if csr_incomplete_exists%ISOPEN then
5735 		close csr_incomplete_exists;
5736 	end if;
5737 	--
5738 	if g_debug then
5739 		hr_utility.set_location('pay_kr_yea_pkg.chk_assignment_id.',60);
5740 	end if;
5741 	------------------------------------------------------------------------
5742 	-- YEA Type Validation
5743 	------------------------------------------------------------------------
5744 	open  csr_archive_exists;
5745 	fetch csr_archive_exists into l_effective_date;
5746 
5747 	if csr_archive_exists%FOUND then
5748 		--
5749 		if g_debug then
5750 			hr_utility.set_location('pay_kr_yea_pkg.chk_assignment_id.',70);
5751 		end if;
5752 		--
5753 		close csr_archive_exists;
5754 
5755 		if l_effective_date > p_effective_date then
5756 			fnd_message.set_name('PAY', 'PAY_KR_YEA_ALREADY_PROCESSED');
5757 			fnd_message.set_token('EFFECTIVE_DATE', fnd_date.date_to_displaydate(l_effective_date));
5758 			p_error := fnd_message.get;
5759 			return;
5760 		else
5761 			if p_report_category in ('N', 'I') then
5762 				fnd_message.set_name('PAY', 'PAY_KR_RUN_REYEA_NOT_YEA');
5763 				p_error := fnd_message.get;
5764 				return;
5765 			end if;
5766 		end if;
5767 	else
5768 		--
5769 		if g_debug then
5770 			hr_utility.set_location('pay_kr_yea_pkg.chk_assignment_id.',80);
5771 		end if;
5772 		--
5773 		close csr_archive_exists;
5774 
5775 		open  csr_bal_adj_exists(l_payroll_id) ;
5776 		fetch csr_bal_adj_exists into l_effective_date;
5777 
5778 		if csr_bal_adj_exists%FOUND then
5779 
5780 			close csr_bal_adj_exists;
5781 			fnd_message.set_name('PAY', 'PAY_KR_ROLLBACK_BAL_ADJ');
5782 			p_error := fnd_message.get;
5783 			return;
5784 		else
5785 			close csr_bal_adj_exists;
5786 
5787 			if p_report_category = 'R' then
5788 				fnd_message.set_name('PAY', 'PAY_KR_RUN_YEA_NOT_REYEA');
5789 				p_error := fnd_message.get;
5790 				return;
5791 			end if;
5792 		end if;
5793 	end if;
5794 
5795 end chk_assignment_id;
5796 --------------------------------------------------------------------------------
5797 procedure process_assignment(
5798 	p_validate		in boolean,
5799 	p_business_group_id	in number,
5800 	p_assignment_id		in number,
5801 	p_assignment_action_id  in number,
5802 	p_bal_asg_action_id	in number,
5803 	p_report_type		in out nocopy varchar2,
5804 	p_report_qualifier	in out nocopy varchar2,
5805 	p_report_category	in out nocopy varchar2,
5806 	p_effective_date	in out nocopy date,
5807 	p_payroll_id		in out nocopy number,
5808 	p_consolidation_set_id	in out nocopy number,
5809         p_archive_type_used     in out nocopy varchar2)  -- Bug 5036734
5810 --------------------------------------------------------------------------------
5811 is
5812 	l_yea_info			t_yea_info;
5813 	l_taxable_earnings_warning	boolean;
5814 	l_taxable_income_warning	boolean;
5815 	l_taxation_base_warning		boolean;
5816 	l_calc_tax_warning		boolean;
5817 	l_itax_warning			boolean;
5818 	l_rtax_warning			boolean;
5819         -- Bug 2878937
5820         l_tax_adj_warning               boolean;
5821 	l_entry_value_tbl		hr_entry.varchar2_table;
5822 	l_user_entity_id_tbl		t_number_tbl;
5823 	l_archive_item_value_tbl	t_varchar2_tbl;
5824 	l_message_level_tbl		t_varchar2_tbl;
5825 	l_message_text_tbl		t_varchar2_tbl;
5826 	--------------------------------------------------------------------------------
5827 	procedure set_message(
5828 		p_condition			in boolean,
5829 		p_message_level			in varchar2,
5830 		p_application_short_name	in varchar2,
5831 		p_message_name			in varchar2,
5832 		p_token_name1			in varchar2,
5833 		p_token_value1			in varchar2)
5834 	--------------------------------------------------------------------------------
5835 	is
5836 		l_index	number;
5837 	begin
5838 		if p_condition then
5839 			l_index := l_message_level_tbl.count + 1;
5840 			fnd_message.set_name(p_application_short_name, p_message_name);
5841 			if p_token_name1 is not null then
5842 				fnd_message.set_token(p_token_name1, p_token_value1);
5843 			end if;
5844 			l_message_level_tbl(l_index) := p_message_level;
5845 			l_message_text_tbl(l_index)  := fnd_message.get;
5846 		end if;
5847 	end set_message;
5848 begin
5849 	------------------------------------------------------------------------
5850 	-- Process YEA
5851 	------------------------------------------------------------------------
5852 	if g_debug then
5853 	   hr_utility.trace('Running YEA ..........................................');
5854 	end if;
5855 	--
5856 	yea_info(
5857 		p_assignment_id			=> p_assignment_id,
5858 		p_assignment_action_id		=> p_bal_asg_action_id,
5859 		p_effective_date		=> p_effective_date,
5860 		p_business_group_id		=> p_business_group_id,
5861 		p_payroll_id         		=> p_payroll_id,
5862 		p_yea_info			=> l_yea_info,
5863 		p_taxable_earnings_warning	=> l_taxable_earnings_warning,
5864 		p_taxable_income_warning	=> l_taxable_income_warning,
5865 		p_taxation_base_warning		=> l_taxation_base_warning,
5866 		p_calc_tax_warning		=> l_calc_tax_warning,
5867 		p_itax_warning			=> l_itax_warning,
5868 		p_rtax_warning			=> l_rtax_warning,
5869                 p_tax_adj_warning               => l_tax_adj_warning);
5870 
5871         --
5872         if g_debug then
5873 	        hr_utility.trace('p_yea_info.cur_itax '||to_char(l_yea_info.cur_itax));
5874 	        hr_utility.trace('p_yea_info.cur_rtax '||to_char(l_yea_info.cur_rtax));
5875 	        hr_utility.trace('p_yea_info.cur_stax '||to_char(l_yea_info.cur_stax));
5876 	        hr_utility.trace('p_yea_info.itax_adj '||to_char(l_yea_info.itax_adj));
5877 	        hr_utility.trace('p_yea_info.rtax_adj '||to_char(l_yea_info.rtax_adj));
5878 	        hr_utility.trace('p_yea_info.stax_adj '||to_char(l_yea_info.stax_adj));
5879            hr_utility.trace('Checking Balance...........');
5880         end if;
5881 	--
5882 	pay_balance_pkg.get_value ( p_assignment_action_id => p_bal_asg_action_id
5883 	                           ,p_defined_balance_lst  => g_tax_adj_balance_tab );
5884 	--
5885         if g_debug then
5886            hr_utility.trace('Balance Value of itax_adj = '||to_char(g_tax_adj_balance_tab(1).balance_value));
5887            hr_utility.trace('Balance Value of rtax_adj = '||to_char(g_tax_adj_balance_tab(2).balance_value));
5888            hr_utility.trace('Balance Value of stax_adj = '||to_char(g_tax_adj_balance_tab(3).balance_value));
5889         end if;
5890         -----------------------------------------------------------------------
5891         if g_tax_adj_balance_tab(1).balance_value <> l_yea_info.itax_adj OR
5892            g_tax_adj_balance_tab(2).balance_value <> l_yea_info.rtax_adj OR
5893            g_tax_adj_balance_tab(3).balance_value <> l_yea_info.stax_adj
5894         then
5895 		--
5896 		if g_debug then
5897 			hr_utility.trace('Incorrect Balance Adjustment amount');
5898 		end if;
5899 		--
5900 		fnd_message.set_name('PAY', 'PAY_KR_INCORRECT_ADJ_AMT');
5901 		fnd_message.set_token('ASSIGNMENT_ID', p_assignment_id);
5902 		--
5903 		insert into pay_message_lines(
5904 			LINE_SEQUENCE,
5905 			PAYROLL_ID,
5906 			MESSAGE_LEVEL,
5907 			SOURCE_ID,
5908 			SOURCE_TYPE,
5909 			LINE_TEXT)
5910 		values( pay_message_lines_s.nextval,
5911 			p_payroll_id,
5912 			'F',
5913 			p_assignment_action_id,
5914 			'A',
5915 			fnd_message.get);
5916 		--
5917 		fnd_message.raise_error;
5918         else
5919 		--
5920 		if g_debug then
5921 			hr_utility.trace('Archiving...................');
5922 		end if;
5923 		------------------------------------------------------------------------
5924 		-- Convert from YEA result from record variable to PL/SQL table.
5925 		------------------------------------------------------------------------
5926 		convert_to_tbl(
5927 			p_report_type                   => p_report_type,
5928 			p_report_qualifier              => p_report_qualifier,
5929 			p_report_category               => p_report_category,
5930 			p_effective_date                => p_effective_date,
5931 			p_yea_info                      => l_yea_info,
5932 			p_user_entity_id_tbl            => l_user_entity_id_tbl,
5933 			p_archive_item_value_tbl        => l_archive_item_value_tbl);
5934 		--
5935                 -- Bug 5036734 : Need to delete archive records while retrying
5936                 --               an archive process that used AAC archive type
5937                 if p_archive_type_used <> 'AAP' then  -- old archive, delete manually.
5938 
5939                     delete from ff_archive_items
5940                     where CONTEXT1 = p_assignment_action_id
5941                     and ARCHIVE_TYPE = 'AAC';
5942 
5943                 end if;
5944 
5945 		------------------------------------------------------------------------
5946 		-- Insert into FF_ARCHIVE_ITEMS
5947 		------------------------------------------------------------------------
5948 		forall i in 1..l_user_entity_id_tbl.count
5949 			insert into ff_archive_items(
5950 				ARCHIVE_ITEM_ID,
5951 				USER_ENTITY_ID,
5952 				CONTEXT1,
5953 				VALUE,
5954 				ARCHIVE_TYPE)
5955 			values( ff_archive_items_s.nextval,
5956 				l_user_entity_id_tbl(i),
5957 				p_assignment_action_id,
5958 				l_archive_item_value_tbl(i),
5959                                 p_archive_type_used);  -- Bug 5036734
5960 		--
5961 		------------------------------------------------------------------------
5962 		-- Convert message information to PL/SQL table.
5963 		------------------------------------------------------------------------
5964 		--
5965 		set_message(l_taxable_earnings_warning, 'W', 'PAY', 'PAY_KR_NGTV_TAXABLE_EARNINGS', 'TAXABLE_EARNINGS', to_char(l_yea_info.taxable));
5966 		set_message(l_taxable_income_warning, 'I', 'PAY', 'PAY_KR_TAXABLE_INCOME_ZERO',null,null);
5967 		set_message(l_taxation_base_warning, 'I', 'PAY', 'PAY_KR_TAXATION_BASE_ZERO',null,null);
5968 		set_message(l_calc_tax_warning, 'I', 'PAY', 'PAY_KR_CALC_TAX_ZERO',null,null);
5969 		set_message(l_itax_warning, 'I', 'PAY', 'PAY_KR_ITAX_ZERO',null,null);
5970 		set_message(l_rtax_warning, 'I', 'PAY', 'PAY_KR_RTAX_ZERO',null,null);
5971 		set_message(l_tax_adj_warning, 'I', 'PAY', 'PAY_KR_ADJ_LESS_THAN_THOUSAND', null, null);
5972 
5973 		--
5974 		------------------------------------------------------------------------
5975 		-- Insert into PAY_MESSAGE_LINES
5976 		------------------------------------------------------------------------
5977 		forall i in 1..l_message_level_tbl.count
5978 			insert into pay_message_lines(
5979 				LINE_SEQUENCE,
5980 				PAYROLL_ID,
5981 				MESSAGE_LEVEL,
5982 				SOURCE_ID,
5983 				SOURCE_TYPE,
5984 				LINE_TEXT)
5985 			values( pay_message_lines_s.nextval,
5986 				p_payroll_id,
5987 				l_message_level_tbl(i),
5988 				p_assignment_action_id,
5989 				'A',
5990 				l_message_text_tbl(i));
5991 		--
5992         end if;
5993 
5994 exception
5995 	when hr_api.validate_enabled then
5996 		fnd_message.raise_error;
5997 end process_assignment;
5998 --
5999 ---------------------------------------------------------------------------------------------------------------
6000 -- New function added to get the adj amount and feed it to ITAX_ADJ,RTAX_ADJ,STAX_ADJ elements
6001 -- using formula results
6002 ---------------------------------------------------------------------------------------------------------------
6003 function calculate_adjustment(
6004            p_assignment_id                 in pay_assignment_actions.assignment_id%type,
6005            p_business_group_id             in pay_payroll_actions.business_group_id%type,
6006            p_effective_date                in pay_payroll_actions.effective_date%type,
6007            p_payroll_action_id             in pay_payroll_actions.payroll_action_id%type,
6008            p_assignment_action_id          in pay_assignment_actions.assignment_action_id%type,
6009            p_itax_adj                      out nocopy number,
6010            p_rtax_adj                      out nocopy number,
6011            p_stax_adj                      out nocopy number,
6012            p_error                         out nocopy varchar2
6013            ) return number
6014 ---------------------------------------------------------------------------------------------------------------
6015 is
6016   l_yea_info                             t_yea_info;
6017   l_tax_adj_warning                      boolean;
6018   l_taxable_earnings_warning             boolean;
6019   l_taxable_income_warning               boolean;
6020   l_taxation_base_warning                boolean;
6021   l_calc_tax_warning                     boolean;
6022   l_itax_warning                         boolean;
6023   l_rtax_warning                         boolean;
6024   l_return                               number;
6025   ------------------------------------------------------------------------------
6026   cursor csr_pact
6027   IS
6028    select  pay_kr_ff_functions_pkg.get_legislative_parameter(ppa.payroll_action_id, 'REPORT_CATEGORY', null) report_category
6029           ,ppa.element_type_id       element_type_id
6030           ,ppa.payroll_id            payroll_id
6031      from  pay_payroll_actions ppa
6032     where  ppa.payroll_action_id     = p_payroll_action_id;
6033     -------------------------------------------
6034     r_pact          csr_pact%rowtype;
6035     -------------------------------------------
6036 begin
6037    --
6038    hr_api.validate_bus_grp_id(p_business_group_id);
6039    --
6040    if g_debug then
6041       hr_utility.trace('Assignment Id: '||to_char(p_assignment_id)||' Payroll Action Id: '||to_char(p_payroll_action_id));
6042       hr_utility.trace('Effective Date: '||to_char(p_effective_date)||' Business Group Id: '||to_char(p_business_group_id));
6043    end if;
6044    --
6045    open  csr_pact;
6046    fetch csr_pact into r_pact;
6047    close csr_pact;
6048    --
6049    if g_debug then
6050         hr_utility.trace('Checking Assignment');
6051    end if;
6052    ------------------------------------------------------------------------
6053    -- Assignment validation
6054    ------------------------------------------------------------------------
6055    chk_assignment_id(
6056 		p_business_group_id	=> p_business_group_id,
6057 		p_assignment_id		=> p_assignment_id,
6058 		p_bal_asg_action_id	=> p_assignment_action_id,
6059 		p_effective_date	=> p_effective_date,
6060 		p_payroll_id		=> r_pact.payroll_id,
6061 		p_report_category	=> r_pact.report_category,
6062 		p_error                 => p_error);
6063    --
6064    if g_debug then
6065 	hr_utility.trace('After checking assignment');
6066    end if;
6067    --
6068    if p_error is not null then
6069         return 1;  -- failure
6070    else
6071            --
6072 	   if g_debug then
6073 	      hr_utility.trace('Calculating Adjustments');
6074 	   end if;
6075 	   --
6076 	   -------------------------------------------------------------------------
6077 	   -- Calculate Tax Adjustments
6078 	   -------------------------------------------------------------------------
6079 	   yea_info(p_assignment_id             => p_assignment_id,
6080 		    p_assignment_action_id      => p_assignment_action_id,
6081 		    p_effective_date            => p_effective_date,
6082 		    p_business_group_id         => p_business_group_id,
6083 		    p_payroll_id         	=> r_pact.payroll_id,
6084 		    p_yea_info                  => l_yea_info,
6085 		    p_taxable_earnings_warning  => l_taxable_earnings_warning,
6086 		    p_taxable_income_warning    => l_taxable_income_warning,
6087 		    p_taxation_base_warning     => l_taxation_base_warning,
6088 		    p_calc_tax_warning          => l_calc_tax_warning,
6089 		    p_itax_warning              => l_itax_warning,
6090 		    p_rtax_warning              => l_rtax_warning,
6091 		    p_tax_adj_warning           => l_tax_adj_warning);
6092 
6093 
6094 	   p_itax_adj := l_yea_info.itax_adj;
6095 	   p_rtax_adj := l_yea_info.rtax_adj;
6096 	   p_stax_adj := l_yea_info.stax_adj;
6097 
6098 	   if g_debug then
6099 	      hr_utility.trace('p_itax_adj '||to_char(p_itax_adj));
6100 	      hr_utility.trace('p_rtax_adj '||to_char(p_rtax_adj));
6101 	      hr_utility.trace('p_stax_adj '||to_char(p_stax_adj));
6102 	   end if;
6103 
6104 	   return 0; -- success
6105    end if;
6106    --
6107 ---------------------------------------------------------------------------------------------------------------
6108 end calculate_adjustment;
6109 ---------------------------------------------------------------------------------------------------------------
6110 BEGIN
6111 	------------------------------------------------------------------------
6112 	-- Package initialization section
6113 	------------------------------------------------------------------------
6114 	declare
6115 		l_user_entity_id_tbl	t_number_tbl;
6116 		l_user_entity_name_tbl	t_varchar2_tbl;
6117 		--------------------------------------------------------
6118 		function defined_balance_id(p_user_name in varchar2) return number
6119 		--------------------------------------------------------
6120 		is
6121 			l_defined_balance_id	number;
6122 		begin
6123 			select
6124 				u.creator_id
6125 			into	l_defined_balance_id
6126 			from	ff_user_entities	u,
6127 				ff_database_items	d
6128 			where	d.user_name = p_user_name
6129 			and	u.user_entity_id = d.user_entity_id
6130 			and	u.legislation_code = 'KR'
6131 			and	u.business_group_id is null
6132 			and	u.creator_type = 'B';
6133 			--
6134 			return l_defined_balance_id;
6135 		end defined_balance_id;
6136 		--------------------------------------------------------
6137 		function element(p_element_name	in varchar2) return t_element
6138 		--------------------------------------------------------
6139 		is
6140 			l_element	t_element;
6141 		begin
6142 			select
6143 				element_type_id
6144 			into	l_element.element_type_id
6145 			from	pay_element_types_f
6146 			where	element_name = p_element_name
6147 			and	legislation_code = 'KR'
6148 			and	business_group_id is null
6149 			group by element_type_id;
6150 			--
6151 			select
6152 				input_value_id,
6153 				min(name)
6154 			bulk collect into
6155 				l_element.input_value_id_tbl,
6156 				l_element.input_value_name_tbl
6157 			from	pay_input_values_f
6158 			where	element_type_id = l_element.element_type_id
6159 			and	legislation_code = 'KR'
6160 			and	business_group_id is null
6161 			group by input_value_id;
6162 			--
6163 			return l_element;
6164 		end element;
6165 		--------------------------------------------------------
6166 		function user_entity_id(p_user_entity_name in varchar2) return number
6167 		--------------------------------------------------------
6168 		is
6169 			l_index			number;
6170 			l_user_entity_id	number;
6171 		begin
6172 			l_index := l_user_entity_id_tbl.first;
6173 			while l_index is not null loop
6174 				if l_user_entity_name_tbl(l_index) = p_user_entity_name then
6175 					l_user_entity_id := l_user_entity_id_tbl(l_index);
6176 					l_user_entity_id_tbl.delete(l_index);
6177 					l_user_entity_name_tbl.delete(l_index);
6178 					exit;
6179 				end if;
6180 				l_index := l_user_entity_id_tbl.next(l_index);
6181 			end loop;
6182 			--
6183 			if l_user_entity_id is null then
6184 				raise no_data_found;
6185 			end if;
6186 			--
6187 			return l_user_entity_id;
6188 		end user_entity_id;
6189 
6190 	begin
6191 	--
6192 	 open csr_contexts;
6193 	 fetch csr_contexts bulk collect into g_contexts_tab;
6194 	 close csr_contexts;
6195 		------------------------------------------------------------------------
6196 		--  Collecting Defined Balance Id into g_balance_value_tab table
6197 		------------------------------------------------------------------------
6198 		g_balance_value_tab(1).defined_balance_id := defined_balance_id('SP_IRREG_BONUS_ASG_YTD_MTH');
6199 		g_balance_value_tab(2).defined_balance_id := defined_balance_id('SP_IRREG_BONUS_ASG_YTD_BON');
6200 		g_balance_value_tab(3).defined_balance_id := defined_balance_id('TOTAL_TAXABLE_EARNINGS_ASG_YTD_MTH');
6201 		g_balance_value_tab(4).defined_balance_id := defined_balance_id('TOTAL_TAXABLE_EARNINGS_ASG_YTD_BON');
6202 		g_balance_value_tab(5).defined_balance_id := defined_balance_id('TOTAL_NON_TAXABLE_EARNINGS_ASG_YTD_MTH');
6203 		g_balance_value_tab(6).defined_balance_id := defined_balance_id('TOTAL_NON_TAXABLE_EARNINGS_ASG_YTD_BON');
6204 		g_balance_value_tab(7).defined_balance_id := defined_balance_id('NON_TAXABLE_OVS_EARNINGS_ASG_YTD_MTH');
6205 		g_balance_value_tab(8).defined_balance_id := defined_balance_id('NON_TAXABLE_OVS_EARNINGS_ASG_YTD_BON');
6206 		g_balance_value_tab(9).defined_balance_id := defined_balance_id('NON_TAXABLE_OVT_EARNINGS_ASG_YTD_MTH');
6207 		g_balance_value_tab(10).defined_balance_id := defined_balance_id('NON_TAXABLE_OVT_EARNINGS_ASG_YTD_BON');
6208 		g_balance_value_tab(11).defined_balance_id := defined_balance_id('HI_PREM_EE_ASG_YTD');
6209 		-- Bug 7164589
6210 		g_balance_value_tab(29).defined_balance_id := defined_balance_id('LTCI_PREM_EE_ASG_YTD');
6211 		-- End of Bug 7164589
6212 		g_balance_value_tab(12).defined_balance_id := defined_balance_id('EI_PREM_ASG_YTD');
6213 		g_balance_value_tab(13).defined_balance_id := defined_balance_id('NP_PREM_EE_ASG_YTD');
6214 		-- Bug 6024342
6215 		g_balance_value_tab(28).defined_balance_id := defined_balance_id('PENSION_PREMIUM_ASG_YTD');
6216 		--
6217 		-- Bug 9737699
6218 		g_balance_value_tab(92).defined_balance_id := defined_balance_id('MILITARY_PENSION_PREMIUM_ASG_YTD');
6219 		g_balance_value_tab(93).defined_balance_id := defined_balance_id('PRIVATE_SCHOOL_PENSION_ASG_YTD');
6220 		g_balance_value_tab(94).defined_balance_id := defined_balance_id('POST_OFFICE_PENSION_ASG_YTD');
6221 		--
6222 		g_balance_value_tab(14).defined_balance_id := defined_balance_id('ITAX_ASG_YTD_MTH');
6223 		g_balance_value_tab(15).defined_balance_id := defined_balance_id('ITAX_ASG_YTD_BON');
6224 		g_balance_value_tab(16).defined_balance_id := defined_balance_id('RTAX_ASG_YTD_MTH');
6225 		g_balance_value_tab(17).defined_balance_id := defined_balance_id('RTAX_ASG_YTD_BON');
6226 		g_balance_value_tab(18).defined_balance_id := defined_balance_id('STAX_ASG_YTD_MTH');
6227 		g_balance_value_tab(19).defined_balance_id := defined_balance_id('STAX_ASG_YTD_BON');
6228 		-- Bug 3201332
6229 		--Bug 7142620
6230 		g_balance_value_tab(30).defined_balance_id := defined_balance_id('BIRTH_RAISING_ALLOWANCE_ASG_YTD_MTH');
6231 		g_balance_value_tab(31).defined_balance_id := defined_balance_id('BIRTH_RAISING_ALLOWANCE_ASG_YTD_BON');
6232 		--End of Bug 7142620
6233 		-- Bug 7439803
6234 		g_balance_value_tab(32).defined_balance_id := defined_balance_id('NON_TAXABLE_OVS_FRGN_EARNINGS_ASG_YTD_MTH');
6235 		g_balance_value_tab(33).defined_balance_id := defined_balance_id('NON_TAXABLE_OVS_FRGN_EARNINGS_ASG_YTD_BON');
6236 		--
6237 		-- Bug 8644512
6238 		g_balance_value_tab(34).defined_balance_id := defined_balance_id('ESOP_WITHDRAWAL_EARNINGS_ASG_YTD_MTH');
6239 		g_balance_value_tab(35).defined_balance_id := defined_balance_id('ESOP_WITHDRAWAL_EARNINGS_ASG_YTD_BON');
6240 		--
6241 		g_balance_value_tab(20).defined_balance_id := defined_balance_id('MONTHLY_REGULAR_EARNINGS_ASG_YTD');
6242                 -- Added for Bug3021585
6243 		-- Bug 4750653
6244 		g_balance_value_tab(21).defined_balance_id := defined_balance_id('CORPORATE_PENSION_ASG_YTD');
6245 		-- End of Bug 4750653
6246 		-- Bug 5756699
6247 		g_balance_value_tab(22).defined_balance_id := defined_balance_id('ADDITIONAL_OTHER_NON_TAXABLE_EARNINGS_ASG_YTD_MTH');
6248 		g_balance_value_tab(23).defined_balance_id := defined_balance_id('ADDITIONAL_OTHER_NON_TAXABLE_EARNINGS_ASG_YTD_BON');
6249 		-- Bug 6012258
6250 		g_balance_value_tab(24).defined_balance_id := defined_balance_id('STOCK_PURCHASE_OPTION_EXECUTION_EARNING_ASG_YTD_MTH');
6251 		g_balance_value_tab(25).defined_balance_id := defined_balance_id('STOCK_PURCHASE_OPTION_EXECUTION_EARNING_ASG_YTD_BON');
6252 		g_balance_value_tab(26).defined_balance_id := defined_balance_id('RESEARCH_PAYMENT_ASG_YTD_MTH');
6253 		g_balance_value_tab(27).defined_balance_id := defined_balance_id('RESEARCH_PAYMENT_ASG_YTD_BON');
6254 		--End of Bug 6012258
6255 		-- End of Bug 5756699
6256 		g_tax_adj_balance_tab(1).defined_balance_id := defined_balance_id('INCOME_TAX_ADJUSTMENT_ASG_RUN');
6257 		g_tax_adj_balance_tab(2).defined_balance_id := defined_balance_id('RESIDENT_TAX_ADJUSTMENT_ASG_RUN');
6258 		g_tax_adj_balance_tab(3).defined_balance_id := defined_balance_id('SPECIAL_TAX_ADJUSTMENT_ASG_RUN');
6259 		-- Bug 8644512
6260 		g_balance_value_tab(36).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_G01_ASG_YTD_MTH');
6261 		g_balance_value_tab(37).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_G01_ASG_YTD_BON');
6262 		g_balance_value_tab(38).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_H01_ASG_YTD_MTH');
6263 		g_balance_value_tab(39).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_H01_ASG_YTD_BON');
6264 		g_balance_value_tab(40).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_H05_ASG_YTD_MTH');
6265 		g_balance_value_tab(41).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_H05_ASG_YTD_BON');
6266 		g_balance_value_tab(42).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_H06_ASG_YTD_MTH');
6267 		g_balance_value_tab(43).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_H06_ASG_YTD_BON');
6268 		g_balance_value_tab(44).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_H07_ASG_YTD_MTH');
6269 		g_balance_value_tab(45).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_H07_ASG_YTD_BON');
6270 		g_balance_value_tab(46).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_H08_ASG_YTD_MTH');
6271 		g_balance_value_tab(47).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_H08_ASG_YTD_BON');
6272 		g_balance_value_tab(48).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_H09_ASG_YTD_MTH');
6273 		g_balance_value_tab(49).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_H09_ASG_YTD_BON');
6274 		g_balance_value_tab(50).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_H10_ASG_YTD_MTH');
6275 		g_balance_value_tab(51).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_H10_ASG_YTD_BON');
6276 		g_balance_value_tab(52).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_H11_ASG_YTD_MTH');
6277 		g_balance_value_tab(53).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_H11_ASG_YTD_BON');
6278 		g_balance_value_tab(54).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_H12_ASG_YTD_MTH');
6279 		g_balance_value_tab(55).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_H12_ASG_YTD_BON');
6280 		g_balance_value_tab(56).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_H13_ASG_YTD_MTH');
6281 		g_balance_value_tab(57).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_H13_ASG_YTD_BON');
6282 		g_balance_value_tab(58).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_I01_ASG_YTD_MTH');
6283 		g_balance_value_tab(59).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_I01_ASG_YTD_BON');
6284 		g_balance_value_tab(60).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_K01_ASG_YTD_MTH');
6285 		g_balance_value_tab(61).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_K01_ASG_YTD_BON');
6286 		g_balance_value_tab(62).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_M01_ASG_YTD_MTH');
6287 		g_balance_value_tab(63).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_M01_ASG_YTD_BON');
6288 		g_balance_value_tab(64).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_M02_ASG_YTD_MTH');
6289 		g_balance_value_tab(65).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_M02_ASG_YTD_BON');
6290 		g_balance_value_tab(66).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_M03_ASG_YTD_MTH');
6291 		g_balance_value_tab(67).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_M03_ASG_YTD_BON');
6292 		g_balance_value_tab(68).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_S01_ASG_YTD_MTH');
6293 		g_balance_value_tab(69).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_S01_ASG_YTD_BON');
6294 		g_balance_value_tab(70).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_T01_ASG_YTD_MTH');
6295 		g_balance_value_tab(71).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_T01_ASG_YTD_BON');
6296 		g_balance_value_tab(72).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_Y01_ASG_YTD_MTH');
6297 		g_balance_value_tab(73).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_Y01_ASG_YTD_BON');
6298 		g_balance_value_tab(74).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_Y02_ASG_YTD_MTH');
6299 		g_balance_value_tab(75).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_Y02_ASG_YTD_BON');
6300 		g_balance_value_tab(76).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_Y03_ASG_YTD_MTH');
6301 		g_balance_value_tab(77).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_Y03_ASG_YTD_BON');
6302 		g_balance_value_tab(78).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_Y20_ASG_YTD_MTH');
6303 		g_balance_value_tab(79).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_Y20_ASG_YTD_BON');
6304 		g_balance_value_tab(80).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_Z01_ASG_YTD_MTH');
6305 		g_balance_value_tab(81).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_Z01_ASG_YTD_BON');
6306 		--
6307 		-- Bug 8880364
6308 		--
6309 		g_balance_value_tab(82).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_FRGN_M01_ASG_YTD_MTH');
6310 		g_balance_value_tab(83).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_FRGN_M01_ASG_YTD_BON');
6311 		g_balance_value_tab(84).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_FRGN_M02_ASG_YTD_MTH');
6312 		g_balance_value_tab(85).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_FRGN_M02_ASG_YTD_BON');
6313 		g_balance_value_tab(86).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_FRGN_M03_ASG_YTD_MTH');
6314 		g_balance_value_tab(87).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_FRGN_M03_ASG_YTD_BON');
6315 		--
6316 		-- Bug 9079450
6317 		g_balance_value_tab(88).defined_balance_id := defined_balance_id('EARN_FOR_ER_SMB_EXEM_ASG_YTD_MTH');
6318 		g_balance_value_tab(89).defined_balance_id := defined_balance_id('EARN_FOR_ER_SMB_EXEM_ASG_YTD_BON');
6319 		--
6320 		-- Bug 9737699
6321 		g_balance_value_tab(90).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_Y21_ASG_YTD_MTH');
6322 		g_balance_value_tab(91).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_Y21_ASG_YTD_BON');
6323 		g_balance_value_tab(95).defined_balance_id := defined_balance_id('NTS_SPEC_NON_TAXABLE_EARN_ASG_YTD_MTH');
6324 		g_balance_value_tab(96).defined_balance_id := defined_balance_id('NTS_SPEC_NON_TAXABLE_EARN_ASG_YTD_BON');
6325 		-- Bug 12807687
6326 		g_balance_value_tab(97).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_R10_ASG_YTD_MTH');
6327 		g_balance_value_tab(98).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_R10_ASG_YTD_BON');
6328 		-- Bug 14754822
6329 		g_balance_value_tab(99).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_H14_ASG_YTD_MTH');
6330 		g_balance_value_tab(100).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_H14_ASG_YTD_BON');
6331 		g_balance_value_tab(101).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_H15_ASG_YTD_MTH');
6332 		g_balance_value_tab(102).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_H15_ASG_YTD_BON');
6333 		g_balance_value_tab(103).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_T10_ASG_YTD_MTH');
6334 		g_balance_value_tab(104).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_T10_ASG_YTD_BON');
6335 		g_balance_value_tab(105).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_T20_ASG_YTD_MTH');
6336 		g_balance_value_tab(106).defined_balance_id := defined_balance_id('NON_TAXABLE_EARN_T20_ASG_YTD_BON');
6337 		------------------------------------------------------------------------
6338 		-- Element Type ID and Input Value ID
6339 		------------------------------------------------------------------------
6340 		g_tax		:= element('TAX');
6341 		g_itax_adj	:= element('ITAX_ADJ');
6342 		g_rtax_adj	:= element('RTAX_ADJ');
6343 		g_stax_adj	:= element('STAX_ADJ');
6344 		------------------------------------------------------------------------
6345 		-- User Entity ID
6346 		------------------------------------------------------------------------
6347 		-- Load all Extract-type db items.
6348 		------------------------------------------------------------------------
6349 		select
6350 			distinct
6351 			u.user_entity_id,
6352 			u.user_entity_name
6353 		bulk collect into
6354 			l_user_entity_id_tbl,
6355 			l_user_entity_name_tbl
6356 		from	ff_user_entities		u,
6357 			pay_report_format_items_f	i
6358 		where	i.report_type = 'YEA'
6359 		and	i.report_qualifier = 'KR'
6360 		and	u.user_entity_id = i.user_entity_id;
6361 		--
6362 		g_user_entity_id.non_resident_flag		:= user_entity_id('X_YEA_NON_RESIDENT_FLAG');
6363                 g_user_entity_id.foreign_residency_flag		:= user_entity_id('X_YEA_FOREIGN_RESIDENCY_FLAG'); -- Bug 6615356
6364 		g_user_entity_id.fw_fixed_tax_rate		:= user_entity_id('X_FW_FIX_TAX_RATE_ELIGIBILITY');  -- 3546993
6365 		g_user_entity_id.nationality			:= user_entity_id('X_YEA_NATIONALITY');  -- Bug 7595082
6366 		g_user_entity_id.cur_taxable_mth		:= user_entity_id('X_YEA_CUR_TAXABLE_MTH');
6367 		g_user_entity_id.cur_taxable_bon		:= user_entity_id('X_YEA_CUR_TAXABLE_BON');
6368 		g_user_entity_id.cur_sp_irreg_bonus		:= user_entity_id('X_YEA_CUR_SP_IRREG_BONUS');
6369 		g_user_entity_id.cur_taxable			:= user_entity_id('X_YEA_CUR_TAXABLE');
6370 		g_user_entity_id.cur_non_taxable_ovt		:= user_entity_id('X_YEA_CUR_NON_TAXABLE_OVT');	-- Bug 8644512
6371 		g_user_entity_id.cur_fw_income_exem		:= user_entity_id('X_YEA_CUR_FW_INCOME_EXEM');	-- Bug 8644512
6372 		g_user_entity_id.prev_taxable_mth		:= user_entity_id('X_YEA_PREV_TAXABLE_MTH');
6373 		g_user_entity_id.prev_taxable_bon		:= user_entity_id('X_YEA_PREV_TAXABLE_BON');
6374 		g_user_entity_id.prev_sp_irreg_bonus		:= user_entity_id('X_YEA_PREV_SP_IRREG_BONUS');
6375                 g_user_entity_id.prev_foreign_wrkr_inc_exem     := user_entity_id('X_YEA_PREV_FOREIGN_WRKR_INC_EXEM');  -- Bug 8341054
6376 		g_user_entity_id.prev_stck_pur_opt_exec_earn    := user_entity_id('X_YEA_PREV_STCK_PUR_OPT_EXEC_EARN');	-- Bug 6024432
6377 		g_user_entity_id.prev_taxable			:= user_entity_id('X_YEA_PREV_TAXABLE');
6378 		g_user_entity_id.taxable_mth			:= user_entity_id('X_YEA_TAXABLE_MTH');
6379 		g_user_entity_id.taxable_bon			:= user_entity_id('X_YEA_TAXABLE_BON');
6380 		g_user_entity_id.sp_irreg_bonus			:= user_entity_id('X_YEA_SP_IRREG_BONUS');
6381 		-- Bug 6012258
6382 		g_user_entity_id.cur_stck_pur_opt_exec_earn	:= user_entity_id('X_YEA_STOCK_PUR_OPT_EXEC_EARN');
6383 		g_user_entity_id.research_payment		:= user_entity_id('X_YEA_RESEARCH_PAYMENT');
6384 		--
6385 		g_user_entity_id.stck_pur_opt_exec_earn		:= user_entity_id('X_YEA_TOT_STCK_PUR_OPT_EXEC_EARN'); -- Bug 6024432
6386 		g_user_entity_id.taxable			:= user_entity_id('X_YEA_TAXABLE');
6387 		g_user_entity_id.taxable1			:= user_entity_id('X_YEA_TAXABLE1'); --Bug 7615517
6388 		g_user_entity_id.non_taxable_ovs		:= user_entity_id('X_YEA_NON_TAXABLE_OVS');
6389 		g_user_entity_id.non_taxable_ovt		:= user_entity_id('X_YEA_NON_TAXABLE_OVT');
6390 		g_user_entity_id.non_taxable_oth		:= user_entity_id('X_YEA_NON_TAXABLE_OTH');
6391 		g_user_entity_id.non_taxable			:= user_entity_id('X_YEA_NON_TAXABLE');
6392 		g_user_entity_id.foreign_worker_income_exem	:= user_entity_id('X_YEA_FOREIGN_WORKER_INCOME_EXEM');  -- 3546993
6393 		g_user_entity_id.basic_income_exem		:= user_entity_id('X_YEA_BASIC_INCOME_EXEM');
6394 		g_user_entity_id.taxable_income			:= user_entity_id('X_YEA_TAXABLE_INCOME');
6395 		g_user_entity_id.ee_tax_exem			:= user_entity_id('X_YEA_EE_TAX_EXEM');
6396 		g_user_entity_id.dpnt_spouse_flag		:= user_entity_id('X_YEA_DPNT_SPOUSE_FLAG');
6397 		g_user_entity_id.dpnt_spouse_tax_exem		:= user_entity_id('X_YEA_DPNT_SPOUSE_TAX_EXEM');
6398 		g_user_entity_id.num_of_aged_dpnts		:= user_entity_id('X_YEA_NUM_OF_AGED_DPNTS');
6399 		g_user_entity_id.num_of_adult_dpnts		:= user_entity_id('X_YEA_NUM_OF_ADULT_DPNTS');
6400 		g_user_entity_id.num_of_underaged_dpnts		:= user_entity_id('X_YEA_NUM_OF_UNDERAGED_DPNTS');
6401 		g_user_entity_id.num_of_dpnts			:= user_entity_id('X_YEA_NUM_OF_DPNTS');
6402 		g_user_entity_id.dpnt_tax_exem			:= user_entity_id('X_YEA_DPNT_TAX_EXEM');
6403 		g_user_entity_id.num_of_ageds			:= user_entity_id('X_YEA_NUM_OF_AGEDS');
6404 		-- Bug 3172960, 3637372
6405 		g_user_entity_id.num_of_super_ageds		:= user_entity_id('X_YEA_NUM_OF_SUPER_AGEDS');
6406 		-- Bug 6705170
6407                 g_user_entity_id.num_of_new_born_adopted	:= user_entity_id('X_YEA_NUM_OF_NEW_BORN_ADOPTED');
6408                 g_user_entity_id.new_born_adopted_tax_exem	:= user_entity_id('X_YEA_NEW_BORN_ADOPTED_TAX_EXEM');
6409 		--
6410 		-- Bug 6784288
6411     -- Bug 16010775
6412     g_user_entity_id.single_parent_flag	:= user_entity_id('X_YEA_SINGLE_PARENT_FLAG');
6413     g_user_entity_id.single_parent_tax_exem	:= user_entity_id('X_YEA_SINGLE_PARENT_TAX_EXEM');
6414     -- Bug 16010775
6415 		g_user_entity_id.num_of_addtl_child		:= user_entity_id('X_YEA_NUM_OF_ADDTL_CHILD');
6416 		--
6417 		-- Bug 9737699
6418 		g_user_entity_id.house_holder_flag		:= user_entity_id('X_YEA_HOUSE_HOLDER_FLAG');
6419 		g_user_entity_id.house_holder_exception_flag	:= user_entity_id('X_YEA_HOUSE_HOLDER_EXCEPTION_FLAG'); -- Bug 13247926
6420 		g_user_entity_id.tot_num_dpnts			:= user_entity_id('X_YEA_TOTAL_NUM_OF_DPNTS');
6421 
6422 		--
6423 		g_user_entity_id.aged_tax_exem			:= user_entity_id('X_YEA_AGED_TAX_EXEM');
6424 		g_user_entity_id.num_of_disableds		:= user_entity_id('X_YEA_NUM_OF_DISABLEDS');
6425 		g_user_entity_id.disabled_tax_exem		:= user_entity_id('X_YEA_DISABLED_TAX_EXEM');
6426 		g_user_entity_id.female_ee_flag			:= user_entity_id('X_YEA_FEMALE_EE_FLAG');
6427 		g_user_entity_id.female_ee_tax_exem		:= user_entity_id('X_YEA_FEMALE_EE_TAX_EXEM');
6428 		g_user_entity_id.num_of_children		:= user_entity_id('X_YEA_NUM_OF_CHILDREN');
6429 		g_user_entity_id.child_tax_exem			:= user_entity_id('X_YEA_CHILD_TAX_EXEM');
6430 		-- Bug 5756690
6431 		g_user_entity_id.addl_child_tax_exem		:= user_entity_id('X_YEA_ADDITIONAL_CHILD_TAX_EXEM');
6432 		g_user_entity_id.supp_tax_exem			:= user_entity_id('X_YEA_SUPP_TAX_EXEM');
6433 		g_user_entity_id.hi_prem			:= user_entity_id('X_YEA_HI_PREM');
6434 		g_user_entity_id.hi_prem_tax_exem		:= user_entity_id('X_YEA_HI_PREM_TAX_EXEM');
6435 		-- Bug 7164589
6436 		g_user_entity_id.long_term_ins_prem	:= user_entity_id('X_YEA_LTCI_PREM');
6437 		g_user_entity_id.long_term_ins_prem_tax_exem := user_entity_id('X_YEA_LTCI_PREM_TAX_EXEM');
6438 		-- End of Bug 7164589
6439 		g_user_entity_id.ei_prem			:= user_entity_id('X_YEA_EI_PREM');
6440 		g_user_entity_id.ei_prem_tax_exem		:= user_entity_id('X_YEA_EI_PREM_TAX_EXEM');
6441 		g_user_entity_id.pers_ins_name			:= user_entity_id('X_YEA_PERS_INS_NAME');
6442 		g_user_entity_id.pers_ins_prem			:= user_entity_id('X_YEA_PERS_INS_PREM');
6443 		g_user_entity_id.pers_ins_prem_tax_exem		:= user_entity_id('X_YEA_PERS_INS_PREM_TAX_EXEM');
6444 		g_user_entity_id.disabled_ins_prem		:= user_entity_id('X_YEA_DISABLED_INS_PREM');
6445 		g_user_entity_id.disabled_ins_prem_tax_exem	:= user_entity_id('X_YEA_DISABLED_INS_PREM_TAX_EXEM');
6446 		g_user_entity_id.ins_prem_tax_exem		:= user_entity_id('X_YEA_INS_PREM_TAX_EXEM');
6447 		g_user_entity_id.med_exp			:= user_entity_id('X_YEA_MED_EXP');
6448 		g_user_entity_id.med_exp_disabled		:= user_entity_id('X_YEA_MED_EXP_DISABLED');
6449 		g_user_entity_id.med_exp_aged			:= user_entity_id('X_YEA_MED_EXP_AGED');
6450 		-- Bug 3172960, 3637372
6451 		g_user_entity_id.med_exp_emp			:= user_entity_id('X_YEA_MED_EXP_EMP');
6452 		g_user_entity_id.max_med_exp_tax_exem		:= user_entity_id('X_YEA_MAX_MED_EXP_TAX_EXEM');
6453 		g_user_entity_id.med_exp_tax_exem		:= user_entity_id('X_YEA_MED_EXP_TAX_EXEM');
6454 		g_user_entity_id.ee_educ_exp			:= user_entity_id('X_YEA_EE_EDUC_EXP');
6455 		g_user_entity_id.spouse_educ_exp		:= user_entity_id('X_YEA_SPOUSE_EDUC_EXP');
6456 		g_user_entity_id.disabled_educ_exp		:= user_entity_id('X_YEA_DISABLED_EDUC_EXP');
6457 		g_user_entity_id.dpnt_educ_exp			:= user_entity_id('X_YEA_DPNT_EDUC_EXP');
6458 		g_user_entity_id.educ_exp_tax_exem		:= user_entity_id('X_YEA_EDUC_EXP_TAX_EXEM');
6459 		g_user_entity_id.housing_saving_type		:= user_entity_id('X_YEA_HOUSING_SAVING_TYPE');
6460 		g_user_entity_id.housing_saving			:= user_entity_id('X_YEA_HOUSING_SAVING');
6461 		g_user_entity_id.housing_purchase_date		:= user_entity_id('X_YEA_HOUSING_PURCHASE_DATE');
6462 		g_user_entity_id.housing_loan_date		:= user_entity_id('X_YEA_HOUSING_LOAN_DATE');
6463 		g_user_entity_id.housing_loan_repay		:= user_entity_id('X_YEA_HOUSING_LOAN_REPAY');
6464 		-- Bug 9393732
6465 		g_user_entity_id.housing_prv_date_moved		:= user_entity_id('X_YEA_HOUSING_PRIVATE_DATE_MOVED');
6466 		g_user_entity_id.housing_prv_loan_date		:= user_entity_id('X_YEA_HOUSING_PRIVATE_LOAN_DATE');
6467 		g_user_entity_id.housing_prv_loan_repay		:= user_entity_id('X_YEA_HOUSING_PRIVATE_LOAN_REPAY');
6468 		--
6469 		g_user_entity_id.lt_housing_loan_date		:= user_entity_id('X_YEA_LT_HOUSING_LOAN_DATE');
6470 		g_user_entity_id.lt_housing_loan_interest_repay	:= user_entity_id('X_YEA_LT_HOUSING_LOAN_INTEREST_REPAY');
6471 		g_user_entity_id.lt_housing_loan_date_1		:= user_entity_id('X_YEA_LT_HOUSING_LOAN_DATE_1');
6472 		g_user_entity_id.lt_housing_loan_intr_repay_1	:= user_entity_id('X_YEA_LT_HOUSING_LOAN_INTEREST_REPAY_1');
6473                 g_user_entity_id.lt_housing_loan_date_2		:= user_entity_id('X_YEA_LT_HOUSING_LOAN_DATE_2');              -- Bug 8237227
6474                 g_user_entity_id.lt_housing_loan_intr_repay_2	:= user_entity_id('X_YEA_LT_HOUSING_LOAN_INTEREST_REPAY_2');    -- Bug 8237227
6475 		g_user_entity_id.lt_2012_fixed_intr_wo_grace := user_entity_id('X_YEA_2012_LT_FIXED_INTERESR_WO_GRACE'); -- Bug 14754836
6476 		g_user_entity_id.lt_2012_housing_other_intr := user_entity_id('X_YEA_2012_LT_HOUSING_LOAN_INTEREST_OTHERS'); -- Bug 14754836
6477 		g_user_entity_id.lt_2012_house_fixed_intr_exem := user_entity_id('X_YEA_2012_LT_HOUSE_FIXED_INTR_EXEM'); -- Bug 14754836
6478 		g_user_entity_id.lt_2012_house_othr_intr_exem := user_entity_id('X_YEA_2012_LT_HOUSE_INTR_OTHER_EXEM'); -- Bug 14754836
6479 		g_user_entity_id.housing_rent_exp		:= user_entity_id('X_YEA_HOUSING_RENT_EXPENSE');    -- Bug 9737699
6480 		g_user_entity_id.max_housing_exp_tax_exem	:= user_entity_id('X_YEA_MAX_HOUSING_EXP_TAX_EXEM');
6481 		g_user_entity_id.housing_exp_tax_exem		:= user_entity_id('X_YEA_HOUSING_EXP_TAX_EXEM');
6482 		-- Bug 9737699
6483 		g_user_entity_id.housing_rent_exp_tax_exem	:= user_entity_id('X_YEA_HOUSING_RENT_EXP_TAX_EXEM');
6484 		g_user_entity_id.housing_sub_saving_exem	:= user_entity_id('X_YEA_HOUSING_SUB_SAVING_EXEM');
6485 		g_user_entity_id.total_housing_saving_exem	:= user_entity_id('X_YEA_TOTAL_HOUSING_SAVING_EXEM');
6486 		g_user_entity_id.lt_hou_pro_saving_exem		:= user_entity_id('X_YEA_LT_HOU_PRO_SAVING_EXEM');
6487 		g_user_entity_id.emp_hou_pro_saving_exem	:= user_entity_id('X_YEA_EMP_HOU_PRO_SAVING_EXEM');
6488 
6489 		--
6490 		g_user_entity_id.birth_raising_allowance	:= user_entity_id('X_YEA_BIRTH_RAISING_ALLOWANCE'); --Bug 7142620
6491 		g_user_entity_id.cur_birth_raising_allowance	:= user_entity_id('X_YEA_CUR_BIRTH_RAISING_ALLOWANCE'); -- Bug 8644512
6492 		g_user_entity_id.housing_saving_exem		:= user_entity_id('X_YEA_HOUSING_SAVING_EXEM'); --Bug  7142620
6493 		g_user_entity_id.housing_loan_repay_exem	:= user_entity_id('X_YEA_HOUSING_LOAN_REPAY_EXEM'); --Bug  7142620
6494 -- Bug 12807687 Start
6495 		g_user_entity_id.housing_prv_loan_repay_exem := user_entity_id('X_YEA_HOUSING_PRV_LOAN_REPAY_EXEM');
6496 		g_user_entity_id.housing_inst_loan_repay_exem := user_entity_id('X_YEA_HOUSING_INST_LOAN_REPAY_EXEM');
6497 		g_user_entity_id.lt_housing_loan_int_rep_exem1 := user_entity_id('X_YEA_LT_HOUSING_LOAN_INT_REP_EXEM1');
6498 		g_user_entity_id.lt_housing_loan_int_rep_exem2 := user_entity_id('X_YEA_LT_HOUSING_LOAN_INT_REP_EXEM2');
6499 		g_user_entity_id.lt_housing_loan_int_rep_exem3 := user_entity_id('X_YEA_LT_HOUSING_LOAN_INT_REP_EXEM3');
6500 -- Bug 12807687 End
6501 		g_user_entity_id.lt_housing_loan_intr_exem	:= user_entity_id('X_YEA_LT_HOUSING_LOAN_INTR_EXEM'); --Bug  7142620
6502 		g_user_entity_id.donation1			:= user_entity_id('X_YEA_DONATION1');
6503 		g_user_entity_id.political_donation1		:= user_entity_id('X_YEA_POLITICAL_DONATION1');
6504 		g_user_entity_id.political_donation2		:= user_entity_id('X_YEA_POLITICAL_DONATION2');
6505 		g_user_entity_id.political_donation3		:= user_entity_id('X_YEA_POLITICAL_DONATION3');
6506 		g_user_entity_id.donation1_tax_exem		:= user_entity_id('X_YEA_DONATION1_TAX_EXEM');
6507 		g_user_entity_id.donation2			:= user_entity_id('X_YEA_DONATION2');
6508                 g_user_entity_id.donation3                      := user_entity_id('X_YEA_DONATION3');
6509 		-- Bug 7142612: Public Legal Entity Donation Trust
6510                 g_user_entity_id.donation4                      := user_entity_id('X_YEA_DONATION4');
6511                 g_user_entity_id.religious_donation             := user_entity_id('X_YEA_RELIGIOUS_DONATION');
6512 		-- End of Bug 7142612
6513 		g_user_entity_id.max_donation2_tax_exem		:= user_entity_id('X_YEA_MAX_DONATION2_TAX_EXEM');
6514 		g_user_entity_id.max_donation3_tax_exem		:= user_entity_id('X_YEA_MAX_DONATION3_TAX_EXEM');
6515 		g_user_entity_id.donation2_tax_exem		:= user_entity_id('X_YEA_DONATION2_TAX_EXEM');
6516 		g_user_entity_id.donation3_tax_exem		:= user_entity_id('X_YEA_DONATION3_TAX_EXEM');
6517 		g_user_entity_id.donation_tax_exem		:= user_entity_id('X_YEA_DONATION_TAX_EXEM');
6518 		g_user_entity_id.marriage_exemption             := user_entity_id('X_YEA_MARRIAGE_EXEMPTION');
6519 		g_user_entity_id.funeral_exemption              := user_entity_id('X_YEA_FUNERAL_EXEMPTION');
6520 		g_user_entity_id.relocation_exemption           := user_entity_id('X_YEA_RELOCATION_EXEMPTION');
6521 		g_user_entity_id.marr_fun_relo_exemption        := user_entity_id('X_YEA_MARR_FUN_RELO_EXEMPTION');
6522 		g_user_entity_id.sp_tax_exem			:= user_entity_id('X_YEA_SP_TAX_EXEM');
6523 		g_user_entity_id.std_sp_tax_exem		:= user_entity_id('X_YEA_STD_SP_TAX_EXEM');
6524 		g_user_entity_id.np_prem			:= user_entity_id('X_YEA_NP_PREM');
6525 		g_user_entity_id.np_prem_tax_exem		:= user_entity_id('X_YEA_NP_PREM_TAX_EXEM');
6526 		-- Bug 6024342
6527 		g_user_entity_id.pen_prem			:= user_entity_id('X_YEA_PEN_PREM');
6528 		--
6529 		-- Bug 9737699
6530 		g_user_entity_id.military_pen_prem		:= user_entity_id('X_YEA_MILITARY_PEN_PREM');
6531 		g_user_entity_id.private_school_pen_prem	:= user_entity_id('X_YEA_PRIVATE_SCHOOL_PEN_PREM');
6532 		g_user_entity_id.post_office_pen_prem		:= user_entity_id('X_YEA_POST_OFFICE_PEN_PREM');
6533 		--
6534 		g_user_entity_id.taxable_income2		:= user_entity_id('X_YEA_TAXABLE_INCOME2');
6535 		g_user_entity_id.pers_pension_prem		:= user_entity_id('X_YEA_PERS_PENSION_PREM');
6536 		g_user_entity_id.pers_pension_prem_tax_exem	:= user_entity_id('X_YEA_PERS_PENSION_PREM_TAX_EXEM');
6537 		-- Bug 4750653
6538 		g_user_entity_id.corp_pension_prem		:= user_entity_id('X_YEA_CORP_PENSION_PREM');
6539 		g_user_entity_id.corp_pension_prem_tax_exem	:= user_entity_id('X_YEA_CORP_PENSION_PREM_TAX_EXEM');
6540 		-- end of Bug 4750653
6541 		-- Bug 9737699
6542 		g_user_entity_id.scientific_technician_tax_exem	:= user_entity_id('X_YEA_SCIENTIFIC_TECHNICIAN_TAX_EXEM');
6543 		g_user_entity_id.sep_pen_exem_amt_archive	:= user_entity_id('X_YEA_SEP_PEN_EXEM_AMT_ARCHIVE');
6544 		g_user_entity_id.pen_sav_amt_archive		:= user_entity_id('X_YEA_PEN_SAV_EXEM_AMT_ARCHIVE');
6545 		g_user_entity_id.hou_sav_amt_archive		:= user_entity_id('X_YEA_HOU_SAV_EXEM_AMT_ARCHIVE');
6546 		g_user_entity_id.lt_stck_sav_amt_archive	:= user_entity_id('X_YEA_LT_STCK_SAV_EXEM_AMT_ARCHIVE');
6547 		g_user_entity_id.sep_pen_exem_amt1		:= user_entity_id('X_YEA_SEP_PEN_EXEM_AMT1');
6548 		g_user_entity_id.sep_pen_exem_amt2		:= user_entity_id('X_YEA_SEP_PEN_EXEM_AMT2');
6549 		g_user_entity_id.pen_sav_exem_amt1		:= user_entity_id('X_YEA_PEN_SAV_EXEM_AMT1');
6550 		g_user_entity_id.pen_sav_exem_amt2		:= user_entity_id('X_YEA_PEN_SAV_EXEM_AMT2');
6551 		g_user_entity_id.hou_sav_exem_amt1		:= user_entity_id('X_YEA_HOU_SAV_EXEM_AMT1');
6552 		g_user_entity_id.hou_sav_exem_amt2		:= user_entity_id('X_YEA_HOU_SAV_EXEM_AMT2');
6553 		g_user_entity_id.hou_sav_exem_amt3		:= user_entity_id('X_YEA_HOU_SAV_EXEM_AMT3');
6554 		g_user_entity_id.lt_stck_sav_exem_amt1		:= user_entity_id('X_YEA_LT_STCK_SAV_EXEM_AMT1');
6555 		g_user_entity_id.lt_stck_sav_exem_amt2		:= user_entity_id('X_YEA_LT_STCK_SAV_EXEM_AMT2');
6556 		g_user_entity_id.lt_stck_sav_exem_amt3		:= user_entity_id('X_YEA_LT_STCK_SAV_EXEM_AMT3');
6557 
6558 		--
6559 		g_user_entity_id.pers_pension_saving		:= user_entity_id('X_YEA_PERS_PENSION_SAVING');
6560 		g_user_entity_id.pers_pension_saving_tax_exem	:= user_entity_id('X_YEA_PERS_PENSION_SAVING_TAX_EXEM');
6561 		g_user_entity_id.invest_partner_fin1		:= user_entity_id('X_YEA_INVEST_PARTNER_FIN1');
6562 		g_user_entity_id.invest_partner_fin2		:= user_entity_id('X_YEA_INVEST_PARTNER_FIN2');
6563                 g_user_entity_id.invest_partner_fin3		:= user_entity_id('X_YEA_INVEST_PARTNER_FIN3');     -- Bug 8237227
6564 		g_user_entity_id.invest_partner_fin_tax_exem	:= user_entity_id('X_YEA_INVEST_PARTNER_FIN_TAX_EXEM');
6565 		-- Bug 6895093
6566 		g_user_entity_id.small_bus_install		:= user_entity_id('X_YEA_SMALL_BUS_INSTALL');
6567 		g_user_entity_id.small_bus_install_exem		:= user_entity_id('X_YEA_SMALL_BUS_INSTALL_EXEM');
6568 		-- End of Bug 6895093
6569 		-- Bug14219478
6570 --		g_user_entity_id.traditional_market_exp		:= user_entity_id('X_YEA_TRADITIONAL_MARKET_EXP');
6571 --		g_user_entity_id.total_cards_amount		:= user_entity_id('X_YEA_TOTAL_CARDS_AMOUNT');
6572 --		g_user_entity_id.credit_card_expense		:= user_entity_id('X_YEA_CREDIT_CARD_EXPENSE');
6573 		-- End of bug 14219478
6574 		g_user_entity_id.credit_card_exp		:= user_entity_id('X_YEA_CREDIT_CARD_EXP');
6575 		g_user_entity_id.credit_card_exp_tax_exem	:= user_entity_id('X_YEA_CREDIT_CARD_EXP_TAX_EXEM');
6576 		g_user_entity_id.emp_stk_own_contri		:= user_entity_id('X_YEA_EMP_STK_OWN_CONTRI');
6577 		g_user_entity_id.emp_stk_own_contri_tax_exem	:= user_entity_id('X_YEA_EMP_STK_OWN_CONTRI_TAX_EXEM');
6578 		g_user_entity_id.taxation_base			:= user_entity_id('X_YEA_TAXATION_BASE');
6579 		g_user_entity_id.calc_tax			:= user_entity_id('X_YEA_CALC_TAX');
6580 	 -- Bug 14754822
6581 		g_user_entity_id.tax_reduction_smb			:= user_entity_id('X_YEA_TAX_REDUCTION_SMB');
6582 		g_user_entity_id.tax_reduction_teachers			:= user_entity_id('X_YEA_TAX_REDUCTION_TEACHERS');
6583 		g_user_entity_id.tax_reduction_marine			:= user_entity_id('X_YEA_TAX_REDUCTION_MARINE');
6584 		g_user_entity_id.basic_tax_break		:= user_entity_id('X_YEA_BASIC_TAX_BREAK');
6585 		g_user_entity_id.housing_loan_interest_repay	:= user_entity_id('X_YEA_HOUSING_LOAN_INTEREST_REPAY');
6586 		g_user_entity_id.housing_exp_tax_break		:= user_entity_id('X_YEA_HOUSING_EXP_TAX_BREAK');
6587 		g_user_entity_id.stock_saving			:= user_entity_id('X_YEA_STOCK_SAVING');
6588 		g_user_entity_id.stock_saving_tax_break		:= user_entity_id('X_YEA_STOCK_SAVING_TAX_BREAK');
6589 		g_user_entity_id.lt_stock_saving1		:= user_entity_id('X_YEA_LT_STOCK_SAVING1');
6590 		g_user_entity_id.lt_stock_saving2		:= user_entity_id('X_YEA_LT_STOCK_SAVING2');
6591 		g_user_entity_id.lt_stock_saving_tax_break	:= user_entity_id('X_YEA_LT_STOCK_SAVING_TAX_BREAK');
6592 		g_user_entity_id.ovstb_tax_paid_date		:= user_entity_id('X_YEA_OVSTB_TAX_PAID_DATE');
6593 		g_user_entity_id.ovstb_territory_code		:= user_entity_id('X_YEA_OVSTB_TERRITORY_CODE');
6594 		g_user_entity_id.ovstb_currency_code		:= user_entity_id('X_YEA_OVSTB_CURRENCY_CODE');
6595 		g_user_entity_id.ovstb_taxable			:= user_entity_id('X_YEA_OVSTB_TAXABLE');
6596 		g_user_entity_id.ovstb_taxable_subj_tax_break	:= user_entity_id('X_YEA_OVSTB_TAXABLE_SUBJ_TAX_BREAK');
6597 		g_user_entity_id.ovstb_tax_break_rate		:= user_entity_id('X_YEA_OVSTB_TAX_BREAK_RATE');
6598 		g_user_entity_id.ovstb_tax_foreign_currency	:= user_entity_id('X_YEA_OVSTB_TAX_FOREIGN_CURRENCY');
6599 		g_user_entity_id.ovstb_tax			:= user_entity_id('X_YEA_OVSTB_TAX');
6600 		g_user_entity_id.ovstb_application_date		:= user_entity_id('X_YEA_OVSTB_APPLICATION_DATE');
6601 		g_user_entity_id.ovstb_submission_date		:= user_entity_id('X_YEA_OVSTB_SUBMISSION_DATE');
6602 		g_user_entity_id.ovs_tax_break			:= user_entity_id('X_YEA_OVS_TAX_BREAK');
6603 		g_user_entity_id.total_tax_break		:= user_entity_id('X_YEA_TOTAL_TAX_BREAK');
6604 		g_user_entity_id.fwtb_immigration_purpose	:= user_entity_id('X_YEA_FWTB_IMMIGRATION_PURPOSE');
6605 		g_user_entity_id.fwtb_contract_date		:= user_entity_id('X_YEA_FWTB_CONTRACT_DATE');
6606 		g_user_entity_id.fwtb_expiry_date		:= user_entity_id('X_YEA_FWTB_EXPIRY_DATE');
6607 		g_user_entity_id.fwtb_application_date		:= user_entity_id('X_YEA_FWTB_APPLICATION_DATE');
6608 		g_user_entity_id.fwtb_submission_date		:= user_entity_id('X_YEA_FWTB_SUBMISSION_DATE');
6609 		g_user_entity_id.foreign_worker_tax_break1	:= user_entity_id('X_YEA_FOREIGN_WORKER_TAX_BREAK1');
6610 		g_user_entity_id.foreign_worker_tax_break2	:= user_entity_id('X_YEA_FOREIGN_WORKER_TAX_BREAK2');
6611 		g_user_entity_id.foreign_worker_tax_break	:= user_entity_id('X_YEA_FOREIGN_WORKER_TAX_BREAK');
6612 		g_user_entity_id.annual_itax			:= user_entity_id('X_YEA_ANNUAL_ITAX');
6613 		g_user_entity_id.annual_rtax			:= user_entity_id('X_YEA_ANNUAL_RTAX');
6614 		g_user_entity_id.annual_stax			:= user_entity_id('X_YEA_ANNUAL_STAX');
6615 		g_user_entity_id.prev_itax			:= user_entity_id('X_YEA_PREV_ITAX');
6616 		g_user_entity_id.prev_rtax			:= user_entity_id('X_YEA_PREV_RTAX');
6617 		g_user_entity_id.prev_stax			:= user_entity_id('X_YEA_PREV_STAX');
6618 		g_user_entity_id.cur_itax			:= user_entity_id('X_YEA_CUR_ITAX');
6619 		g_user_entity_id.cur_rtax			:= user_entity_id('X_YEA_CUR_RTAX');
6620 		g_user_entity_id.cur_stax			:= user_entity_id('X_YEA_CUR_STAX');
6621 		g_user_entity_id.itax_adj			:= user_entity_id('X_YEA_ITAX_ADJ');
6622 		g_user_entity_id.rtax_adj			:= user_entity_id('X_YEA_RTAX_ADJ');
6623 		g_user_entity_id.stax_adj			:= user_entity_id('X_YEA_STAX_ADJ');
6624 		-- Bug 3966549
6625 		g_user_entity_id.don_tax_break2004		:= user_entity_id('X_YEA_DONATION_TAX_BREAK') ;
6626 		-- End of 3966549
6627                 g_user_entity_id.cash_receipt_expense           := user_entity_id('X_YEA_CASH_RECEIPT_EXPENSE');  -- 4738717
6628 		-- Bug 6630135
6629 		g_user_entity_id.tot_med_exp_cards		:= user_entity_id('X_YEA_TOT_MED_EXP_CARDS') ;
6630 		g_user_entity_id.med_exp_paid_not_inc_med_exem	:= user_entity_id('X_YEA_MED_EXP_PAID_NOT_INC_MED_EXEM') ;
6631 		-- End of 6630135
6632                 --Bug 6716401
6633 		g_user_entity_id.double_exem_amt		:= user_entity_id('X_YEA_DOUBLE_EXEM_AMT') ;
6634                 --End 6716401
6635                 -- Bug 7361372
6636                 g_user_entity_id.tax_grp_bus_reg_num		:= user_entity_id('X_YEA_TAX_GRP_BUS_REG_NUM');
6637                 g_user_entity_id.tax_grp_name			:= user_entity_id('X_YEA_TAX_GRP_NAME');
6638                 g_user_entity_id.tax_grp_taxable_mth		:= user_entity_id('X_YEA_TAX_GRP_TAXABLE_MTH');
6639                 g_user_entity_id.tax_grp_taxable_bon		:= user_entity_id('X_YEA_TAX_GRP_TAXABLE_BON');
6640                 g_user_entity_id.tax_grp_sp_irreg_bonus		:= user_entity_id('X_YEA_TAX_GRP_SP_IRREG_BONUS');
6641                 g_user_entity_id.tax_grp_stck_pur_opt_exec_earn	:= user_entity_id('X_YEA_TAX_GRP_STCK_PUR_OPT_EXEC_EARN');
6642                 g_user_entity_id.tax_grp_itax			:= user_entity_id('X_YEA_TAX_GRP_ITAX');
6643                 g_user_entity_id.tax_grp_rtax			:= user_entity_id('X_YEA_TAX_GRP_RTAX');
6644                 g_user_entity_id.tax_grp_stax			:= user_entity_id('X_YEA_TAX_GRP_STAX');
6645                 g_user_entity_id.tax_grp_taxable		:= user_entity_id('X_YEA_TAX_GRP_TAXABLE');
6646                 g_user_entity_id.tax_grp_post_tax_deduc         := user_entity_id('X_YEA_TAX_GRP_POST_TAX_DEDUC');
6647                 -- End of Bug 7361372
6648 		g_user_entity_id.non_taxable_ovs_frgn		:= user_entity_id('X_YEA_NON_TAXABLE_OVS_FRGN'); -- Bug 7439803
6649 		-- Bug 7508706
6650 		g_user_entity_id.tax_grp_taxable_mth_ne		:= user_entity_id('X_YEA_TAX_GRP_TAXABLE_MTH_NE');
6651                 g_user_entity_id.tax_grp_taxable_bon_ne		:= user_entity_id('X_YEA_TAX_GRP_TAXABLE_BON_NE');
6652                 g_user_entity_id.tax_grp_sp_irreg_bonus_ne	:= user_entity_id('X_YEA_TAX_GRP_SP_IRREG_BONUS_NE');
6653                 g_user_entity_id.tax_grp_stck_pur_ne		:= user_entity_id('X_YEA_TAX_GRP_STCK_PUR_OPT_EXEC_EARN_NE');
6654                 g_user_entity_id.tax_grp_taxable_ne		:= user_entity_id('X_YEA_TAX_GRP_TAXABLE_NE');
6655 		-- End of Bug 7508706
6656 		-- Bug 7615517
6657 		g_user_entity_id.company_related_exp		:= user_entity_id('X_YEA_COMPANY_RELATED_EXPENSE');
6658 		g_user_entity_id.long_term_stck_fund_1year  	:= user_entity_id('X_YEA_LONG_TERM_STOCK_FUND_1YEAR');
6659 		g_user_entity_id.long_term_stck_fund_2year  	:= user_entity_id('X_YEA_LONG_TERM_STOCK_FUND_2YEAR');
6660 		g_user_entity_id.long_term_stck_fund_3year  	:= user_entity_id('X_YEA_LONG_TERM_STOCK_FUND_3YEAR');
6661 		g_user_entity_id.long_term_stck_fund_tax_exem  	:= user_entity_id('X_YEA_LONG_TERM_STOCK_FUND_TAX_EXEM');
6662 		-- End of Bug 7615517
6663 		-- Bug 8644512
6664 		g_user_entity_id.esop_withd_earn		:= user_entity_id('X_YEA_ESOP_WITHD_EARN');
6665 		g_user_entity_id.cur_esop_withd_earn		:= user_entity_id('X_YEA_CUR_ESOP_WITHD_EARN');
6666 		g_user_entity_id.prev_esop_withd_earn		:= user_entity_id('X_YEA_PREV_ESOP_WITHD_EARN');
6667 		g_user_entity_id.tax_grp_wkpd_from		:= user_entity_id('X_YEA_TAX_GRP_WKPD_FROM');
6668 		g_user_entity_id.tax_grp_wkpd_to		:= user_entity_id('X_YEA_TAX_GRP_WKPD_TO');
6669 		g_user_entity_id.tax_grp_tax_brk_pd_from	:= user_entity_id('X_YEA_TAX_GRP_TAX_BRK_PD_FROM');
6670 		g_user_entity_id.tax_grp_tax_brk_pd_to		:= user_entity_id('X_YEA_TAX_GRP_TAX_BRK_PD_TO');
6671 		g_user_entity_id.tax_grp_esop_withd_earn	:= user_entity_id('X_YEA_TAX_GRP_ESOP_WITHD_EARN');
6672 		g_user_entity_id.tax_grp_esop_withd_earn_ne	:= user_entity_id('X_YEA_TAX_GRP_ESOP_WITHD_EARN_NE');
6673 		g_user_entity_id.tax_grp_non_taxable_ovt	:= user_entity_id('X_YEA_TAX_GRP_NON_TAXABLE_OVT');
6674 		g_user_entity_id.tax_grp_bir_raising_allw	:= user_entity_id('X_YEA_TAX_GRP_BIR_RAISING_ALLW');
6675 		g_user_entity_id.tax_grp_fw_income_exem		:= user_entity_id('X_YEA_TAX_GRP_FW_INCOME_EXEM');
6676 		--
6677 		g_user_entity_id.cur_ntax_R10			:= user_entity_id('X_YEA_CUR_NTAX_R10'); --Bug 12807687
6678 		g_user_entity_id.cur_ntax_G01			:= user_entity_id('X_YEA_CUR_NTAX_G01');
6679 		g_user_entity_id.cur_ntax_H01			:= user_entity_id('X_YEA_CUR_NTAX_H01');
6680 		g_user_entity_id.cur_ntax_H05			:= user_entity_id('X_YEA_CUR_NTAX_H05');
6681 		g_user_entity_id.cur_ntax_H06			:= user_entity_id('X_YEA_CUR_NTAX_H06');
6682 		g_user_entity_id.cur_ntax_H07			:= user_entity_id('X_YEA_CUR_NTAX_H07');
6683 		g_user_entity_id.cur_ntax_H08			:= user_entity_id('X_YEA_CUR_NTAX_H08');
6684 		g_user_entity_id.cur_ntax_H09			:= user_entity_id('X_YEA_CUR_NTAX_H09');
6685 		g_user_entity_id.cur_ntax_H10			:= user_entity_id('X_YEA_CUR_NTAX_H10');
6686 		g_user_entity_id.cur_ntax_H11			:= user_entity_id('X_YEA_CUR_NTAX_H11');
6687 		g_user_entity_id.cur_ntax_H12			:= user_entity_id('X_YEA_CUR_NTAX_H12');
6688 		g_user_entity_id.cur_ntax_H13			:= user_entity_id('X_YEA_CUR_NTAX_H13');
6689 		g_user_entity_id.cur_ntax_I01			:= user_entity_id('X_YEA_CUR_NTAX_I01');
6690 		g_user_entity_id.cur_ntax_K01			:= user_entity_id('X_YEA_CUR_NTAX_K01');
6691 		g_user_entity_id.cur_ntax_M01			:= user_entity_id('X_YEA_CUR_NTAX_M01');
6692 		g_user_entity_id.cur_ntax_M02			:= user_entity_id('X_YEA_CUR_NTAX_M02');
6693 		g_user_entity_id.cur_ntax_M03			:= user_entity_id('X_YEA_CUR_NTAX_M03');
6694 		g_user_entity_id.cur_ntax_S01			:= user_entity_id('X_YEA_CUR_NTAX_S01');
6695 		g_user_entity_id.cur_ntax_T01			:= user_entity_id('X_YEA_CUR_NTAX_T01');
6696 		g_user_entity_id.cur_ntax_Y01			:= user_entity_id('X_YEA_CUR_NTAX_Y01');
6697 		g_user_entity_id.cur_ntax_Y02			:= user_entity_id('X_YEA_CUR_NTAX_Y02');
6698 		g_user_entity_id.cur_ntax_Y03			:= user_entity_id('X_YEA_CUR_NTAX_Y03');
6699 		g_user_entity_id.cur_ntax_Y20			:= user_entity_id('X_YEA_CUR_NTAX_Y20');
6700 		g_user_entity_id.cur_ntax_Y21			:= user_entity_id('X_YEA_CUR_NTAX_Y21'); -- Bug 9737699
6701 		g_user_entity_id.cur_ntax_ZZ			:= user_entity_id('X_YEA_CUR_NTAX_ZZ'); -- Bug 9737699
6702 		g_user_entity_id.cur_ntax_Z01			:= user_entity_id('X_YEA_CUR_NTAX_Z01');
6703 		g_user_entity_id.cur_ntax_tax_brk		:= user_entity_id('X_YEA_CUR_NTAX_TAX_BREAK');
6704 		g_user_entity_id.cur_ntax_H14			:= user_entity_id('X_YEA_CUR_NTAX_H14'); --Bug 14754822
6705 		g_user_entity_id.cur_ntax_H15			:= user_entity_id('X_YEA_CUR_NTAX_H15');
6706 		g_user_entity_id.cur_ntax_T10			:= user_entity_id('X_YEA_CUR_NTAX_T10');
6707 		g_user_entity_id.cur_ntax_T20			:= user_entity_id('X_YEA_CUR_NTAX_T20');
6708 
6709 		--
6710 		g_user_entity_id.prev_ntax_R10			:= user_entity_id('X_YEA_PREV_NTAX_R10'); --Bug 12807687
6711 		g_user_entity_id.prev_ntax_G01			:= user_entity_id('X_YEA_PREV_NTAX_G01');
6712 		g_user_entity_id.prev_ntax_H01			:= user_entity_id('X_YEA_PREV_NTAX_H01');
6713 		g_user_entity_id.prev_ntax_H05			:= user_entity_id('X_YEA_PREV_NTAX_H05');
6714 		g_user_entity_id.prev_ntax_H06			:= user_entity_id('X_YEA_PREV_NTAX_H06');
6715 		g_user_entity_id.prev_ntax_H07			:= user_entity_id('X_YEA_PREV_NTAX_H07');
6716 		g_user_entity_id.prev_ntax_H08			:= user_entity_id('X_YEA_PREV_NTAX_H08');
6717 		g_user_entity_id.prev_ntax_H09			:= user_entity_id('X_YEA_PREV_NTAX_H09');
6718 		g_user_entity_id.prev_ntax_H10			:= user_entity_id('X_YEA_PREV_NTAX_H10');
6719 		g_user_entity_id.prev_ntax_H11			:= user_entity_id('X_YEA_PREV_NTAX_H11');
6720 		g_user_entity_id.prev_ntax_H12			:= user_entity_id('X_YEA_PREV_NTAX_H12');
6721 		g_user_entity_id.prev_ntax_H13			:= user_entity_id('X_YEA_PREV_NTAX_H13');
6722 		g_user_entity_id.prev_ntax_I01			:= user_entity_id('X_YEA_PREV_NTAX_I01');
6723 		g_user_entity_id.prev_ntax_K01			:= user_entity_id('X_YEA_PREV_NTAX_K01');
6724 		g_user_entity_id.prev_ntax_M01			:= user_entity_id('X_YEA_PREV_NTAX_M01');
6725 		g_user_entity_id.prev_ntax_M02			:= user_entity_id('X_YEA_PREV_NTAX_M02');
6726 		g_user_entity_id.prev_ntax_M03			:= user_entity_id('X_YEA_PREV_NTAX_M03');
6727 		g_user_entity_id.prev_ntax_S01			:= user_entity_id('X_YEA_PREV_NTAX_S01');
6728 		g_user_entity_id.prev_ntax_T01			:= user_entity_id('X_YEA_PREV_NTAX_T01');
6729 		g_user_entity_id.prev_ntax_Y01			:= user_entity_id('X_YEA_PREV_NTAX_Y01');
6730 		g_user_entity_id.prev_ntax_Y02			:= user_entity_id('X_YEA_PREV_NTAX_Y02');
6731 		g_user_entity_id.prev_ntax_Y03			:= user_entity_id('X_YEA_PREV_NTAX_Y03');
6732 		g_user_entity_id.prev_ntax_Y20			:= user_entity_id('X_YEA_PREV_NTAX_Y20');
6733 		g_user_entity_id.prev_ntax_Y21			:= user_entity_id('X_YEA_PREV_NTAX_Y21'); -- Bug 9737699
6734 		g_user_entity_id.prev_ntax_ZZ			:= user_entity_id('X_YEA_PREV_NTAX_ZZ'); -- Bug 9737699
6735 		g_user_entity_id.prev_ntax_Z01			:= user_entity_id('X_YEA_PREV_NTAX_Z01');
6736 		g_user_entity_id.prev_ntax_tax_brk		:= user_entity_id('X_YEA_PREV_NTAX_TAX_BREAK'); -- Bug 9737699
6737 		g_user_entity_id.prev_ntax_H14			:= user_entity_id('X_YEA_PREV_NTAX_H14'); --Bug 14754822
6738 		g_user_entity_id.prev_ntax_H15			:= user_entity_id('X_YEA_PREV_NTAX_H15');
6739 		g_user_entity_id.prev_ntax_T10			:= user_entity_id('X_YEA_PREV_NTAX_T10');
6740 		g_user_entity_id.prev_ntax_T20			:= user_entity_id('X_YEA_PREV_NTAX_T20');
6741 		--
6742 		g_user_entity_id.tax_grp_ntax_R10		:= user_entity_id('X_YEA_TAX_GRP_NTAX_R10'); --Bug 12807687
6743 		g_user_entity_id.tax_grp_ntax_G01		:= user_entity_id('X_YEA_TAX_GRP_NTAX_G01');
6744 		g_user_entity_id.tax_grp_ntax_H01		:= user_entity_id('X_YEA_TAX_GRP_NTAX_H01');
6745 		g_user_entity_id.tax_grp_ntax_H05		:= user_entity_id('X_YEA_TAX_GRP_NTAX_H05');
6746 		g_user_entity_id.tax_grp_ntax_H06		:= user_entity_id('X_YEA_TAX_GRP_NTAX_H06');
6747 		g_user_entity_id.tax_grp_ntax_H07		:= user_entity_id('X_YEA_TAX_GRP_NTAX_H07');
6748 		g_user_entity_id.tax_grp_ntax_H08		:= user_entity_id('X_YEA_TAX_GRP_NTAX_H08');
6749 		g_user_entity_id.tax_grp_ntax_H09		:= user_entity_id('X_YEA_TAX_GRP_NTAX_H09');
6750 		g_user_entity_id.tax_grp_ntax_H10		:= user_entity_id('X_YEA_TAX_GRP_NTAX_H10');
6751 		g_user_entity_id.tax_grp_ntax_H11		:= user_entity_id('X_YEA_TAX_GRP_NTAX_H11');
6752 		g_user_entity_id.tax_grp_ntax_H12		:= user_entity_id('X_YEA_TAX_GRP_NTAX_H12');
6753 		g_user_entity_id.tax_grp_ntax_H13		:= user_entity_id('X_YEA_TAX_GRP_NTAX_H13');
6754 		g_user_entity_id.tax_grp_ntax_I01		:= user_entity_id('X_YEA_TAX_GRP_NTAX_I01');
6755 		g_user_entity_id.tax_grp_ntax_K01		:= user_entity_id('X_YEA_TAX_GRP_NTAX_K01');
6756 		g_user_entity_id.tax_grp_ntax_M01		:= user_entity_id('X_YEA_TAX_GRP_NTAX_M01');
6757 		g_user_entity_id.tax_grp_ntax_M02		:= user_entity_id('X_YEA_TAX_GRP_NTAX_M02');
6758 		g_user_entity_id.tax_grp_ntax_M03		:= user_entity_id('X_YEA_TAX_GRP_NTAX_M03');
6759 		g_user_entity_id.tax_grp_ntax_S01		:= user_entity_id('X_YEA_TAX_GRP_NTAX_S01');
6760 		g_user_entity_id.tax_grp_ntax_T01		:= user_entity_id('X_YEA_TAX_GRP_NTAX_T01');
6761 		g_user_entity_id.tax_grp_ntax_Y01		:= user_entity_id('X_YEA_TAX_GRP_NTAX_Y01');
6762 		g_user_entity_id.tax_grp_ntax_Y02		:= user_entity_id('X_YEA_TAX_GRP_NTAX_Y02');
6763 		g_user_entity_id.tax_grp_ntax_Y03		:= user_entity_id('X_YEA_TAX_GRP_NTAX_Y03');
6764 		g_user_entity_id.tax_grp_ntax_Y20		:= user_entity_id('X_YEA_TAX_GRP_NTAX_Y20');
6765 		g_user_entity_id.tax_grp_ntax_Y21		:= user_entity_id('X_YEA_TAX_GRP_NTAX_Y21');  -- Bug 9737699
6766 		g_user_entity_id.tax_grp_ntax_ZZ		:= user_entity_id('X_YEA_TAX_GRP_NTAX_ZZ');  -- Bug 9737699
6767 		g_user_entity_id.tax_grp_ntax_Z01		:= user_entity_id('X_YEA_TAX_GRP_NTAX_Z01');
6768 		g_user_entity_id.tax_grp_ntax_tax_brk		:= user_entity_id('X_YEA_TAX_GRP_NTAX_TAX_BREAK');
6769 		g_user_entity_id.tax_grp_ntax_H14			:= user_entity_id('X_YEA_TAX_GRP_NTAX_H14'); --Bug 14754822
6770 		g_user_entity_id.tax_grp_ntax_H15			:= user_entity_id('X_YEA_TAX_GRP_NTAX_H15');
6771 		g_user_entity_id.tax_grp_ntax_T10			:= user_entity_id('X_YEA_TAX_GRP_NTAX_T10');
6772 		g_user_entity_id.tax_grp_ntax_T20			:= user_entity_id('X_YEA_TAX_GRP_NTAX_T20');
6773 		--
6774 		g_user_entity_id.prev_birth_raising_allowance	:= user_entity_id('X_YEA_PREV_BIRTH_RAISING_ALLOWANCE');
6775 		g_user_entity_id.prev_non_taxable_ovt		:= user_entity_id('X_YEA_PREV_NON_TAXABLE_OVT');
6776 		--
6777 		g_user_entity_id.total_ntax_R10			:= user_entity_id('X_YEA_TOTAL_NTAX_R10');
6778 		g_user_entity_id.total_ntax_G01			:= user_entity_id('X_YEA_TOTAL_NTAX_G01');
6779 		g_user_entity_id.total_ntax_H01			:= user_entity_id('X_YEA_TOTAL_NTAX_H01');
6780 		g_user_entity_id.total_ntax_H05			:= user_entity_id('X_YEA_TOTAL_NTAX_H05');
6781 		g_user_entity_id.total_ntax_H06			:= user_entity_id('X_YEA_TOTAL_NTAX_H06');
6782 		g_user_entity_id.total_ntax_H07			:= user_entity_id('X_YEA_TOTAL_NTAX_H07');
6783 		g_user_entity_id.total_ntax_H08			:= user_entity_id('X_YEA_TOTAL_NTAX_H08');
6784 		g_user_entity_id.total_ntax_H09			:= user_entity_id('X_YEA_TOTAL_NTAX_H09');
6785 		g_user_entity_id.total_ntax_H10			:= user_entity_id('X_YEA_TOTAL_NTAX_H10');
6786 		g_user_entity_id.total_ntax_H11			:= user_entity_id('X_YEA_TOTAL_NTAX_H11');
6787 		g_user_entity_id.total_ntax_H12			:= user_entity_id('X_YEA_TOTAL_NTAX_H12');
6788 		g_user_entity_id.total_ntax_H13			:= user_entity_id('X_YEA_TOTAL_NTAX_H13');
6789 		g_user_entity_id.total_ntax_I01			:= user_entity_id('X_YEA_TOTAL_NTAX_I01');
6790 		g_user_entity_id.total_ntax_K01			:= user_entity_id('X_YEA_TOTAL_NTAX_K01');
6791 		g_user_entity_id.total_ntax_M01			:= user_entity_id('X_YEA_TOTAL_NTAX_M01');
6792 		g_user_entity_id.total_ntax_M02			:= user_entity_id('X_YEA_TOTAL_NTAX_M02');
6793 		g_user_entity_id.total_ntax_M03			:= user_entity_id('X_YEA_TOTAL_NTAX_M03');
6794 		g_user_entity_id.total_ntax_S01			:= user_entity_id('X_YEA_TOTAL_NTAX_S01');
6795 		g_user_entity_id.total_ntax_T01			:= user_entity_id('X_YEA_TOTAL_NTAX_T01');
6796 		g_user_entity_id.total_ntax_Y01			:= user_entity_id('X_YEA_TOTAL_NTAX_Y01');
6797 		g_user_entity_id.total_ntax_Y02			:= user_entity_id('X_YEA_TOTAL_NTAX_Y02');
6798 		g_user_entity_id.total_ntax_Y03			:= user_entity_id('X_YEA_TOTAL_NTAX_Y03');
6799 		g_user_entity_id.total_ntax_Y20			:= user_entity_id('X_YEA_TOTAL_NTAX_Y20');
6800 		g_user_entity_id.total_ntax_Y21			:= user_entity_id('X_YEA_TOTAL_NTAX_Y21'); -- Bug 9737699
6801 		g_user_entity_id.total_ntax_ZZ			:= user_entity_id('X_YEA_TOTAL_NTAX_ZZ'); -- Bug 9737699
6802 		g_user_entity_id.total_ntax_Z01			:= user_entity_id('X_YEA_TOTAL_NTAX_Z01');
6803 		g_user_entity_id.total_ntax_tax_brk		:= user_entity_id('X_YEA_TOTAL_NTAX_TAX_BREAK');
6804 		g_user_entity_id.total_ntax_H14			:= user_entity_id('X_YEA_TOTAL_NTAX_H14'); -- Bug 14754822
6805 		g_user_entity_id.total_ntax_H15			:= user_entity_id('X_YEA_TOTAL_NTAX_H15');
6806 		g_user_entity_id.total_ntax_T10			:= user_entity_id('X_YEA_TOTAL_NTAX_T10');
6807 		g_user_entity_id.total_ntax_T20			:= user_entity_id('X_YEA_TOTAL_NTAX_T20');
6808 		--
6809 		g_user_entity_id.cur_total_ntax_earn		:= user_entity_id('X_YEA_CUR_TOTAL_NTAX_EARN');
6810 		g_user_entity_id.tax_grp_total_ntax_earn	:= user_entity_id('X_YEA_TAX_GRP_TOTAL_NTAX_EARN');
6811 		--
6812 
6813 		--End of Bug 8644512
6814 		--
6815 		-- Bug 8880364
6816 		g_user_entity_id.cur_ntax_frgn_M01		:= user_entity_id('X_YEA_CUR_NTAX_FRGN_M01');
6817 		g_user_entity_id.cur_ntax_frgn_M02		:= user_entity_id('X_YEA_CUR_NTAX_FRGN_M02');
6818 		g_user_entity_id.cur_ntax_frgn_M03		:= user_entity_id('X_YEA_CUR_NTAX_FRGN_M03');
6819 		--
6820 		g_user_entity_id.non_rep_non_taxable		:= user_entity_id('X_YEA_NON_REP_NON_TAXABLE'); 	-- Bug 9079450
6821 		g_user_entity_id.smb_income_exem		:= user_entity_id('X_YEA_SMB_INCOME_EXEM');	-- Bug 9079450
6822 		g_user_entity_id.cur_smb_days_worked 		:= user_entity_id('X_YEA_CUR_SMB_DAYS_WORKED'); 	-- Bug 9079450
6823 		g_user_entity_id.prev_smb_days_worked 		:= user_entity_id('X_YEA_PREV_SMB_DAYS_WORKED');	-- Bug 9079450
6824 		g_user_entity_id.cur_smb_eligible_income		:= user_entity_id('X_YEA_CUR_SMB_ELIGIBLE_INCOME'); 	-- Bug 9079450
6825 		g_user_entity_id.prev_smb_eligible_income		:= user_entity_id('X_YEA_PREV_SMB_ELIGIBLE_INCOME');  	-- Bug 9079450
6826 		g_user_entity_id.emp_join_prev_year		:= user_entity_id('X_YEA_EMP_JOIN_PREV_YEAR');	-- Bug 9079450
6827 		g_user_entity_id.emp_leave_cur_year		:= user_entity_id('X_YEA_EMP_LEAVE_CUR_YEAR');  	-- Bug 9079450
6828 		g_user_entity_id.smb_eligibility_flag		:= user_entity_id('X_YEA_SMB_ELIGIBILITY_FLAG');	-- Bug 9079450
6829 		--
6830 	end;
6831 end pay_kr_yea_pkg;