DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_GB_WNU_EDI_BIP

Source


1 package body pay_gb_wnu_edi_bip as
2 /* $Header: PYGBWNU.pkb 120.1 2010/05/14 08:30:20 dwkrishn noship $ */
3 
4 
5 function beforereport return boolean is
6 
7 l_wrap_point number;
8 l_employers_address_line varchar2(500);
9 
10 cursor empl_address_line is
11 select 	nvl(upper(hoi.org_information4),' ') employers_address_line
12 from   pay_payroll_actions pact,
13 	   hr_organization_information hoi
14 where  pact.payroll_action_id = p_payroll_action_id
15 and    pact.business_group_id = hoi.organization_id
16 and    hoi.org_information_context = 'Tax Details References'
17 and    nvl(hoi.org_information10,'UK') = 'UK'
18 and    substr(pact.legislative_parameters,instr(pact.legislative_parameters,'TAX_REF=') + 8,
19 	   instr(pact.legislative_parameters||' ',' ', instr(pact.legislative_parameters,'TAX_REF=')+8) -
20 	   instr(pact.legislative_parameters, 'TAX_REF=') - 8) = hoi.org_information1;
21 
22 begin
23 
24 
25 	open empl_address_line;
26 	fetch empl_address_line into l_employers_address_line;
27 	close empl_address_line;
28 
29 
30 
31 	g_address1 := l_employers_address_line;
32 
33 	if length(g_address1) > 35 then
34 	  l_wrap_point := instr(g_address1, ',', 34-length(g_address1));
35 
36 		if l_wrap_point = 0 then
37 		  l_wrap_point := 35;
38 		  g_address2 := ltrim(substr(g_address1,1+l_wrap_point),' ,');
39 		  g_address1 := substr(g_address1,1,l_wrap_point);
40 		end if;
41 	end if;
42 
43 
44 
45 	if length(g_address2) > 35 then
46 	  l_wrap_point := instr(g_address2, ',', 34-length(g_address2));
47 		if l_wrap_point = 0 then
48 		  l_wrap_point := 35;
49 		  g_address3 := ltrim(substr(g_address2,1+l_wrap_point),' ,');
50 		  g_address2 := substr(g_address2,1,l_wrap_point);
51 		end if;
52 	end if;
53 
54 
55 
56 	if length(g_address3) > 35 then
57 	  l_wrap_point := instr(g_address3, ',', 34-length(g_address3));
58 		if l_wrap_point = 0 then
59 		  l_wrap_point := 35;
60 		  g_address4 := ltrim(substr(g_address3,1+l_wrap_point),' ,');
61 		  g_address3 := substr(g_address3,1,l_wrap_point);
62 		end if;
63 	end if;
64 
65 
66 
67      return true;
68 end beforereport;
69 
70 function cp_address_1 return varchar2 is
71 begin
72   return g_address1;
73 end;
74 
75 function cp_address_2 return varchar2 is
76 begin
77   return g_address2;
78 end;
79 
80 
81 function cp_address_3 return varchar2 is
82 begin
83   return g_address3;
84 end;
85 
86 
87 function cp_address_4 return varchar2 is
88 begin
89   return g_address4;
90 end;
91 
92 function cp_address_5 return varchar2 is
93 begin
94   return g_address5;
95 end;
96 
97 
98 END pay_gb_wnu_edi_bip;