DBA Data[Home] [Help]

PACKAGE BODY: APPS.JG_ZZ_AUDIT_AP_PKG

Source


1 PACKAGE BODY JG_ZZ_AUDIT_AP_PKG
2 -- $Header: jgzzauditapb.pls 120.5.12010000.2 2009/04/28 15:27:07 pakumare ship $
3 -- +======================================================================+
4 -- | Copyright (c) 1996 Oracle Corporation Redwood Shores, California, USA|
5 -- |                       All rights reserved.                           |
6 -- +======================================================================+
7 -- NAME:        JG_ZZ_AUDIT_AP_PKG
8 --
9 -- DESCRIPTION: This Package is the default Package containing the Procedures
10 --              used by AUDIT-AP Extract
11 --
12 -- NOTES:
13 --
14 -- Change Record:
15 -- ===============
16 -- Version   Date        Author                     Remarks
17 -- =======  ===========  =========================  =======================+
18 -- DRAFT 1A 04-Feb-2006  Amit Basu                  Initial draft version
19 -- DRAFT 1B 21-Feb-2006  Amit Basu                  Updated with Review
20 --                                                  comments from IDC
21 -- 120.2    13/06/2006   Bhavik Rathod              Bug: 5308160.  Please refer bug for details regarding the changes done.
22 -- 120.3    04-Aug-2005  Venkataramanan S           Bug 5194991 : Incorporated the reprint functionality
23 -- +=======================================================================+
24 AS
25 
26   -- Declare global variables
27 
28   l_func_curr_code       VARCHAR2(10);
29   l_rep_entity_name      VARCHAR2(100);
30   l_legal_entity_id      NUMBER;
31   l_taxpayer_id          VARCHAR2(50);
32   l_tax_registration     VARCHAR2(50);
33   l_tax_registration_to  VARCHAR2(50); -- Bug#8453182
34   l_period_start_date    DATE;
35   l_period_end_date      DATE;
36   l_period_start_date_to DATE; -- Bug#8453182
37   l_period_end_date_to   DATE; -- Bug#8453182
38   l_status               VARCHAR2(50);
39   l_status_to            VARCHAR2(50); -- Bug#8453182
40   l_company_name         VARCHAR2(100);
41   l_registration_number  VARCHAR2(50);
42   l_country              VARCHAR2(50);
43   l_address1             VARCHAR2(100);
44   l_address2             VARCHAR2(100);
45   l_address3             VARCHAR2(100);
46   l_address4             VARCHAR2(100);
47   l_city                 VARCHAR2(50);
48   l_postal_code          VARCHAR2(15);
49   l_contact              VARCHAR2(100);
50   l_phone_number         VARCHAR2(15);
51       -- Added for Glob-006 ER
52   l_province                      VARCHAR2(120);
53   l_comm_num                      VARCHAR2(30);
54   l_vat_reg_num                   VARCHAR2(50);
55 
56   FUNCTION beforeReport RETURN BOOLEAN
57   IS
58   BEGIN
59   -- Calling Common Package
60     IF p_debug_flag = 'Y' THEN
61       fnd_file.put_line(fnd_file.log,'Calling jg_zz_common_pkg.funct_curr_legal');
62     END IF;
63 
64    JG_ZZ_COMMON_PKG.FUNCT_CURR_LEGAL(x_func_curr_code      => l_func_curr_code
65                                    ,x_rep_entity_name     => l_rep_entity_name
66                                    ,x_legal_entity_id     => l_legal_entity_id
67                                    ,x_taxpayer_id         => l_taxpayer_id
68                                    ,pn_vat_rep_entity_id  => p_vat_rep_entity_id
69                                    ,pv_period_name        => p_period_name
70                                    ,pn_period_year        => p_period_year
71                                    );
72 
73   fnd_file.put_line(fnd_file.log,'Calling jg_zz_common_pkg.tax_registration');
74   JG_ZZ_COMMON_PKG.TAX_REGISTRATION(x_tax_registration    => l_tax_registration
75                                   ,x_period_start_date   => l_period_start_date
76                                   ,x_period_end_date     => l_period_end_date
77                                   ,x_status              => l_status
78                                   ,pn_vat_rep_entity_id  => p_vat_rep_entity_id
79                                   ,pv_period_name        => p_period_name
80                                   ,pn_period_year        => p_period_year
81                                   ,pv_source             => 'AP'
82                                   );
83 
84 	-- Bug#8453182 Start Below code added to get PERIOD_TO end date
85 	IF nvl(P_REPORT_NAME,'ZZ') = 'JEESDOCE' then
86 
87       fnd_file.put_line(fnd_file.log,'P_REPORT_NAME :'||P_REPORT_NAME);
88 	  fnd_file.put_line(fnd_file.log,'Getting period_to information');
89 
90 	JG_ZZ_COMMON_PKG.TAX_REGISTRATION(x_tax_registration    => l_tax_registration_to
91                                   ,x_period_start_date   => l_period_start_date_to
92                                   ,x_period_end_date     => l_period_end_date_to
93                                   ,x_status              => l_status_to
94                                   ,pn_vat_rep_entity_id  => p_vat_rep_entity_id
95                                   ,pv_period_name        => p_period_name_to
96                                   ,pn_period_year        => p_period_year
97                                   ,pv_source             => 'AP'
98                                   );
99 	END IF;
100 
101 	-- Bug#8453182 End
102 
103   fnd_file.put_line(fnd_file.log,'Calling jg_zz_common_pkg.company_detail');
104  /* JG_ZZ_COMMON_PKG.COMPANY_DETAIL (x_company_name         => l_company_name
105                                  ,x_registration_number  => l_registration_number
106                                  ,x_country              => l_country
107                                  ,x_address1             => l_address1
108                                  ,x_address2             => l_address2
109                                  ,x_address3             => l_address3
110                                  ,x_address4             => l_address4
111                                  ,x_city                 => l_city
112                                  ,x_postal_code          => l_postal_code
113                                  ,x_contact              => l_contact
114                                  ,x_phone_number         => l_phone_number
115                                  ,pn_legal_entity_id     => l_legal_entity_id
116                                  );
117 */
118 
119   jg_zz_common_pkg.company_detail(x_company_name            => l_company_name
120                                   ,x_registration_number    => l_registration_number
121                                   ,x_country                => l_country
122                                   ,x_address1               => l_address1
123                                   ,x_address2               => l_address2
124                                   ,x_address3               => l_address3
125                                   ,x_address4               => l_address4
126                                   ,x_city                   => l_city
127                                   ,x_postal_code            => l_postal_code
128                                   ,x_contact                => l_contact
129                                   ,x_phone_number           => l_phone_number
130                                   ,x_province               => l_province
131                                   ,x_comm_number            => l_comm_num
132                                   ,x_vat_reg_num            => l_vat_reg_num
133                                   ,pn_legal_entity_id       => l_legal_entity_id
134                                   ,p_vat_reporting_entity_id =>p_vat_rep_entity_id) ;
135 
136     l_status := JG_ZZ_VAT_REP_UTILITY.get_period_status(pn_vat_reporting_entity_id => p_vat_rep_entity_id
137                                                                  ,pv_tax_calendar_period => p_period_name
138                                                                  ,pv_tax_calendar_year => p_period_year
139                                                                  ,pv_source => NULL
140                                                                  ,pv_report_name => p_report_name);
141     INSERT INTO jg_zz_vat_trx_gt
142             (
143               jg_info_v1      -- Func Currency
144              ,jg_info_v2      -- LE Entity Name
145              ,jg_info_n1      -- LE Id
146              ,jg_info_v3      -- LE Tax Payer ID
147              ,jg_info_v4      -- LE Tax Registration Number
148              ,jg_info_d1      -- Period Start Date
149              ,jg_info_d2      -- Period End Date
150              ,jg_info_v5      -- Status
151              ,jg_info_v6      -- Company Name
152              ,jg_info_v16     -- Registration Number --brathod, using jg_info_v16  instead of jg_info_n2
153              ,jg_info_v7      -- Country
154              ,jg_info_v8      -- Address1
155              ,jg_info_v9      -- Address2
156              ,jg_info_v10     -- Address3
157              ,jg_info_v11     -- Address4
158              ,jg_info_v12     -- City
159              ,jg_info_v13     -- Postal Code
160              ,jg_info_v14     -- Contact Person
161              ,jg_info_v15     -- Phone Number
162              ,jg_info_v30
163              )
164       VALUES(
165               l_func_curr_code
166              ,l_company_name  ----l_rep_entity_name changed for bug # 5494424
167              ,l_legal_entity_id
168              ,l_registration_number ---l_taxpayer_id changed for bug # 5494424
169              ,l_tax_registration
170              ,l_period_start_date
171              ,decode(nvl(P_REPORT_NAME,'ZZ'),'JEESDOCE',l_period_end_date_to,l_period_end_date)
172              ,l_status
173              ,l_company_name
174              ,l_registration_number
175              ,l_country
176              ,l_address1
177              ,l_address2
178              ,l_address3
179              ,l_address4
180              ,l_city
181              ,l_postal_code
182              ,l_contact
183              ,l_phone_number
184              ,'H'
185              );
186 RETURN (TRUE);
187  EXCEPTION
188   WHEN OTHERS THEN
189     fnd_file.put_line(fnd_file.log,'Error while processing Before Report Trigger' || SQLCODE || SUBSTR(SQLERRM,1,200));
190    RETURN (FALSE);
191    END beforeReport;
192   END JG_ZZ_AUDIT_AP_PKG;