DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_US_TRR_ENGINE_PKG

Source


1 package body PAY_US_TRR_ENGINE_PKG as
2 /* $Header: pyusteng.pkb 120.1 2011/11/25 09:51:58 nkjaladi ship $ */
3 
4 procedure federal_trr(errbuf     OUT nocopy    VARCHAR2,
5                       retcode    OUT nocopy    NUMBER,
6                       p_business_group   number ,
7                       p_start_date       varchar2,
8                       p_end_date	 varchar2,
9 		      p_gre		 number,
10                       p_federal  	 varchar2,
11                       p_state		 varchar2,
12                       p_dimension        varchar2)
13 is
14 --
15 --
16 /* ORIGINAL CODE
17  cursor gre_sizes(c_business_group_id  number,
18                   c_tax_unit_id        number,
19                   c_jurisdiction_code  varchar2)
20  is
21    select count(*) gre_size, puar.tax_unit_id gre_id, htu.name gre_name
22    from   pay_us_asg_reporting puar,
23           hr_tax_units_v htu
24    where  puar.tax_unit_id=htu.tax_unit_id
25    and    htu.business_group_id=c_business_group_id
26    and    substr(puar.jurisdiction_code,1,2)=
27                    nvl(c_jurisdiction_code,substr(puar.jurisdiction_code,1,2))
28    and    htu.tax_unit_id=nvl(c_tax_unit_id,htu.tax_unit_id)
29    group by puar.tax_unit_id,htu.name
30    order by count(*);
31 */
32 
33  cursor gre_sizes_gre is
34    select count(*) gre_size, info.organization_id gre_id, hoi.name gre_name
35    from   hr_organization_units hoi,
36           hr_organization_information info
37    where hoi.organization_id = info.organization_id
38      and info.org_information_context = 'CLASS'
39      and info.org_information1  = 'HR_LEGAL'
40      and hoi.business_group_id  = p_business_group
41      and info.organization_id = p_gre
42    group by info.organization_id,hoi.name
43    order by count(*);
44 
45  cursor gre_sizes is
46    select count(*) gre_size, info.organization_id gre_id, hoi.name gre_name
47    from   hr_organization_units hoi,
48           hr_organization_information info
49    where hoi.organization_id = info.organization_id
50      and info.org_information_context = 'CLASS'
51      and info.org_information1  = 'HR_LEGAL'
52      and hoi.business_group_id  = p_business_group
53      and trunc(nvl(date_to,fnd_date.canonical_to_date(p_start_date)),'Y') >= trunc(fnd_date.canonical_to_date(p_start_date),'Y')
54    group by info.organization_id,hoi.name
55    order by count(*);
56 
57  cursor gre_sizes_gre_state is
58    select count(*) gre_size, info.organization_id gre_id, hoi.name gre_name
59    from   hr_organization_units hoi,
60           hr_organization_information info
61    where hoi.organization_id = info.organization_id
62      and info.org_information_context = 'CLASS'
63      and info.org_information1  = 'HR_LEGAL'
64      and hoi.business_group_id  = p_business_group
65      and info.organization_id = p_gre
66      and exists (select  '1' from pay_us_asg_reporting puar
67                  where puar.tax_unit_id = info.organization_id
68                    and puar.jurisdiction_code like p_state||'%')
69    group by info.organization_id,hoi.name
70    order by count(*);
71 
72  cursor gre_sizes_state is
73  select /*+ INDEX(hoi.hao HR_ORGANIZATION_UNITS_FK1) */
74     count(*) gre_size,info.organization_id gre_id, hoi.name gre_name
75     from  hr_organization_units hoi,
76           hr_organization_information info
77     where hoi.organization_id = info.organization_id
78       and info.org_information_context = 'CLASS'
79       and info.org_information1  = 'HR_LEGAL'
80       and hoi.business_group_id  = p_business_group
81       and trunc(nvl(date_to,fnd_date.canonical_to_date(p_start_date)),'Y') >= trunc(fnd_date.canonical_to_date(p_start_date),'Y')
82       and exists (select  '1' from pay_us_asg_reporting puar
83                   where puar.tax_unit_id = info.organization_id
84                     and puar.jurisdiction_code like p_state||'%')
85     group by info.organization_id,hoi.name
86     order by count(*);
87 
88   gre_list    gre_info_list;
89   list_index  number:=1;
90   start_index number:=1;
91   end_index   number:=1;
92   l_req_id    number;
93   copies_buffer varchar2(80) := null;
94   print_buffer  varchar2(80) := null;
95   printer_buffer  varchar2(80) := null;
96   style_buffer  varchar2(80) := null;
97   save_buffer  boolean := null;
98   save_result  varchar2(1) := null;
99   req_id  varchar2(80) := null;
100   x boolean;
101   x1 boolean;
102 
103   l_valid_status  varchar2(5);
104   l_program       varchar2(100);
105 --
106 --
107 begin
108 
109 --hr_utility.trace_on(null,'oracle');
110 
111   -- initialise variable - 0 is SRS Success, 1 is SRS Warning, 2 is SRS Error
112   retcode := 0;
113   -- get printing info
114   req_id:=fnd_profile.value('CONC_REQUEST_ID');
115   print_buffer:=fnd_profile.value('CONC_PRINT_TOGETHER');
116    if (print_buffer is NULL)
117    then print_buffer:='N';
118    end if;
119 
120   select number_of_copies,
121         printer,
122         print_style,
123         save_output_flag
127         save_result
124   into  copies_buffer,
125         printer_buffer,
126         style_buffer,
128   from  fnd_concurrent_requests
129   where request_id = fnd_number.canonical_to_number(req_id);
130 
131 
132   if (save_result='Y') then
133     save_buffer:=true;
134   elsif (save_result='N') then
135     save_buffer:=false;
136   else
137     save_buffer:=NULL;
138   end if;
139 
140 -- logic to decide which report to fire
141    /*begin
142         select pdb.run_balance_status
143           into l_valid_status
144         from   pay_defined_balances pdb,
145                pay_balance_types pbt,
146                pay_balance_dimensions pbd
147         where  pdb.legislation_code = 'US'
148            and pdb.save_run_balance = 'Y'
149            and pdb.run_balance_status is not null
150            and pdb.balance_type_id = pbt.balance_type_id
151            and pbd.balance_dimension_id = pdb.balance_dimension_id
152            and pbt.balance_name = 'SIT Withheld'
153            and pbd.database_item_suffix = '_GRE_JD_RUN';
154    */
155 /* New code : In the table pay_balnace_validation the balance_load_date is
156               not Mendatory so we need to take a look at it.p_start_date
157               can have null value .
158           1.  What should we do if the status of the column
159               is processing. Should we stop running TRR or should we
160               continue with the process "
161 
162 */
163    -- Bug 3400857 : Logic to check valid balances is now moved to PAYUSFTR.rdf
164      /* select   pbv.run_balance_status
165         into   l_valid_status
166         from   pay_defined_balances pdb,
167                pay_balance_types pbt,
168                pay_balance_validation pbv,
169                pay_balance_dimensions pbd
170          where  pdb.legislation_code = 'US'
171            and pdb.save_run_balance = 'Y'
172            and pdb.balance_type_id = pbt.balance_type_id
173            and pbd.balance_dimension_id = pdb.balance_dimension_id
174            and pbt.balance_name = 'SIT Withheld'
175            and pbd.database_item_suffix = '_GRE_JD_RUN'
176            and pdb.defined_balance_id = pbv.defined_balance_id
177            and pbv.business_group_id = p_business_group
178            and nvl(pbv.balance_load_date,
179                    fnd_date.canonical_to_date(p_start_date))
180                 <= fnd_date.canonical_to_date(p_start_date);
181 
182 
183         if l_valid_status = 'V' then
184            --call the new report
185            l_program := 'PYFEDTRR_RB';
186 
187         else
188            -- call the old report
189            l_program := 'PYFEDTRR';
190 
191         end if;
192 
193    exception when others then
194            -- call the old report
195            l_program := 'PYFEDTRR';
196    end;*/
197 -- end logic
198   l_program := 'PYFEDTRR';
199 --  l_program := 'PYFEDTRR_RB';
200   -- read data into table
201   if (p_gre is null and p_state is null ) then
202 
203      for  grerec in gre_sizes loop
204        gre_list(list_index).gre_size :=grerec.gre_size;
205        gre_list(list_index).gre_id   :=grerec.gre_id;
206        gre_list(list_index).gre_name :=grerec.gre_name;
207 
208        list_index:=list_index+1;
209      end loop;
210 
211   elsif (p_gre is not null and p_state is null ) then
212 
213      for  grerec in gre_sizes_gre loop
214        gre_list(list_index).gre_size :=grerec.gre_size;
215        gre_list(list_index).gre_id   :=grerec.gre_id;
216        gre_list(list_index).gre_name :=grerec.gre_name;
217 
218        list_index:=list_index+1;
219      end loop;
220 
221   elsif (p_gre is not null and p_state is not null) then
222 
223      for  grerec in gre_sizes_gre_state loop
224        gre_list(list_index).gre_size :=grerec.gre_size;
225        gre_list(list_index).gre_id   :=grerec.gre_id;
226        gre_list(list_index).gre_name :=grerec.gre_name;
227 
228        list_index:=list_index+1;
229      end loop;
230 
231   else /* (p_gre is null and p_state is not null) */
232 
233      for  grerec in gre_sizes_state loop
234        gre_list(list_index).gre_size :=grerec.gre_size;
235        gre_list(list_index).gre_id   :=grerec.gre_id;
236        gre_list(list_index).gre_name :=grerec.gre_name;
237 
238        list_index:=list_index+1;
239      end loop;
240 
241   end if;
242 
243 /* ORIGINAL CODE
244   for  grerec in gre_sizes(p_business_group,p_gre,p_state) loop
245     gre_list(list_index).gre_size :=grerec.gre_size;
246     gre_list(list_index).gre_id   :=grerec.gre_id;
247     gre_list(list_index).gre_name :=grerec.gre_name;
248 
249     list_index:=list_index+1;
250   end loop;
251 */
252 
253   -- get start of list
254   start_index:=1;
255   -- get end of list
256   end_index:=list_index-1;
257   -- loop round from both ends working inwards
258   while (start_index<end_index) loop
259     -- set print options
260     x:=FND_REQUEST.set_print_options(
261                    printer        => printer_buffer,
262                    style          => style_buffer,
263                    copies         => copies_buffer,
264                    save_output    => save_buffer,
265                    print_together => print_buffer);
266 
267     -- Bug 3487186 Added by ssmukher
268     x1 := fnd_Request.USE_CURRENT_NOTIFICATION;
269 
270     -- submit requests for report
271     l_req_id:=fnd_request.submit_request(
275                             argument2      => p_business_group,
272                             application    => 'PAY',
273                             program        => l_program,
274                             argument1      => gre_list(start_index).gre_name,
276                             argument3      => p_start_date,
277                             argument4      => p_end_date,
278                             argument5      => gre_list(start_index).gre_id,
279                             argument6      => p_federal,
280                             argument7      => p_state,
281                             argument8      => p_dimension);
282     -- set print options
283     x:=FND_REQUEST.set_print_options(
284                    printer        => printer_buffer,
285                    style          => style_buffer,
286                    copies         => copies_buffer,
287                    save_output    => save_buffer,
288                    print_together => print_buffer);
289    --Bug 3487186 Add  by ssmukher
290    x1 := fnd_Request.USE_CURRENT_NOTIFICATION;
291 
292     l_req_id:=fnd_request.submit_request(
293                             application    => 'PAY',
294                             program        => l_program,
295                             argument1      => gre_list(end_index).gre_name,
296                             argument2      => p_business_group,
297                             argument3      => p_start_date,
298                             argument4      => p_end_date,
299                             argument5      => gre_list(end_index).gre_id,
300                             argument6      => p_federal,
301                             argument7      => p_state,
302                             argument8      => p_dimension);
303     -- get next values
304     start_index:=start_index+1;
305     end_index:=end_index-1;
306     --
307 
308   end loop;
309   -- submit for middle value in list if odd number of gre's
310   if (start_index=end_index) then
311     -- set print options
312     x:=FND_REQUEST.set_print_options(
313                    printer        => printer_buffer,
314                    style          => style_buffer,
315                    copies         => copies_buffer,
316                    save_output    => save_buffer,
317                    print_together => print_buffer);
318 
319 -- Bug 3487186 Added by ssmukher
320    x1 := fnd_Request.USE_CURRENT_NOTIFICATION;
321     l_req_id:=fnd_request.submit_request(
322                             application    => 'PAY',
323                             program        => l_program,
324                             argument1      => gre_list(start_index).gre_name,
325                             argument2      => p_business_group,
326                             argument3      => p_start_date,
327                             argument4      => p_end_date,
328                             argument5      => gre_list(start_index).gre_id,
329                             argument6      => p_federal,
330                             argument7      => p_state,
331                             argument8      => p_dimension);
332   end if;
333 EXCEPTION
334   --
335    WHEN hr_utility.hr_error THEN
336      --
337      -- Set up error message and error return code.
338      --
339 	--hr_utility.trace('in the exception');
340      errbuf  := hr_utility.get_message;
341      retcode := 2;
342      --
343 --
344 WHEN others THEN
345 --
346      -- Set up error message and return code.
347      --
348      errbuf  := sqlerrm;
349      retcode := 2;
350 end federal_trr;
351 
352 procedure state_trr
353 is
354 begin
355 
356  null;
357 end state_trr;
358 --
359 procedure local_trr(errbuf      out nocopy    varchar2
360                      ,retcode   out nocopy    number
361                      ,p_business_group  number
362                      ,p_start_date      varchar2
363                      ,p_end_date        varchar2
364                      ,p_gre             number
365                      ,p_state           varchar2
366                      ,p_locality_type   varchar2
367                      ,p_is_city         varchar2
368                      ,p_city            varchar2
369                      ,p_is_county       varchar2
370                      ,p_county          varchar2
371                      ,p_is_school       varchar2
372                      ,p_school          varchar2
373                      ,p_is_psd          varchar2  --Added for #11926304
374                      ,p_psd             varchar2  --Added for #11926304
375                      ,p_sort_option_1   varchar2
376                      ,p_sort_option_2   varchar2
377                      ,p_sort_option_3   varchar2
378                      ,p_dimension       varchar2)
379 is
380 --
381 /* ORIGINAL CODE
382  cursor gre_sizes(c_business_group_id  number,
383                   c_tax_unit_id        number,
384                   c_jurisdiction_code  varchar2)
385  is
386    select count(*) gre_size,puar.tax_unit_id gre_id,htu.name gre_name
387    from   pay_us_asg_reporting puar,
388           hr_tax_units_v htu
389    where  puar.tax_unit_id=htu.tax_unit_id
390    and    htu.business_group_id=c_business_group_id
391    and    substr(puar.jurisdiction_code,1,2)=
392                    nvl(c_jurisdiction_code,substr(puar.jurisdiction_code,1,2))
393    and    htu.tax_unit_id=nvl(c_tax_unit_id,htu.tax_unit_id)
394    group by puar.tax_unit_id,htu.name
395    order by count(*);
396 */
397 
398  cursor gre_sizes_gre is
402    where hoi.organization_id = info.organization_id
399    select count(*) gre_size, info.organization_id gre_id, hoi.name gre_name
400    from   hr_organization_units hoi,
401           hr_organization_information info
403      and info.org_information_context = 'CLASS'
404      and info.org_information1  = 'HR_LEGAL'
405      and hoi.business_group_id  = p_business_group
406      and info.organization_id = p_gre
407    group by info.organization_id,hoi.name
408    order by count(*);
409 
410  cursor gre_sizes is
411    select count(*) gre_size, info.organization_id gre_id, hoi.name gre_name
412    from   hr_organization_units hoi,
413           hr_organization_information info
414    where hoi.organization_id = info.organization_id
415      and info.org_information_context = 'CLASS'
416      and info.org_information1  = 'HR_LEGAL'
417      and hoi.business_group_id  = p_business_group
418      and trunc(nvl(date_to,fnd_date.canonical_to_date(p_start_date)),'Y') >= trunc(fnd_date.canonical_to_date(p_start_date),'Y')
419    group by info.organization_id,hoi.name
420    order by count(*);
421 
422  cursor gre_sizes_gre_juri(cv_jurisdiction  varchar2) is
423    select count(*) gre_size, info.organization_id gre_id, hoi.name gre_name
424    from   hr_organization_units hoi,
425           hr_organization_information info
426    where hoi.organization_id = info.organization_id
427      and info.org_information_context = 'CLASS'
428      and info.org_information1  = 'HR_LEGAL'
429      and hoi.business_group_id  = p_business_group
430      and info.organization_id = p_gre
431      and exists (select  '1' from pay_us_asg_reporting puar
432                  where puar.tax_unit_id = info.organization_id
433                    and puar.jurisdiction_code like cv_jurisdiction)
434    group by info.organization_id,hoi.name
435    order by count(*);
436 
437  cursor gre_sizes_juri(cv_jurisdiction  varchar2) is
438    select /*+ INDEX(hoi.hao HR_ORGANIZATION_UNITS_FK1) */
439    count(*) gre_size, info.organization_id gre_id, hoi.name gre_name
440    from   hr_organization_units hoi,
441           hr_organization_information info
442    where hoi.organization_id = info.organization_id
443      and info.org_information_context = 'CLASS'
444      and info.org_information1  = 'HR_LEGAL'
445      and hoi.business_group_id  = p_business_group
446      and trunc(nvl(date_to,fnd_date.canonical_to_date(p_start_date)),'Y') >= trunc(fnd_date.canonical_to_date(p_start_date),'Y')
447      and exists (select  '1' from pay_us_asg_reporting puar
448                  where puar.tax_unit_id = info.organization_id
449                    and puar.jurisdiction_code like cv_jurisdiction)
450    group by info.organization_id,hoi.name
451    order by count(*);
452 
453   gre_list    gre_info_list;
454   list_index  number:=1;
455   start_index number:=1;
456   end_index   number:=1;
457   l_req_id    number;
458   copies_buffer varchar2(80) := null;
459   print_buffer  varchar2(80) := null;
460   printer_buffer  varchar2(80) := null;
461   style_buffer  varchar2(80) := null;
462   save_buffer  boolean := null;
463   save_result  varchar2(1) := null;
464   req_id  varchar2(80) := null;
465   x boolean;
466   x1 boolean;
467 
468   c_jurisdiction    varchar2(15);
469 /* Bug 3376256  added local variable to hold the substring of p_county  */
470   lv_County         varchar2(15);
471 --
472 --
473 begin
474   -- initialise variable - 0 is SRS Success, 1 is SRS Warning, 2 is SRS Error
475   retcode := 0;
476   -- get printing info
477   req_id:=fnd_profile.value('CONC_REQUEST_ID');
478   print_buffer:=fnd_profile.value('CONC_PRINT_TOGETHER');
479    if (print_buffer is NULL)
480    then print_buffer:='N';
481    end if;
482 
483   select number_of_copies,
484         printer,
485         print_style,
486         save_output_flag
487   into  copies_buffer,
488         printer_buffer,
489         style_buffer,
490         save_result
491   from  fnd_concurrent_requests
492   where request_id = fnd_number.canonical_to_number(req_id);
493 
494   if (save_result='Y') then
495     save_buffer:=true;
496   elsif (save_result='N') then
497     save_buffer:=false;
498   else
499     save_buffer:=NULL;
500   end if;
501 
502 /* New Logic */
503 
504    If p_locality_type is null then
505 
506       if p_state is null then
507 
508          c_jurisdiction := null;
509       else
510          c_jurisdiction := p_state||'%';
511 
512       end if;
513 
514    else /* p_locality_type */
515 
516       if p_city is null then
517 
518          if p_county is null then
519 
520             if p_school is null then
521 
522               /*11926304 added*/
523               IF p_psd is null then
524                 c_jurisdiction := null;
525               ELSE
526                 c_jurisdiction := '39%'||p_psd||'%';
527               END IF;
528               /*11926304 end*/
529             else
530                c_jurisdiction := p_school;
531 
532             end if; /* school */
533 
534          else /* county */
535 
536 /* Bug 3376256: select the first 6 characters from p_county and assign to c_jurisdiction   */
537 
538  		Begin
539 			Select Substr(p_county, 1, 6)
540 			Into	lv_County
541 			From	Dual;
542 		Exception
543 			When Others Then
544 				lv_County := Null;
545 		End;
546               c_jurisdiction := lv_County||'%';
550 
547 
548 /* End Bug 3376256                              */
549          end if; /* county */
551       else  /* city */
552          c_jurisdiction := p_city;
553 
554       end if; /* city */
555 
556   end if; /* p_locality_type */
557 
558     if (p_gre is null and c_jurisdiction is null ) then
559 
560      for  grerec in gre_sizes loop
561        gre_list(list_index).gre_size :=grerec.gre_size;
562        gre_list(list_index).gre_id   :=grerec.gre_id;
563        gre_list(list_index).gre_name :=grerec.gre_name;
564 
565        list_index:=list_index+1;
566      end loop;
567 
568   elsif (p_gre is not null and c_jurisdiction is null ) then
569 
570      for  grerec in gre_sizes_gre loop
571        gre_list(list_index).gre_size :=grerec.gre_size;
572        gre_list(list_index).gre_id   :=grerec.gre_id;
573        gre_list(list_index).gre_name :=grerec.gre_name;
574 
575        list_index:=list_index+1;
576      end loop;
577 
578   elsif (p_gre is not null and c_jurisdiction is not null) then
579 
580      for  grerec in gre_sizes_gre_juri(c_jurisdiction ) loop
581        gre_list(list_index).gre_size :=grerec.gre_size;
582        gre_list(list_index).gre_id   :=grerec.gre_id;
583        gre_list(list_index).gre_name :=grerec.gre_name;
584 
585        list_index:=list_index+1;
586      end loop;
587 
588   else /* (p_gre is null and c_jurisdiction is not null) */
589 
590      for  grerec in gre_sizes_juri(c_jurisdiction ) loop
591        gre_list(list_index).gre_size :=grerec.gre_size;
592        gre_list(list_index).gre_id   :=grerec.gre_id;
593        gre_list(list_index).gre_name :=grerec.gre_name;
594 
595        list_index:=list_index+1;
596      end loop;
597 
598   end if;
599 
600   -- read data into table
601 /* ORIGINAL CODE
602   for  grerec in gre_sizes(p_business_group,p_gre,p_state) loop
603     gre_list(list_index).gre_size:=grerec.gre_size;
604     gre_list(list_index).gre_id   :=grerec.gre_id;
605     gre_list(list_index).gre_name :=grerec.gre_name;
606 
607     list_index:=list_index+1;
608   end loop;
609 
610 */
611   -- get start of list
612   start_index:=1;
613   -- get end of list
614   end_index:=list_index-1;
615   -- loop round from both ends working inwards
616   while (start_index<end_index) loop
617     -- set print options
618     x:=FND_REQUEST.set_print_options(
619                    printer        => printer_buffer,
620                    style          => style_buffer,
621                    copies         => copies_buffer,
622                    save_output    => save_buffer,
623                    print_together => print_buffer);
624 
625 -- Bug 3487186 Added by ssmukher
626     x1 := fnd_Request.USE_CURRENT_NOTIFICATION;
627     -- submit requests for report
628     l_req_id:=fnd_request.submit_request(
629                             application    => 'PAY',
630                             program        => 'PYLOCTRR',
631                             argument1      => gre_list(start_index).gre_name,
632                             argument2      => p_business_group,
633                             argument3      => p_start_date,
634                             argument4      => p_end_date,
635                             argument5      => gre_list(start_index).gre_id,
636                             argument6      => p_state,
637 			    argument7	   => p_locality_type,
638                             argument8      => p_is_city,
639                             argument9      => p_city,
640                             argument10     => p_is_county,
641                             argument11     => p_county,
642                             argument12     => p_is_school,
643                             argument13     => p_school,
644                             argument14     => p_is_psd,   --  #11926304
645                             argument15     => p_psd,      --  #11926304
646                             argument16     => p_sort_option_1,
647                             argument17     => p_sort_option_2,
648                             argument18     => p_sort_option_3,
649                             argument19     => p_dimension);
650     -- set print options
651     x:=FND_REQUEST.set_print_options(
652                    printer        => printer_buffer,
653                    style          => style_buffer,
654                    copies         => copies_buffer,
655                    save_output    => save_buffer,
656                    print_together => print_buffer);
657 
658     -- Bug 3487186 Added by ssmukher
659     x1 := fnd_Request.USE_CURRENT_NOTIFICATION;
660 
661     l_req_id:=fnd_request.submit_request(
662                             application    => 'PAY',
663                             program        => 'PYLOCTRR',
664                             argument1      => gre_list(end_index).gre_name,
665                             argument2      => p_business_group,
666                             argument3      => p_start_date,
667                             argument4      => p_end_date,
668                             argument5      => gre_list(end_index).gre_id,
669                             argument6      => p_state,
670                             argument7      => p_locality_type,
671                             argument8      => p_is_city,
672                             argument9      => p_city,
673                             argument10     => p_is_county,
674                             argument11     => p_county,
675                             argument12     => p_is_school,
676                             argument13     => p_school,
680                             argument17     => p_sort_option_2,
677                             argument14     => p_is_psd,   --  #11926304
678                             argument15     => p_psd,      --  #11926304
679                             argument16     => p_sort_option_1,
681                             argument18     => p_sort_option_3,
682                             argument19     => p_dimension);
683     -- get next values
684     start_index:=start_index+1;
685     end_index:=end_index-1;
686     --
687 
688   end loop;
689   -- submit for middle value in list if odd number of gre's
690   if (start_index=end_index) then
691     -- set print options
692     x:=FND_REQUEST.set_print_options(
693                    printer        => printer_buffer,
694                    style          => style_buffer,
695                    copies         => copies_buffer,
696                    save_output    => save_buffer,
697                    print_together => print_buffer);
698 
699   -- Bug 3487186 Added by ssmukher
700     x1 := fnd_Request.USE_CURRENT_NOTIFICATION;
701     l_req_id:=fnd_request.submit_request(
702                             application    => 'PAY',
703                             program        => 'PYLOCTRR',
704                             argument1      => gre_list(start_index).gre_name,
705                             argument2      => p_business_group,
706                             argument3      => p_start_date,
707                             argument4      => p_end_date,
708                             argument5      => gre_list(start_index).gre_id,
709                             argument6      => p_state,
710                             argument7      => p_locality_type,
711                             argument8      => p_is_city,
712                             argument9      => p_city,
713                             argument10     => p_is_county,
714                             argument11     => p_county,
715                             argument12     => p_is_school,
716                             argument13     => p_school,
717                             argument14     => p_is_psd,   --  #11926304
718                             argument15     => p_psd,      --  #11926304
719                             argument16     => p_sort_option_1,
720                             argument17     => p_sort_option_2,
721                             argument18     => p_sort_option_3,
722                             argument19     => p_dimension);
723   end if;
724 EXCEPTION
725   --
726    WHEN hr_utility.hr_error THEN
727      --
728      -- Set up error message and error return code.
729      --
730      errbuf  := hr_utility.get_message;
731      retcode := 2;
732 
733    WHEN others THEN
734      -- Set up error message and return code.
735      --
736      errbuf  := sqlerrm;
737      retcode := 2;
738 end local_trr;
739 end PAY_US_TRR_ENGINE_PKG;