DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_KR_PROCESS_NAV_PKG

Source


4 	g_item_key				varchar2(20) ;
1 package body pay_kr_process_nav_pkg AS
2 /* $Header: pykrpnav.pkb 120.0 2005/05/29 06:27:58 appldev noship $ */
3 	g_item_type				constant varchar2(10)  := 'KRPAYNAV' ;
5 	g_process_name				varchar2(20) ;
6 	g_debug					constant boolean := hr_utility.debug_enabled;
7 	procedure submit_workflow (
8 		-- The usual, first two parameters
9 		p_errbuf			out nocopy	varchar2,
10 		p_retcode			out nocopy	number,
11 		--
12 		-- The parameters for actual workflow
13 		p_business_place_id_notifier	in		number,		-- the business place to be notified
14 		p_payroll_id			in		number,		-- the payroll id
15 		p_consolidation_set_id		in		number,		-- the consolidation set id
16 		--
17 		-- For BEE
18 		p_run_bee			in		varchar2,	-- To run BEE ('Y'), or not ('N)
19 		p_batch_id			in		number, 	-- the batch id
20 		--
21 		-- For Retro-Notifications
22 		p_run_retro_notf		in		varchar2,	-- To run Retro-Notifications ('Y'), or not ('N)
23 		p_effective_date_retro_notf	in		varchar2,	-- effective date for retro-notifications
24 		p_event_group			in		varchar2,	-- event group
25 		p_gen_assignment_set_name	in		varchar2,	-- the generated assignment set name
26 		--
27 		-- For RetroPay
28 		p_run_retro			in		varchar2,	-- To run RetroPay ('Y'), or not ('N')
29 		p_retro_assignment_set_id	in		number,		-- the assignment set id for retro pay
30 		p_retro_element_set_id		in		number, 	-- the element set id for retro pay
31 		p_retro_start_date		in		varchar2,	-- the start date for retro pay
32 		p_retro_effective_date		in		varchar2,	-- the end date for retro pay
33 		--
34 		-- For Monthly/Bonus Payroll
35 		p_run_monthly_bonus		in		varchar2,	-- To run Monthly Payroll/Bonus ('Y'), or not ('N')
36 		p_date_earned			in		varchar2,	-- the date earned
37 		p_date_paid			in		varchar2,	-- the paid date
38 		p_element_set_id		in		number,		-- the element set id
39 		p_assignment_set_id		in		number,		-- the assignment set id
40 		p_run_type_id			in		number,		-- the run type id
41 		p_bonus_start_date		in		varchar2,	-- the bonus period start date
42 		p_additional_tax_rate		in		number,		-- additional tax rate for bonus pay
43 		p_overriding_tax_rate		in		number,		-- overriding tax rate for bonus pay
44 		p_payout_date			in		varchar2,	-- the payout date
45 		--
46 		-- For Prepayments
47 		p_run_prepayment		in		varchar2,	-- To run prepayments ('Y'), or not ('N')
48 		p_prepayment_start_date		in		varchar2,	-- the start date for prepayment run
49 		p_prepayment_end_date		in		varchar2,	-- the end date for prepayment run
50 		p_payment_method_override	in		number,		-- the override payment method
51 		--
52 		-- For Bank Transfer
53 		p_run_bank_transfer		in		varchar2,	-- To run bank transfer ('Y'), or not ('N')
54 		p_direct_deposit_start_date	in		varchar2,	-- the start date for bank transfer
55 		p_direct_deposit_end_date	in		varchar2,	-- the end date for bank transfer
56 		p_direct_deposit_date		in		varchar2,	-- the date for direct deposit
57 		p_payment_method		in		number,		-- the payment method
58 		p_characterset			in		varchar2,	-- the characterset
59 		--
60 		-- For Payslip Archive
61 		p_run_payslip_archive		in		varchar2,	-- To run payslip archive ('Y'), or not ('N')
62 		p_archive_start_date		in		varchar2, 	-- the start date for payslip archive
63 		p_archive_end_date		in		varchar2,	-- the end date for payslip archive
64 		--
65 		-- For payslip report
66 		p_run_payslip_report		in		varchar2,	-- To run payslip report ('Y'), or not ('N')
67 		p_run_type_period		in		varchar2,	-- the run_type or period
71 		p_run_costing			in		varchar2,	-- To run payslip report ('Y'), or not ('N')
68 		p_business_place_id		in		number,		-- the business place id
69                 p_sort_order1                   in              varchar2,       -- Sort Order 1 for Payslip Report
70                 p_sort_order2                   in              varchar2,       -- Sort Order 2 for Payslip Report		-- For costing
72 		p_costing_start_date		in		varchar2,	-- the start date for costing run
73 		p_costing_end_date		in		varchar2,	-- the end date for costing run
74 		--
75 		-- Parameters that are not displayed
76 		p_act_param_group_id		in		number		-- action parameter group id
77 	) is
78 --
79 		l_payment_type_id		pay_payment_types.payment_type_id%TYPE ;
80 		l_business_group_id		per_business_groups.business_group_id%TYPE ;
81 		l_run_type_name			pay_run_types_f_tl.run_type_name%TYPE ;
82 		l_bonus_start_date_hd		varchar2(200) ;	-- the bonus period start date (hidden)
83 		l_additional_tax_rate_hd	varchar2(200) ;	-- additional tax rate for bonus pay (hidden)
84 		l_overriding_tax_rate_hd	varchar2(200) ;	-- overriding tax rate for bonus pay (hidden)
85 		l_payout_date_hd		varchar2(200) ;	-- the payout date (hidden)
86 		l_characterset_hd		varchar2(200) ;	-- the characterset (hidden)
87 		l_payroll_retro_notf_hd		varchar2(200) ; -- for retro-notifications
88 		l_retro_notf_start_date_dmy	varchar2(200) ; -- dummy start date for retro-notifications
89 		l_gen_assignment_set_name_dmy	varchar2(200) ; -- dummy assignment set name for retro-notifications
90 		l_payroll_hd			varchar2(200) ;	-- legislative, for payslip archive
91 		l_consolidation_set_hd		varchar2(200) ;	-- legislative, for payslip archive
92 		l_archive_start_date_hd		varchar2(200) ;	-- legislative, for payslip archive
93 		l_archive_end_date_hd		varchar2(200) ;	-- legislative, for payslip archive
94 		l_business_group_hd		varchar2(200) ;	-- legislative, for payslip archive
95 		l_hr_payroll_contact_source	varchar2(80)  ; -- has either GRE/PAYROLL/CUSTOM, depending on which we look for the performer
96 		l_performer_name		fnd_user.user_name%TYPE ;
97 		l_payroll_name			pay_all_payrolls_f.payroll_name%TYPE;
98 		l_consolidation_set_name	pay_consolidation_sets.consolidation_set_name%TYPE ;
99 		l_retro_assignment_set_name	hr_assignment_sets.assignment_set_name%TYPE ;
100 		l_retro_element_set_name	pay_element_sets.element_set_name%TYPE ;
101 		l_element_set_name		pay_element_sets.element_set_name%TYPE ;
102 		l_assignment_set_name		hr_assignment_sets.assignment_set_name%TYPE ;
103 		l_payment_method_override_name	PAY_ORG_PAYMENT_METHODS_F.org_payment_method_name%TYPE ;
104 		l_payment_method_name		PAY_ORG_PAYMENT_METHODS_F.org_payment_method_name%TYPE ;
105 		l_business_place_name		hr_all_organization_units.name%TYPE ;
106 		l_retro_notf_event_group_name	pay_event_groups.event_group_name%TYPE ;
107 		l_sort_order1_disp		hr_lookups.meaning%TYPE ;
108 		l_sort_order2_disp		hr_lookups.meaning%TYPE ;
109 		l_eff_date_retro_notf_disp	varchar2(200) ;
110 		l_run_type_period_name_disp	varchar2(400) ;
111 		--
112 		TYPE char80_table 		IS TABLE OF VARCHAR2(80) INDEX BY BINARY_INTEGER ;
113 		l_conc_prog_name_tbl		char80_table ;
114 		l_cur_process_tbl		char80_table ;
115 		--
116 		l_num_var_name_tbl		wf_engine.NameTabTyp ;
117 		l_text_var_name_tbl		wf_engine.NameTabTyp ;
118 		l_num_var_value_tbl		wf_engine.NumTabTyp ;
119 		l_text_var_value_tbl		wf_engine.TextTabTyp ;
120 		--
121 		n				number(3) := 1 ;
122 		i				number(3) := 1 ;
123 		--
127 		l_cur_time			varchar2(25) ;
124 		l_prc_list			VARCHAR2(3200) ;
125 		l_message_text1			VARCHAR2(3200) ;
126 		l_message_html2			VARCHAR2(3200) ;
128 		--
129 		cursor csr_gre_performer is
130 			select		org_information2
131 			from		hr_organization_information
132 			where		organization_id = p_business_place_id
133 			and		org_information_context = 'KR_BP_PAYROLL_PARAMETERS';
134 		--
135 		cursor csr_payroll_performer is
136 			select		prl_information8
137 			from		pay_payrolls_f
138 			where		payroll_id = p_payroll_id
139 			and		prl_information_category = 'KR'
140 			and 		sysdate between effective_start_date and effective_end_date ;
141 		--
142 		cursor csr_payment_type is
143 			select		payment_type_id
144 			from		pay_payment_types
145 			where		payment_type_name = 'KR Direct Deposit' ;
146 		--
147 		cursor csr_payroll_name is
148 			select 		payroll_name
149 			from 		pay_all_payrolls_f
150 			where 		payroll_id = p_payroll_id
151 			and		rownum = 1 ;
152 		--
153 		cursor csr_consolidation_set_name is
154 			select 		consolidation_set_name
155 			from 		pay_consolidation_sets
156 			where		consolidation_set_id = p_consolidation_set_id ;
157 		--
158 		cursor csr_assignment_set_name(p_asg_set_id   in   number) is
159 			select 		assignment_set_name
160 			from 		hr_assignment_sets
164 			select 		element_set_name
161 			where 		assignment_set_id = p_asg_set_id ;
162 		--
163 		cursor csr_element_set_name(p_ele_set_id   in   number) is
165 			from 		pay_element_sets
166 			where 		element_set_id = p_ele_set_id ;
167 		--
168 		cursor csr_run_type_name_tl is
169 			select		run_type_name
170 			from 		pay_run_types_f_tl
171 			where 		run_type_id = p_run_type_id
172 			and		language = userenv('LANG') ;
173 		--
174 		cursor csr_run_type_name is
175 			select		run_type_name
176 			from 		pay_run_types_f
177 			where 		run_type_id = p_run_type_id;
178 		--
179 		cursor csr_payment_method (p_pay_method   in   number) is
180 			select 		org_payment_method_name
181 			from 		pay_org_payment_methods_f_tl
182 			where		org_payment_method_id = p_pay_method
183 			and		language = userenv('LANG') ;
184 		--
185 		cursor csr_business_place_name is
186 			select 		org_information1 business_place_name
187 			from 		hr_organization_information
188 			where 		org_information_context = 'KR_BUSINESS_PLACE_REGISTRATION'
189 			and		organization_id = p_business_place_id ;
190 		--
191 		cursor csr_bonus_start_date is
192 			select		'BONUS_PERIOD_START_DATE=' ||
193 					 fnd_date.date_to_canonical(
194 						greatest(fnd_date.canonical_to_date(p_bonus_start_date),
195 						         trunc(fnd_date.canonical_to_date(p_date_earned), 'YYYY')
196 					                )
197 				         ) a_bonus_start_date_hd
198 			from		dual;
199 		--
200 		cursor csr_prog_name(short_name 	in 	varchar2) is
201 			select		user_concurrent_program_name
202 			from		fnd_concurrent_programs_tl
203 			where		concurrent_program_id =
204 					(
205 						select	concurrent_program_id
206 						from	fnd_concurrent_programs
207 						where	concurrent_program_name = short_name
208 						and	application_id in (800, 801)
209 					)
210 			and		language = userenv('LANG') ;
211 		--
212 		cursor csr_event_group_name is
213 			select 		event_group_name
214 			from 		pay_event_groups
215 			where		event_group_id = to_number(substr(p_event_group, 12)) ;
216 		--
217 		cursor csr_run_type_period_name is
218 			select 		run_type_name||'-'||ptp.period_name||'-'||ppa.payroll_action_id	run_type_period_name
219 			from 		pay_payroll_actions 	ppa,
220 					pay_payroll_actions     rppa,
221 					pay_assignment_actions  paa,
222 					pay_assignment_actions  rpaa,
223 					pay_action_interlocks   pai,
224 					pay_run_types_f 	prt,
225 					per_time_periods 	ptp
226 			where 		ppa.payroll_action_id = p_run_type_period
227 			and		paa.payroll_action_id = ppa.payroll_action_id
228 			and		ppa.action_type in ('P','U')
229 			and		ppa.action_status = 'C'
230 			and		rppa.action_type in ('Q','R')
231 			and		rppa.action_status = 'C'
232 			and		rpaa.payroll_action_id = rppa.payroll_action_id
233 			and		rpaa.assignment_id = paa.assignment_id
234 			and		pai.locking_action_id = paa.assignment_action_id
235 			and		pai.locked_action_id  = rpaa.assignment_action_id
236 			and		ppa.effective_date >= rppa.effective_date
237 			and 		rpaa.run_type_id       = prt.run_type_id
238 			and 		rppa.time_period_id    = ptp.time_period_id
239 			and             ppa.payroll_action_id = paa.payroll_action_id
240 			and             rpaa.assignment_action_id = (select max(paa_locked.assignment_action_id)
241 								    from   pay_assignment_actions paa_locked,
242 									   pay_action_interlocks  pai_locking
243 								    where  pai_locking.locking_action_id =
244 										(select max(paa1.assignment_action_id)
245 										   from pay_assignment_actions paa1
246 										  where paa1.payroll_action_id = ppa.payroll_action_Id)
247 								      and  paa_locked.assignment_action_id = pai_locking.locked_action_id)
248 			and		ppa.effective_date between prt.effective_start_date and prt.effective_end_date
249 			and		rppa.effective_date between ptp.start_date and ptp.end_date;
250 		--
251 		cursor csr_sort_names(p_lookup_code in varchar2) is
252 			select		meaning
253 			from		hr_lookups
254 			where		lookup_code = p_lookup_code
255 			and		lookup_type = 'KR_SOE_SORT_BY';
256 --
257 begin
258 		--
259 		if g_debug then
260 			hr_utility.trace('Getting into submit_workflow') ;
261 		end if ;
262 		--
263 		-- initialise current time
264 		l_cur_time := to_char(sysdate, 'YYYY/MM/DD HH24:MI:SS') ;
265 		--
266 		--
267 		if g_debug then
268 			hr_utility.trace('Current date and time is ' || l_cur_time ) ;
269 		end if ;
270 		--
271 		l_performer_name := '' ;
272 		--
273 		-- Initialize item key value.
274 		--
275 		select		to_char(sysdate, 'YYYYMMDD-HH24MISS')
276 		into		g_item_key
277 		from		dual ;
278 		--
279 		if g_debug then
280 			hr_utility.trace('Initialized item type and item key') ;
281 		end if ;
282 		--
283 		-- Initialize process name
284 		--
285 		g_process_name 	:= 'KR_PAY_PROCESS' ;
286 	        --
287 		-- Initialize concurrent programs list
288 		--
289 		for cur in csr_prog_name('PAYLINK(TRANSFER)') loop
290 			l_conc_prog_name_tbl(1) := cur.user_concurrent_program_name;
291 		end loop ;
292 		for cur in csr_prog_name('PAYRPRNP') loop
293 			l_conc_prog_name_tbl(2) := cur.user_concurrent_program_name;
294 		end loop ;
295 		for cur in csr_prog_name('RETROELE') loop
299 			l_conc_prog_name_tbl(4) := cur.user_concurrent_program_name;
296 			l_conc_prog_name_tbl(3) := cur.user_concurrent_program_name;
297 		end loop ;
298 		for cur in csr_prog_name('PAYKRMTH') loop
300 		end loop ;
301 		for cur in csr_prog_name('PAYKRBON') loop
302 			l_conc_prog_name_tbl(5) := cur.user_concurrent_program_name;
303 		end loop ;
304 		for cur in csr_prog_name('PREPAY') loop
305 			l_conc_prog_name_tbl(6) := cur.user_concurrent_program_name;
306 		end loop ;
307 		for cur in csr_prog_name('PAYKRMAG') loop
308 			l_conc_prog_name_tbl(7) := cur.user_concurrent_program_name;
309 		end loop ;
310 		for cur in csr_prog_name('PYKRPSAC') loop
311 			l_conc_prog_name_tbl(8) := cur.user_concurrent_program_name;
312 		end loop ;
313 		for cur in csr_prog_name('PAYKRSOE') loop
314 			l_conc_prog_name_tbl(9) := cur.user_concurrent_program_name;
315 		end loop ;
316 		for cur in csr_prog_name('COSTING') loop
317 			l_conc_prog_name_tbl(10) := cur.user_concurrent_program_name;
318 		end loop ;
319 		--
320 		if g_debug then
321 			hr_utility.trace('Initialised concurrent program list. Now creating workflow...') ;
322 		end if ;
323 		--
324 		-- Create the workflow process
325 		--
326 		wf_engine.createprocess(
327 			ITEMTYPE	=>	g_item_type,
328 			ITEMKEY		=>	g_item_key,
329 			PROCESS		=>	g_process_name
330 		) ;
331 		--
332 		if g_debug then
333 			hr_utility.trace('Created workflow, itemtype '|| g_item_type || ', itemkey ' || g_item_key || ', process ' || g_process_name) ;
334 		end if ;
335 		--
336 		-- initialize the security
337 		--
338 		hr_signon.initialize_hr_security ;
339 		--
340 		-- Set the performer
341 		--
342 		if p_business_place_id_notifier is not null then -- look into Org Developer DF for the performer
343 			open  		csr_gre_performer ;
344 			fetch 		csr_gre_performer into l_performer_name ;
345 			close 		csr_gre_performer ;
346 			--
347 			if g_debug then
348 				hr_utility.trace('Got performer ' || l_performer_name || ' from Org Developer DF flex') ;
349 			end if ;
350 			--
351 		else  -- look into Further Payroll Information DFF for the performer
352 			open  		csr_payroll_performer ;
353 			fetch 		csr_payroll_performer into l_performer_name ;
354 			close 		csr_payroll_performer ;
355 			--
356 			if g_debug then
357 				hr_utility.trace('Got performer ' || l_performer_name || ' from Further Payroll Information flex') ;
358 			end if ;
359 			--
360 		end if ;
361 
362 		-- Default to SYSADMIN
363 
364 		if l_performer_name is null then
365 			l_performer_name := 'SYSADMIN' ;
366 			--
367 			if g_debug then
368 				hr_utility.trace('Got performer ' || l_performer_name || ' as default') ;
369 			end if ;
370 			--
371 		end if ;
372 
373 		/*
374 		 * Check for parameters required by specific processes. If they are not all provided, set the to_run flag
375 		 * for that process to 'N'.
376 		 */
377 		-- Initialize to 'Y'
378 		wf_engine.setItemAttrText(g_item_type, g_item_key, 'TO_RUN_BEE', 'Y') ;
379 		wf_engine.setItemAttrText(g_item_type, g_item_key, 'TO_RUN_RETRO', 'Y') ;
380 		wf_engine.setItemAttrText(g_item_type, g_item_key, 'TO_RUN_MONTHLY_PAYROLL', 'Y') ;
381 		wf_engine.setItemAttrText(g_item_type, g_item_key, 'TO_RUN_BONUS', 'Y') ;
382 		wf_engine.setItemAttrText(g_item_type, g_item_key, 'TO_RUN_PREPAYMENTS', 'Y') ;
383 		wf_engine.setItemAttrText(g_item_type, g_item_key, 'TO_RUN_BANK_TRANSFER', 'Y') ;
384 		wf_engine.setItemAttrText(g_item_type, g_item_key, 'TO_RUN_PAYSLIP_ARCHIVE', 'Y') ;
385 		wf_engine.setItemAttrText(g_item_type, g_item_key, 'TO_RUN_COSTING', 'Y') ;
386 		wf_engine.setItemAttrText(g_item_type, g_item_key, 'TO_RUN_PAYSLIP', 'Y') ;
387 		wf_engine.setItemAttrText(g_item_type, g_item_key, 'TO_RUN_RETRO_NOTF', 'Y') ;
388 		--
389 		l_message_html2 := 'WF_NOTIFICATION(ATTRS';
390 		--
391 		-- Setting flags for concurrent processes to be run
392 		-- Check for BEE
393 		--
394 		if p_run_bee <> 'Y' OR p_batch_id is NULL then
395 			wf_engine.setItemAttrText(g_item_type, g_item_key, 'TO_RUN_BEE', 'N') ;
396 		else
397 			--
398 			if g_debug then
399 				hr_utility.trace('Will run BEE') ;
400 			end if ;
401 			--
402 			l_prc_list           := l_prc_list||l_conc_prog_name_tbl(1)||wf_core.newline;
403 			l_cur_process_tbl(n) := l_conc_prog_name_tbl(1);
404 			l_message_html2 := l_message_html2||',MSG_ATTR'||to_char(n);
405 			n := n + 1;
406 		end if ;
407 		--
408 		-- Check for Retro-Notifications
409 		--
410 		if p_run_retro_notf <> 'Y' OR trim(p_effective_date_retro_notf) is NULL OR trim(p_event_group) is NULL OR trim(p_gen_assignment_set_name) is NULL then
411 			wf_engine.setItemAttrText(g_item_type, g_item_key, 'TO_RUN_RETRO_NOTF', 'N') ;
412 		else
413 			--
417 			--
414 			if g_debug then
415 				hr_utility.trace('Will run Retro-Notifications') ;
416 			end if ;
418 			for rec in csr_event_group_name loop
419 				l_retro_notf_event_group_name := rec.event_group_name ;
420 			end loop ;
421 			l_eff_date_retro_notf_disp := substr(p_effective_date_retro_notf, 10) ;
422 			l_prc_list           := l_prc_list||l_conc_prog_name_tbl(2)||wf_core.newline;
423 			l_cur_process_tbl(n) := l_conc_prog_name_tbl(2);
424 			l_message_html2 := l_message_html2||',MSG_ATTR'||to_char(n);
425 			n := n + 1;
426 		end if ;
427 		--
428 		-- Check for RetroPay
429 		--
430 		if p_run_retro <> 'Y' OR trim(p_retro_effective_date) is NULL OR p_retro_assignment_set_id is NULL then
431 			wf_engine.setItemAttrText(g_item_type, g_item_key, 'TO_RUN_RETRO', 'N') ;
432 		else
433 			--
434 			if g_debug then
435 				hr_utility.trace('Will run RetroPay') ;
436 			end if ;
437 			--
438 			for rec in csr_assignment_set_name(p_retro_assignment_set_id) loop
439 				l_retro_assignment_set_name := rec.assignment_set_name ;
440 			end loop ;
441 			--
442 			for rec in csr_element_set_name(p_retro_element_set_id) loop
443 				l_retro_element_set_name := rec.element_set_name ;
444 			end loop ;
445 			--
446 			l_prc_list           := l_prc_list||l_conc_prog_name_tbl(3)||wf_core.newline;
447 			l_cur_process_tbl(n) := l_conc_prog_name_tbl(3);
448 			l_message_html2 := l_message_html2||',MSG_ATTR'||to_char(n);
449 			n := n + 1;
450 		end if ;
451 		--
452 		-- Check for Monthly/Bonus Payroll
453 		--
454 		if p_run_monthly_bonus <> 'Y' OR p_payroll_id is NULL OR p_consolidation_set_id is NULL OR trim(p_date_earned) is NULL OR trim(p_date_paid) is NULL OR p_run_type_id is NULL then
455 		   	wf_engine.setItemAttrText(g_item_type, g_item_key, 'TO_RUN_MONTHLY_PAYROLL', 'N') ;
456 			wf_engine.setItemAttrText(g_item_type, g_item_key, 'TO_RUN_BONUS', 'N') ;
457 		else
458 			--
462 			--
459 			for rec in csr_assignment_set_name(p_assignment_set_id) loop
460 				l_assignment_set_name := rec.assignment_set_name ;
461 			end loop ;
463 			for rec in csr_element_set_name(p_element_set_id) loop
464 				l_element_set_name := rec.element_set_name ;
465 			end loop ;
466 			--
467 			-- Decide between monthly payroll process and bonus payroll process.
468 		 	--
469 			open csr_run_type_name;
470 			fetch csr_run_type_name into l_run_type_name;
471 			close csr_run_type_name;
472 			--
473 			if l_run_type_name like 'BON%' then
474 				--
475 				if g_debug then
476 					hr_utility.trace('Will run Bonus') ;
477 				end if ;
478 				--
479 				for rec in csr_bonus_start_date loop
480 					l_bonus_start_date_hd := rec.a_bonus_start_date_hd ;
481 				end loop ;
482 				wf_engine.setItemAttrText(g_item_type, g_item_key, 'TO_RUN_MONTHLY_PAYROLL', 'N') ;
483 				--
484 				l_prc_list           := l_prc_list||l_conc_prog_name_tbl(5)||wf_core.newline;
485 				l_cur_process_tbl(n) := l_conc_prog_name_tbl(5);
486 				l_message_html2 := l_message_html2||',MSG_ATTR'||to_char(n);
487 				n := n + 1;
488 
489 			elsif l_run_type_name = 'MTH' then
490 				--
491 				if g_debug then
492 					hr_utility.trace('Will run Monthly Payroll') ;
493 				end if ;
494 				--
495 				wf_engine.setItemAttrText(g_item_type, g_item_key, 'TO_RUN_BONUS', 'N') ;
496 				--
497 				l_prc_list           := l_prc_list||l_conc_prog_name_tbl(4)||wf_core.newline;
498 				l_cur_process_tbl(n) := l_conc_prog_name_tbl(4);
499 				l_message_html2 := l_message_html2||',MSG_ATTR'||to_char(n);
500 				n := n + 1;
501 
502 			end if ;
503 			--
504 			-- fill in the translated value in run type
505 			for rec in csr_run_type_name_tl loop
506 				l_run_type_name := rec.run_type_name ;
507 			end loop ;
508 			--
509 		end if ;
510 		--
511 		-- Check for Prepayments
512 		--
513 		if p_run_prepayment <> 'Y' OR p_payroll_id is NULL OR p_consolidation_set_id is NULL OR trim(p_prepayment_end_date) is NULL then
514 			wf_engine.setItemAttrText(g_item_type, g_item_key, 'TO_RUN_PREPAYMENTS', 'N') ;
515 		else
516 			--
517 			if g_debug then
518 				hr_utility.trace('Will run PrePayments') ;
519 			end if ;
520 			--
521 			for rec in csr_payment_method(p_payment_method_override) loop
522 				l_payment_method_override_name := rec.org_payment_method_name ;
523 			end loop ;
524 			--
525 			l_prc_list           := l_prc_list||l_conc_prog_name_tbl(6)||wf_core.newline;
526 			l_cur_process_tbl(n) := l_conc_prog_name_tbl(6);
527 			l_message_html2 := l_message_html2||',MSG_ATTR'||to_char(n);
528 			n := n + 1;
529 		end if ;
530 		--
531 		-- Check for KR Bank Transfer
532 		--
536 			--
533 		if p_run_bank_transfer <> 'Y' OR p_consolidation_set_id is NULL OR trim(p_direct_deposit_start_date) is NULL OR trim(p_direct_deposit_end_date) is NULL OR trim(p_direct_deposit_date) is NULL OR trim(p_characterset) is NULL then
534 		 	wf_engine.setItemAttrText(g_item_type, g_item_key, 'TO_RUN_BANK_TRANSFER', 'N') ;
535 		else
537 			if g_debug then
538 				hr_utility.trace('Will run Bank Transfer') ;
539 			end if ;
540 			--
541 			for rec in csr_payment_method(p_payment_method) loop
542 				l_payment_method_name := rec.org_payment_method_name ;
543 			end loop ;
544 			--
545 
546 			l_prc_list           := l_prc_list||l_conc_prog_name_tbl(7)||wf_core.newline;
547 			l_cur_process_tbl(n) := l_conc_prog_name_tbl(7);
548 			l_message_html2 := l_message_html2||',MSG_ATTR'||to_char(n);
549 			n := n + 1;
550 		end if ;
551 		--
552 		-- Check for Payslip Archive
553 		--
554 		if p_run_payslip_archive <> 'Y' OR p_payroll_id is NULL OR p_consolidation_set_id is NULL OR trim(p_archive_start_date) is NULL OR trim(p_archive_end_date) is NULL then
555 		  	wf_engine.setItemAttrText(g_item_type, g_item_key, 'TO_RUN_PAYSLIP_ARCHIVE', 'N') ;
556 		else
557 			--
558 			if g_debug then
559 				hr_utility.trace('Will run Payslip Archive') ;
560 			end if ;
561 			--
562 			l_prc_list           := l_prc_list||l_conc_prog_name_tbl(8)||wf_core.newline;
563 			l_cur_process_tbl(n) := l_conc_prog_name_tbl(8);
564 			l_message_html2 := l_message_html2||',MSG_ATTR'||to_char(n);
565 			n := n + 1;
566 		end if ;
567 		--
568 		-- Check for Payslip Report
569 		--
570 		if p_run_payslip_report <> 'Y' OR p_business_place_id is NULL then
571 		  	wf_engine.setItemAttrText(g_item_type, g_item_key, 'TO_RUN_PAYSLIP', 'N') ;
572 			--
573 		elsif trim(p_run_type_period) is NULL and wf_engine.getItemAttrText(g_item_type, g_item_key, 'TO_RUN_PREPAYMENTS') = 'N' then
574 			wf_engine.setItemAttrText(g_item_type, g_item_key, 'TO_RUN_PAYSLIP', 'N') ;
575 			--
576 		else
577 			--
578 			if g_debug then
579 				hr_utility.trace('Will run Payslip Report') ;
580 			end if ;
581 			--
582 			if trim(p_run_type_period) is not NULL then
583 				--
584 				if g_debug then
585 					hr_utility.trace('Got Payslip Runtype Payroll Action Id = '||p_run_type_period || ' from parameter Run Type/Period');
586 				end if ;
587 				--
588 				for rec in csr_run_type_period_name loop
589 					l_run_type_period_name_disp := rec.run_type_period_name ;
590 				end loop ;
591 				--
592 				if g_debug then
593 					hr_utility.trace('Run Type/Period : '||l_run_type_period_name_disp);
594 				end if;
595 				--
596 			end if ;
597 			--
598 			if trim(p_sort_order1) is not null then
599 				for rec in csr_sort_names(p_sort_order1) loop
600 					l_sort_order1_disp := rec.meaning ;
601 				end loop ;
602 			end if ;
603 			--
604 			if trim(p_sort_order2) is not null then
605 				for rec in csr_sort_names(p_sort_order2) loop
606 					l_sort_order2_disp := rec.meaning ;
607 				end loop ;
608 			end if ;
609 			--
610 			l_prc_list           := l_prc_list||l_conc_prog_name_tbl(9)||wf_core.newline;
611 			l_cur_process_tbl(n) := l_conc_prog_name_tbl(9);
612 			l_message_html2 := l_message_html2||',MSG_ATTR'||to_char(n);
613 			n := n + 1;
614 		end if ;
615 		--
616 		-- Check for Costing
617 		--
618 		if p_run_costing <> 'Y' OR p_consolidation_set_id is NULL OR trim(p_costing_end_date) is NULL then
619 			wf_engine.setItemAttrText(g_item_type, g_item_key, 'TO_RUN_COSTING', 'N') ;
620 		else
621 			--
622 			if g_debug then
623 				hr_utility.trace('Will run Costing') ;
624 			end if ;
625 			--
626 			l_prc_list           := l_prc_list||l_conc_prog_name_tbl(10)||wf_core.newline;
627 			l_cur_process_tbl(n) := l_conc_prog_name_tbl(10);
628 			l_message_html2 := l_message_html2||',MSG_ATTR'||to_char(n);
629 			n := n + 1;
630 		end if ;
631 		--
632 		for j in n..10 loop
636 	        l_message_text1 := l_prc_list;
633 			l_cur_process_tbl(j) := null;
634 		end loop;
635 		--
637 		l_message_html2 := l_message_html2||')';
638 		--
639 		-- Get a few local variables
640 		--
641 		l_business_group_id := fnd_profile.value('PER_BUSINESS_GROUP_ID') ;
642 		--
643 		for rec in csr_payment_type loop
644 			l_payment_type_id := rec.payment_type_id;
645 		end loop ;
646 		--
647 		for rec in csr_payroll_name loop
648 			l_payroll_name := rec.payroll_name ;
649 		end loop ;
650 		--
651 		for rec in csr_consolidation_set_name loop
652 			l_consolidation_set_name := rec.consolidation_set_name ;
653 		end loop ;
654 		--
655 		for rec in csr_business_place_name loop
656 			l_business_place_name := rec.business_place_name ;
657 		end loop ;
658 		--
659 		--
663 		l_characterset_hd 		:= 'CHARACTERSET=' 			|| p_characterset ;
660 		l_additional_tax_rate_hd 	:= 'BONUS_ADDITIONAL_TAX_RATE=' 	|| to_char(p_additional_tax_rate) ;
661 		l_overriding_tax_rate_hd 	:= 'BONUS_OVERRIDING_TAX_RATE=' 	|| to_char(p_overriding_tax_rate) ;
662 		l_payout_date_hd 		:= 'PAYOUTDATE=' 			|| p_payout_date ;
664 		l_payroll_hd 			:= 'PAYROLL=' 				|| to_char(p_payroll_id) ;
665 		l_consolidation_set_hd 		:= 'CONSOLIDATION=' 			|| to_char(p_consolidation_set_id) ;
666 		l_archive_start_date_hd 	:= 'START_DATE=' 			|| p_archive_start_date ;
667 		l_archive_end_date_hd 		:= 'END_DATE=' 				|| p_archive_end_date ;
668 		l_business_group_hd 		:= 'BG_ID=' 				|| l_business_group_id ;
669 		l_payroll_retro_notf_hd 	:=  'PAYROLL_ID='			|| to_char(p_payroll_id) ;
670 		l_retro_notf_start_date_dmy 	:= 'START_DATE=1900/01/01 00:00:00' ;
671 		l_gen_assignment_set_name_dmy	:= 'ASG_SET='				|| p_gen_assignment_set_name ;
672 		--
673 		-- initialize the item attributes in workflow
674 		-- first initialize the variable name and value tables
675 		--
676 		if g_debug then
677 			hr_utility.trace('Starting initalization of number attributes array') ;
678 		end if ;
679 		--
680 		l_num_var_name_tbl(i) 	:= 'BATCH_ID' ;
681 		l_num_var_value_tbl(i) 	:= p_batch_id ;
682 		i := i + 1 ;
683 		l_num_var_name_tbl(i) 	:= 'ASSIGNMENT_SET_ID' ;
684 		l_num_var_value_tbl(i) 	:= p_assignment_set_id ;
685 		i := i + 1 ;
686 		l_num_var_name_tbl(i) 	:= 'PAYMENT_METHOD' ;
687 		l_num_var_value_tbl(i) 	:= p_payment_method ;
688 		i := i + 1 ;
689 		l_num_var_name_tbl(i) 	:= 'ELEMENT_SET_ID' ;
690 		l_num_var_value_tbl(i) 	:= p_element_set_id ;
691 		i := i + 1 ;
692 		l_num_var_name_tbl(i) 	:= 'PAYROLL_ID' ;
693 		l_num_var_value_tbl(i) 	:= p_payroll_id ;
694 		i := i + 1 ;
695 		l_num_var_name_tbl(i) 	:= 'RETRO_ASSIGNMENT_SET_ID' ;
696 		l_num_var_value_tbl(i) 	:= p_retro_assignment_set_id ;
697 		i := i + 1 ;
698 		l_num_var_name_tbl(i) 	:= 'RETRO_ELEMENT_SET_ID' ;
699 		l_num_var_value_tbl(i) 	:= p_retro_element_set_id ;
700 		i := i + 1 ;
701 		l_num_var_name_tbl(i) 	:= 'CONSOLIDATION_SET_ID' ;
702 		l_num_var_value_tbl(i) 	:= p_consolidation_set_id ;
703 		i := i + 1 ;
704 		l_num_var_name_tbl(i) 	:= 'PAYMENT_METHOD_OVERRIDE' ;
705 		l_num_var_value_tbl(i) 	:= p_payment_method_override ;
706 		i := i + 1 ;
707 		l_num_var_name_tbl(i) 	:= 'ACT_PARAM_GROUP_ID' ;
708 		l_num_var_value_tbl(i) 	:= p_act_param_group_id ;
709 		i := i + 1 ;
710 		l_num_var_name_tbl(i) 	:= 'PAYMENT_TYPE' ;
711 		l_num_var_value_tbl(i) 	:= l_payment_type_id ;
712 		i := i + 1 ;
713 		l_num_var_name_tbl(i) 	:= 'RUN_TYPE_ID' ;
714 		l_num_var_value_tbl(i) 	:= p_run_type_id ;
715 		i := i + 1 ;
716 		l_num_var_name_tbl(i) 	:= 'BUSINESS_GROUP_NUMBER' ;
717 		l_num_var_value_tbl(i) 	:= l_business_group_id ;
718 		i := i + 1 ;
719 		l_num_var_name_tbl(i) 	:= 'BUSINESS_PLACE_ID' ;
720 		l_num_var_value_tbl(i) 	:= p_business_place_id ;
721 		i := i + 1 ;
722 		l_num_var_name_tbl(i) 	:= 'BONUS_ADDITIONAL_TAX_RATE' ;
723 		l_num_var_value_tbl(i) 	:= p_additional_tax_rate ;
724 		i := i + 1 ;
725 		l_num_var_name_tbl(i) 	:= 'BONUS_OVERRIDING_TAX_RATE' ;
726 		l_num_var_value_tbl(i) 	:= p_overriding_tax_rate ;
727 		--
728 		-- text values
729 		--
730 		if g_debug then
731 			hr_utility.trace('Starting initalization of text attributes array') ;
732 		end if ;
733 		--
734 		i := 1 ;
735 		l_text_var_name_tbl(i) 		:= 'DATE_TIME' ;
736 		l_text_var_value_tbl(i) 	:= l_cur_time ;
737 		i := i + 1 ;
738 		l_text_var_name_tbl(i) 		:= 'CHARACTERSET' ;
739 		l_text_var_value_tbl(i) 	:= p_characterset ;
740 		i := i + 1 ;
741 		l_text_var_name_tbl(i) 		:= 'CHARACTERSET_HD' ;
742 		l_text_var_value_tbl(i) 	:= l_characterset_hd ;
743 		i := i + 1 ;
744 		l_text_var_name_tbl(i) 		:= 'EARNED_DATE' ;
745 		l_text_var_value_tbl(i) 	:= p_date_earned ;
746 		i := i + 1 ;
747 		l_text_var_name_tbl(i) 		:= 'PAID_DATE' ;
748 		l_text_var_value_tbl(i) 	:= p_date_paid ;
749 		i := i + 1 ;
750 		l_text_var_name_tbl(i) 		:= 'PAYOUT_DATE' ;
751 		l_text_var_value_tbl(i) 	:= p_payout_date ;
752 		i := i + 1 ;
753 		l_text_var_name_tbl(i) 		:= 'PAYOUT_DATE_HD' ;
754 		l_text_var_value_tbl(i) 	:= l_payout_date_hd ;
755 		i := i + 1 ;
756 		l_text_var_name_tbl(i) 		:= 'RETRO_START_DATE' ;
757 		l_text_var_value_tbl(i) 	:= p_retro_start_date ;
758 		i := i + 1 ;
759 		l_text_var_name_tbl(i) 		:= 'BONUS_START_DATE' ;
760 		l_text_var_value_tbl(i) 	:= p_bonus_start_date ;
761 		i := i + 1 ;
762 		l_text_var_name_tbl(i) 		:= 'DIRECT_DEPOSIT_DATE' ;
763 		l_text_var_value_tbl(i) 	:= p_direct_deposit_date ;
764 		i := i + 1 ;
765 		l_text_var_name_tbl(i) 		:= 'DIRECT_DEPOSIT_START_DATE' ;
766 		l_text_var_value_tbl(i) 	:= p_direct_deposit_start_date ;
767 		i := i + 1 ;
768 		l_text_var_name_tbl(i) 		:= 'DIRECT_DEPOSIT_END_DATE' ;
769 		l_text_var_value_tbl(i) 	:= p_direct_deposit_end_date ;
770 		i := i + 1 ;
771 		l_text_var_name_tbl(i) 		:= 'COSTING_START_DATE' ;
772 		l_text_var_value_tbl(i) 	:= p_costing_start_date ;
773 		i := i + 1 ;
774 		l_text_var_name_tbl(i) 		:= 'COSTING_END_DATE' ;
775 		l_text_var_value_tbl(i) 	:= p_costing_end_date ;
776 		i := i + 1 ;
777 		l_text_var_name_tbl(i) 		:= 'PREPAYMENTS_START_DATE' ;
778 		l_text_var_value_tbl(i) 	:= p_prepayment_start_date ;
779 		i := i + 1 ;
780 		l_text_var_name_tbl(i) 		:= 'PREPAYMENTS_END_DATE' ;
781 		l_text_var_value_tbl(i) 	:= p_prepayment_end_date ;
782 		i := i + 1 ;
783 		l_text_var_name_tbl(i) 		:= 'PAYROLL_NUMBER_HD' ;
784 		l_text_var_value_tbl(i) 	:= l_payroll_hd ;
785 		i := i + 1 ;
786 		l_text_var_name_tbl(i) 		:= 'CONSOLIDATION_SET_HIDDEN' ;
787 		l_text_var_value_tbl(i) 	:= l_consolidation_set_hd ;
788 		i := i + 1 ;
789 		l_text_var_name_tbl(i) 		:= 'ARCHIVE_START_DATE' ;
790 		l_text_var_value_tbl(i) 	:= p_archive_start_date ;
798 		l_text_var_name_tbl(i) 		:= 'ARCHIVE_END_DATE_HIDDEN' ;
791 		i := i + 1 ;
792 		l_text_var_name_tbl(i) 		:= 'ARCHIVE_END_DATE' ;
793 		l_text_var_value_tbl(i) 	:= p_archive_end_date ;
794 		i := i + 1 ;
795 		l_text_var_name_tbl(i) 		:= 'ARCHIVE_START_DATE_HIDDEN' ;
796 		l_text_var_value_tbl(i) 	:= l_archive_start_date_hd ;
797 		i := i + 1 ;
799 		l_text_var_value_tbl(i) 	:= l_archive_end_date_hd ;
800 		i := i + 1 ;
801 		l_text_var_name_tbl(i) 		:= 'BUSINESS_GROUP_HIDDEN' ;
802 		l_text_var_value_tbl(i) 	:= l_business_group_hd ;
803 		i := i + 1 ;
804 		l_text_var_name_tbl(i) 		:= 'RETROPAY_EFFECTIVE_DATE' ;
805 		l_text_var_value_tbl(i) 	:= p_retro_effective_date ;
806 		i := i + 1 ;
807 		l_text_var_name_tbl(i) 		:= 'BONUS_ADDITIONAL_TAX_RATE_HD' ;
808 		l_text_var_value_tbl(i) 	:= l_additional_tax_rate_hd ;
809 		i := i + 1 ;
810 		l_text_var_name_tbl(i) 		:= 'BONUS_OVERRIDING_TAX_RATE_HD' ;
811 		l_text_var_value_tbl(i) 	:= l_overriding_tax_rate_hd ;
812 		i := i + 1 ;
813 		l_text_var_name_tbl(i) 		:= 'BONUS_START_DATE_HD' ;
814 		l_text_var_value_tbl(i) 	:= l_bonus_start_date_hd ;
815 		i := i + 1 ;
816 		l_text_var_name_tbl(i) 		:= 'RUNTYPEPERIODID' ;
817 		l_text_var_value_tbl(i) 	:= p_run_type_period ;
818 		i := i + 1 ;
819 		l_text_var_name_tbl(i) 		:= 'PAYROLL_ID_RETRO_NOTF_HD' ;
820 		l_text_var_value_tbl(i) 	:= l_payroll_retro_notf_hd ;
821 		i := i + 1 ;
822 		l_text_var_name_tbl(i) 		:= 'START_DATE_RETRO_NOTF_DMY' ;
823 		l_text_var_value_tbl(i) 	:= l_retro_notf_start_date_dmy ;
824 		i := i + 1 ;
825 		l_text_var_name_tbl(i) 		:= 'RETRO_NOTF_EFFECTIVE_DATE' ;
826 		l_text_var_value_tbl(i) 	:= p_effective_date_retro_notf ;
827 		i := i + 1 ;
828 		l_text_var_name_tbl(i) 		:= 'EFF_DATE_RETRO_NOTF_DISP' ;
829 		l_text_var_value_tbl(i) 	:= l_eff_date_retro_notf_disp ;
830 		i := i + 1 ;
831 		l_text_var_name_tbl(i) 		:= 'EVENT_GROUP_ID_TOKEN' ;
832 		l_text_var_value_tbl(i) 	:= p_event_group ;
833 		i := i + 1 ;
834 		l_text_var_name_tbl(i) 		:= 'ASSIGNMENT_SET_NAME_RETRO_NOTF' ;
835 		l_text_var_value_tbl(i) 	:= p_gen_assignment_set_name ;
836 		i := i + 1 ;
837 		l_text_var_name_tbl(i) 		:= 'ASSIGN_SET_NAME_RETRO_NOTF_DMY' ;
838 		l_text_var_value_tbl(i) 	:= l_gen_assignment_set_name_dmy ;
839 		i := i + 1 ;
840 		l_text_var_name_tbl(i) 		:= 'PERFORMER_NAME' ;
841 		l_text_var_value_tbl(i) 	:= l_performer_name ;
842 		i := i + 1 ;
843 		l_text_var_name_tbl(i) 		:= 'PAYROLL_NAME' ;
844 		l_text_var_value_tbl(i) 	:= l_payroll_name ;
845 		i := i + 1 ;
846 		l_text_var_name_tbl(i) 		:= 'CONSOLIDATION_SET_NAME' ;
847 		l_text_var_value_tbl(i) 	:= l_consolidation_set_name ;
848 		i := i + 1 ;
849 		l_text_var_name_tbl(i) 		:= 'RETRO_NOTF_EVENT_GROUP_NAME' ;
850 		l_text_var_value_tbl(i) 	:= l_retro_notf_event_group_name ;
851 		i := i + 1 ;
852 		l_text_var_name_tbl(i) 		:= 'RETRO_PAY_ASSIGNMENT_SET_NAME' ;
853 		l_text_var_value_tbl(i) 	:= l_retro_assignment_set_name ;
854 		i := i + 1 ;
855 		l_text_var_name_tbl(i) 		:= 'RETRO_PAY_ELEMENT_SET_NAME' ;
856 		l_text_var_value_tbl(i) 	:= l_retro_element_set_name ;
857 		i := i + 1 ;
858 		l_text_var_name_tbl(i) 		:= 'ELEMENT_SET_NAME' ;
859 		l_text_var_value_tbl(i) 	:= l_element_set_name ;
860 		i := i + 1 ;
861 		l_text_var_name_tbl(i) 		:= 'RUN_TYPE_PERIOD_NAME_DISP' ;
862 		l_text_var_value_tbl(i) 	:= l_run_type_period_name_disp ;
863 		i := i + 1 ;
864 		l_text_var_name_tbl(i) 		:= 'ASSIGNMENT_SET_NAME' ;
865 		l_text_var_value_tbl(i) 	:= l_assignment_set_name ;
866 		i := i + 1 ;
867 		l_text_var_name_tbl(i) 		:= 'RUN_TYPE_NAME' ;
868 		l_text_var_value_tbl(i) 	:= l_run_type_name ;
869 		i := i + 1 ;
870 		l_text_var_name_tbl(i) 		:= 'PAYMENT_METHOD_OVERRIDE_NAME' ;
871 		l_text_var_value_tbl(i) 	:= l_payment_method_override_name ;
872 		i := i + 1 ;
873 		l_text_var_name_tbl(i) 		:= 'PAYMENT_METHOD_NAME' ;
874 		l_text_var_value_tbl(i) 	:= l_payment_method_name ;
875 		i := i + 1 ;
879 		l_text_var_name_tbl(i) 		:= 'BANK_TRANSFER_CONC_PROG_NAME' ;
876 		l_text_var_name_tbl(i) 		:= 'BUSINESS_PLACE_NAME' ;
877 		l_text_var_value_tbl(i) 	:= l_business_place_name ;
878 		i := i + 1 ;
880 		l_text_var_value_tbl(i) 	:= l_conc_prog_name_tbl(7);
881 		i := i + 1 ;
882 		l_text_var_name_tbl(i) 		:= 'BEE_CONC_PROG_NAME' ;
883 		l_text_var_value_tbl(i) 	:= l_conc_prog_name_tbl(1);
884 		i := i + 1 ;
885 		l_text_var_name_tbl(i) 		:= 'RETRO_NOTF_CONC_PROG_NAME' ;
886 		l_text_var_value_tbl(i) 	:= l_conc_prog_name_tbl(2);
887 		i := i + 1 ;
888 		l_text_var_name_tbl(i) 		:= 'RETRO_PAY_CONC_PROG_NAME' ;
889 		l_text_var_value_tbl(i) 	:= l_conc_prog_name_tbl(3);
890 		i := i + 1 ;
891 		l_text_var_name_tbl(i) 		:= 'MONTHLY_PAYROLL_CONC_PROG_NAME' ;
892 		l_text_var_value_tbl(i) 	:= l_conc_prog_name_tbl(4);
893 		i := i + 1 ;
894 		l_text_var_name_tbl(i) 		:= 'BONUS_PAYROLL_CONC_PROG_NAME' ;
895 		l_text_var_value_tbl(i) 	:= l_conc_prog_name_tbl(5);
896 		i := i + 1 ;
897 		l_text_var_name_tbl(i) 		:= 'PREPAYMENTS_CONC_PROG_NAME' ;
898 		l_text_var_value_tbl(i) 	:= l_conc_prog_name_tbl(6);
899 		i := i + 1 ;
900 		l_text_var_name_tbl(i) 		:= 'PAYSLIP_ARCHIVE_CONC_PROG_NAME' ;
901 		l_text_var_value_tbl(i) 	:= l_conc_prog_name_tbl(8);
902 		i := i + 1 ;
903 		l_text_var_name_tbl(i) 		:= 'PAYSLIP_REPORT_CONC_PROG_NAME' ;
904 		l_text_var_value_tbl(i) 	:= l_conc_prog_name_tbl(9);
905 		i := i + 1 ;
906 		l_text_var_name_tbl(i) 		:= 'COSTING_CONC_PROG_NAME' ;
907 		l_text_var_value_tbl(i) 	:= l_conc_prog_name_tbl(10);
908 		i := i + 1 ;
909 		l_text_var_name_tbl(i) 		:= 'MESSAGE_TEXT_1' ;
910 		l_text_var_value_tbl(i) 	:= l_message_text1 ;
911 		i := i + 1 ;
912 		l_text_var_name_tbl(i) 		:= 'MESSAGE_HTML_TEXT_2' ;
913 		l_text_var_value_tbl(i) 	:= l_message_html2 ;
914 		i := i + 1 ;
915 		l_text_var_name_tbl(i) 		:= 'PROCESS_1' ;
916 		l_text_var_value_tbl(i) 	:= l_cur_process_tbl(1) ;
917 		i := i + 1 ;
918 		l_text_var_name_tbl(i) 		:= 'PROCESS_2' ;
919 		l_text_var_value_tbl(i) 	:= l_cur_process_tbl(2) ;
920 		i := i + 1 ;
921 		l_text_var_name_tbl(i) 		:= 'PROCESS_3' ;
922 		l_text_var_value_tbl(i) 	:= l_cur_process_tbl(3) ;
923 		i := i + 1 ;
924 		l_text_var_name_tbl(i) 		:= 'PROCESS_4' ;
925 		l_text_var_value_tbl(i) 	:= l_cur_process_tbl(4) ;
926 		i := i + 1 ;
927 		l_text_var_name_tbl(i) 		:= 'PROCESS_5' ;
928 		l_text_var_value_tbl(i) 	:= l_cur_process_tbl(5) ;
929 		i := i + 1 ;
930 		l_text_var_name_tbl(i) 		:= 'PROCESS_6' ;
931 		l_text_var_value_tbl(i) 	:= l_cur_process_tbl(6) ;
932 		i := i + 1 ;
933 		l_text_var_name_tbl(i) 		:= 'PROCESS_7' ;
934 		l_text_var_value_tbl(i) 	:= l_cur_process_tbl(7) ;
935 		i := i + 1 ;
936 		l_text_var_name_tbl(i) 		:= 'PROCESS_8' ;
937 		l_text_var_value_tbl(i) 	:= l_cur_process_tbl(8) ;
938 		i := i + 1 ;
939 		l_text_var_name_tbl(i) 		:= 'PROCESS_9' ;
940 		l_text_var_value_tbl(i) 	:= l_cur_process_tbl(9) ;
941 		i := i + 1 ;
942 		l_text_var_name_tbl(i) 		:= 'PROCESS_10' ;
946 		l_text_var_value_tbl(i) 	:= p_sort_order1 ;
943 		l_text_var_value_tbl(i) 	:= l_cur_process_tbl(10) ;
944 		i := i + 1 ;
945 		l_text_var_name_tbl(i) 		:= 'SORT_ORDER_1' ;
947 		i := i + 1 ;
948 		l_text_var_name_tbl(i) 		:= 'SORT_ORDER_2' ;
949 		l_text_var_value_tbl(i) 	:= p_sort_order2 ;
950 		i := i + 1 ;
951 		l_text_var_name_tbl(i) 		:= 'SORT_ORDER_1_DISP' ;
952 		l_text_var_value_tbl(i) 	:= l_sort_order1_disp ;
953 		i := i + 1 ;
954 		l_text_var_name_tbl(i) 		:= 'SORT_ORDER_2_DISP' ;
955 		l_text_var_value_tbl(i) 	:= l_sort_order2_disp ;
956 		i := i + 1 ;
957 		--
958 		if g_debug then
959 			hr_utility.trace('Finished initialising attributes array') ;
960 		end if ;
961 		--
962 		-- now initialize, using the wf_engine API
963 		--
964 		wf_engine.setItemAttrNumberArray(g_item_type, g_item_key, l_num_var_name_tbl, l_num_var_value_tbl);
965 		--
966 		if g_debug then
967 			hr_utility.trace('Actually initalized number attributes by calling wf_engine.setItemAttrNumberArray') ;
968 		end if ;
969 		--
970 		wf_engine.setItemAttrTextArray(g_item_type, g_item_key, l_text_var_name_tbl, l_text_var_value_tbl);
971 		--
972 		if g_debug then
973 			hr_utility.trace('Actually initalized of text attributes by calling wf_engine.setItemAttrTextArray') ;
974 		end if ;
975 		--
976 		if g_debug then
977 			hr_utility.trace('Starting workflow') ;
978 		end if ;
979 		--
980 		-- Start the workflow
981 		--
982 		wf_engine.startprocess(
983 			ITEMTYPE	=>	g_item_type,
984 			ITEMKEY		=>	g_item_key
985 		) ;
986 		--
987 		if g_debug then
988 			hr_utility.trace('Workflow started. Quiting submit_workflow') ;
989 		end if ;
990 		--
991 		p_retcode := 0;
992 		--
996 				hr_utility.trace(sqlerrm);
993 	exception
994 		when others then
995 			if g_debug then
997 				p_retcode := 2;
998 			end if ;
999 	end submit_workflow ;
1000 ----------------------------------------------------------------------------------------------------------------------------
1001 end pay_kr_process_nav_pkg ;