DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_JP_LTAX_EFILE_PKG

Source


1 package body pay_jp_ltax_efile_pkg as
2 /* $Header: pyjpltxe.pkb 120.3 2006/11/03 06:52:52 sgottipa noship $ */
3 --
4 -- Constants
5 --
6 c_package			constant varchar2(31) := 'pay_jp_ltax_efile_pkg.';
7 c_header_record_formatter	constant ff_formulas_f.formula_name%type := 'LTX_EFILE_WITHHOLD_AGENT_HEADER_PAYMENT';
8 c_data_record_init		constant ff_formulas_f.formula_name%type := 'LTX_EFILE_LTX_HEADER_PAYMENT';
9 c_data_record_detail		constant ff_formulas_f.formula_name%type := 'LTX_EFILE_LTX_FOOTER_PAYMENT';
10 c_data_record_formatter		constant ff_formulas_f.formula_name%type := 'LTX_EFILE_LTX_BODY_PAYMENT';
11 c_trailer_record_formatter	constant ff_formulas_f.formula_name%type := 'LTX_EFILE_WITHHOLD_AGENT_FOOTER_PAYMENT';
12 c_end_record_formatter		constant ff_formulas_f.formula_name%type := 'LTX_EFILE_END_PAYMENT';
13 --
14 -- Global Variables
15 --
16 type t_parameter is record(
17 	business_group_id		number,
18 	organization_id			number,
19 	effective_date			date,
20 	effective_date_from		date,
21 	effective_date_to		date);
22 g_parameter	t_parameter;
23 --
24 type t_formula is record(
25 	header_record_formatter		number,
26 	data_record_init		number,
27 	data_record_detail		number,
28 	data_record_formatter		number,
29 	trailer_record_formatter	number,
30 	end_record_formatter		number);
31 g_formula	t_formula;
32 --
33 type t_number_tbl is table of number index by binary_integer;
34 type t_varchar2_tbl is table of varchar2(255) index by binary_integer;
35 type t_date_tbl is table of date index by binary_integer;
36 type t_data is record(
37 	current_index			number,
38 	district_code_tbl		t_varchar2_tbl,
39 	district_name_kana_tbl		t_varchar2_tbl,
40 	swot_number_tbl			t_varchar2_tbl,
41 	assignment_id_tbl		t_number_tbl,
42 	date_earned_tbl			t_date_tbl,
43 	tax_tbl				t_number_tbl,
44 	lumpsum_tax_tbl			t_number_tbl,
45 	term_tax_tbl			t_number_tbl,
46 	term_income_tbl			t_number_tbl,
47 	term_district_tax_tbl		t_number_tbl,
48 	term_prefectural_tax_tbl	t_number_tbl);
49 g_data		t_data;
50 -- ----------------------------------------------------------------------------
51 -- |---------------------------------< init >---------------------------------|
52 -- ----------------------------------------------------------------------------
53 procedure init
54 is
55 --
56   l_count     number := 0;
57   l_rec_count number := 1;
58 --
59 	l_proc	varchar2(61) := c_package || 'init';
60 	--
61 	l_data_record_sort_order	hr_lookups.lookup_code%type := pay_jp_mag_utility_pkg.get_parameter('DATA_RECORD_SORT_ORDER');
62 	--
63   l_district_code      VARCHAR2(255);
64   l_district_name_kana VARCHAR2(255);
65   l_swot_number        VARCHAR2(255);
66   l_assignment_id      pay_action_information.assignment_id%TYPE;
67   l_date_earned        pay_payroll_actions.date_earned%TYPE;
68   l_ltax               NUMBER;
69   l_ltax_lumpsum       NUMBER;
70   l_sp_ltax            NUMBER;
71   l_sp_ltax_income     NUMBER;
72   l_sp_ltax_shi        NUMBER;
73   l_sp_ltax_to         NUMBER;
74   --
75 	cursor csr_org is
76 		--
77 		-- In header and trailer section, session_date is used as context DATE_EARNED.
78 		--
79 		select	hou.business_group_id,
80 			to_number(hoi.org_information1)	header_record_formatter,
81 			to_number(hoi.org_information2)	data_record_init,
82 			to_number(hoi.org_information3)	data_record_detail,
83 			to_number(hoi.org_information4)	data_record_formatter,
84 			to_number(hoi.org_information5)	trailer_record_formatter,
85 			to_number(hoi.org_information6)	end_record_formatter
86 		from	hr_organization_information	hoi,
87 			hr_all_organization_units	hou
88 		where	hou.organization_id = g_parameter.organization_id
89 		and	hoi.organization_id(+) = hou.organization_id
90 		and	hoi.org_information_context(+) = 'JP_LTAX_EFILE';
91     --
92   cursor csr_data(p_sort_order varchar2) is
93 		--
94 		-- In body section, context values used in payroll run are
95 		-- applied to "Payment" formula.
96 		--
97 -- Query has been modified to fix Bug 5371071
98     select v.assignment_action_id,
99            v.ltax_district_code,
100            v.assignment_id,
101            v.date_earned,
102            v.ltax,
103            v.ltax_lumpsum,
104            v.sp_ltax,
105            v.sp_ltax_income,
106            v.sp_ltax_shi,
107            v.sp_ltax_to
108     from    (select pptn.action_information1   assignment_action_id,
109                     paan.assignment_id         assignment_id,
110                     ppan.date_earned           date_earned,
111                     pptn.action_information3   ltax_district_code,
112                     pptn.action_information5   ltax,
113                     pptn.action_information6   ltax_lumpsum,
114                     decode(pptn.action_information3,
115                            nvl(pptn.action_information15,pptn.action_information3), pptn.action_information7, 0) sp_ltax,
116                     decode(pptn.action_information3,
117                            nvl(pptn.action_information15,pptn.action_information3), pptn.action_information8, 0) sp_ltax_income,
118                     decode(pptn.action_information3,
119                            nvl(pptn.action_information15,pptn.action_information3), pptn.action_information9, 0)  sp_ltax_shi,
120                     decode(pptn.action_information3,
121                            nvl(pptn.action_information15,pptn.action_information3), pptn.action_information10, 0) sp_ltax_to
122              from   pay_payroll_actions     ppan,
123                     pay_assignment_actions  paan,
124                     pay_action_information  pptn
125              where  ppan.business_group_id = g_parameter.business_group_id
126              and    ppan.action_type in ('R', 'Q', 'B')
127              and    ppan.effective_date
128                       between g_parameter.effective_date_from and g_parameter.effective_date_to
129              and    paan.payroll_action_id = ppan.payroll_action_id
130              and    paan.action_status = 'C'
131              and    pptn.action_information_category = 'JP_PRE_TAX_2'
132              and    pptn.action_context_type = 'AAP'
133              and    pptn.action_information1 = paan.assignment_action_id
134              and    pptn.assignment_id = paan.assignment_id
135              and    pptn.action_information3 is not null
136 
137              union
138 
139              select pptl.action_information1    assignment_action_id,
140                     paal.assignment_id          assignment_id,
141                     ppal.date_earned            date_earned,
142                     pptl.action_information15   ltax_district_code,
143                     pptl.action_information5    ltax,
144                     decode(pptl.action_information15,
145                            nvl(pptl.action_information3,pptl.action_information15), pptl.action_information6, 0) ltax_lumpsum,
146                     pptl.action_information7    sp_ltax,
147                     pptl.action_information8    sp_ltax_income,
148                     pptl.action_information9    sp_ltax_shi,
149                     pptl.action_information10   sp_ltax_to
150              from   pay_payroll_actions     ppal,
151                     pay_assignment_actions  paal,
152                     pay_action_information  pptl
153              where  ppal.business_group_id = g_parameter.business_group_id
154              and     ppal.action_type in ('R', 'Q', 'B')
155              and     ppal.effective_date
156                        between g_parameter.effective_date_from and g_parameter.effective_date_to
157              and     paal.payroll_action_id = ppal.payroll_action_id
158              and     paal.action_status = 'C'
159              and     pptl.action_information_category = 'JP_PRE_TAX_2'
160              and     pptl.action_context_type = 'AAP'
161              and     pptl.action_information1 = paal.assignment_action_id
162              and     pptl.assignment_id = paal.assignment_id
163              and     pptl.action_information15 is not null) v,
164           per_all_assignments_f           asg,
165           per_all_people_f                per
166     where asg.assignment_id = v.assignment_id
167     and   v.date_earned
168             between asg.effective_start_date and asg.effective_end_date
169     and   per.person_id = asg.person_id
170     and   v.date_earned
171             between per.effective_start_date and per.effective_end_date
172     order by
173             v.ltax_district_code,
174             decode(p_sort_order,
175               'ASSIGNMENT_NUMBER', asg.assignment_number,
176               'EMPLOYEE_NUMBER', per.employee_number,
177               nvl(per.order_name, per.full_name));
178 	--
179 	-- Function to derive JP legislative "Payment" formula
180 	--
181 	function formula_id(p_formula_name in varchar2) return number
182 	is
183 		l_formula_id	number;
184 	begin
185 		select	min(f.formula_id)
186 		into	l_formula_id
187 		from	ff_formula_types	t,
188 			ff_formulas_f		f
189 		where	f.formula_name = p_formula_name
190 		and	f.legislation_code = 'JP'
191 		and	f.business_group_id is null
192 		and	t.formula_type_id = f.formula_type_id
193 		and	t.formula_type_name = 'Payment';
194 		--
195 		return l_formula_id;
196 	end formula_id;
197 begin
198 	hr_utility.set_location('Entering : ' || l_proc, 10);
199 	--
200 	-- Execute initialization code only if this is the first run
201 	--
202 	if g_parameter.effective_date is null then
203 		--
204 		-- Derive concurrent program parameter values from pay_mag_tape
205 		--
206 		select	effective_date
207 		into	g_parameter.effective_date
208 		from	fnd_sessions
209 		where	session_id = userenv('sessionid');
210 		g_parameter.effective_date_from	:= fnd_date.canonical_to_date(pay_jp_mag_utility_pkg.get_parameter('EFFECTIVE_DATE_FROM'));
211 		g_parameter.effective_date_to	:= fnd_date.canonical_to_date(pay_jp_mag_utility_pkg.get_parameter('EFFECTIVE_DATE_TO'));
212 		g_parameter.organization_id	:= fnd_number.canonical_to_number(pay_jp_mag_utility_pkg.get_parameter('ORGANIZATION_ID'));
213 		--
214 		hr_utility.trace('Session Date        : ' || fnd_date.date_to_canonical(g_parameter.effective_date));
215 		hr_utility.trace('EFFECTIVE_DATE_FROM : ' || fnd_date.date_to_canonical(g_parameter.effective_date_from));
216 		hr_utility.trace('EFFECTIVE_DATE_TO   : ' || fnd_date.date_to_canonical(g_parameter.effective_date_to));
217 		hr_utility.trace('ORGANIZATION_ID     : ' || to_char(g_parameter.organization_id));
218 		hr_utility.trace('CHARACTER_SET       : ' || pay_jp_mag_utility_pkg.get_parameter('CHARACTER_SET'));
219 		hr_utility.set_location(l_proc, 20);
220 		--
221 		-- Derive 6 formulas to be executed by PYUMAG
222 		--
223 		open csr_org;
224 		fetch csr_org into
225 			g_parameter.business_group_id,
226 			g_formula.header_record_formatter,
227 			g_formula.data_record_init,
228 			g_formula.data_record_detail,
229 			g_formula.data_record_formatter,
230 			g_formula.trailer_record_formatter,
231 			g_formula.end_record_formatter;
232 		close csr_org;
233 		if g_formula.header_record_formatter is null then
234 			g_formula.header_record_formatter	:= formula_id(c_header_record_formatter);
235 		end if;
236 		if g_formula.data_record_init is null then
237 			g_formula.data_record_init		:= formula_id(c_data_record_init);
238 		end if;
239 		if g_formula.data_record_detail is null then
240 			g_formula.data_record_detail		:= formula_id(c_data_record_detail);
241 		end if;
242 		if g_formula.data_record_formatter is null then
243 			g_formula.data_record_formatter		:= formula_id(c_data_record_formatter);
244 		end if;
245 		if g_formula.trailer_record_formatter is null then
246 			g_formula.trailer_record_formatter	:= formula_id(c_trailer_record_formatter);
247 		end if;
248 		if g_formula.end_record_formatter is null then
249 			g_formula.end_record_formatter		:= formula_id(c_end_record_formatter);
250 		end if;
251 		--
252 		hr_utility.trace('BUSINESS_GROUP_ID        : ' || to_char(g_parameter.business_group_id));
253 		hr_utility.trace('HEADER_RECORD_FORMATTER  : ' || to_char(g_formula.header_record_formatter));
254 		hr_utility.trace('DATA_RECORD_INIT         : ' || to_char(g_formula.data_record_init));
255 		hr_utility.trace('DATA_RECORD_DETAIL       : ' || to_char(g_formula.data_record_detail));
256 		hr_utility.trace('DATA_RECORD_FORMATTER    : ' || to_char(g_formula.data_record_formatter));
257 		hr_utility.trace('TRAILER_RECORD_FORMATTER : ' || to_char(g_formula.trailer_record_formatter));
258 		hr_utility.trace('END_RECORD_FORMATTER     : ' || to_char(g_formula.end_record_formatter));
259 		hr_utility.set_location(l_proc, 30);
260 		--
261 		-- Derive "Data Record" information with BULK COLLECT
262 		--
263 		g_data.current_index := 0;
264 		--
265 		hr_utility.trace('DATA_RECORD_SORT_ORDER   : ' || l_data_record_sort_order);
266 --
267 -- Broken the cursor fetch statement as PL/SQL Code to fix Bug 5371071
268 --
269   for l_rec in csr_data(l_data_record_sort_order)
270   loop
271 
272     select count(1)
273     into   l_count
274     from   pay_action_information pai
275     where  pai.action_information_category = 'JP_PRE_TAX_1'
276     and    pai.action_context_type = 'AAP'
277     and    pai.action_information1 = l_rec.assignment_action_id
278     and    pai.action_information21 = g_parameter.organization_id
279     and    not exists(
280              select NULL
281              from   pay_action_interlocks   pain,
282                     pay_assignment_actions  paan2,
283                     pay_payroll_actions     ppan2
284              where  pain.locked_action_id = pai.action_information1
285              and    paan2.assignment_action_id = pain.locking_action_id
286              and    ppan2.payroll_action_id = paan2.payroll_action_id
287              and    ppan2.action_type = 'V');
288 
289     if (l_count > 0) then
290     --
291       if ((l_district_code = l_rec.ltax_district_code) and
292               l_assignment_id = l_rec.assignment_id) then
293 
294         if (l_date_earned is null or l_date_earned < l_rec.date_earned) then
295           l_date_earned := l_rec.date_earned;
296         end if;
297 
298         l_ltax           := l_ltax + l_rec.ltax;
299         l_ltax_lumpsum   := l_ltax_lumpsum + l_rec.ltax_lumpsum;
300         l_sp_ltax        := l_sp_ltax + l_rec.sp_ltax;
301         l_sp_ltax_income := l_sp_ltax_income + l_rec.sp_ltax_income;
302         l_sp_ltax_shi    := l_sp_ltax_shi + l_rec.sp_ltax_shi;
303         l_sp_ltax_to     := l_sp_ltax_to + l_rec.sp_ltax_to;
304 
305       else
306 
307         if (l_district_code is null and l_assignment_id is null) then
308 
309           l_district_code := l_rec.ltax_district_code;
310           l_assignment_id := l_rec.assignment_id;
311 
312         elsif ((l_district_code <> l_rec.ltax_district_code) or
313                (l_assignment_id <> l_rec.assignment_id)) then
314 
315           if (l_ltax <> 0 or l_ltax_lumpsum <> 0 or l_sp_ltax <> 0) then
316 
317             g_data.district_code_tbl(l_rec_count) := l_district_code;
318             g_data.district_name_kana_tbl(l_rec_count) := l_district_name_kana;
319             g_data.swot_number_tbl(l_rec_count) := l_swot_number;
320             g_data.assignment_id_tbl(l_rec_count) := l_assignment_id;
321             g_data.date_earned_tbl(l_rec_count) := l_date_earned;
322             g_data.tax_tbl(l_rec_count) := l_ltax;
323             g_data.lumpsum_tax_tbl(l_rec_count) := l_ltax_lumpsum;
324             g_data.term_tax_tbl(l_rec_count) := l_sp_ltax;
325             g_data.term_income_tbl(l_rec_count) := l_sp_ltax_income;
326             g_data.term_district_tax_tbl(l_rec_count) := l_sp_ltax_shi;
327             g_data.term_prefectural_tax_tbl(l_rec_count) := l_sp_ltax_to;
328 
329             l_rec_count := l_rec_count + 1;
330 
331           end if;
332 
333         end if;
334 
335         if (l_district_name_kana is null or
336             l_district_code <> l_rec.ltax_district_code) then
337 
338           select adr.district_name_kana,
339                  psn.swot_number
340           into   l_district_name_kana,
341                  l_swot_number
342           from   per_jp_address_lookups          adr,
343                  pay_jp_swot_numbers             psn
344           where  adr.district_code = substrb(l_rec.ltax_district_code, 1, 5)
345           and    psn.organization_id(+) = g_parameter.organization_id
346           and    psn.district_code(+) = adr.district_code || substrb(l_rec.ltax_district_code,6);
347 
348         end if;
349 
350         l_district_code  := l_rec.ltax_district_code;
351         l_assignment_id  := l_rec.assignment_id;
352         l_date_earned    := l_rec.date_earned;
353         l_ltax           := l_rec.ltax;
354         l_ltax_lumpsum   := l_rec.ltax_lumpsum;
355         l_sp_ltax        := l_rec.sp_ltax;
356         l_sp_ltax_income := l_rec.sp_ltax_income;
357         l_sp_ltax_shi    := l_rec.sp_ltax_shi;
358         l_sp_ltax_to     := l_rec.sp_ltax_to;
359 
360       end if;
361 
362     end if;
363 
364   end loop;
365 
366   if (l_ltax <> 0 or l_ltax_lumpsum <> 0 or l_sp_ltax <> 0) then
367     g_data.district_code_tbl(l_rec_count) := l_district_code;
368     g_data.district_name_kana_tbl(l_rec_count) := l_district_name_kana;
369     g_data.swot_number_tbl(l_rec_count) := l_swot_number;
370     g_data.assignment_id_tbl(l_rec_count) := l_assignment_id;
371     g_data.date_earned_tbl(l_rec_count) := l_date_earned;
372     g_data.tax_tbl(l_rec_count) := l_ltax;
373     g_data.lumpsum_tax_tbl(l_rec_count) := l_ltax_lumpsum;
374     g_data.term_tax_tbl(l_rec_count) := l_sp_ltax;
375     g_data.term_income_tbl(l_rec_count) := l_sp_ltax_income;
376     g_data.term_district_tax_tbl(l_rec_count) := l_sp_ltax_shi;
377     g_data.term_prefectural_tax_tbl(l_rec_count) := l_sp_ltax_to;
378 
379   end if;
380 		--
381 		hr_utility.trace('Num of Data Records : ' || to_char(g_data.district_code_tbl.count));
382 	end if;
383 	--
384 	hr_utility.set_location('Leaving : ' || l_proc, 40);
385 end init;
386 -- ----------------------------------------------------------------------------
387 -- |-----------------------------< run_formula >------------------------------|
388 -- ----------------------------------------------------------------------------
389 procedure run_formula
390 is
391 	l_proc		varchar2(61) := c_package || 'run_formula';
392 	--
393 	l_formula_id	number;
394 begin
395 	hr_utility.set_location('Entering : ' || l_proc, 10);
396 	--
397 	-- Execute initialization code
398 	--
399 	init;
400 	--
401 	-- Dequeue the formula to be executed from the formula queue.
402 	-- If not exists, setup the formula into the formula queue
403 	-- and dequeue the first formula from the formula queue.
404 	--
405 	l_formula_id := pay_jp_mag_utility_pkg.dequeue_formula;
406 	if l_formula_id is null then
407 		g_data.current_index := g_data.current_index + 1;
408 		--
409 		if g_data.district_code_tbl.exists(g_data.current_index) then
410 			if g_data.current_index = 1 then
411 				pay_jp_mag_utility_pkg.enqueue_formula(g_formula.header_record_formatter);
412 				pay_jp_mag_utility_pkg.enqueue_formula(g_formula.data_record_init);
413 			else
414 				if g_data.district_code_tbl(g_data.current_index) <> g_data.district_code_tbl(g_data.current_index - 1) then
415 					pay_jp_mag_utility_pkg.enqueue_formula(g_formula.data_record_init);
416 				end if;
417 			end if;
418 			--
419 			pay_jp_mag_utility_pkg.enqueue_formula(g_formula.data_record_detail);
420 			--
421 			if g_data.current_index = g_data.district_code_tbl.count then
422 				pay_jp_mag_utility_pkg.enqueue_formula(g_formula.data_record_formatter);
423 				pay_jp_mag_utility_pkg.enqueue_formula(g_formula.trailer_record_formatter);
424 				pay_jp_mag_utility_pkg.enqueue_formula(g_formula.end_record_formatter);
425 			else
426 				if g_data.district_code_tbl(g_data.current_index) <> g_data.district_code_tbl(g_data.current_index + 1) then
427 					pay_jp_mag_utility_pkg.enqueue_formula(g_formula.data_record_formatter);
428 				end if;
429 			end if;
430 			--
431 			-- Dequeue the latest formula
432 			--
433 			l_formula_id := pay_jp_mag_utility_pkg.dequeue_formula;
434 		--
435 		-- The following NO_DATA_FOUND will finishes process successfully
436 		-- in the following conditions.
437 		--   1) TRANSFER_END_OF_FILE is not passed to PYUMAG in the last formula.
438 		--   2) No target assignments are derived.
439 		--
440 		else
441 			raise NO_DATA_FOUND;
442 		end if;
443 	end if;
444 	--
445 	hr_utility.set_location(l_proc, 20);
446 	--
447 	-- Setup contexts and parameters depending on the formula
448 	-- which is going to be executed by PYUMAG.
449 	-- Note that all parameter values are inherited to the subsequent formulas,
450 	-- but contexts available depends on each formula.
451 	--
452 	pay_jp_mag_utility_pkg.set_parameter('NEW_FORMULA_ID', l_formula_id, null);
453 	pay_jp_mag_utility_pkg.clear_contexts;
454 	--
455 	-- HEADER_RECORD_FORMATTER
456 	--
457 	if l_formula_id = g_formula.header_record_formatter then
458 		hr_utility.trace('HEADER_RECORD_FORMATTER');
459 		--
460 		pay_jp_mag_utility_pkg.set_context('BUSINESS_GROUP_ID',		g_parameter.business_group_id);
461 		pay_jp_mag_utility_pkg.set_context('DATE_EARNED',		g_parameter.effective_date);
462 		pay_jp_mag_utility_pkg.set_context('ORGANIZATION_ID',		g_parameter.organization_id);
463 	--
464 	-- DATA_RECORD_INIT
465 	--
466 	elsif l_formula_id = g_formula.data_record_init then
467 		hr_utility.trace('DATA_RECORD_INIT');
468 		--
469 		pay_jp_mag_utility_pkg.set_context('BUSINESS_GROUP_ID',		g_parameter.business_group_id);
470 		pay_jp_mag_utility_pkg.set_context('DATE_EARNED',		g_parameter.effective_date);
471 		pay_jp_mag_utility_pkg.set_context('ORGANIZATION_ID',		g_parameter.organization_id);
472 		--
473 		pay_jp_mag_utility_pkg.set_parameter('DISTRICT_CODE', 		g_data.district_code_tbl(g_data.current_index));
474 		pay_jp_mag_utility_pkg.set_parameter('DISTRICT_NAME_KANA', 	g_data.district_name_kana_tbl(g_data.current_index));
475 		pay_jp_mag_utility_pkg.set_parameter('SWOT_NUMBER', 		g_data.swot_number_tbl(g_data.current_index));
476 	--
477 	-- DATA_RECORD_DETAIL
478 	--
479 	elsif l_formula_id = g_formula.data_record_detail then
480 		hr_utility.trace('DATA_RECORD_DETAIL');
481 		--
482 		pay_jp_mag_utility_pkg.set_context('BUSINESS_GROUP_ID',		g_parameter.business_group_id);
483 		pay_jp_mag_utility_pkg.set_context('ORGANIZATION_ID',		g_parameter.organization_id);
484 		pay_jp_mag_utility_pkg.set_context('ASSIGNMENT_ID',		g_data.assignment_id_tbl(g_data.current_index));
485 		pay_jp_mag_utility_pkg.set_context('DATE_EARNED',		g_data.date_earned_tbl(g_data.current_index));
486 		--
487 		pay_jp_mag_utility_pkg.set_parameter('TAX', 			g_data.tax_tbl(g_data.current_index));
488 		pay_jp_mag_utility_pkg.set_parameter('LUMPSUM_TAX', 		g_data.lumpsum_tax_tbl(g_data.current_index));
489 		pay_jp_mag_utility_pkg.set_parameter('TERM_TAX', 		g_data.term_tax_tbl(g_data.current_index));
490 		pay_jp_mag_utility_pkg.set_parameter('TERM_INCOME', 		g_data.term_income_tbl(g_data.current_index));
491 		pay_jp_mag_utility_pkg.set_parameter('TERM_DISTRICT_TAX', 	g_data.term_district_tax_tbl(g_data.current_index));
492 		pay_jp_mag_utility_pkg.set_parameter('TERM_PREFECTURAL_TAX', 	g_data.term_prefectural_tax_tbl(g_data.current_index));
493 	--
494 	-- DATA_RECORD_FORMATTER
495 	--
496 	elsif l_formula_id = g_formula.data_record_formatter then
497 		hr_utility.trace('DATA_RECORD_FORMATTER');
498 		--
499 		pay_jp_mag_utility_pkg.set_context('BUSINESS_GROUP_ID',		g_parameter.business_group_id);
500 		pay_jp_mag_utility_pkg.set_context('DATE_EARNED',		g_parameter.effective_date);
501 		pay_jp_mag_utility_pkg.set_context('ORGANIZATION_ID',		g_parameter.organization_id);
502 	--
503 	-- TRAILER_RECORD_FORMATTER
504 	--
505 	elsif l_formula_id = g_formula.trailer_record_formatter then
506 		hr_utility.trace('TRAILER_RECORD_FORMATTER');
507 		--
508 		pay_jp_mag_utility_pkg.set_context('BUSINESS_GROUP_ID',		g_parameter.business_group_id);
509 		pay_jp_mag_utility_pkg.set_context('DATE_EARNED',		g_parameter.effective_date);
510 		pay_jp_mag_utility_pkg.set_context('ORGANIZATION_ID',		g_parameter.organization_id);
511 	--
512 	-- END_RECORD_FORMATTER
513 	--
514 	elsif l_formula_id = g_formula.end_record_formatter then
515 		hr_utility.trace('END_RECORD_FORMATTER');
516 		--
517 		pay_jp_mag_utility_pkg.set_context('BUSINESS_GROUP_ID',		g_parameter.business_group_id);
518 		pay_jp_mag_utility_pkg.set_context('DATE_EARNED',		g_parameter.effective_date);
519 	else
520 		hr_utility.trace('Unknown formula : ' || to_char(l_formula_id));
521 	end if;
522 	--
523 	hr_utility.set_location('Leaving : ' || l_proc, 30);
524 end run_formula;
525 --
526 end pay_jp_ltax_efile_pkg;