DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_INS_CUSTOM_TEMPLATE

Source


1 PACKAGE BODY pay_ins_custom_template AS
2 /* $Header: payinscstmplt.pkb 120.2.12020000.4 2013/03/28 11:17:31 skchalla ship $  */
3  /*===========================================================================+
4  |               Copyright (c) 2001 Oracle Corporation                        |
5  |                  Redwood Shores, California, USA                           |
6  |                       All rights reserved.                                 |
7  +============================================================================+
8   Name      PAY_INS_CUSTOM_TEMPLATE
9 
10   File      payinscstmplt.pkb
11 
12   Purpose   The purpose of this package is to register the user defined custom
13                 Templates into Payroll Tables i.e. PAY_REPORT_CATEGORUES,
14         PAY_REPORT_CATEGORY_COMPONENTS AND PAY_REPORT_VARIABLES.
15 
16   Notes     Currently this procedure supports the following concurrent programs
17                 for which user defined custom templates can be registered :
18         1.  Local Year End Interface Extract
19         2.  Employee W-2 PDF
20         3.  1099R Information Return - PDF
21         4.  Check Writer (XML)
22         5.  Deposit Advice (XML)
23         6.  RL1 PDF
24         7.  RL2 PDF
25         8.  Direct Deposit (New Zealand)
26         9.  Japan, Roster of Workers
27         10. Japan, Employee Ledger
28         11. Employee W-2c PDF
29         Whenever any new concurrent programs is required to be added in this
30         category i.e if any new conc programs is decided to have the flexibility
31         of registering custom template, please edit the function GET_NAME.
32         If the Concurrent program's short name differs from the corresponding
33         data_source_code in table xdo_templates_b, this function needs one
34         'elsif' clause to be added for that new concurrent program.
35 
36   Change History
37 
38   Date          User Id       Version    Description
39   ============================================================================
40   01-Sep-08     kagangul       115.0     Initial Version Created
41   01-Oct-08     kagangul       115.4     Modified the Cursor csr_report_group_id
42                                          to consider those Report Groups which
43                                          are seeded by Core Payroll
44                                          i.e. Legislation Code is NULL.
45    03-Aug-09    avenkatk       115.5     Bug #8716056 - Added support for PER templates
46    03-Aug-09    avenkatk       115.6     Resolved GSCC Warnings
47    13-Feb-13    skchalla       115.7     Modified the GET_NAME function for supporting
48                                          the custom tempalte feature for W-2c
49    28-Mar-13    skchalla       115.8     Modified the GET_NAME function for W-2c PDF
50   ============================================================================*/
51 
52 DEBUG_MODE  BOOLEAN := FALSE;
53 
54 PROCEDURE insert_custom_template(errbuf out nocopy VARCHAR2,
55                  retcode out nocopy NUMBER,
56                  p_conc_prog  IN VARCHAR2,
57                  p_lookup_type_name IN VARCHAR2,
58                  p_business_group_id IN NUMBER) IS
59 
60 CURSOR csr_get_temp_codes(p_lookup_type IN VARCHAR) IS
61 SELECT lookup_code, meaning
62 FROM fnd_common_lookups
63 WHERE lookup_type = p_lookup_type
64 AND application_id IN (800,801)
65 AND sysdate between nvl(start_date_active,sysdate) AND nvl(end_date_active,sysdate)
66 AND enabled_flag = 'Y';
67 
68 CURSOR csr_temp_code_dtls(p_template_code IN VARCHAR,
69                           p_concurrent_prog IN VARCHAR) IS
70 SELECT xtl.template_code, xtl.template_name, xb.template_type_code
71 FROM xdo_templates_b xb, xdo_templates_tl xtl
72 WHERE xb.template_code = xtl.template_code
73 AND xb.application_short_name = xtl.application_short_name
74 AND xtl.application_short_name IN ('PAY', 'PER')        /* Bug 8716056 */
75 AND xb.template_status = 'E'
76 AND xtl.language = USERENV('LANG')
77 /*AND xb.data_source_code = decode(p_concurrent_prog,'LOCALW2XML','LOCALW2MAG',
78                            'PAYUSW2PDF','PAYUSW2',
79                            'EMP_1099R_PDF','PAYUS1099R',p_conc_prog)*/
80 AND xb.data_source_code = GET_NAME(p_concurrent_prog)
81 AND xtl.template_code = p_template_code;
82 
83 CURSOR csr_report_group_id(p_report_group_short_name IN VARCHAR,
84                p_legislation_code IN VARCHAR) IS
85 SELECT report_group_id
86 FROM pay_report_groups
87 WHERE short_name = p_report_group_short_name
88 AND business_group_id IS NULL
89 /*AND nvl(legislation_code,'US') = nvl(p_legislation_code,'US');*/
90 AND ((legislation_code = p_legislation_code) OR (legislation_code IS NULL));
91 
92 CURSOR csr_report_category_id(p_report_group_id IN NUMBER,
93                   p_category_short_name IN VARCHAR2,
94                               p_business_group_id IN NUMBER
95                              ) IS
96 SELECT report_category_id
97 FROM pay_report_categories
98 WHERE report_group_id = p_report_group_id
99 AND short_name = p_category_short_name
100 AND business_group_id = p_business_group_id
101 AND legislation_code IS NULL;
102 
103 CURSOR csr_report_definition_id(p_report_group_id NUMBER) IS
104 SELECT report_definition_id
105 FROM pay_report_definitions
106 WHERE report_group_id = p_report_group_id;
107 
108 CURSOR csr_report_cat_comp_id(p_report_category_id IN NUMBER,
109                               p_report_definition_id IN NUMBER,
110                   p_business_group_id IN NUMBER) IS
111 SELECT style_sheet_variable_id
112 FROM pay_report_category_components
113 WHERE report_category_id = p_report_category_id
114 AND report_definition_id = p_report_definition_id
115 AND business_group_id = p_business_group_id
116 AND legislation_code IS NULL;
117 
118 CURSOR csr_report_variable_id(p_report_variable_id IN NUMBER,
119                   p_business_group_id IN NUMBER) IS
120 SELECT report_variable_id
121 FROM pay_report_variables
122 WHERE report_variable_id = p_report_variable_id
123 AND business_group_id = p_business_group_id
124 AND legislation_code IS NULL;
125 
126 lv_lookup_code          fnd_common_lookups.lookup_code%TYPE;
127 lv_meaning          fnd_common_lookups.meaning%TYPE;
128 lv_template_code        xdo_templates_tl.template_code%TYPE;
129 lv_template_name        xdo_templates_tl.template_name%TYPE;
130 lv_template_type_code       xdo_templates_b.template_type_code%TYPE;
131 lv_rg_short_name        fnd_common_lookups.description%TYPE;
132 lv_legislation_code     hr_organization_information.org_information9%TYPE;
133 ln_report_group_id      pay_report_groups.report_group_id%TYPE;
134 ln_report_category_id       pay_report_categories.report_category_id%TYPE;
135 ln_report_category_id_new   pay_report_categories.report_category_id%TYPE;
136 ln_report_definition_id     pay_report_definitions.report_definition_id%TYPE;
137 ln_definition_id        pay_report_definitions.report_definition_id%TYPE;
138 ln_style_sheet_id       pay_report_category_components.style_sheet_variable_id%TYPE;
139 ln_report_variable_id       pay_report_variables.report_variable_id%TYPE;
140 pn_report_variable_id       pay_report_variables.report_variable_id%TYPE;
141 lv_lookup_type_meaning      fnd_common_lookup_types.lookup_type_meaning%TYPE;
142 pn_report_category_comp_id  pay_report_category_components.report_category_comp_id%TYPE;
143 
144 BEGIN
145 
146    fnd_file.put_line(fnd_file.log,'Starting ....');
147    lv_legislation_code := get_legislation_code(p_business_group_id);
148    fnd_file.put_line(fnd_file.log,'Business Group Id : ' || p_business_group_id);
149    fnd_file.put_line(fnd_file.log,'Legislation Code : ' || lv_legislation_code);
150 
151    BEGIN
152       SELECT description INTO lv_rg_short_name
153       FROM fnd_common_lookups
154       WHERE lookup_type = 'GEN_CUST_TEMP_CONC_PROGS'
155       AND lookup_code = p_conc_prog
156       AND application_id IN (800, 801)                                                  /* Bug 8716056 */
157       AND SYSDATE between nvl(start_date_active,sysdate) AND nvl(end_date_active,sysdate)
158       AND enabled_flag = 'Y';
159       fnd_file.put_line(fnd_file.log,'Report Group Short Name : ' || lv_rg_short_name);
160    EXCEPTION
161       WHEN OTHERS THEN
162          fnd_file.put_line(fnd_file.log,'Report Group Not Found : Please Contact Your Support Representative');
163    END;
164 
165    BEGIN
166       SELECT lookup_type_meaning INTO lv_lookup_type_meaning
167       FROM fnd_common_lookup_types
168       WHERE lookup_type = p_lookup_type_name;
169       fnd_file.put_line(fnd_file.log,'+---------------------------------------------------------------------------+');
170       fnd_file.put_line(fnd_file.log,'New Category Name : ' || lv_lookup_type_meaning);
171    EXCEPTION
172       WHEN OTHERS THEN
173          fnd_file.put_line(fnd_file.log,'Report Category Not Found : Please Contact Your Support Representative');
174    END;
175 
176    SELECT pay_report_categories_s.nextval INTO ln_report_category_id_new
177    FROM DUAL;
178    fnd_file.put_line(fnd_file.log,'New Category Id : ' || ln_report_category_id_new);
179    fnd_file.put_line(fnd_file.log,'+---------------------------------------------------------------------------+');
180 
181    OPEN csr_get_temp_codes(p_lookup_type_name);
182    LOOP
183 
184       FETCH csr_get_temp_codes INTO lv_lookup_code,lv_meaning;
185       EXIT WHEN csr_get_temp_codes%NOTFOUND;
186       fnd_file.put_line(fnd_file.log,'+---------------------------------------------------------------------------+');
187       fnd_file.put_line(fnd_file.log,'Registering Template : ' || lv_lookup_code);
188       OPEN csr_temp_code_dtls(lv_lookup_code,p_conc_prog);
189       FETCH csr_temp_code_dtls INTO lv_template_code, lv_template_name, lv_template_type_code;
190 
191       IF csr_temp_code_dtls%FOUND THEN
192      fnd_file.put_line(fnd_file.log,'Template Name : ' || lv_template_name);
193      fnd_file.put_line(fnd_file.log,'Template Type : ' || lv_template_type_code);
194          OPEN csr_report_group_id(lv_rg_short_name,lv_legislation_code);
195      FETCH csr_report_group_id INTO ln_report_group_id;
196 
197      IF csr_report_group_id%FOUND THEN
198         fnd_file.put_line(fnd_file.log,'Report Group Id : ' || ln_report_group_id);
199         IF DEBUG_MODE THEN
200            hr_utility.trace('Before Opening Category Cursor : csr_report_category_id');
201            hr_utility.trace('ln_report_group_id='||ln_report_group_id);
202            hr_utility.trace('p_lookup_type_name='||p_lookup_type_name);
203            hr_utility.trace('p_business_group_id='||p_business_group_id);
204         END IF;
205 
206             OPEN csr_report_category_id(ln_report_group_id,p_lookup_type_name,p_business_group_id);
207         FETCH csr_report_category_id INTO ln_report_category_id;
208 
209         IF DEBUG_MODE THEN
210            hr_utility.trace('After Opening Category Cursor : csr_report_category_id');
211            hr_utility.trace('ln_report_category_id='||ln_report_category_id);
212         END IF;
213 
214         IF csr_report_category_id%FOUND THEN
215 
216            OPEN csr_report_definition_id(ln_report_group_id);
217            LOOP
218           FETCH csr_report_definition_id INTO ln_report_definition_id;
219               EXIT WHEN csr_report_definition_id%NOTFOUND;
220 
221               OPEN csr_report_cat_comp_id(ln_report_category_id,ln_report_definition_id,p_business_group_id);
222               FETCH csr_report_cat_comp_id INTO ln_style_sheet_id;
223           IF csr_report_cat_comp_id%FOUND THEN
224              fnd_file.put_line(fnd_file.log,'Removing Template For Definition Id : ' || ln_report_definition_id);
225              fnd_file.put_line(fnd_file.log,'Removing Template For Category Id : ' || ln_report_category_id);
226              fnd_file.put_line(fnd_file.log,'Removing Style Sheet Id : ' || ln_style_sheet_id);
227              OPEN csr_report_variable_id(ln_style_sheet_id,p_business_group_id);
228              FETCH csr_report_variable_id INTO ln_report_variable_id;
229              IF csr_report_variable_id%FOUND THEN
230                 fnd_file.put_line(fnd_file.log,'Removing Variable Id : ' || ln_style_sheet_id);
231                 IF DEBUG_MODE THEN
235                     WHERE report_variable_id = ln_report_variable_id;
232                hr_utility.trace('DELETE FROM pay_report_variables WHERE report_variable_id = ' || ln_report_variable_id);
233             ELSE
234                DELETE FROM pay_report_variables
236             END IF;
237              END IF;
238              CLOSE csr_report_variable_id;
239              IF DEBUG_MODE THEN
240             hr_utility.trace('DELETE FROM pay_report_category_components WHERE style_sheet_variable_id = ' || ln_style_sheet_id);
241              ELSE
242                 DELETE FROM pay_report_category_components
243                     WHERE style_sheet_variable_id = ln_style_sheet_id;
244              END IF;
245               END IF;
246           CLOSE csr_report_cat_comp_id;
247            END LOOP;
248            CLOSE csr_report_definition_id;
249         END IF;
250         CLOSE csr_report_category_id;
251 
252         ln_definition_id := get_definition_id(ln_report_group_id,lv_template_type_code,lv_template_code);
253 
254         fnd_file.put_line(fnd_file.log,'+---------------------------------------------------------------------------+');
255         fnd_file.put_line(fnd_file.log,'Inserting Record Into PAY_REPORT_VARIABLES');
256         fnd_file.put_line(fnd_file.log,'Definition Id ' || ln_definition_id);
257         fnd_file.put_line(fnd_file.log,'Template Name ' || lv_template_name);
258         fnd_file.put_line(fnd_file.log,'Template Code ' || lv_template_code);
259         fnd_file.put_line(fnd_file.log,'Business Group Id ' || p_business_group_id);
260 
261         insert_report_variable(p_report_definition_id => ln_definition_id,
262                    p_definition_type => 'SS',
263                    p_name => lv_template_name,
264                    p_value => lv_template_code,
265                    p_business_group_id => p_business_group_id,
266                    p_report_variable_id => pn_report_variable_id);
267 
268         fnd_file.put_line(fnd_file.log,'Report Variable Id ' || pn_report_variable_id);
269 
270         fnd_file.put_line(fnd_file.log,'Inserting Record Into PAY_REPORT_CATEGORY_COMPONENTS');
271         fnd_file.put_line(fnd_file.log,'Category Id ' || ln_report_category_id_new);
272         fnd_file.put_line(fnd_file.log,'Definition Id ' || ln_definition_id);
273         fnd_file.put_line(fnd_file.log,'Style Sheet Id ' || pn_report_variable_id);
274         fnd_file.put_line(fnd_file.log,'Business Group Id ' || p_business_group_id);
275 
276         insert_report_catg_comp(p_report_category_id => ln_report_category_id_new,
277                     p_report_definition_id => ln_definition_id,
278                     p_breakout_variable_id => NULL,
279                     p_order_by_variable_id => NULL,
280                     p_style_sheet_variable_id => pn_report_variable_id,
281                     p_business_group_id => p_business_group_id,
282                     p_report_category_comp_id => pn_report_category_comp_id);
283 
284         fnd_file.put_line(fnd_file.log,'Category Component Id ' || pn_report_category_comp_id);
285 
286          END IF;
287      CLOSE csr_report_group_id;
288       END IF;
289       CLOSE csr_temp_code_dtls;
290    END LOOP;
291    CLOSE csr_get_temp_codes;
292 
293    IF DEBUG_MODE THEN
294       hr_utility.trace('DELETE FROM pay_report_categories WHERE report_category_id = ' || ln_report_category_id);
295    ELSE
296       DELETE FROM pay_report_categories
297                WHERE report_category_id = ln_report_category_id;
298    END IF;
299 
300    fnd_file.put_line(fnd_file.log,'+---------------------------------------------------------------------------+');
301    fnd_file.put_line(fnd_file.log,'Inserting Record Into PAY_REPORT_CATEGORIES');
302    fnd_file.put_line(fnd_file.log,'Report Group Id ' || ln_report_group_id);
303    fnd_file.put_line(fnd_file.log,'Category Name ' || lv_lookup_type_meaning);
304    fnd_file.put_line(fnd_file.log,'Category Short Name ' || p_lookup_type_name);
305    fnd_file.put_line(fnd_file.log,'Business Group Id ' || p_business_group_id);
306    fnd_file.put_line(fnd_file.log,'Category Id ' || ln_report_category_id_new);
307 
308    insert_report_category(p_report_group_id => ln_report_group_id,
309                p_category_name => lv_lookup_type_meaning,
310                p_short_name => p_lookup_type_name,
311                p_legislation_code => NULL,
312                p_business_group_id => p_business_group_id,
313                p_report_category_id => ln_report_category_id_new);
314 
315    fnd_file.put_line(fnd_file.log,'Template Registered Successfully');
316 
317 END insert_custom_template;
318 
319 FUNCTION get_legislation_code(p_business_group_id NUMBER)
320 RETURN VARCHAR2 IS
321 
322 lv_legislation_code hr_organization_information.org_information9%TYPE;
323 
324 BEGIN
325 
326    BEGIN
327       SELECT org_information9 INTO lv_legislation_code
328       FROM hr_organization_information
329       WHERE org_information_context = 'Business Group Information'
330       AND organization_id = p_business_group_id;
331    EXCEPTION
332       WHEN OTHERS THEN
333          lv_legislation_code := NULL;
334    END;
335 
336 RETURN lv_legislation_code;
337 
338 END get_legislation_code;
339 
340 FUNCTION get_definition_id(pn_report_group_id NUMBER, pv_template_type_code VARCHAR2,
341                 pv_template_code VARCHAR2)
342 RETURN NUMBER IS
343 
344 CURSOR csr_fetch_definition_id_one IS
345 SELECT report_definition_id
346 FROM pay_report_definitions
347 WHERE report_group_id = pn_report_group_id;
348 
349 CURSOR csr_fetch_definition_id_mul IS
350 SELECT report_definition_id
351 FROM pay_report_definitions
355 
352 WHERE report_group_id = pn_report_group_id
353 AND upper(report_name) LIKE  '%' || upper(substr(pv_template_code,(instr(pv_template_code,'_',-1) + 1),(length(pv_template_code) - instr(pv_template_code,'_',-1)))) || '%';
354 --AND report_type = decode(pv_template_type_code,'ETEXT','EFT',pv_template_type_code);
356 ln_report_definition_id     pay_report_definitions.report_definition_id%TYPE;
357 ln_tot_report_definitions   NUMBER;
358 
359 BEGIN
360 
361    SELECT count(*) INTO ln_tot_report_definitions
362    FROM pay_report_definitions
363    WHERE report_group_id = pn_report_group_id;
364 
365    IF ln_tot_report_definitions = 1 THEN
366       OPEN csr_fetch_definition_id_one;
367       FETCH csr_fetch_definition_id_one INTO ln_report_definition_id;
368 
369       IF csr_fetch_definition_id_one%FOUND THEN
370          RETURN ln_report_definition_id;
371       END IF;
372       CLOSE csr_fetch_definition_id_one;
373    ELSE
374       OPEN csr_fetch_definition_id_mul;
375       FETCH csr_fetch_definition_id_mul INTO ln_report_definition_id;
376 
377       IF csr_fetch_definition_id_mul%FOUND THEN
378          RETURN ln_report_definition_id;
379       END IF;
380       CLOSE csr_fetch_definition_id_mul;
381    END IF;
382 
383 END get_definition_id;
384 
385 
386 PROCEDURE insert_report_variable(p_report_definition_id NUMBER,
387                                  p_definition_type      VARCHAR2,
388                                  p_name                 VARCHAR2,
389                                  p_value                VARCHAR2,
390                      p_business_group_id    NUMBER,
391                                  p_report_variable_id   out nocopy NUMBER) IS
392 
393 l_proc_name       VARCHAR2(50);
394 BEGIN
395 
396    l_proc_name := 'INSERT_REPORT_VARIABLE';
397    hr_utility.trace('Entering '||l_proc_name);
398    hr_utility.trace('Inserting report variable '|| p_name);
399 
400    SELECT pay_report_variables_s.nextval INTO p_report_variable_id FROM DUAL;
401 
402    IF DEBUG_MODE THEN
403       hr_utility.trace('INSERT INTO pay_report_variables(report_variable_id,report_definition_id,definition_type,name,value,legislation_code,business_group_id) ' ||
404                    'VALUES(' ||p_report_variable_id||','||p_report_definition_id||','||p_definition_type||','||p_name||','||p_value||','||NULL||','||p_business_group_id||')');
405    ELSE
406       INSERT INTO pay_report_variables(report_variable_id,
407                                        report_definition_id,
408                                        definition_type,
409                                        name,
410                                        value,
411                                        legislation_code,
412                                        business_group_id)
413       VALUES(p_report_variable_id,
414          p_report_definition_id,
415          p_definition_type,
416          p_name,
417          p_value,
418          NULL,
419          p_business_group_id);
420    END IF;
421 
422    hr_utility.trace('Leaving '||l_proc_name);
423 
424 END insert_report_variable;
425 
426 PROCEDURE insert_report_catg_comp(p_report_category_id      NUMBER,
427                   p_report_definition_id    NUMBER,
428                   p_breakout_variable_id    NUMBER,
429                   p_order_by_variable_id    NUMBER,
430                   p_style_sheet_variable_id NUMBER,
431                   p_business_group_id           NUMBER,
432                   p_report_category_comp_id  out nocopy NUMBER) IS
433 
434 l_proc_name       VARCHAR2(50);
435 
436 BEGIN
437 
438    l_proc_name := 'INSERT_REPORT_CATEGORY_COMPONENT';
439    hr_utility.trace('Entering '||l_proc_name);
440    hr_utility.trace('Deleting report category component.');
441 
442    SELECT pay_report_category_comp_s.nextval INTO p_report_category_comp_id FROM DUAL;
443 
444    hr_utility.trace('Inserting report category component.');
445 
446    IF DEBUG_MODE THEN
447       hr_utility.trace('INSERT INTO PAY_REPORT_CATEGORY_COMPONENTS(report_category_comp_id,report_category_id,report_definition_id,breakout_variable_id,order_by_variable_id,style_sheet_variable_id,legislation_code,business_group_id) ' ||
448                            'VALUES (' ||p_report_category_comp_id||','||p_report_category_id||','||p_report_definition_id||','||p_breakout_variable_id||','||p_order_by_variable_id||','||p_style_sheet_variable_id||','||NULL||','||
449                p_business_group_id||');');
450    ELSE
451       INSERT INTO PAY_REPORT_CATEGORY_COMPONENTS(report_category_comp_id,
452                                                  report_category_id,
453                                                  report_definition_id,
454                                                  breakout_variable_id,
455                                                  order_by_variable_id,
456                                                  style_sheet_variable_id,
457                                                  legislation_code,
458                                                  business_group_id)
459       VALUES (p_report_category_comp_id,
460           p_report_category_id,
461           p_report_definition_id,
462           p_breakout_variable_id,
463           p_order_by_variable_id,
464           p_style_sheet_variable_id,
465           NULL,
466           p_business_group_id);
467     END IF;
468 
469     hr_utility.trace('Leaving '||l_proc_name);
470 
471 END insert_report_catg_comp;
472 
473 PROCEDURE insert_report_category(p_report_group_id IN NUMBER,
474                  p_category_name IN VARCHAR2,
475                  p_short_name IN VARCHAR2,
476                  p_legislation_code IN VARCHAR2,
477                  p_business_group_id IN NUMBER,
478                  p_report_category_id IN NUMBER) IS
479 
480 l_proc_name       VARCHAR2(50);
481 
482 BEGIN
483 
484    l_proc_name := 'INSERT_REPORT_CATEGORY';
485    hr_utility.trace('Entering '||l_proc_name);
486    hr_utility.trace('Inserting report category '|| p_short_name);
487 
488    IF DEBUG_MODE THEN
489       hr_utility.trace('INSERT INTO pay_report_categories(report_category_id,report_group_id,category_name,short_name,legislation_code,business_group_id) ' ||
490                            'VALUES ('||p_report_category_id||','||p_report_group_id||','||p_category_name||','||p_short_name||','||p_legislation_code||','||p_business_group_id||');');
491    ELSE
492       INSERT INTO pay_report_categories(report_category_id,
493                                         report_group_id,
494                                         category_name,
495                                         short_name,
496                                         legislation_code,
497                                         business_group_id)
498       VALUES (p_report_category_id,
499               p_report_group_id,
500           p_category_name,
501           p_short_name,
502           p_legislation_code,
503           p_business_group_id);
504    END IF;
505 
506     hr_utility.trace('Leaving '||l_proc_name);
507 
508 END insert_report_category;
509 
510 FUNCTION GET_NAME(p_conc_prog IN VARCHAR2)
511 -- This function accepts the short_name of a concurrent program
512 -- and returns the corresponding data_source_code in table
513 -- xdo_templates_b
514 RETURN  VARCHAR2
515 IS
516 
517 BEGIN
518 
519    IF p_conc_prog = 'LOCALW2XML' THEN
520       RETURN 'LOCALW2MAG';
521    ELSIF p_conc_prog = 'PAYUSW2PDF' THEN
522       RETURN 'PAYUSW2';
523    ELSIF p_conc_prog = 'EMP_1099R_PDF' THEN
524       RETURN 'PAYUS1099R';
525    ELSIF p_conc_prog = 'PAYUSW2CXML' OR p_conc_prog = 'PAYUSW2CPDF' THEN
526       RETURN 'PAYUSW2C';
527    ELSE
528       RETURN p_conc_prog;
529    END IF;
530 
531 END GET_NAME;
532 
533 END pay_ins_custom_template;