DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_KR_PAYKRYTR_PKG

Source


1 package body pay_kr_paykrytr_pkg as
2 /* $Header: paykrytr.pkb 120.45.12020000.6 2012/12/07 10:50:31 scireddy ship $ */
3 ------------------------------------------------------------------------
4 procedure data(
5 	p_assignment_action_id		in number,
6 	p_person_id			out nocopy number,		-- bug 6012258
7 	p_resident_type			out nocopy varchar2,
8 	p_nationality_type		out nocopy varchar2,
9 	p_fw_fixed_tax_rate		out nocopy varchar2, -- 3546993
10 	p_emp_start_date		out nocopy date,	-- Bug 8644512
11 	p_period_start_date		out nocopy date,
12 	p_period_end_date		out nocopy date,
13 	p_fwtb_contract_date		out nocopy date,
14 	p_fwtb_expiry_date		out nocopy date,
15 	p_cur_taxable_mth		out nocopy number,
16 	p_cur_taxable_bon		out nocopy number,
17 	p_cur_sp_irreg_bonus		out nocopy number,
18 	p_cur_stck_pur_opt_exec_earn    out nocopy number,  -- bug 6012258
19 	p_cur_esop_withd_earn		out nocopy number,  -- Bug 8644512
20 	p_cur_taxable			out nocopy number,
21 	p_cur_non_taxable_ovt		out nocopy number, -- Bug 8644512
22 	p_cur_birth_raising_allowance	out nocopy number, -- Bug 8644512
23 	p_cur_fw_income_exem		out nocopy number, -- Bug 8644512
24 	p_prev_hire_date1		out nocopy date,   -- Bug 8644512
25 	p_prev_termination_date1	out nocopy date,   -- Bug 8644512
26 	p_prev_tax_brk_pd_from1		out nocopy date,   -- Bug 8644512
27 	p_prev_tax_brk_pd_to1		out nocopy date,   -- Bug 8644512
28 	p_prev_corp_name1		out nocopy varchar2,
29 	p_prev_bp_number1		out nocopy varchar2,
30 	p_prev_taxable_mth1		out nocopy number,
31 	p_prev_taxable_bon1		out nocopy number,
32 	p_prev_sp_irreg_bonus1		out nocopy number,
33 	p_prev_stck_pur_opt_exec_earn1  out nocopy number,  -- Bug 6024342
34 	p_prev_esop_withd_earn1		out nocopy number,  -- Bug 8644512
35 	p_prev_non_taxable_ovt1		out nocopy number,  -- Bug 8644512
36 	p_prev_bir_raising_allw1	out nocopy number,  -- Bug 8644512
37 	p_prev_fw_income_exem1		out nocopy number,  -- Bug 8644512
38 	p_prev_taxable1			out nocopy number,
39 	p_prev_hire_date2		out nocopy date,	-- Bug 8644512
40 	p_prev_termination_date2	out nocopy date,	-- Bug 8644512
41 	p_prev_tax_brk_pd_from2		out nocopy date,	-- Bug 8644512
42 	p_prev_tax_brk_pd_to2		out nocopy date,	-- Bug 8644512
43 	p_prev_corp_name2		out nocopy varchar2,
44 	p_prev_bp_number2		out nocopy varchar2,
45 	p_prev_taxable_mth2		out nocopy number,
46 	p_prev_taxable_bon2		out nocopy number,
47 	p_prev_sp_irreg_bonus2		out nocopy number,
48 	p_prev_stck_pur_opt_exec_earn2  out nocopy number,   -- Bug 6024342
49 	p_prev_esop_withd_earn2		out nocopy number,  -- Bug 8644512
50 	p_prev_non_taxable_ovt2		out nocopy number,  -- Bug 8644512
51 	p_prev_bir_raising_allw2	out nocopy number,  -- Bug 8644512
52 	p_prev_fw_income_exem2		out nocopy number,  -- Bug 8644512
53 	p_prev_taxable2			out nocopy number,
54 	p_taxable_mth			out nocopy number,
55 	p_taxable_bon			out nocopy number,
56 	p_sp_irreg_bonus		out nocopy number,
57 	p_stck_pur_opt_exec_earn        out nocopy number,  -- bug 6024342
58 	p_esop_withd_earn		out nocopy number,  -- Bug 8644512
59 	p_research_payment		out nocopy number,  -- bug 6012258
60 	p_taxable			out nocopy number,
61 	p_taxable1                      out nocopy number,   -- bug 7615517
62 	p_non_taxable_ovs		out nocopy number,
63 	p_non_taxable_ovt		out nocopy number,
64 	p_non_taxable_oth		out nocopy number,
65 	p_non_taxable			out nocopy number,
66 	p_foreign_worker_tax_exem	out nocopy number,  -- 3546993
67 	p_basic_income_exem		out nocopy number,
68 	p_taxable_income		out nocopy number,
69 	p_ee_tax_exem			out nocopy number,
70 	p_dpnt_spouse_tax_exem		out nocopy number,
71 	p_num_of_dpnts			out nocopy number,
72 	p_dpnt_tax_exem			out nocopy number,
73 	p_num_of_ageds			out nocopy number,
74 	p_aged_tax_exem			out nocopy number,
75 	p_num_of_disableds		out nocopy number,
76 	p_disabled_tax_exem		out nocopy number,
77 	p_female_ee_tax_exem		out nocopy number,
78 	p_num_of_children		out nocopy number,
79 	--- Bug 7142620
80 	p_housing_loan_repay_exem	out nocopy number,
81 -- Bug 12807687 Start
82 	p_housing_prv_loan_repay_exem out nocopy number,
83 	p_housing_inst_loan_repay_exem out nocopy number,
84 	p_lt_housing_loan_int_rep_exm1 out nocopy number,
85 	p_lt_housing_loan_int_rep_exm2 out nocopy number,
86 	p_lt_housing_loan_int_rep_exm3 out nocopy number,
87 --Bug 12807687 End
88 --Bug 14754836 START
89    p_lt_2012_hou_fixed_intr_exm out nocopy number,
90    p_lt_2012_hou_othr_intr_exm out nocopy number,
91 --Bug 14754836 End
92 	p_housing_saving_exem		out nocopy number,
93 	p_lt_housing_loan_intr_exem	out nocopy number,
94 	p_birth_raising_allowance	out nocopy number,
95 	p_num_of_new_born_adopted	out nocopy number,
96 	p_new_born_adopted_tax_exem	out nocopy number,
97 	--- End of  Bug 7142620
98 	p_long_term_stck_fund_tax_exem  out nocopy number,  -- Bug 7615517
99 	p_num_of_underaged_dpnts	out nocopy number,  -- Bug 6024342
100 	p_child_tax_exem		out nocopy number,
101 	p_num_of_addtl_child		out nocopy number,  -- Bug 6784288
102 	p_addl_child_tax_exem		out nocopy number,  -- bug 6012258
103 	p_supp_tax_exem			out nocopy number,
104 	p_ins_prem_tax_exem		out nocopy number,
105 	-- Bug 9737699
106 	p_hi_prem_tax_exem		out nocopy number,
107 	p_ei_prem_tax_exem		out nocopy number,
108 	p_pers_ins_prem_tax_exem	out nocopy number,
109 	p_disabled_ins_prem_tax_exem	out nocopy number,
110 	--
111 	p_med_exp_tax_exem		out nocopy number,
112 	p_educ_exp_tax_exem		out nocopy number,
113 	p_donation_tax_exem		out nocopy number,
114 	p_marr_fun_relo_exem		out nocopy number,       -- bug 3402025
115 	p_sp_tax_exem			out nocopy number,
116 	p_std_sp_tax_exem		out nocopy number,
117 	p_np_prem_tax_exem		out nocopy number,
118 	p_pension_premium		out nocopy number,	-- Bug 6024342
119 	p_military_pen_prem		out nocopy number,	-- Bug 9737699
120 	p_private_school_pen_prem	out nocopy number,	-- Bug 9737699
121 	p_post_office_pen_prem		out nocopy number,	-- Bug 9737699
122 	p_taxable_income2		out nocopy number,
123 	p_pers_pension_prem_tax_exem	out nocopy number,
124 	p_corp_pension_prem_tax_exem	out nocopy number,	 -- Bug 4750653
125 	p_scientific_tech_tax_exem	out nocopy number,      -- Bug 9737699
126 	p_housing_rent_exp_tax_exem     out nocopy number,	 -- Bug 9737699
127 	p_housing_sub_saving_exem       out nocopy number,	 -- Bug 9737699
128 	p_emp_hou_pro_saving_exem	out nocopy number,	 -- Bug 9737699
129 	p_lt_hou_pro_saving_exem	out nocopy number,	 -- Bug 9737699
130 	p_total_housing_saving_exem	out nocopy number,	 -- Bug 9737699
131 	p_pers_pension_saving_tax_exem	out nocopy number,
132 	p_invest_partner_fin_tax_exem	out nocopy number,
133 	p_credit_card_exp_tax_exem	out nocopy number,
134 	p_emp_st_own_plan_cont_exem     out nocopy number,
135 	p_small_bus_install_exem	out nocopy number, 	 -- Bug 6895093
136 	p_hi_prem			out nocopy number,   	 -- Bug 6895093
137         p_ltci_prem                     out nocopy number,       -- Bug 7260606
138 	p_ei_prem			out nocopy number,   	 -- Bug 6895093
139 	p_np_prem			out nocopy number,   	 -- Bug 6895093
140 	p_non_rep_non_taxable		out nocopy number,       -- Bug 9079478
141 	p_smb_income_exem               out nocopy number,       -- Bug 9079478
142 	p_taxation_base			out nocopy number,
143 	p_calc_tax			out nocopy number,
144 	p_tax_reduction_smb		out nocopy number, --  Bug 14754822
145 	p_tax_reduction_teachers		out nocopy number,
146 	p_tax_reduction_marine		out nocopy number,
147 	p_basic_tax_break		out nocopy number,
148 	p_housing_exp_tax_break		out nocopy number,
149 	p_stock_saving_tax_break	out nocopy number,
150 	p_ovs_tax_break			out nocopy number,
151 	p_don_tax_break			out nocopy number, -- Bug 3966549
152 	p_lt_stock_saving_tax_break	out nocopy number,
153 	p_total_tax_break		out nocopy number,
154 	p_foreign_worker_tax_break1	out nocopy number,
155 	p_foreign_worker_tax_break2	out nocopy number,
156 	p_foreign_worker_tax_break	out nocopy number,
157 	p_annual_itax			out nocopy number,
158 	p_annual_stax			out nocopy number,
159 	p_annual_rtax			out nocopy number,
160 	p_annual_tax			out nocopy number,
161 	p_prev_itax			out nocopy number,
162 	p_prev_stax			out nocopy number,
163 	p_prev_rtax			out nocopy number,
164 	p_prev_tax			out nocopy number,
165 	p_cur_itax			out nocopy number,
166 	p_cur_stax			out nocopy number,
167 	p_cur_rtax			out nocopy number,
168 	p_cur_tax			out nocopy number,
169 	p_itax_adj			out nocopy number,
170 	p_stax_adj			out nocopy number,
171 	p_rtax_adj			out nocopy number,
172 	p_tax_adj			out nocopy number,
173 	p_cash_receipt_expense          out nocopy number,   -- 4289780
174 	p_emp_ins_exp_nts		out nocopy number,   -- 5190884
175 	p_emp_tot_ins_exp		out nocopy number,
176 	p_emp_med_exp_nts		out nocopy number,
177 	p_emp_med_exp_oth		out nocopy number,
178 	p_emp_educ_exp_nts		out nocopy number,
179 	p_emp_educ_exp_oth		out nocopy number,
180 	p_emp_card_exp_nts		out nocopy number,
181 	p_emp_direct_exp_nts		out nocopy number, -- Bug 9737699
182 	p_emp_card_exp_oth		out nocopy number,
183 	p_emp_direct_exp_oth		out nocopy number, -- Bug 9737699
184 	p_emp_cash_exp_nts		out nocopy number,
185 -- Bug 14502155 start
186 	p_emp_tm_cash_exp_nts		out nocopy number,
187 	p_emp_tm_card_exp_nts		out nocopy number,
188 	p_emp_tm_card_exp_oth		out nocopy number,
189 	p_emp_tm_direct_exp_nts		out nocopy number,
190 	p_emp_tm_direct_exp_oth		out nocopy number,
191 	p_emp_tuition_paid_exp_nts		out nocopy number,
192 	p_emp_tuition_paid_exp_oth		out nocopy number,
193 -- Bug 14502155 end
194 	p_emp_don_exp_nts		out nocopy number,
195 	p_emp_don_exp_oth		out nocopy number,
196 	p_double_exem_amt               out nocopy number,   -- Bug 6716401
197         p_tax_grp_bus_reg_num           out nocopy varchar2,   -- Bug 7361372
198         p_tax_grp_name                  out nocopy varchar2,   -- Bug 7361372
199 	p_tax_grp_wkpd_from		out nocopy date,	-- Bug 8644512
200 	p_tax_grp_wkpd_to		out nocopy date,	-- Bug 8644512
201 	p_tax_grp_tax_brk_pd_from	out nocopy date,	-- Bug 8644512
202 	p_tax_grp_tax_brk_pd_to		out nocopy date,	-- Bug 8644512
203         p_tax_grp_taxable_mth           out nocopy number,   -- Bug 7361372
204         p_tax_grp_taxable_bon           out nocopy number,   -- Bug 7361372
205         p_tax_grp_sp_irreg_bonus        out nocopy number,   -- Bug 7361372
206         p_tax_stck_pur_opt_exec_earn 	out nocopy number,   -- Bug 7361372
207 	p_tax_grp_esop_withd_earn	out nocopy number,   -- Bug 8644512
208         p_tax_grp_taxable               out nocopy number,   -- Bug 7361372
209 	p_tax_grp_non_taxable_ovt	out nocopy number,   -- Bug 8644512
210 	p_tax_grp_bir_raising_allw	out nocopy number,   -- Bug 8644512
211 	p_tax_grp_fw_income_exem	out nocopy number,   -- Bug 8644512
212         p_tax_grp_post_tax_deduc        out nocopy number,   -- Bug 7361372
213 	p_house_holder_flag		out nocopy varchar2, -- Bug 9737699
214 	-- Bug 9737699
215 	p_sep_pen_exm_amt_archive	out nocopy varchar2,
216 	p_pen_sav_exm_amt_archive	out nocopy varchar2,
217 	p_hou_sav_exm_amt_archive	out nocopy varchar2,
218 	p_lt_stck_sav_exm_amt_archive	out nocopy varchar2,
219         p_sep_pen_priority1		out nocopy number,
220         p_sep_pen_priority2		out nocopy number,
221 	p_pen_sav_priority1		out nocopy number,
222 	p_pen_sav_priority2		out nocopy number,
223 	p_hou_sav_priority1		out nocopy number,
224 	p_hou_sav_priority2		out nocopy number,
225 	p_hou_sav_priority3		out nocopy number,
226 	p_lt_stck_sav_priority1		out nocopy number,
227 	p_lt_stck_sav_priority2		out nocopy number,
228 	p_lt_stck_sav_priority3		out nocopy number,
229         p_sep_pen_type1			out nocopy varchar2,
230         p_sep_pen_fin_inst1             out nocopy varchar2,
231 	p_sep_pen_acc_number1		out nocopy varchar2,
232 	p_sep_pen_cont_amt1		out nocopy number,
233 	p_sep_pen_exem_amt1		out nocopy number,
234         p_sep_pen_type2			out nocopy varchar2,
235         p_sep_pen_fin_inst2             out nocopy varchar2,
236 	p_sep_pen_acc_number2		out nocopy varchar2,
237 	p_sep_pen_cont_amt2		out nocopy number,
238 	p_sep_pen_exem_amt2		out nocopy number,
239 	p_pen_sav_type1			out nocopy varchar2,
240 	p_pen_sav_fin_inst1		out nocopy varchar2,
241         p_pen_sav_acc_number1		out nocopy varchar2,
242 	p_pen_sav_cont_amt1		out nocopy number,
243         p_pen_sav_exem_amt1             out nocopy number,
244 	p_pen_sav_type2			out nocopy varchar2,
245 	p_pen_sav_fin_inst2		out nocopy varchar2,
246         p_pen_sav_acc_number2		out nocopy varchar2,
247 	p_pen_sav_cont_amt2		out nocopy number,
248         p_pen_sav_exem_amt2             out nocopy number,
249 	p_hou_sav_type1			out nocopy varchar2,
250 	p_hou_sav_fin_inst1		out nocopy varchar2,
251         p_hou_sav_acc_number1		out nocopy varchar2,
252         p_hou_sav_cont_amt1		out nocopy number,
253         p_hou_sav_exem_amt1             out nocopy number,
254 	p_hou_sav_type2			out nocopy varchar2,
255 	p_hou_sav_fin_inst2		out nocopy varchar2,
256         p_hou_sav_acc_number2		out nocopy varchar2,
257         p_hou_sav_cont_amt2		out nocopy number,
258         p_hou_sav_exem_amt2             out nocopy number,
259 	p_hou_sav_type3			out nocopy varchar2,
260 	p_hou_sav_fin_inst3		out nocopy varchar2,
261         p_hou_sav_acc_number3		out nocopy varchar2,
262         p_hou_sav_cont_amt3		out nocopy number,
263         p_hou_sav_exem_amt3             out nocopy number,
264 	p_lt_stck_sav_type1		out nocopy varchar2,
265 	p_lt_stck_sav_fin_inst1		out nocopy varchar2,
266 	p_lt_stck_sav_acc_number1	out nocopy varchar2,
267 	p_lt_stck_sav_cont_amt1		out nocopy number,
268 	p_lt_stck_sav_exem_amt1		out nocopy number,
269 	p_lt_stck_sav_type2		out nocopy varchar2,
270 	p_lt_stck_sav_fin_inst2		out nocopy varchar2,
271 	p_lt_stck_sav_acc_number2	out nocopy varchar2,
272 	p_lt_stck_sav_cont_amt2		out nocopy number,
273 	p_lt_stck_sav_exem_amt2		out nocopy number,
274 	p_lt_stck_sav_type3		out nocopy varchar2,
275 	p_lt_stck_sav_fin_inst3		out nocopy varchar2,
276 	p_lt_stck_sav_acc_number3	out nocopy varchar2,
277 	p_lt_stck_sav_cont_amt3		out nocopy number,
278 	p_lt_stck_sav_exem_amt3		out nocopy number,
279 	--
280 	p_total_ntax_R10	out nocopy number,  -- Bug 12807687
281 	p_total_ntax_G01	out nocopy number,   -- Bug 8644512
282 	p_total_ntax_H01	out nocopy number,   -- Bug 8644512
283 	p_total_ntax_H05	out nocopy number,   -- Bug 8644512
284 	p_total_ntax_H06	out nocopy number,   -- Bug 8644512
285 	p_total_ntax_H07	out nocopy number,   -- Bug 8644512
286 	p_total_ntax_H08	out nocopy number,   -- Bug 8644512
287 	p_total_ntax_H09	out nocopy number,   -- Bug 8644512
288 	p_total_ntax_H10	out nocopy number,   -- Bug 8644512
289 	p_total_ntax_H11	out nocopy number,   -- Bug 8644512
290 	p_total_ntax_H12	out nocopy number,   -- Bug 8644512
291 	p_total_ntax_H13	out nocopy number,   -- Bug 8644512
292 	p_total_ntax_I01	out nocopy number,   -- Bug 8644512
293 	p_total_ntax_K01	out nocopy number,   -- Bug 8644512
294 	p_total_ntax_M01	out nocopy number,   -- Bug 8644512
295 	p_total_ntax_M02	out nocopy number,   -- Bug 8644512
296 	p_total_ntax_M03	out nocopy number,   -- Bug 8644512
297 	p_total_ntax_S01	out nocopy number,   -- Bug 8644512
298 	p_total_ntax_T01	out nocopy number,   -- Bug 8644512
299 	p_total_ntax_Y01	out nocopy number,   -- Bug 8644512
300 	p_total_ntax_Y02	out nocopy number,   -- Bug 8644512
301 	p_total_ntax_Y03	out nocopy number,   -- Bug 8644512
302 	p_total_ntax_Y20	out nocopy number,   -- Bug 8644512
303 	p_total_ntax_Y21	out nocopy number,   -- Bug 9737699
304 	p_total_ntax_ZZ		out nocopy number,   -- Bug 9737699
305 	p_total_ntax_Z01	out nocopy number,   -- Bug 8644512
306 	p_total_ntax_tax_brk	out nocopy number,   -- Bug 9737699
307 	p_total_ntax_H14	out nocopy number,   -- Bug 14754822
308 	p_total_ntax_H15	out nocopy number,   -- Bug 14754822
309 	p_total_ntax_T10	out nocopy number,   -- Bug 14754822
310 	p_total_ntax_T20	out nocopy number,   -- Bug 14754822
311 	--
312 	p_cur_ntax_R10		out nocopy number,   -- Bug 12807687
313 	p_cur_ntax_G01		out nocopy number,   -- Bug 8644512
314 	p_cur_ntax_H01		out nocopy number,   -- Bug 8644512
315 	p_cur_ntax_H05		out nocopy number,   -- Bug 8644512
316 	p_cur_ntax_H06		out nocopy number,   -- Bug 8644512
317 	p_cur_ntax_H07		out nocopy number,   -- Bug 8644512
318 	p_cur_ntax_H08		out nocopy number,   -- Bug 8644512
319 	p_cur_ntax_H09		out nocopy number,   -- Bug 8644512
320 	p_cur_ntax_H10		out nocopy number,   -- Bug 8644512
321 	p_cur_ntax_H11		out nocopy number,   -- Bug 8644512
322 	p_cur_ntax_H12		out nocopy number,   -- Bug 8644512
323 	p_cur_ntax_H13		out nocopy number,   -- Bug 8644512
324 	p_cur_ntax_I01		out nocopy number,   -- Bug 8644512
325 	p_cur_ntax_K01		out nocopy number,   -- Bug 8644512
326 	p_cur_ntax_M01		out nocopy number,   -- Bug 8644512
327 	p_cur_ntax_M02		out nocopy number,   -- Bug 8644512
328 	p_cur_ntax_M03		out nocopy number,   -- Bug 8644512
329 	p_cur_ntax_S01		out nocopy number,   -- Bug 8644512
330 	p_cur_ntax_T01		out nocopy number,   -- Bug 8644512
331 	p_cur_ntax_Y01		out nocopy number,   -- Bug 8644512
332 	p_cur_ntax_Y02		out nocopy number,   -- Bug 8644512
333 	p_cur_ntax_Y03		out nocopy number,   -- Bug 8644512
334 	p_cur_ntax_Y20		out nocopy number,   -- Bug 8644512
335 	p_cur_ntax_Y21		out nocopy number,   -- Bug 9737699
336 	p_cur_ntax_ZZ		out nocopy number,   -- Bug 9737699
337 	p_cur_ntax_Z01		out nocopy number,   -- Bug 8644512
338 	p_cur_ntax_tax_brk	out nocopy number,   -- Bug 9737699
339 	p_cur_ntax_H14	out nocopy number,   -- Bug 14754822
340 	p_cur_ntax_H15	out nocopy number,   -- Bug 14754822
341 	p_cur_ntax_T10	out nocopy number,   -- Bug 14754822
342 	p_cur_ntax_T20	out nocopy number,   -- Bug 14754822
343 	--
344 	p_tax_grp_ntax_R10	out nocopy number,   -- Bug 12807687
345 	p_tax_grp_ntax_G01	out nocopy number,   -- Bug 8644512
346 	p_tax_grp_ntax_H01	out nocopy number,   -- Bug 8644512
347 	p_tax_grp_ntax_H05	out nocopy number,   -- Bug 8644512
348 	p_tax_grp_ntax_H06	out nocopy number,   -- Bug 8644512
349 	p_tax_grp_ntax_H07	out nocopy number,   -- Bug 8644512
350 	p_tax_grp_ntax_H08	out nocopy number,   -- Bug 8644512
351 	p_tax_grp_ntax_H09	out nocopy number,   -- Bug 8644512
352 	p_tax_grp_ntax_H10	out nocopy number,   -- Bug 8644512
353 	p_tax_grp_ntax_H11	out nocopy number,   -- Bug 8644512
354 	p_tax_grp_ntax_H12	out nocopy number,   -- Bug 8644512
355 	p_tax_grp_ntax_H13	out nocopy number,   -- Bug 8644512
356 	p_tax_grp_ntax_I01	out nocopy number,   -- Bug 8644512
357 	p_tax_grp_ntax_K01	out nocopy number,   -- Bug 8644512
358 	p_tax_grp_ntax_M01	out nocopy number,   -- Bug 8644512
359 	p_tax_grp_ntax_M02	out nocopy number,   -- Bug 8644512
360 	p_tax_grp_ntax_M03	out nocopy number,   -- Bug 8644512
361 	p_tax_grp_ntax_S01	out nocopy number,   -- Bug 8644512
362 	p_tax_grp_ntax_T01	out nocopy number,   -- Bug 8644512
363 	p_tax_grp_ntax_Y01	out nocopy number,   -- Bug 8644512
364 	p_tax_grp_ntax_Y02	out nocopy number,   -- Bug 8644512
365 	p_tax_grp_ntax_Y03	out nocopy number,   -- Bug 8644512
366 	p_tax_grp_ntax_Y20	out nocopy number,   -- Bug 8644512
367 	p_tax_grp_ntax_Y21	out nocopy number,   -- Bug 9737699
368 	p_tax_grp_ntax_ZZ	out nocopy number,   -- Bug 9737699
369 	p_tax_grp_ntax_Z01	out nocopy number,   -- Bug 8644512
370 	p_tax_grp_ntax_tax_brk	out nocopy number,   -- Bug 8644512
371 	p_tax_grp_ntax_H14	out nocopy number,   -- Bug 14754822
372 	p_tax_grp_ntax_H15	out nocopy number,   -- Bug 14754822
373 	p_tax_grp_ntax_T10	out nocopy number,   -- Bug 14754822
374 	p_tax_grp_ntax_T20	out nocopy number,   -- Bug 14754822
375 	--
376 	p_prev1_ntax_R10	out nocopy number,  -- Bug 12807687
377 	p_prev1_ntax_G01	out nocopy number,   -- Bug 8644512
378 	p_prev1_ntax_H01	out nocopy number,   -- Bug 8644512
379 	p_prev1_ntax_H05	out nocopy number,   -- Bug 8644512
380 	p_prev1_ntax_H06	out nocopy number,   -- Bug 8644512
381 	p_prev1_ntax_H07	out nocopy number,   -- Bug 8644512
382 	p_prev1_ntax_H08	out nocopy number,   -- Bug 8644512
383 	p_prev1_ntax_H09	out nocopy number,   -- Bug 8644512
384 	p_prev1_ntax_H10	out nocopy number,   -- Bug 8644512
385 	p_prev1_ntax_H11	out nocopy number,   -- Bug 8644512
386 	p_prev1_ntax_H12	out nocopy number,   -- Bug 8644512
387 	p_prev1_ntax_H13	out nocopy number,   -- Bug 8644512
388 	p_prev1_ntax_I01	out nocopy number,   -- Bug 8644512
389 	p_prev1_ntax_K01	out nocopy number,   -- Bug 8644512
390 	p_prev1_ntax_M01	out nocopy number,   -- Bug 8644512
391 	p_prev1_ntax_M02	out nocopy number,   -- Bug 8644512
392 	p_prev1_ntax_M03	out nocopy number,   -- Bug 8644512
393 	p_prev1_ntax_S01	out nocopy number,   -- Bug 8644512
394 	p_prev1_ntax_T01	out nocopy number,   -- Bug 8644512
395 	p_prev1_ntax_Y01	out nocopy number,   -- Bug 8644512
396 	p_prev1_ntax_Y02	out nocopy number,   -- Bug 8644512
397 	p_prev1_ntax_Y03	out nocopy number,   -- Bug 8644512
398 	p_prev1_ntax_Y20	out nocopy number,   -- Bug 8644512
399 	p_prev1_ntax_Y21	out nocopy number,   -- Bug 9737699
400 	p_prev1_ntax_ZZ		out nocopy number,   -- Bug 9737699
401 	p_prev1_ntax_Z01	out nocopy number,   -- Bug 8644512
402 	p_prev1_ntax_tax_brk	out nocopy number,   -- Bug 8644512
403 	p_prev1_ntax_H14	out nocopy number,   -- Bug 14754822
404 	p_prev1_ntax_H15	out nocopy number,   -- Bug 14754822
405 	p_prev1_ntax_T10		out nocopy number, -- Bug 14754822
406 	p_prev1_ntax_T20	out nocopy number,   -- Bug 14754822
407 	--
408 	p_prev2_ntax_R10	out nocopy number,  --Bug 12807687
409 	p_prev2_ntax_G01	out nocopy number,   -- Bug 8644512
410 	p_prev2_ntax_H01	out nocopy number,   -- Bug 8644512
411 	p_prev2_ntax_H05	out nocopy number,   -- Bug 8644512
412 	p_prev2_ntax_H06	out nocopy number,   -- Bug 8644512
413 	p_prev2_ntax_H07	out nocopy number,   -- Bug 8644512
414 	p_prev2_ntax_H08	out nocopy number,   -- Bug 8644512
415 	p_prev2_ntax_H09	out nocopy number,   -- Bug 8644512
416 	p_prev2_ntax_H10	out nocopy number,   -- Bug 8644512
417 	p_prev2_ntax_H11	out nocopy number,   -- Bug 8644512
418 	p_prev2_ntax_H12	out nocopy number,   -- Bug 8644512
419 	p_prev2_ntax_H13	out nocopy number,   -- Bug 8644512
420 	p_prev2_ntax_I01	out nocopy number,   -- Bug 8644512
421 	p_prev2_ntax_K01	out nocopy number,   -- Bug 8644512
422 	p_prev2_ntax_M01	out nocopy number,   -- Bug 8644512
423 	p_prev2_ntax_M02	out nocopy number,   -- Bug 8644512
424 	p_prev2_ntax_M03	out nocopy number,   -- Bug 8644512
425 	p_prev2_ntax_S01	out nocopy number,   -- Bug 8644512
426 	p_prev2_ntax_T01	out nocopy number,   -- Bug 8644512
427 	p_prev2_ntax_Y01	out nocopy number,   -- Bug 8644512
428 	p_prev2_ntax_Y02	out nocopy number,   -- Bug 8644512
429 	p_prev2_ntax_Y03	out nocopy number,   -- Bug 8644512
430 	p_prev2_ntax_Y20	out nocopy number,   -- Bug 8644512
431 	p_prev2_ntax_Y21	out nocopy number,   -- Bug 9737699
432 	p_prev2_ntax_ZZ		out nocopy number,   -- Bug 9737699
433 	p_prev2_ntax_Z01	out nocopy number,   -- Bug 8644512
434 	p_prev2_ntax_tax_brk	out nocopy number,   -- Bug 8644512
435 	p_prev2_ntax_H14	out nocopy number,   -- Bug 14754822
436 	p_prev2_ntax_H15	out nocopy number,   -- Bug 14754822
437 	p_prev2_ntax_T10	out nocopy number,   -- Bug 14754822
438 	p_prev2_ntax_T20	out nocopy number,   -- Bug 14754822
439 	--
440 	p_cur_total_ntax_earn	out nocopy number,   -- Bug 8644512
441 	p_tax_grp_total_ntax_earn out nocopy number,   -- Bug 8644512
442 	p_prev1_total_ntax_earn	out nocopy number,   -- Bug 8644512
443 	p_prev2_total_ntax_earn	out nocopy number,   -- Bug 8644512
444 	--
445 	p_prev1_bus_reg_num	out nocopy varchar2, -- Bug 8644512
446 	p_prev1_itax		out nocopy number,   -- Bug 8644512
447 	p_prev1_rtax		out nocopy number,   -- Bug 8644512
448 	p_prev1_stax		out nocopy number,   -- Bug 8644512
449 	p_prev1_total_tax	out nocopy number,   -- Bug 8644512
450 	p_prev2_bus_reg_num	out nocopy varchar2, -- Bug 8644512
451 	p_prev2_itax		out nocopy number,   -- Bug 8644512
452 	p_prev2_rtax		out nocopy number,   -- Bug 8644512
453 	p_prev2_stax		out nocopy number,   -- Bug 8644512
454 	p_prev2_total_tax	out nocopy number,   -- Bug 8644512
455 	p_prev3_bus_reg_num	out nocopy varchar2, -- Bug 8644512
456 	p_prev3_itax		out nocopy number,   -- Bug 8644512
457 	p_prev3_rtax		out nocopy number,   -- Bug 8644512
458 	p_prev3_stax		out nocopy number,   -- Bug 8644512
459 	p_prev3_total_tax	out nocopy number,   -- Bug 8644512
460 	p_prev4_bus_reg_num	out nocopy varchar2, -- Bug 8644512
461 	p_prev4_itax		out nocopy number,   -- Bug 8644512
462 	p_prev4_rtax		out nocopy number,   -- Bug 8644512
463 	p_prev4_stax		out nocopy number,   -- Bug 8644512
464 	p_prev4_total_tax	out nocopy number,   -- Bug 8644512
465 	p_prev5_bus_reg_num	out nocopy varchar2, -- Bug 8644512
466 	p_prev5_itax		out nocopy number,   -- Bug 8644512
467 	p_prev5_rtax		out nocopy number,   -- Bug 8644512
468 	p_prev5_stax		out nocopy number,   -- Bug 8644512
469 	p_prev5_total_tax	out nocopy number)   -- Bug 8644512
470 ------------------------------------------------------------------------
471 is
472 	l_yea_info	pay_kr_yea_pkg.t_yea_info;
473 	cursor csr is
474 		select	hr_ni_chk_pkg.chk_nat_id_format(per.national_identifier, 'DDDDDD-DDDDDDD') NATIONAL_IDENTIFIER,
475 			per.person_id,                  -- bug 6012258
476 			pds.date_start,
477 			pds.actual_termination_date,
478 			ppa.effective_date
479 		from	per_people_f	        per,
480 			per_periods_of_service	pds,
481 			per_assignments_f	asg,
482 			pay_payroll_actions	ppa,
483 			pay_assignment_actions	paa
484 		where	paa.assignment_action_id = p_assignment_action_id
485 		and	ppa.payroll_action_id = paa.payroll_action_id
486 		and	asg.assignment_id = paa.assignment_id
487 		and	ppa.effective_date
488 			between asg.effective_start_date and asg.effective_end_date
489 		and	pds.period_of_service_id = asg.period_of_service_id
490 		and	per.person_id = pds.person_id
491 		and	ppa.effective_date
492 			between per.effective_start_date and per.effective_end_date;
493 	l_rec	csr%ROWTYPE;
494 
495         -- 4289780
496         cursor csr_cash_receipt is
497         select to_number(pi.aei_information13) "Cash Receipt"
498         from per_assignment_extra_info  pi,
499              pay_assignment_actions     paa,
500              pay_payroll_actions        ppa
501         where paa.assignment_action_id    = p_assignment_action_id
502         and ppa.payroll_action_id         = paa.payroll_action_id
503         and pi.assignment_id              = paa.assignment_id
504         and pi.information_type           = 'KR_YEA_TAX_EXEM_INFO'
505         and trunc(fnd_date.canonical_to_date(pi.aei_information1), 'YYYY')
506                                           = trunc(ppa.effective_date, 'YYYY');
507 
508 	--5190884
509 	cursor csr_emp_exp_details is
510 	select aei_information2 emp_med_exp_nts,
511                aei_information3 emp_educ_exp_nts,
512                aei_information4 emp_card_exp_nts,
513 	       aei_information7 emp_direct_exp_nts, -- Bug 9737699
514                aei_information5 emp_don_exp_nts,
515                aei_information6 emp_ins_exp_nts, -- Bug 5667762
516 	       aei_information8 emp_tm_card_exp_nts, -- Bug 14502155
517 	       aei_information9 emp_tm_direct_exp_nts, -- Bug 14502155
518 	       aei_information10 emp_tuition_paid_exp_nts -- Bug 14502155
519 	from per_assignment_extra_info pei,
520 	     pay_assignment_actions    paa,
521 	     pay_payroll_actions       ppa
522 	where paa.assignment_action_id   = p_assignment_action_id
523 	and ppa.payroll_action_id         = paa.payroll_action_id
524 	and pei.assignment_id             = paa.assignment_id
525         and pei.information_type	  = 'KR_YEA_EMP_EXPENSE_DETAILS'
526         and trunc(fnd_date.canonical_to_date(pei.aei_information1), 'YYYY')
527                                           = trunc(ppa.effective_date, 'YYYY');
528 
529 	cursor csr_get_emp_exp_amount is
530         select nvl(to_number(aei_information18), 0) + nvl(to_number(aei_information19), 0) +
531                nvl(to_number(aei_information20), 0) + nvl(to_number(aei_information22), 0) +
532 	       nvl(to_number(aei_information23), 0) + nvl(to_number(aei_information30), 0)
533         from per_assignment_extra_info  pi,
534              pay_assignment_actions     paa,
535              pay_payroll_actions        ppa
536         where paa.assignment_action_id    = p_assignment_action_id
537         and ppa.payroll_action_id         = paa.payroll_action_id
538         and pi.assignment_id              = paa.assignment_id
539         and pi.information_type           = 'KR_YEA_SP_TAX_EXEM_INFO'
540         and trunc(fnd_date.canonical_to_date(pi.aei_information1), 'YYYY')
541                                           = trunc(ppa.effective_date, 'YYYY');
542 
543       cursor csr_get_emp_card_expense is
544         select nvl(to_number(aei_information7), 0),
545                nvl(to_number(aei_information10), 0),
546                nvl(to_number(aei_information12), 0)
547         from per_assignment_extra_info  pi,
548              pay_assignment_actions     paa,
549              pay_payroll_actions        ppa
550         where paa.assignment_action_id    = p_assignment_action_id
551         and ppa.payroll_action_id         = paa.payroll_action_id
552         and pi.assignment_id              = paa.assignment_id
553         and pi.information_type           = 'KR_YEA_TAX_EXEM_INFO'
554         and trunc(fnd_date.canonical_to_date(pi.aei_information1), 'YYYY')
555                                           = trunc(ppa.effective_date, 'YYYY');
556 -- BUG 14502155
557 	cursor csr_get_tm_emp_card_expense is
558         select nvl(to_number(aei_information3), 0),
559                nvl(to_number(aei_information5), 0),
560                nvl(to_number(aei_information7), 0)
561         from per_assignment_extra_info  pi,
562              pay_assignment_actions     paa,
563              pay_payroll_actions        ppa
564         where paa.assignment_action_id    = p_assignment_action_id
565         and ppa.payroll_action_id         = paa.payroll_action_id
566         and pi.assignment_id              = paa.assignment_id
567         and pi.information_type           = 'KR_YEA_TAX_EXEM_INFO2'
568         and trunc(fnd_date.canonical_to_date(pi.aei_information1), 'YYYY')
569                                           = trunc(ppa.effective_date, 'YYYY');
570 
571 	cursor csr_get_emp_don_educ_details is
572         select nvl(to_number(aei_information4), 0) +
573                nvl(to_number(aei_information5), 0) +
574                nvl(to_number(aei_information6), 0) +
575                nvl(to_number(aei_information7), 0),
576                nvl(to_number(aei_information8), 0),
577 	       nvl(to_number(aei_information2),0)
578         from per_assignment_extra_info  pi,
579              pay_assignment_actions     paa,
580              pay_payroll_actions        ppa
581         where paa.assignment_action_id    = p_assignment_action_id
582         and ppa.payroll_action_id         = paa.payroll_action_id
583         and pi.assignment_id              = paa.assignment_id
584         and pi.information_type           = 'KR_YEA_SP_TAX_EXEM_INFO2'
585         and trunc(fnd_date.canonical_to_date(pi.aei_information1), 'YYYY')
586                                           = trunc(ppa.effective_date, 'YYYY');
587 
588         -- Bug 5726158
589 	cursor csr_asg_details is
590 	 select paa.assignment_id, ppa.effective_date
591 	   from pay_payroll_actions ppa,
592 	        pay_assignment_actions paa
593 	  where paa.assignment_action_id = p_assignment_action_id
594 	    and ppa.payroll_action_id = paa.payroll_action_id;
595 	--
596 	l_asg_details csr_asg_details%rowtype;
597 	--
598 	cursor csr_get_dpnt_cash_exp(p_assignment_id number, p_effective_date date) is
599 	select sum(nvl(to_number(cei.cei_information9),0))
600 	 from pay_kr_cont_details_v      pkc,
601               per_contact_extra_info_f   cei    -- Bug 5879106
602 	where pkc.assignment_id        = p_assignment_id
603           and p_effective_date between emp_start_date and emp_end_date
604           and p_effective_date between cont_start_date and cont_end_date
605 	  and cei.information_type(+) = 'KR_DPNT_EXPENSE_INFO'
606 	  and cei.contact_relationship_id(+) = pkc.contact_relationship_id
607 	  and to_char(cei.effective_start_date(+), 'YYYY') = to_char(p_effective_date, 'YYYY')
608 	  and  p_effective_date between nvl(ADDRESS_START_DATE, p_effective_date) and nvl(ADDRESS_END_DATE, p_effective_date)
609 	  and  p_effective_date between nvl(pkc.date_start, p_effective_date)
610 			     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) )
611 	  and  pay_kr_ff_functions_pkg.is_exempted_dependent(   pkc.contact_type,
612 								pkc.cont_information11,  -- Bug 7661820
613 								pkc.national_identifier,
614 								pkc.cont_information2,
615 								pkc.cont_information3,
616 								pkc.cont_information4,
617 								pkc.cont_information7,
618 								pkc.cont_information8,
619 								p_effective_date,
620 								pkc.cont_information10,
621 								pkc.cont_information12,
622 								pkc.cont_information13,
623 								pkc.cont_information14,
624 								cei.contact_extra_info_id(+)
625 	    					             ) = 'Y';
626 l_emp_ins_exp_nts	NUMBER := 0;
627 l_emp_med_exp_nts	NUMBER := 0;
628 l_emp_educ_exp_nts	NUMBER := 0;
629 l_emp_card_exp_nts	NUMBER := 0;
630 l_emp_direct_exp_nts	NUMBER := 0; -- Bug 9737699
631 l_emp_don_exp_nts	NUMBER := 0;
632 l_card_expense_total	NUMBER := 0;
633 l_direct_expense_total	NUMBER := 0; -- Bug 9737699
634 l_emp_tm_card_exp_nts	NUMBER := 0; -- Bug 14502155
635 l_emp_tm_direct_exp_nts	NUMBER := 0; -- Bug 14502155
636 l_emp_tuition_paid_exp_nts	NUMBER := 0; -- Bug 14502155
637 l_tuition_paid_exp_total	NUMBER := 0; -- Bug 14502155
638 l_tm_card_expense_total	NUMBER := 0; -- Bug 14502155
639 l_tm_cash_expense_total	NUMBER := 0; -- Bug 14502155
640 l_tm_direct_expense_total	NUMBER := 0; -- Bug 14502155
641 --Bug 5308995
642 l_don_amount1		NUMBER := 0;
643 l_don_amount2		NUMBER := 0;
644 l_don_tax_break2004	NUMBER := 0;
645 l_emp_occu_trng		NUMBER := 0;
646 l_dpnt_cash_exp		NUMBER := 0;
647 l_emp_cash_exp          NUMBER := 0; -- Bug 5726158
648 l_dpnt_don_total	NUMBER := 0; -- Bug 7142612
649 l_period_start_date     DATE;
650 l_period_end_date       DATE;
651 
652 begin
653 
654 	open csr;
655 	fetch csr into l_rec;
656 	close csr;
657 
658 	-- 4289780
659 	open csr_cash_receipt;
660 	fetch csr_cash_receipt into l_emp_cash_exp;
661 	close csr_cash_receipt;
662 
663 	-- 5190884
664 	--
665 	-- Retrieve all the Employee Expense Details
666 	--
667 	open csr_emp_exp_details;
668 	fetch csr_emp_exp_details into  l_emp_med_exp_nts,
669 					l_emp_educ_exp_nts,
670 					l_emp_card_exp_nts,
671 					l_emp_direct_exp_nts, -- Bug 9737699
672 					l_emp_don_exp_nts,
673 					l_emp_ins_exp_nts,
674 					l_emp_tm_card_exp_nts, -- Bug 14502155
675 					l_emp_tm_direct_exp_nts, -- Bug 14502155
676 					l_emp_tuition_paid_exp_nts; -- Bug 14502155;
677 	open csr_get_emp_exp_amount;
678 	fetch csr_get_emp_exp_amount into l_don_amount1;
679 	close csr_get_emp_exp_amount;
680 	--
681 	open csr_get_emp_card_expense;
682 	fetch csr_get_emp_card_expense into l_card_expense_total, l_direct_expense_total, l_tuition_paid_exp_total;
683 	close csr_get_emp_card_expense;
684 	--
685 	--
686 	open csr_get_tm_emp_card_expense;
687 	fetch csr_get_tm_emp_card_expense into l_tm_card_expense_total, l_tm_cash_expense_total, l_tm_direct_expense_total;
688 	close csr_get_tm_emp_card_expense;
689 	--
690 	open csr_get_emp_don_educ_details;
691 	fetch csr_get_emp_don_educ_details into l_don_amount2,l_dpnt_don_total,l_emp_occu_trng;
692 	close csr_get_emp_don_educ_details;
693 
694 	-- Bug 5726158
695 	open csr_asg_details;
696 	fetch csr_asg_details into l_asg_details;
697 	close csr_asg_details;
698 
699 	open csr_get_dpnt_cash_exp(l_asg_details.assignment_id, l_asg_details.effective_date);
700 	fetch csr_get_dpnt_cash_exp into l_dpnt_cash_exp;
701 	close csr_get_dpnt_cash_exp;
702 
703 	p_cash_receipt_expense := nvl(l_emp_cash_exp,0) + nvl(l_dpnt_cash_exp,0);
704 
705 	--
706 	-- Derive YEA results
707 	--
708 	l_yea_info := pay_kr_yea_pkg.yea_info(p_assignment_action_id);
709 	--
710 	-- Employee Basic Information
711 	--
712 	if l_yea_info.non_resident_flag = 'Y' then
713 		p_resident_type := 'N';
714 	else
715 		p_resident_type := 'R';
716 	end if;
717 	/* Bug 6779649: New logic for Korean/Foreigner Identification */
718 	if ((substr(l_rec.national_identifier, 8, 1) between 5 and 8) or (l_yea_info.foreign_residency_flag = 'Y')) then
719 	 /* Bug No: 13865190  */
720  	  if (substr(l_rec.national_identifier, 13, 1) = 8) then
721   	     p_nationality_type := 'K';
722     	  else
723     	     p_nationality_type := 'F';
724      	  end if;
725 
726 	else
727 	   p_nationality_type := 'K';
728 	end if;
729 	p_fwtb_contract_date	:= l_yea_info.fwtb_contract_date;
730 	p_fwtb_expiry_date	:= l_yea_info.fwtb_expiry_date;
731 
732         -- Foreign worket fixed tax rate
733         --
734 	if l_yea_info.fixed_tax_rate = 'Y' then
735 		p_fw_fixed_tax_rate := 'Y';
736 	else
737 		p_fw_fixed_tax_rate := 'N';
738 	end if;
739 
740 	--
741 	-- Taxable Earnings
742 	--
743 	p_cur_taxable_mth	:= l_yea_info.cur_taxable_mth;
744 	p_cur_taxable_bon	:= l_yea_info.cur_taxable_bon;
745 	p_cur_sp_irreg_bonus	:= l_yea_info.cur_sp_irreg_bonus;
746 	p_cur_stck_pur_opt_exec_earn := l_yea_info.cur_stck_pur_opt_exec_earn;	-- Bug 6012258
747 	p_cur_esop_withd_earn	:= l_yea_info.cur_esop_withd_earn;		-- Bug 8644512
748 	p_cur_taxable		:= l_yea_info.cur_taxable;
749 	p_cur_non_taxable_ovt	:= l_yea_info.cur_non_taxable_ovt;	-- Bug 8644512
750 	p_cur_birth_raising_allowance	:= l_yea_info.cur_birth_raising_allowance;	-- Bug 8644512
751 	p_cur_fw_income_exem	:= l_yea_info.cur_fw_income_exem;	-- Bug 8644512
752 	p_sep_pen_exm_amt_archive := l_yea_info.sep_pen_exem_amt_archive;
753 	p_pen_sav_exm_amt_archive := l_yea_info.pen_sav_amt_archive;
754 	p_hou_sav_exm_amt_archive := l_yea_info.hou_sav_amt_archive;
755 	p_lt_stck_sav_exm_amt_archive := l_yea_info.lt_stck_sav_amt_archive;
756 	--
757 	-- Bug 9737699
758 	for i in 1..l_yea_info.sep_pen_type_tbl.count loop
759 	  if i=1 then
760 	     p_sep_pen_exem_amt1  := l_yea_info.sep_pen_exem_amt1;
761 	     p_sep_pen_priority1  := l_yea_info.sep_pen_priority_tbl(i);
762 	     p_sep_pen_type1 := hr_general.decode_lookup('KR_YEA_SEP_PEN_TYPES',l_yea_info.sep_pen_type_tbl(i));
763 	     p_sep_pen_fin_inst1 :=  hr_general.decode_lookup('KR_YEA_FIN_INST_CODES',l_yea_info.sep_pen_fin_institute_tbl(i));
764 	     p_sep_pen_acc_number1   := l_yea_info.sep_pen_acc_number_tbl(i);
765 	     p_sep_pen_cont_amt1  := l_yea_info.sep_pen_cont_amount_tbl(i);
766 	  else
767 	  if i=2 then
768 	      p_sep_pen_exem_amt2  := l_yea_info.sep_pen_exem_amt2;
769 	      p_sep_pen_priority2  := l_yea_info.sep_pen_priority_tbl(i);
770 	      p_sep_pen_type2 := hr_general.decode_lookup('KR_YEA_SEP_PEN_TYPES',l_yea_info.sep_pen_type_tbl(i));
771 	      p_sep_pen_fin_inst2 := hr_general.decode_lookup('KR_YEA_FIN_INST_CODES',l_yea_info.sep_pen_fin_institute_tbl(i));
772 	      p_sep_pen_acc_number2   := l_yea_info.sep_pen_acc_number_tbl(i);
773 	      p_sep_pen_cont_amt2  := l_yea_info.sep_pen_cont_amount_tbl(i);
774 
775 	  end if;
776 	  end if;
777 	end loop;
778 
779 	for i in 1..l_yea_info.pen_saving_type_tbl.count loop
780 	  if i=1 then
781 	    p_pen_sav_priority1  := l_yea_info.pen_saving_priority_tbl(i);
782 	    p_pen_sav_exem_amt1  := l_yea_info.pen_sav_exem_amt1;
783 	    p_pen_sav_type1  := hr_general.decode_lookup('KR_YEA_PEN_SAVING_TYPES',l_yea_info.pen_saving_type_tbl(i));
784 	    p_pen_sav_fin_inst1 := hr_general.decode_lookup('KR_YEA_FIN_INST_CODES',l_yea_info.pen_saving_fin_institute_tbl(i));
785 	    p_pen_sav_acc_number1 := l_yea_info.pen_saving_acc_number_tbl(i);
786 	    p_pen_sav_cont_amt1 := l_yea_info.pen_saving_cont_amount_tbl(i);
787 	  else
788           if i=2 then
789 	    p_pen_sav_priority2  := l_yea_info.pen_saving_priority_tbl(i);
790 	    p_pen_sav_exem_amt2  := l_yea_info.pen_sav_exem_amt2;
791 	    p_pen_sav_type2  := hr_general.decode_lookup('KR_YEA_PEN_SAVING_TYPES',l_yea_info.pen_saving_type_tbl(i));
792 	    p_pen_sav_fin_inst2 := hr_general.decode_lookup('KR_YEA_FIN_INST_CODES',l_yea_info.pen_saving_fin_institute_tbl(i));
793 	    p_pen_sav_acc_number2 := l_yea_info.pen_saving_acc_number_tbl(i);
794 	    p_pen_sav_cont_amt2 := l_yea_info.pen_saving_cont_amount_tbl(i);
795 	  end if;
796 	  end if;
797 	 end loop;
798 	for i in 1..l_yea_info.hou_saving_type_tbl.count loop
799 	  if i=1 then
800 	   p_hou_sav_priority1 := l_yea_info.hou_saving_priority_tbl(i);
801 	   p_hou_sav_exem_amt1  := l_yea_info.hou_sav_exem_amt1;
802 	    p_hou_sav_type1  := hr_general.decode_lookup('KR_HOUSING_SAVING_TYPE',l_yea_info.hou_saving_type_tbl(i));
803 	    p_hou_sav_fin_inst1  := hr_general.decode_lookup('KR_YEA_FIN_INST_CODES',l_yea_info.hou_saving_fin_institute_tbl(i));
804 	    p_hou_sav_acc_number1 := l_yea_info.hou_saving_acc_number_tbl(i);
805 	    p_hou_sav_cont_amt1 := l_yea_info.hou_saving_cont_amount_tbl(i);
806 	  else
807           if i=2 then
808 	    p_hou_sav_priority2 := l_yea_info.hou_saving_priority_tbl(i);
809 	    p_hou_sav_exem_amt2  := l_yea_info.hou_sav_exem_amt2;
810 	    p_hou_sav_type2  := hr_general.decode_lookup('KR_HOUSING_SAVING_TYPE',l_yea_info.hou_saving_type_tbl(i));
811 	    p_hou_sav_fin_inst2  := hr_general.decode_lookup('KR_YEA_FIN_INST_CODES',l_yea_info.hou_saving_fin_institute_tbl(i));
812 	    p_hou_sav_acc_number2 := l_yea_info.hou_saving_acc_number_tbl(i);
813 	    p_hou_sav_cont_amt2 := l_yea_info.hou_saving_cont_amount_tbl(i);
814 	  end if;
815 
816 	   if i=3 then
817 	    p_hou_sav_priority3 := l_yea_info.hou_saving_priority_tbl(i);
818 	    p_hou_sav_exem_amt3  := l_yea_info.hou_sav_exem_amt3;
819 	    p_hou_sav_type3  := hr_general.decode_lookup('KR_HOUSING_SAVING_TYPE',l_yea_info.hou_saving_type_tbl(i));
820 	    p_hou_sav_fin_inst3  := hr_general.decode_lookup('KR_YEA_FIN_INST_CODES',l_yea_info.hou_saving_fin_institute_tbl(i));
821 	    p_hou_sav_acc_number3 := l_yea_info.hou_saving_acc_number_tbl(i);
822 	    p_hou_sav_cont_amt3 := l_yea_info.hou_saving_cont_amount_tbl(i);
823 	  end if;
824 	  end if;
825 	 end loop;
826 
827 	for i in 1..l_yea_info.lt_stck_saving_type_tbl.count loop
828 	  if i=1 then
829 	   p_lt_stck_sav_priority1  := l_yea_info.lt_stck_saving_priority_tbl(i);
830 	   p_lt_stck_sav_exem_amt1 := l_yea_info.lt_stck_sav_exem_amt1;
831 	    p_lt_stck_sav_type1 := hr_general.decode_lookup('KR_YEA_LT_STOCK_SAVING_YEAR',l_yea_info.lt_stck_saving_type_tbl(i));
832 	    p_lt_stck_sav_fin_inst1 := hr_general.decode_lookup('KR_YEA_FIN_INST_CODES',l_yea_info.lt_stck_saving_fin_inst_tbl(i));
833 	    p_lt_stck_sav_acc_number1 := l_yea_info.lt_stck_saving_acc_number_tbl(i);
834 	    p_lt_stck_sav_cont_amt1 := l_yea_info.lt_stck_saving_cont_amt_tbl(i);
835 	  else
836 	    if i=2 then
837 	    p_lt_stck_sav_priority2  := l_yea_info.lt_stck_saving_priority_tbl(i);
838 	    p_lt_stck_sav_exem_amt2 := l_yea_info.lt_stck_sav_exem_amt2;
839             p_lt_stck_sav_type2 := hr_general.decode_lookup('KR_YEA_LT_STOCK_SAVING_YEAR',l_yea_info.lt_stck_saving_type_tbl(i));
840 	    p_lt_stck_sav_fin_inst2 := hr_general.decode_lookup('KR_YEA_FIN_INST_CODES',l_yea_info.lt_stck_saving_fin_inst_tbl(i));
841 	    p_lt_stck_sav_acc_number2 := l_yea_info.lt_stck_saving_acc_number_tbl(i);
842 	    p_lt_stck_sav_cont_amt2 := l_yea_info.lt_stck_saving_cont_amt_tbl(i);
843 	    end if;
844 
845             if i=3 then
846 	    p_lt_stck_sav_priority3  := l_yea_info.lt_stck_saving_priority_tbl(i);
847     	    p_lt_stck_sav_exem_amt3 := l_yea_info.lt_stck_sav_exem_amt3;
848 	    p_lt_stck_sav_type3 := hr_general.decode_lookup('KR_YEA_LT_STOCK_SAVING_YEAR',l_yea_info.lt_stck_saving_type_tbl(i));
849 	    p_lt_stck_sav_fin_inst3 := hr_general.decode_lookup('KR_YEA_FIN_INST_CODES',l_yea_info.lt_stck_saving_fin_inst_tbl(i));
850 	    p_lt_stck_sav_acc_number3 := l_yea_info.lt_stck_saving_acc_number_tbl(i);
851 	    p_lt_stck_sav_cont_amt3 := l_yea_info.lt_stck_saving_cont_amt_tbl(i);
852 	    end if;
853 	   end if;
854 	 end loop;
855 	--
856 	-- End of Bug 9737699
857 	-- Previous Employers' Information
858 	--
859 	for i in 1..l_yea_info.prev_termination_date_tbl.count loop
860 		if l_yea_info.prev_bp_number_tbl(i) = '0' then
861 			fnd_message.set_encoded('Invalid Business Registration Number for Previous Employer');
862 			fnd_message.raise_error;
863 		end if;
864 		--
865 		if i = 1 then
866 			-- Bug 8644512
867 			p_prev1_bus_reg_num	:= l_yea_info.prev_bp_number_tbl(i);
868 			p_prev1_itax		:= l_yea_info.prev_itax_tbl(i);
869 			p_prev1_rtax		:= l_yea_info.prev_rtax_tbl(i);
870 			p_prev1_stax		:= l_yea_info.prev_stax_tbl(i);
871 			p_prev1_total_tax	:= nvl(p_prev1_itax,0) + nvl(p_prev1_rtax,0) + nvl(p_prev1_stax,0);
872 			--
873 			p_prev_corp_name1	:= l_yea_info.prev_corp_name_tbl(i);
874 			p_prev_bp_number1	:= l_yea_info.prev_bp_number_tbl(i);
875 			-- Bug 8644512
876 			p_prev_hire_date1	:= l_yea_info.prev_hire_date_tbl(i);
877 			p_prev_termination_date1:= l_yea_info.prev_termination_date_tbl(i);
878 			p_prev_tax_brk_pd_from1	:= l_yea_info.prev_tax_brk_pd_from_tbl(i);
879 			p_prev_tax_brk_pd_to1	:= l_yea_info.prev_tax_brk_pd_to_tbl(i);
880 			--
881 			p_prev_taxable_mth1	:= l_yea_info.prev_taxable_mth_tbl(i);
882 			p_prev_taxable_bon1	:= l_yea_info.prev_taxable_bon_tbl(i);
883 			p_prev_sp_irreg_bonus1	:= l_yea_info.prev_sp_irreg_bonus_tbl(i);
884 			p_prev_stck_pur_opt_exec_earn1 := l_yea_info.prev_stck_pur_opt_exe_earn_tbl(i);  -- Bug 6024342
885 			p_prev_esop_withd_earn1	:= l_yea_info.prev_esop_withd_earn_tbl(i); -- Bug 8644512
886 			p_prev_taxable1		:= l_yea_info.prev_taxable_mth_tbl(i)
887 						+  l_yea_info.prev_taxable_bon_tbl(i)
888 						+  l_yea_info.prev_sp_irreg_bonus_tbl(i)
889 						+  l_yea_info.prev_stck_pur_opt_exe_earn_tbl(i)
890 						+  l_yea_info.prev_esop_withd_earn_tbl(i); -- Bug 8644512
891 			p_prev_non_taxable_ovt1	:= l_yea_info.prev_non_taxable_ovt_tbl(i); -- Bug 8644512
892 			p_prev_bir_raising_allw1:= l_yea_info.prev_bir_raising_allowance_tbl(i); -- Bug 8644512
893 			p_prev_fw_income_exem1	:= l_yea_info.prev_foreign_wrkr_inc_exem_tbl(i); -- Bug 8644512
894 			--
895 			-- Bug 8644512
896 			--
897 			p_prev1_ntax_R10	:= l_yea_info.prev_ntax_R10_tbl(i); -- Bug 12807687
898 			p_prev1_ntax_G01	:= l_yea_info.prev_ntax_G01_tbl(i);
899 			p_prev1_ntax_H01	:= l_yea_info.prev_ntax_H01_tbl(i);
900 			p_prev1_ntax_H05	:= l_yea_info.prev_ntax_H05_tbl(i);
901 			p_prev1_ntax_H06	:= l_yea_info.prev_ntax_H06_tbl(i);
902 			p_prev1_ntax_H07	:= l_yea_info.prev_ntax_H07_tbl(i);
903 			p_prev1_ntax_H08	:= l_yea_info.prev_ntax_H08_tbl(i);
904 			p_prev1_ntax_H09	:= l_yea_info.prev_ntax_H09_tbl(i);
905 			p_prev1_ntax_H10	:= l_yea_info.prev_ntax_H10_tbl(i);
906 			p_prev1_ntax_H11	:= l_yea_info.prev_ntax_H11_tbl(i);
907 			p_prev1_ntax_H12	:= l_yea_info.prev_ntax_H12_tbl(i);
908 			p_prev1_ntax_H13	:= l_yea_info.prev_ntax_H13_tbl(i);
909 			p_prev1_ntax_I01	:= l_yea_info.prev_ntax_I01_tbl(i);
910 			p_prev1_ntax_K01	:= l_yea_info.prev_ntax_K01_tbl(i);
911 			p_prev1_ntax_M01	:= l_yea_info.prev_ntax_M01_tbl(i);
912 			p_prev1_ntax_M02	:= l_yea_info.prev_ntax_M02_tbl(i);
913 			p_prev1_ntax_M03	:= l_yea_info.prev_ntax_M03_tbl(i);
914 			p_prev1_ntax_S01	:= l_yea_info.prev_ntax_S01_tbl(i);
915 			p_prev1_ntax_T01	:= l_yea_info.prev_ntax_T01_tbl(i);
916 			p_prev1_ntax_Y01	:= l_yea_info.prev_ntax_Y01_tbl(i);
917 			p_prev1_ntax_Y02	:= l_yea_info.prev_ntax_Y02_tbl(i);
918 			p_prev1_ntax_Y03	:= l_yea_info.prev_ntax_Y03_tbl(i);
919 			p_prev1_ntax_Y20	:= l_yea_info.prev_ntax_Y20_tbl(i);
920 			p_prev1_ntax_Y21	:= l_yea_info.prev_ntax_Y21_tbl(i); -- Bug 9737699
921 			p_prev1_ntax_ZZ		:= l_yea_info.prev_ntax_ZZ_tbl(i); -- Bug 9737699
922 			p_prev1_ntax_Z01	:= l_yea_info.prev_ntax_Z01_tbl(i);
923 			p_prev1_ntax_tax_brk	:= l_yea_info.prev_ntax_tax_brk_tbl(i);
924 			p_prev1_ntax_H14	:= l_yea_info.prev_ntax_H14_tbl(i); -- Bug 14754822
925 			p_prev1_ntax_H15	:= l_yea_info.prev_ntax_H15_tbl(i);
926 			p_prev1_ntax_T10	:= l_yea_info.prev_ntax_T10_tbl(i);
927 			p_prev1_ntax_T20	:= l_yea_info.prev_ntax_T20_tbl(i);
928 			--
929 			p_prev1_total_ntax_earn	:= p_prev1_ntax_G01 + p_prev1_ntax_R10 --Bug 12807687
930 						+ p_prev1_ntax_H01
931 						+ p_prev1_ntax_H05
932 						+ p_prev1_ntax_H06
933 						+ p_prev1_ntax_H07
934 						+ p_prev1_ntax_H08
935 						+ p_prev1_ntax_H09
936 						+ p_prev1_ntax_H10
937 						+ p_prev1_ntax_H11
938 						+ p_prev1_ntax_H12
939 						+ p_prev1_ntax_H13
940 						+ p_prev1_ntax_I01
941 						+ p_prev1_ntax_K01
942 						+ p_prev1_ntax_M01
943 						+ p_prev1_ntax_M02
944 						+ p_prev1_ntax_M03
945 						+ p_prev1_ntax_S01
946 						-- + p_prev1_ntax_T01
947 						+ p_prev1_ntax_Y01
948 						+ p_prev1_ntax_Y02
949 						+ p_prev1_ntax_Y03
950 						+ p_prev1_ntax_Y20
951 						+ p_prev1_ntax_Y21 -- Bug 9737699
952 						+ p_prev1_ntax_ZZ -- Bug 9737699
953 						-- + p_prev1_ntax_Z01
954 						+ p_prev1_ntax_H14 -- Bug 14754822
955 						+ p_prev1_ntax_H15
956 						+ p_prev_non_taxable_ovt1
957 						+ p_prev_bir_raising_allw1
958 						+ p_prev_fw_income_exem1;
959 
960 		else
961 			if i = 2 then
962 				-- Bug 8644512
963 				if nvl(p_prev1_total_tax,0) > 0 then
964 				p_prev2_bus_reg_num	:= l_yea_info.prev_bp_number_tbl(i);
965 				p_prev2_itax		:= l_yea_info.prev_itax_tbl(i);
966 				p_prev2_rtax		:= l_yea_info.prev_rtax_tbl(i);
967 				p_prev2_stax		:= l_yea_info.prev_stax_tbl(i);
968 				p_prev2_total_tax	:= nvl(p_prev2_itax,0) + nvl(p_prev2_rtax,0) + nvl(p_prev2_stax,0);
969 				else
970 				p_prev1_bus_reg_num	:= l_yea_info.prev_bp_number_tbl(i);
971 				p_prev1_itax		:= l_yea_info.prev_itax_tbl(i);
972 				p_prev1_rtax		:= l_yea_info.prev_rtax_tbl(i);
973 				p_prev1_stax		:= l_yea_info.prev_stax_tbl(i);
974 				p_prev1_total_tax	:= nvl(p_prev1_itax,0) + nvl(p_prev1_rtax,0) + nvl(p_prev1_stax,0);
975 				end if;
976 				--
977 				p_prev_corp_name2	:= l_yea_info.prev_corp_name_tbl(i);
978 				p_prev_bp_number2	:= l_yea_info.prev_bp_number_tbl(i);
979 				p_prev_hire_date2	:= l_yea_info.prev_hire_date_tbl(i);
980 				p_prev_termination_date2:= l_yea_info.prev_termination_date_tbl(i);
981 				p_prev_tax_brk_pd_from2	:= l_yea_info.prev_tax_brk_pd_from_tbl(i);
982 				p_prev_tax_brk_pd_to2	:= l_yea_info.prev_tax_brk_pd_to_tbl(i);
983 			end if;
984 			if i = 3 then
985 				-- Bug 8644512
986 				if nvl(p_prev1_total_tax,0) > 0 then
987 				   if nvl(p_prev2_total_tax,0) > 0 then
988 					p_prev3_bus_reg_num	:= l_yea_info.prev_bp_number_tbl(i);
989 					p_prev3_itax		:= l_yea_info.prev_itax_tbl(i);
990 					p_prev3_rtax		:= l_yea_info.prev_rtax_tbl(i);
991 					p_prev3_stax		:= l_yea_info.prev_stax_tbl(i);
992 					p_prev3_total_tax	:= nvl(p_prev3_itax,0) + nvl(p_prev3_rtax,0) + nvl(p_prev3_stax,0);
993 					--
994 				   else
995 					p_prev2_bus_reg_num	:= l_yea_info.prev_bp_number_tbl(i);
996 					p_prev2_itax		:= l_yea_info.prev_itax_tbl(i);
997 					p_prev2_rtax		:= l_yea_info.prev_rtax_tbl(i);
998 					p_prev2_stax		:= l_yea_info.prev_stax_tbl(i);
999 					p_prev2_total_tax	:= nvl(p_prev2_itax,0) + nvl(p_prev2_rtax,0) + nvl(p_prev2_stax,0);
1000 				   end if;
1001 				else
1002 					p_prev1_bus_reg_num	:= l_yea_info.prev_bp_number_tbl(i);
1003 					p_prev1_itax		:= l_yea_info.prev_itax_tbl(i);
1004 					p_prev1_rtax		:= l_yea_info.prev_rtax_tbl(i);
1005 					p_prev1_stax		:= l_yea_info.prev_stax_tbl(i);
1006 					p_prev1_total_tax	:= nvl(p_prev1_itax,0) + nvl(p_prev1_rtax,0) + nvl(p_prev1_stax,0);
1007 				end if;
1008 			end if;
1009 			if i = 4 then
1010 				-- Bug 8644512
1011 				if nvl(p_prev1_total_tax,0) > 0 then
1012 				   if nvl(p_prev2_total_tax,0) > 0 then
1013 				      if nvl(p_prev3_total_tax,0) > 0 then
1014 					p_prev4_bus_reg_num	:= l_yea_info.prev_bp_number_tbl(i);
1015 					p_prev4_itax		:= l_yea_info.prev_itax_tbl(i);
1016 					p_prev4_rtax		:= l_yea_info.prev_rtax_tbl(i);
1017 					p_prev4_stax		:= l_yea_info.prev_stax_tbl(i);
1018 					p_prev4_total_tax	:= nvl(p_prev4_itax,0) + nvl(p_prev4_rtax,0) + nvl(p_prev4_stax,0);
1019 				      else
1020 					p_prev3_bus_reg_num	:= l_yea_info.prev_bp_number_tbl(i);
1021 					p_prev3_itax		:= l_yea_info.prev_itax_tbl(i);
1022 					p_prev3_rtax		:= l_yea_info.prev_rtax_tbl(i);
1023 					p_prev3_stax		:= l_yea_info.prev_stax_tbl(i);
1024 					p_prev3_total_tax	:= nvl(p_prev3_itax,0) + nvl(p_prev3_rtax,0) + nvl(p_prev3_stax,0);
1025 					--
1026 				      end if;
1027 				   else
1028 					p_prev2_bus_reg_num	:= l_yea_info.prev_bp_number_tbl(i);
1029 					p_prev2_itax		:= l_yea_info.prev_itax_tbl(i);
1030 					p_prev2_rtax		:= l_yea_info.prev_rtax_tbl(i);
1031 					p_prev2_stax		:= l_yea_info.prev_stax_tbl(i);
1032 					p_prev2_total_tax	:= nvl(p_prev2_itax,0) + nvl(p_prev2_rtax,0) + nvl(p_prev2_stax,0);
1033 				   end if;
1034 				else
1035 					p_prev1_bus_reg_num	:= l_yea_info.prev_bp_number_tbl(i);
1036 					p_prev1_itax		:= l_yea_info.prev_itax_tbl(i);
1037 					p_prev1_rtax		:= l_yea_info.prev_rtax_tbl(i);
1038 					p_prev1_stax		:= l_yea_info.prev_stax_tbl(i);
1039 					p_prev1_total_tax	:= nvl(p_prev1_itax,0) + nvl(p_prev1_rtax,0) + nvl(p_prev1_stax,0);
1040 				end if;
1041 				--
1042 			end if;
1043 			p_prev_taxable_mth2	:= nvl(p_prev_taxable_mth2, 0) + l_yea_info.prev_taxable_mth_tbl(i);
1044 			p_prev_taxable_bon2	:= nvl(p_prev_taxable_bon2, 0) + l_yea_info.prev_taxable_bon_tbl(i);
1045 			p_prev_sp_irreg_bonus2	:= nvl(p_prev_sp_irreg_bonus2, 0) + l_yea_info.prev_sp_irreg_bonus_tbl(i);
1046 			p_prev_stck_pur_opt_exec_earn2 :=nvl(p_prev_stck_pur_opt_exec_earn2, 0)
1047     							 + l_yea_info.prev_stck_pur_opt_exe_earn_tbl(i);  -- Bug 6024342
1048 			p_prev_esop_withd_earn2	:= nvl(p_prev_esop_withd_earn2,0)
1049 						 + l_yea_info.prev_esop_withd_earn_tbl(i); -- Bug 8644512
1050 			p_prev_taxable2		:= nvl(p_prev_taxable2, 0) + l_yea_info.prev_taxable_mth_tbl(i)
1051 									   + l_yea_info.prev_taxable_bon_tbl(i)
1052 									   + l_yea_info.prev_sp_irreg_bonus_tbl(i)
1053 									   + l_yea_info.prev_stck_pur_opt_exe_earn_tbl(i)
1054 									   + l_yea_info.prev_esop_withd_earn_tbl(i); -- Bug 8644512
1055 			p_prev_non_taxable_ovt2	:= nvl(p_prev_non_taxable_ovt2,0)
1056 						+ l_yea_info.prev_non_taxable_ovt_tbl(i); -- Bug 8644512
1057 			p_prev_bir_raising_allw2:= nvl(p_prev_bir_raising_allw2,0)
1058 						+ l_yea_info.prev_bir_raising_allowance_tbl(i); -- Bug 8644512
1059 			p_prev_fw_income_exem2	:= nvl(p_prev_fw_income_exem2,0)
1060 						+ l_yea_info.prev_foreign_wrkr_inc_exem_tbl(i); -- Bug 8644512
1061 			--
1062 			-- Bug 8644512
1063 			--
1064 			p_prev2_ntax_R10	:= nvl(p_prev2_ntax_R10,0) + l_yea_info.prev_ntax_R10_tbl(i); -- Bug 12807687
1065 			p_prev2_ntax_G01	:= nvl(p_prev2_ntax_G01,0) + l_yea_info.prev_ntax_G01_tbl(i);
1066 			p_prev2_ntax_H01	:= nvl(p_prev2_ntax_H01,0) + l_yea_info.prev_ntax_H01_tbl(i);
1067 			p_prev2_ntax_H05	:= nvl(p_prev2_ntax_H05,0) + l_yea_info.prev_ntax_H05_tbl(i);
1068 			p_prev2_ntax_H06	:= nvl(p_prev2_ntax_H06,0) + l_yea_info.prev_ntax_H06_tbl(i);
1069 			p_prev2_ntax_H07	:= nvl(p_prev2_ntax_H07,0) + l_yea_info.prev_ntax_H07_tbl(i);
1070 			p_prev2_ntax_H08	:= nvl(p_prev2_ntax_H08,0) + l_yea_info.prev_ntax_H08_tbl(i);
1071 			p_prev2_ntax_H09	:= nvl(p_prev2_ntax_H09,0) + l_yea_info.prev_ntax_H09_tbl(i);
1072 			p_prev2_ntax_H10	:= nvl(p_prev2_ntax_H10,0) + l_yea_info.prev_ntax_H10_tbl(i);
1073 			p_prev2_ntax_H11	:= nvl(p_prev2_ntax_H11,0) + l_yea_info.prev_ntax_H11_tbl(i);
1074 			p_prev2_ntax_H12	:= nvl(p_prev2_ntax_H12,0) + l_yea_info.prev_ntax_H12_tbl(i);
1075 			p_prev2_ntax_H13	:= nvl(p_prev2_ntax_H13,0) + l_yea_info.prev_ntax_H13_tbl(i);
1076 			p_prev2_ntax_I01	:= nvl(p_prev2_ntax_I01,0) + l_yea_info.prev_ntax_I01_tbl(i);
1077 			p_prev2_ntax_K01	:= nvl(p_prev2_ntax_K01,0) + l_yea_info.prev_ntax_K01_tbl(i);
1078 			p_prev2_ntax_M01	:= nvl(p_prev2_ntax_M01,0) + l_yea_info.prev_ntax_M01_tbl(i);
1079 			p_prev2_ntax_M02	:= nvl(p_prev2_ntax_M02,0) + l_yea_info.prev_ntax_M02_tbl(i);
1080 			p_prev2_ntax_M03	:= nvl(p_prev2_ntax_M03,0) + l_yea_info.prev_ntax_M03_tbl(i);
1081 			p_prev2_ntax_S01	:= nvl(p_prev2_ntax_S01,0) + l_yea_info.prev_ntax_S01_tbl(i);
1082 			p_prev2_ntax_T01	:= nvl(p_prev2_ntax_T01,0) + l_yea_info.prev_ntax_T01_tbl(i);
1083 			p_prev2_ntax_Y01	:= nvl(p_prev2_ntax_Y01,0) + l_yea_info.prev_ntax_Y01_tbl(i);
1084 			p_prev2_ntax_Y02	:= nvl(p_prev2_ntax_Y02,0) + l_yea_info.prev_ntax_Y02_tbl(i);
1085 			p_prev2_ntax_Y03	:= nvl(p_prev2_ntax_Y03,0) + l_yea_info.prev_ntax_Y03_tbl(i);
1086 			p_prev2_ntax_Y20	:= nvl(p_prev2_ntax_Y20,0) + l_yea_info.prev_ntax_Y20_tbl(i);
1087 			p_prev2_ntax_Y21	:= nvl(p_prev2_ntax_Y21,0) + l_yea_info.prev_ntax_Y21_tbl(i); -- Bug 9737699
1088 			p_prev2_ntax_ZZ		:= nvl(p_prev2_ntax_ZZ,0) + l_yea_info.prev_ntax_ZZ_tbl(i); -- Bug 9737699
1089 			p_prev2_ntax_Z01	:= nvl(p_prev2_ntax_Z01,0) + l_yea_info.prev_ntax_Z01_tbl(i);
1090 			p_prev2_ntax_tax_brk	:= nvl(p_prev2_ntax_tax_brk,0) + l_yea_info.prev_ntax_tax_brk_tbl(i); -- Bug 9737699
1091 			p_prev2_ntax_H14	:= nvl(p_prev2_ntax_H14,0) + l_yea_info.prev_ntax_H14_tbl(i); -- Bug 14754822
1092 			p_prev2_ntax_H15	:= nvl(p_prev2_ntax_H15,0) + l_yea_info.prev_ntax_H15_tbl(i);
1093 			p_prev2_ntax_T10	:= nvl(p_prev2_ntax_T10,0) + l_yea_info.prev_ntax_T10_tbl(i);
1094 			p_prev2_ntax_T20	:= nvl(p_prev2_ntax_T20,0) + l_yea_info.prev_ntax_T20_tbl(i);
1095 			--
1096 			p_prev2_total_ntax_earn	:= p_prev2_ntax_G01 + p_prev2_ntax_R10 -- Bug 12807687
1097 						+ p_prev2_ntax_H01
1098 						+ p_prev2_ntax_H05
1099 						+ p_prev2_ntax_H06
1100 						+ p_prev2_ntax_H07
1101 						+ p_prev2_ntax_H08
1102 						+ p_prev2_ntax_H09
1103 						+ p_prev2_ntax_H10
1104 						+ p_prev2_ntax_H11
1105 						+ p_prev2_ntax_H12
1106 						+ p_prev2_ntax_H13
1107 						+ p_prev2_ntax_I01
1108 						+ p_prev2_ntax_K01
1109 						+ p_prev2_ntax_M01
1110 						+ p_prev2_ntax_M02
1111 						+ p_prev2_ntax_M03
1112 						+ p_prev2_ntax_S01
1113 						-- + p_prev2_ntax_T01
1114 						+ p_prev2_ntax_Y01
1115 						+ p_prev2_ntax_Y02
1116 						+ p_prev2_ntax_Y03
1117 						+ p_prev2_ntax_Y20
1118 						+ p_prev2_ntax_Y21 -- Bug 9737699
1119 						+ p_prev2_ntax_ZZ -- Bug 9737699
1120 						-- + p_prev2_ntax_Z01
1121 						+ p_prev2_ntax_H14 -- Bug 14754822
1122 						+ p_prev2_ntax_H15
1123 						+ p_prev_non_taxable_ovt2
1124 						+ p_prev_bir_raising_allw2
1125 						+ p_prev_fw_income_exem2;
1126 			--
1127 		end if;
1128 	end loop;
1129 	--
1130 	--------------------------------------------------------------------------------------
1131 	-- Bug 7361372: Type B Tax Group Information
1132 	--------------------------------------------------------------------------------------
1133 	if l_yea_info.tax_grp_bus_reg_num is not null then
1134 		p_tax_grp_bus_reg_num 			:= l_yea_info.tax_grp_bus_reg_num;
1135         	p_tax_grp_name   			:= l_yea_info.tax_grp_name;
1136 		-- Bug 8644512
1137 		p_tax_grp_wkpd_from			:= l_yea_info.tax_grp_wkpd_from;
1138 		p_tax_grp_wkpd_to			:= l_yea_info.tax_grp_wkpd_to;
1139 		p_tax_grp_tax_brk_pd_from		:= l_yea_info.tax_grp_tax_brk_pd_from;
1140 		p_tax_grp_tax_brk_pd_to			:= l_yea_info.tax_grp_tax_brk_pd_to;
1141 		--
1142 		-- Bug 7508706
1143         	p_tax_grp_taxable_mth  	     := nvl(l_yea_info.tax_grp_taxable_mth,0) + nvl(l_yea_info.tax_grp_taxable_mth_ne,0);
1144         	p_tax_grp_taxable_bon  	     := nvl(l_yea_info.tax_grp_taxable_bon,0) + nvl(l_yea_info.tax_grp_taxable_bon_ne,0);
1145         	p_tax_grp_sp_irreg_bonus     := nvl(l_yea_info.tax_grp_sp_irreg_bonus,0) + nvl(l_yea_info.tax_grp_sp_irreg_bonus_ne,0);
1146         	p_tax_stck_pur_opt_exec_earn := nvl(l_yea_info.tax_grp_stck_pur_opt_exec_earn,0) + nvl(l_yea_info.tax_grp_stck_pur_ne,0);
1147 		--  Bug 8644512
1148 		p_tax_grp_esop_withd_earn    := nvl(l_yea_info.tax_grp_esop_withd_earn,0) + nvl(l_yea_info.tax_grp_esop_withd_earn_ne,0);
1149 		--
1150         	p_tax_grp_taxable    	     := nvl(l_yea_info.tax_grp_taxable,0) + nvl(l_yea_info.tax_grp_taxable_ne,0);
1151 		-- End of Bug 7508706
1152 		-- Bug 8644512
1153 		p_tax_grp_non_taxable_ovt	:= l_yea_info.tax_grp_non_taxable_ovt;	-- Bug 8644512
1154 		p_tax_grp_bir_raising_allw	:= l_yea_info.tax_grp_bir_raising_allw;	-- Bug 8644512
1155 		p_tax_grp_fw_income_exem	:= l_yea_info.tax_grp_fw_income_exem;	-- Bug 8644512
1156 		--
1157 		p_tax_grp_ntax_R10		:= l_yea_info.tax_grp_ntax_R10; --Bug 12807687
1158 		p_tax_grp_ntax_G01		:= l_yea_info.tax_grp_ntax_G01;
1159 		p_tax_grp_ntax_H01		:= l_yea_info.tax_grp_ntax_H01;
1160 		p_tax_grp_ntax_H05		:= l_yea_info.tax_grp_ntax_H05;
1161 		p_tax_grp_ntax_H06		:= l_yea_info.tax_grp_ntax_H06;
1162 		p_tax_grp_ntax_H07		:= l_yea_info.tax_grp_ntax_H07;
1163 		p_tax_grp_ntax_H08		:= l_yea_info.tax_grp_ntax_H08;
1164 		p_tax_grp_ntax_H09		:= l_yea_info.tax_grp_ntax_H09;
1165 		p_tax_grp_ntax_H10		:= l_yea_info.tax_grp_ntax_H10;
1166 		p_tax_grp_ntax_H11		:= l_yea_info.tax_grp_ntax_H11;
1167 		p_tax_grp_ntax_H12		:= l_yea_info.tax_grp_ntax_H12;
1168 		p_tax_grp_ntax_H13		:= l_yea_info.tax_grp_ntax_H13;
1169 		p_tax_grp_ntax_I01		:= l_yea_info.tax_grp_ntax_I01;
1170 		p_tax_grp_ntax_K01		:= l_yea_info.tax_grp_ntax_K01;
1171 		p_tax_grp_ntax_M01		:= l_yea_info.tax_grp_ntax_M01;
1172 		p_tax_grp_ntax_M02		:= l_yea_info.tax_grp_ntax_M02;
1173 		p_tax_grp_ntax_M03		:= l_yea_info.tax_grp_ntax_M03;
1174 		p_tax_grp_ntax_S01		:= l_yea_info.tax_grp_ntax_S01;
1175 		p_tax_grp_ntax_T01		:= l_yea_info.tax_grp_ntax_T01;
1176 		p_tax_grp_ntax_Y01		:= l_yea_info.tax_grp_ntax_Y01;
1177 		p_tax_grp_ntax_Y02		:= l_yea_info.tax_grp_ntax_Y02;
1178 		p_tax_grp_ntax_Y03		:= l_yea_info.tax_grp_ntax_Y03;
1179 		p_tax_grp_ntax_Y20		:= l_yea_info.tax_grp_ntax_Y20;
1180 		p_tax_grp_ntax_Y21		:= l_yea_info.tax_grp_ntax_Y21; -- Bug 9737699
1181 		p_tax_grp_ntax_ZZ		:= l_yea_info.tax_grp_ntax_ZZ; -- Bug 9737699
1182 		p_tax_grp_ntax_Z01		:= l_yea_info.tax_grp_ntax_Z01;
1183 		p_tax_grp_ntax_tax_brk		:= l_yea_info.tax_grp_ntax_tax_brk; -- Bug 9737699
1184 		p_tax_grp_ntax_H14		:= l_yea_info.tax_grp_ntax_H14; --Bug 14754822
1185 		p_tax_grp_ntax_H15		:= l_yea_info.tax_grp_ntax_H15;
1186 		p_tax_grp_ntax_T10		:= l_yea_info.tax_grp_ntax_T10;
1187 		p_tax_grp_ntax_T20		:= l_yea_info.tax_grp_ntax_T20;
1188 		--
1189 		p_tax_grp_total_ntax_earn	:= l_yea_info.tax_grp_total_ntax_earn;
1190 		--
1191 	end if;
1192         	p_tax_grp_post_tax_deduc 	:= l_yea_info.tax_grp_post_tax_deduc;
1193 	-- End of Bug 7361372
1194 	--------------------------------------------------------------------------------------
1195 	-- Bug 6012258
1196 	p_research_payment	  := l_yea_info.research_payment;
1197 	p_person_id 		  := l_rec.person_id;
1198 	--
1199 	p_birth_raising_allowance := l_yea_info.birth_raising_allowance; -- Bug 7142620
1200 	p_taxable_mth		  := l_yea_info.taxable_mth;
1201 	p_taxable_bon		  := l_yea_info.taxable_bon;
1202 	p_sp_irreg_bonus	  := l_yea_info.sp_irreg_bonus;
1203 	p_stck_pur_opt_exec_earn  := l_yea_info.stck_pur_opt_exec_earn;
1204 	p_esop_withd_earn	  := l_yea_info.esop_withd_earn;	-- Bug 8644512
1205 	p_taxable		  := l_yea_info.taxable;
1206 	p_taxable1                := l_yea_info.taxable1; -- Bug 7615517
1207 	--
1208 	--
1209 	-- Non-taxable Earnings
1210 	--
1211 	-- Bug 8644512
1212 	--
1213 	p_total_ntax_R10	:= l_yea_info.total_ntax_R10; --Bug 12807687
1214 	p_total_ntax_G01	:= l_yea_info.total_ntax_G01;
1215 	p_total_ntax_H01	:= l_yea_info.total_ntax_H01;
1216 	p_total_ntax_H05	:= l_yea_info.total_ntax_H05;
1217 	p_total_ntax_H06	:= l_yea_info.total_ntax_H06;
1218 	p_total_ntax_H07	:= l_yea_info.total_ntax_H07;
1219 	p_total_ntax_H08	:= l_yea_info.total_ntax_H08;
1220 	p_total_ntax_H09	:= l_yea_info.total_ntax_H09;
1221 	p_total_ntax_H10	:= l_yea_info.total_ntax_H10;
1222 	p_total_ntax_H11	:= l_yea_info.total_ntax_H11;
1223 	p_total_ntax_H12	:= l_yea_info.total_ntax_H12;
1224 	p_total_ntax_H13	:= l_yea_info.total_ntax_H13;
1225 	p_total_ntax_I01	:= l_yea_info.total_ntax_I01;
1226 	p_total_ntax_K01	:= l_yea_info.total_ntax_K01;
1227 	p_total_ntax_M01	:= l_yea_info.total_ntax_M01;
1228 	p_total_ntax_M02	:= l_yea_info.total_ntax_M02;
1229 	p_total_ntax_M03	:= l_yea_info.total_ntax_M03;
1230 	p_total_ntax_S01	:= l_yea_info.total_ntax_S01;
1231 	p_total_ntax_T01	:= l_yea_info.total_ntax_T01;
1232 	p_total_ntax_Y01	:= l_yea_info.total_ntax_Y01;
1233 	p_total_ntax_Y02	:= l_yea_info.total_ntax_Y02;
1234 	p_total_ntax_Y03	:= l_yea_info.total_ntax_Y03;
1235 	p_total_ntax_Y20	:= l_yea_info.total_ntax_Y20;
1236 	p_total_ntax_Y21	:= l_yea_info.total_ntax_Y21; -- Bug 9737699
1237 	p_total_ntax_ZZ		:= l_yea_info.total_ntax_ZZ; -- Bug 9737699
1238 	p_total_ntax_Z01	:= l_yea_info.total_ntax_Z01;
1239 	p_total_ntax_tax_brk	:= l_yea_info.total_ntax_tax_brk;
1240 	p_total_ntax_H14	:= l_yea_info.total_ntax_H14; --Bug 14754822
1241 	p_total_ntax_H15	:= l_yea_info.total_ntax_H15;
1242 	p_total_ntax_T10	:= l_yea_info.total_ntax_T10;
1243 	p_total_ntax_T20	:= l_yea_info.total_ntax_T20;
1244 	--
1245 	p_cur_ntax_R10		:= l_yea_info.cur_ntax_R10; -- Bug 12807687
1246 	p_cur_ntax_G01		:= l_yea_info.cur_ntax_G01;
1247 	p_cur_ntax_H01		:= l_yea_info.cur_ntax_H01;
1248 	p_cur_ntax_H05		:= l_yea_info.cur_ntax_H05;
1249 	p_cur_ntax_H06		:= l_yea_info.cur_ntax_H06;
1250 	p_cur_ntax_H07		:= l_yea_info.cur_ntax_H07;
1251 	p_cur_ntax_H08		:= l_yea_info.cur_ntax_H08;
1252 	p_cur_ntax_H09		:= l_yea_info.cur_ntax_H09;
1253 	p_cur_ntax_H10		:= l_yea_info.cur_ntax_H10;
1254 	p_cur_ntax_H11		:= l_yea_info.cur_ntax_H11;
1255 	p_cur_ntax_H12		:= l_yea_info.cur_ntax_H12;
1256 	p_cur_ntax_H13		:= l_yea_info.cur_ntax_H13;
1257 	p_cur_ntax_I01		:= l_yea_info.cur_ntax_I01;
1258 	p_cur_ntax_K01		:= l_yea_info.cur_ntax_K01;
1259 	p_cur_ntax_M01		:= l_yea_info.cur_ntax_M01 + l_yea_info.cur_ntax_frgn_M01 ;
1260 	p_cur_ntax_M02		:= l_yea_info.cur_ntax_M02 + l_yea_info.cur_ntax_frgn_M02;
1261 	p_cur_ntax_M03		:= l_yea_info.cur_ntax_M03 + l_yea_info.cur_ntax_frgn_M03;
1262 	p_cur_ntax_S01		:= l_yea_info.cur_ntax_S01;
1263 	p_cur_ntax_T01		:= l_yea_info.cur_ntax_T01;
1264 	p_cur_ntax_Y01		:= l_yea_info.cur_ntax_Y01;
1265 	p_cur_ntax_Y02		:= l_yea_info.cur_ntax_Y02;
1266 	p_cur_ntax_Y03		:= l_yea_info.cur_ntax_Y03;
1267 	p_cur_ntax_Y20		:= l_yea_info.cur_ntax_Y20;
1268 	p_cur_ntax_Y21		:= l_yea_info.cur_ntax_Y21; -- Bug 9737699
1269 	p_cur_ntax_ZZ		:= l_yea_info.cur_ntax_ZZ; -- Bug 9737699
1270 	p_cur_ntax_Z01		:= l_yea_info.cur_ntax_Z01;
1271 	p_cur_ntax_tax_brk	:= l_yea_info.cur_ntax_tax_brk;  -- Bug 9737699
1272 	p_cur_ntax_H14	:= l_yea_info.cur_ntax_H14; --Bug 14754822
1273 	p_cur_ntax_H15	:= l_yea_info.cur_ntax_H15;
1274 	p_cur_ntax_T10	:= l_yea_info.cur_ntax_T10;
1275 	p_cur_ntax_T20	:= l_yea_info.cur_ntax_T20;
1276 	--
1277 	p_cur_total_ntax_earn 	:= l_yea_info.cur_total_ntax_earn;
1278 	--
1279 	if nvl(p_prev1_total_tax,0) > 0 then
1280 	   if nvl(p_prev2_total_tax,0) > 0 then
1281 	      if nvl(p_prev3_total_tax,0) > 0 then
1282 	         if nvl(p_prev4_total_tax,0) > 0 then
1283 		    p_prev5_bus_reg_num	:= l_yea_info.tax_grp_bus_reg_num;
1284 	            p_prev5_itax	:= l_yea_info.tax_grp_itax;
1285 	            p_prev5_rtax	:= l_yea_info.tax_grp_rtax;
1286 	            p_prev5_stax	:= l_yea_info.tax_grp_stax;
1287 	            p_prev5_total_tax	:= nvl(p_prev5_itax,0) + nvl(p_prev5_rtax,0) + nvl(p_prev5_stax,0);
1288 		 else
1289 		    p_prev4_bus_reg_num	:= l_yea_info.tax_grp_bus_reg_num;
1290 	            p_prev4_itax	:= l_yea_info.tax_grp_itax;
1291 	            p_prev4_rtax	:= l_yea_info.tax_grp_rtax;
1292 	            p_prev4_stax	:= l_yea_info.tax_grp_stax;
1293 	            p_prev4_total_tax	:= nvl(p_prev4_itax,0) + nvl(p_prev4_rtax,0) + nvl(p_prev4_stax,0);
1294 		 end if;
1295 	      else
1296 		    p_prev3_bus_reg_num	:= l_yea_info.tax_grp_bus_reg_num;
1297 	            p_prev3_itax	:= l_yea_info.tax_grp_itax;
1298 	            p_prev3_rtax	:= l_yea_info.tax_grp_rtax;
1299 	            p_prev3_stax	:= l_yea_info.tax_grp_stax;
1300 	            p_prev3_total_tax	:= nvl(p_prev3_itax,0) + nvl(p_prev3_rtax,0) + nvl(p_prev3_stax,0);
1301 	      end if;
1302 	   else
1303 		    p_prev2_bus_reg_num	:= l_yea_info.tax_grp_bus_reg_num;
1304 	            p_prev2_itax	:= l_yea_info.tax_grp_itax;
1305 	            p_prev2_rtax	:= l_yea_info.tax_grp_rtax;
1306 	            p_prev2_stax	:= l_yea_info.tax_grp_stax;
1307 	            p_prev2_total_tax	:= nvl(p_prev2_itax,0) + nvl(p_prev2_rtax,0) + nvl(p_prev2_stax,0);
1308            end if;
1309 	else
1310 		    p_prev1_bus_reg_num	:= l_yea_info.tax_grp_bus_reg_num;
1311 	            p_prev1_itax	:= l_yea_info.tax_grp_itax;
1312 	            p_prev1_rtax	:= l_yea_info.tax_grp_rtax;
1313 	            p_prev1_stax	:= l_yea_info.tax_grp_stax;
1314 	            p_prev1_total_tax	:= nvl(p_prev1_itax,0) + nvl(p_prev1_rtax,0) + nvl(p_prev1_stax,0);
1315         end if;
1316 	--
1317 	p_non_taxable_ovs	:= l_yea_info.non_taxable_ovs + l_yea_info.non_taxable_ovs_frgn; -- Bug 7439803
1318 	p_non_taxable_ovt	:= l_yea_info.non_taxable_ovt;
1319 	p_non_taxable_oth	:= l_yea_info.non_taxable_oth;
1320 	p_non_taxable		:= l_yea_info.non_taxable;
1321 
1322         -- Bug 9336934
1323 	--
1324 	l_period_start_date	:= trunc(l_rec.effective_date, 'YYYY');
1325 	l_period_end_date	:= add_months(l_period_start_date, 12) - 1;
1326         p_period_start_date     := l_period_start_date;
1327 	p_period_end_date       := l_period_end_date;
1328 	p_period_start_date	:= greatest(p_period_start_date, l_rec.date_start);
1329 	-- Bug 8644512
1330 	p_emp_start_date	:= l_rec.date_start;
1331 	--
1332 	if l_rec.actual_termination_date < p_period_end_date then
1333 		p_period_end_date := l_rec.actual_termination_date;
1334 	end if;
1335 	if  nvl(p_prev_hire_date1,l_period_start_date) < l_period_start_date then
1336 	    p_prev_hire_date1 := l_period_start_date;
1337 	end if;
1338 
1339 	if  nvl(p_prev_hire_date2,l_period_start_date) < l_period_start_date then
1340 	    p_prev_hire_date2 := l_period_start_date;
1341 	end if;
1342 
1343 	if nvl(p_tax_grp_wkpd_from,l_period_start_date) < l_period_start_date then
1344 	     p_tax_grp_wkpd_from := l_period_start_date;
1345 	end if;
1346 
1347         if nvl(p_prev_termination_date1,l_period_end_date) > l_period_end_date then
1348 	   p_prev_termination_date1 := l_period_end_date;
1349 	end if;
1350 
1351 	if nvl(p_prev_termination_date2,l_period_end_date) > l_period_end_date then
1352 	   p_prev_termination_date2 := l_period_end_date;
1353 	end if;
1354 
1355 	if nvl(p_tax_grp_wkpd_to,l_period_end_date) > l_period_end_date then
1356 	   p_tax_grp_wkpd_to := l_period_end_date;
1357 	end if;
1358 
1359 	if nvl(p_prev_tax_brk_pd_from1,l_period_start_date) < l_period_start_date then
1360 	    p_prev_tax_brk_pd_from1 := l_period_start_date;
1361 	end if;
1362 
1363 	if nvl(p_prev_tax_brk_pd_from2,l_period_start_date) < l_period_start_date then
1364 	    p_prev_tax_brk_pd_from2 := l_period_start_date;
1365 	end if;
1366 
1367 	if nvl(p_tax_grp_tax_brk_pd_from,l_period_start_date) < l_period_start_date then
1368 	    p_tax_grp_tax_brk_pd_from := l_period_start_date;
1369 	end if;
1370 
1371 	if nvl(p_prev_tax_brk_pd_to1,l_period_end_date) > l_period_end_date then
1372 	   p_prev_tax_brk_pd_to1 := l_period_end_date;
1373 	end if;
1374 
1375         if nvl(p_prev_tax_brk_pd_to2,l_period_end_date) > l_period_end_date then
1376 	   p_prev_tax_brk_pd_to2 := l_period_end_date;
1377 	end if;
1378 
1379 	if nvl(p_tax_grp_tax_brk_pd_to,l_period_end_date) > l_period_end_date then
1380 	   p_tax_grp_tax_brk_pd_to := l_period_end_date;
1381 	 end if;
1382 	-- End of Bug 9336934
1383 	-- Bug 9737699
1384 	p_house_holder_flag :=l_yea_info.house_holder_flag;
1385 	--
1386         -- Foreign worker income exem
1387         --
1388         p_foreign_worker_tax_exem := l_yea_info.foreign_worker_income_exem;
1389         --
1390 	/*
1391 	Bug No: 3546993
1392 	Modified Non-Taxable Earnings depending on Nationality
1393 	and Fixed Tax Rate Flag. Archived values are not changed.
1394 	*/
1395 
1396 	/* Bug No: 3546993 */
1397 
1398 	-- Basic Income Exemption
1399 	--
1400 	p_basic_income_exem	:= l_yea_info.basic_income_exem;
1401 	p_taxable_income	:= l_yea_info.taxable_income;
1402 	--
1403 	-- Basic Tax Exemption
1404 	--
1405 	p_ee_tax_exem		:= l_yea_info.ee_tax_exem;
1406 	p_dpnt_spouse_tax_exem	:= l_yea_info.dpnt_spouse_tax_exem;
1407 	p_num_of_dpnts		:= l_yea_info.num_of_dpnts;
1408 	p_dpnt_tax_exem		:= l_yea_info.dpnt_tax_exem;
1409 	--
1410 	-- Additional Tax Exemption
1411 	--
1412 	p_num_of_ageds		:= l_yea_info.num_of_ageds;
1413 	p_aged_tax_exem		:= l_yea_info.aged_tax_exem;
1414 	p_num_of_disableds	:= l_yea_info.num_of_disableds;
1415 	p_disabled_tax_exem	:= l_yea_info.disabled_tax_exem;
1416 	p_female_ee_tax_exem	:= l_yea_info.female_ee_tax_exem;
1417 	p_num_of_children	:= l_yea_info.num_of_children;
1418 	p_child_tax_exem	:= l_yea_info.child_tax_exem;
1419 	p_new_born_adopted_tax_exem	:=l_yea_info.new_born_adopted_tax_exem;----Bug 7142620
1420 	p_num_of_new_born_adopted	:=l_yea_info.num_of_new_born_adopted; ----- Bug 7142620
1421 	p_num_of_addtl_child    := l_yea_info.num_of_addtl_child;      -- Bug 6784288
1422 	p_addl_child_tax_exem	:= l_yea_info.addl_child_tax_exem;     -- Bug 6012258
1423 	p_supp_tax_exem		:= l_yea_info.supp_tax_exem;
1424 	p_num_of_underaged_dpnts := l_yea_info.num_of_underaged_dpnts; -- Bug 6024342
1425 	--
1426 	-- Special Tax Exemption
1427 	--
1428 	p_ins_prem_tax_exem	:= l_yea_info.ins_prem_tax_exem;
1429 	-- Bug 9737699
1430 	p_hi_prem_tax_exem      := nvl(l_yea_info.hi_prem_tax_exem,0) + nvl(l_yea_info.long_term_ins_prem_tax_exem,0);
1431 	p_ei_prem_tax_exem	:= l_yea_info.ei_prem_tax_exem;
1432 	p_pers_ins_prem_tax_exem  := l_yea_info.pers_ins_prem_tax_exem;
1433 	p_disabled_ins_prem_tax_exem := l_yea_info.disabled_ins_prem_tax_exem;
1434 	--
1435 	p_med_exp_tax_exem	:= l_yea_info.med_exp_tax_exem;
1436 	p_educ_exp_tax_exem	:= l_yea_info.educ_exp_tax_exem;
1437 	p_housing_loan_repay_exem := l_yea_info.housing_loan_repay_exem; --- Bug 7142620
1438 	--Bug 12807687 Start
1439 	p_housing_prv_loan_repay_exem := l_yea_info.housing_prv_loan_repay_exem;
1440 	p_housing_inst_loan_repay_exem := l_yea_info.housing_inst_loan_repay_exem;
1441 	p_lt_housing_loan_int_rep_exm1  := l_yea_info.lt_housing_loan_int_rep_exem1;
1442 	p_lt_housing_loan_int_rep_exm2  := l_yea_info.lt_housing_loan_int_rep_exem2;
1443 	p_lt_housing_loan_int_rep_exm3  := l_yea_info.lt_housing_loan_int_rep_exem3;
1444 	--Bug 12807687 End
1445  	--Bug 14754836 START
1446    p_lt_2012_hou_fixed_intr_exm := l_yea_info.lt_2012_house_fixed_intr_exem;
1447    p_lt_2012_hou_othr_intr_exm := l_yea_info.lt_2012_house_othr_intr_exem;
1448 --Bug 14754836 End
1449 	p_lt_housing_loan_intr_exem  := l_yea_info.lt_housing_loan_intr_exem;  --- Bug 7142620
1450 	p_donation_tax_exem	:= l_yea_info.donation_tax_exem;
1451         	p_marr_fun_relo_exem    := l_yea_info.marr_fun_relo_exemption;
1452 	p_sp_tax_exem		:= l_yea_info.sp_tax_exem;
1453 	p_std_sp_tax_exem	:= l_yea_info.std_sp_tax_exem;
1454 	--
1455 	-- Bug 9737699
1456 	p_housing_rent_exp_tax_exem := l_yea_info.housing_rent_exp_tax_exem;
1457 	p_housing_sub_saving_exem   := l_yea_info.housing_sub_saving_exem;
1458 	p_emp_hou_pro_saving_exem   := l_yea_info.emp_hou_pro_saving_exem;
1459 	p_lt_hou_pro_saving_exem    := l_yea_info.lt_hou_pro_saving_exem;
1460 	p_total_housing_saving_exem := l_yea_info.total_housing_saving_exem;
1461 	-- National Pension Premium Tax Exemption
1462 	--
1463 	p_np_prem_tax_exem	:= l_yea_info.np_prem_tax_exem;
1464 	p_taxable_income2	:= l_yea_info.taxable_income2;
1465 	--
1466 	-- Pension Premium
1467 	--
1468 	p_pension_premium	:= l_yea_info.pen_prem;	-- Bug 6024342
1469 	--  Bug 9737699
1470 	p_military_pen_prem     := l_yea_info.military_pen_prem;
1471 	p_private_school_pen_prem  := l_yea_info.private_school_pen_prem;
1472 	p_post_office_pen_prem  := l_yea_info.post_office_pen_prem;
1473 
1474 	--
1475 	-- Other Tax Exemptions
1476 	--
1477 	p_pers_pension_prem_tax_exem	:= l_yea_info.pers_pension_prem_tax_exem;
1478 	p_corp_pension_prem_tax_exem	:= l_yea_info.corp_pension_prem_tax_exem;
1479 	p_scientific_tech_tax_exem	:= l_yea_info.scientific_technician_tax_exem; -- Bug 9737699
1480 	p_pers_pension_saving_tax_exem	:= l_yea_info.pers_pension_saving_tax_exem;
1481 	p_invest_partner_fin_tax_exem	:= l_yea_info.invest_partner_fin_tax_exem;
1482 	p_credit_card_exp_tax_exem	:= l_yea_info.credit_card_exp_tax_exem;
1483 	p_emp_st_own_plan_cont_exem  	:= l_yea_info.emp_stk_own_contri_tax_exem;
1484 	p_small_bus_install_exem	:= l_yea_info.small_bus_install_exem;		-- Bug 6895093
1485 	p_housing_saving_exem           := l_yea_info.housing_saving_exem; -- Bug 7142620
1486 	p_long_term_stck_fund_tax_exem  := l_yea_info.long_term_stck_fund_tax_exem; -- Bug 7615517
1487 	--
1488 	p_non_rep_non_taxable           := l_yea_info.non_rep_non_taxable; -- Bug 9079478
1489 	p_smb_income_exem               := l_yea_info.smb_income_exem; -- Bug 9079478
1490 	-- Bug 6895093
1491 	-- Premium Details
1492 	-- Bug 13606528
1493 	p_hi_prem	:= l_yea_info.hi_prem;
1494 	p_ei_prem	:= l_yea_info.ei_prem;
1495 	p_np_prem	:= l_yea_info.np_prem;
1496         	p_ltci_prem	:= l_yea_info.long_term_ins_prem; -- Bug 7260606
1497         --
1498 	-- Bug : 5190884
1499 	-- Employee Expense Details
1500 	--
1501 	p_emp_med_exp_nts		:= nvl(l_emp_med_exp_nts,0);
1502 	p_emp_educ_exp_nts		:= nvl(l_emp_educ_exp_nts,0);
1503 	p_emp_card_exp_nts		:= nvl(l_emp_card_exp_nts,0);
1504 	p_emp_direct_exp_nts		:= nvl(l_emp_direct_exp_nts,0); -- Bug 9737699
1505 	p_emp_don_exp_nts		:= nvl(l_emp_don_exp_nts,0);
1506 	p_emp_ins_exp_nts		:= nvl(l_emp_ins_exp_nts,0); -- Bug 5667762
1507 	p_emp_tm_card_exp_nts		:= nvl(l_emp_tm_card_exp_nts,0); -- Bug 14502155
1508 	p_emp_tm_direct_exp_nts		:= nvl(l_emp_tm_direct_exp_nts,0); -- Bug 14502155
1509 	p_emp_tuition_paid_exp_nts		:= nvl(l_emp_tuition_paid_exp_nts,0); -- Bug 14502155
1510 	--
1511 	p_emp_tot_ins_exp		:= ( l_yea_info.hi_prem + l_yea_info.long_term_ins_prem
1512                                             +l_yea_info.ei_prem + l_yea_info.pers_ins_prem
1513                                             + l_yea_info.disabled_ins_prem);        -- Bug 7260606
1514 	p_emp_med_exp_oth		:=   l_yea_info.med_exp_emp - p_emp_med_exp_nts;
1515         -- Bug : 5745179
1516         --
1517 	l_don_tax_break2004		:= pay_kr_yea_form_pkg.get_donation_tax_break(fnd_date.date_to_canonical(l_rec.effective_date), l_yea_info.political_donation1);
1518 	--
1519         p_emp_don_exp_oth		:= ( nvl(l_don_amount1,0) + nvl(l_don_amount2,0) - nvl(l_don_tax_break2004,0))
1520                                           - nvl(p_emp_don_exp_nts,0) - nvl(l_dpnt_don_total,0);
1521 	p_emp_educ_exp_oth		:= ( l_yea_info.ee_educ_exp + l_emp_occu_trng ) - p_emp_educ_exp_nts;
1522 	p_emp_card_exp_oth		:= l_card_expense_total - p_emp_card_exp_nts;
1523 	p_emp_direct_exp_oth		:= l_direct_expense_total - p_emp_direct_exp_nts; -- Bug 9737699
1524 	p_emp_cash_exp_nts		:= nvl(l_emp_cash_exp,0);
1525 	p_emp_tm_cash_exp_nts		:= nvl(l_tm_cash_expense_total,0); -- Bug 14502155
1526 	p_emp_tm_card_exp_oth		:= l_tm_card_expense_total - p_emp_tm_card_exp_nts; -- Bug 14502155
1527 	p_emp_tm_direct_exp_oth		:= l_tm_direct_expense_total - p_emp_tm_direct_exp_nts; -- Bug 14502155
1528 	p_emp_tuition_paid_exp_oth		:= l_tuition_paid_exp_total - p_emp_tuition_paid_exp_nts; -- Bug 14502155
1529 
1530         -- Double Exemption Amount Bug 6716401
1531 	p_double_exem_amt               :=  l_yea_info.double_exem_amt;
1532 
1533 	--
1534 	-- Calculated Tax
1535 	--
1536 	p_taxation_base			:= l_yea_info.taxation_base;
1537 	p_calc_tax			:= l_yea_info.calc_tax;
1538 	p_basic_tax_break		:= l_yea_info.basic_tax_break;
1539 	p_housing_exp_tax_break		:= l_yea_info.housing_exp_tax_break;
1540 	p_stock_saving_tax_break	:= l_yea_info.stock_saving_tax_break;
1541 	p_ovs_tax_break			:= l_yea_info.ovs_tax_break;
1542 	p_lt_stock_saving_tax_break	:= l_yea_info.lt_stock_saving_tax_break;
1543 	p_total_tax_break		:= l_yea_info.total_tax_break;
1544 	-- Bug 3966549
1545 	p_don_tax_break			:= l_yea_info.don_tax_break2004 ;
1546 	-- End of 3966549
1547 	--
1548 	-- Foreign Worker Tax Break
1549 	--
1550 	p_foreign_worker_tax_break1	:= l_yea_info.foreign_worker_tax_break1;
1551 	p_foreign_worker_tax_break2	:= l_yea_info.foreign_worker_tax_break2;
1552 	p_foreign_worker_tax_break	:= l_yea_info.foreign_worker_tax_break;
1553 -- Bug 14754822
1554 	p_tax_reduction_smb	 := l_yea_info.tax_reduction_smb;
1555 	p_tax_reduction_teachers	 := l_yea_info.tax_reduction_teachers;
1556 	p_tax_reduction_marine	 := l_yea_info.tax_reduction_marine;
1557 	-- Tax
1558 	--
1559 	p_annual_itax	:= l_yea_info.annual_itax;
1560 	p_annual_stax	:= l_yea_info.annual_stax;
1561 	p_annual_rtax	:= l_yea_info.annual_rtax;
1562 	p_annual_tax	:= p_annual_itax + p_annual_stax + p_annual_rtax;
1563 	p_prev_itax	:= l_yea_info.prev_itax + l_yea_info.tax_grp_itax; -- Bug 7361372
1564 	p_prev_stax	:= l_yea_info.prev_stax + l_yea_info.tax_grp_stax; -- Bug 7361372, Bug 7759357
1565 	p_prev_rtax	:= l_yea_info.prev_rtax + l_yea_info.tax_grp_rtax; -- Bug 7361372, Bug 7759357
1566 	p_prev_tax	:= p_prev_itax + p_prev_stax + p_prev_rtax;
1567 	p_cur_itax	:= l_yea_info.cur_itax;
1568 	p_cur_stax	:= l_yea_info.cur_stax;
1569 	p_cur_rtax	:= l_yea_info.cur_rtax;
1570 	p_cur_tax	:= p_cur_itax + p_cur_stax + p_cur_rtax;
1571 	p_itax_adj	:= l_yea_info.itax_adj;
1572 	p_stax_adj	:= l_yea_info.stax_adj;
1573 	p_rtax_adj	:= l_yea_info.rtax_adj;
1574 	p_tax_adj	:= p_itax_adj + p_stax_adj + p_rtax_adj;
1575 
1576 end data;
1577 end pay_kr_paykrytr_pkg;