DBA Data[Home] [Help]

PACKAGE BODY: APPS.JG_ZZ_AUDIT_GL_PKG

Source


1 PACKAGE BODY JG_ZZ_AUDIT_GL_PKG
2 -- $Header: jgzzauditglb.pls 120.7.12020000.2 2012/09/06 09:21:10 abhijsar ship $
3 -- +======================================================================+
4 -- | Copyright (c) 1996 Oracle Corporation Redwood Shores, California, USA|
5 -- |                       All rights reserved.                           |
6 -- +======================================================================+
7 -- NAME:        JG_ZZ_AUDIT_GL_PKG
8 --
9 -- DESCRIPTION: This package is the default package for the Audit GL reports
10 --              data template.
11 --
12 -- NOTES:
13 --
14 --
15 -- Change Record:                                                     |
16 -- ===============
17 -- Version   Date        Author           Remarks
18 -- =======   ==========  =============    ================================
19 -- DRAFT1A   06-Feb-2006 VIJAY GOYAL      Initial version
20 -- DRAFT1B   22-Feb-2006 VIJAY GOYAL      Modified as per review comments.
21 -- 120.2     27-Apr-2007 Brathod          Bug:5192284, Modified column jg_info_n3 to jg_info_v17 for inserting
22 --                                        taxpayer_id (char value) in the insert into global temp table
23 -- 120.3     31-May-2006 Rukmani Basker   Bug:5248556 Fixed issues identified
24 --					  during UT for ECE GL VAT Register.
25 -- 120.4     27-Jun-2006 Suresh.Pasupunuri Bug: 5248556Fixed issues reported in the bug.
26 -- 120.5     04-Aug-2005 Venkataramanan S  Bug 5194991 : Incorporated the reprint functionality
27 -- +======================================================================+
28 AS
29 
30 FUNCTION beforeReport RETURN BOOLEAN
31 -- +======================================================================+
32 -- | Name :              beforeReport                                     |
33 -- | Description :       This procedure processes the data before the     |
34 -- |                     execution of report.                             |
35 -- |                                                                      |
36 -- +======================================================================+
37 IS
38 
39 l_func_curr_code      VARCHAR2(240);
40 l_rep_legal_entity    VARCHAR2(240);
41 l_trn                 VARCHAR2(240);
42 l_rep_legal_entity_id NUMBER;
43 l_period_start_date   DATE;
44 l_period_end_date     DATE;
45 l_reporting_mode      VARCHAR2(240);
46 
47 l_taxpayer_id          jg_zz_vat_trx_details.taxpayer_id%TYPE;
48 l_company_name         xle_registrations.registered_name%TYPE;
49 l_registration_number  xle_registrations.registration_number%TYPE;
50 l_country              hz_locations.country%TYPE;
51 l_address1             hz_locations.address1%TYPE;
52 l_address2             hz_locations.address2%TYPE;
53 l_address3             hz_locations.address3%TYPE;
54 l_address4             hz_locations.address4%TYPE;
55 l_city                 hz_locations.city%TYPE;
56 l_postal_code          hz_locations.postal_code%TYPE;
57 l_contact              hz_parties.party_name%TYPE;
58 l_phone_number         hz_contact_points.phone_number%TYPE;
59 l_period_year          NUMBER;
60 
61 l_calendar_name             jg_zz_vat_rep_entities.tax_calendar_name%TYPE;
62 l_enable_register_flag      jg_zz_vat_rep_entities.enable_registers_flag%TYPE;
63 l_enable_report_seq_flag    jg_zz_vat_rep_entities.enable_report_sequence_flag%TYPE;
64 l_enable_alloc_flag         jg_zz_vat_rep_entities.enable_allocations_flag%TYPE;
65 l_enable_annual_alloc_flag  jg_zz_vat_rep_entities.enable_annual_allocation_flag%TYPE;
66 l_threshold_amt             jg_zz_vat_rep_entities.threshold_amount%TYPE;
67  -- Added for Glob-006 ER
68 l_province                      VARCHAR2(120);
69 l_comm_num                      VARCHAR2(30);
70 l_vat_reg_num                   VARCHAR2(50);
71 
72 
73 
74  CURSOR c_get_ledger_id
75  IS
76   SELECT  NVL(cfg.ledger_id,glp.ledger_id)
77   FROM   jg_zz_vat_rep_entities cfg,
78          jg_zz_vat_rep_entities cfgd,
79          gl_ledger_le_v glp
80   WHERE  cfg.vat_reporting_entity_id =  P_VAT_REP_ENTITY_ID
81   AND ( ( cfg.entity_type_code  = 'ACCOUNTING'
82 	  AND cfg.mapping_vat_rep_entity_id = cfgd.vat_reporting_entity_id
83 	  AND glp.legal_entity_id = cfgd.legal_entity_id)
84       OR
85        ( cfg.entity_type_code  = 'LEGAL'
86 	     AND cfg.vat_reporting_entity_id = cfgd.vat_reporting_entity_id
87 	     AND glp.legal_entity_id = cfg.legal_entity_id)
88       )
89   AND glp.ledger_category_code = 'PRIMARY';
90 
91 BEGIN
92    FND_FILE.PUT_LINE(FND_FILE.LOG,'begin-1');
93 
94    jg_zz_common_pkg.funct_curr_legal( x_func_curr_code     => l_func_curr_code
95                                    , x_rep_entity_name    => l_rep_legal_entity
96                                    , x_legal_entity_id    => l_rep_legal_entity_id
100                                    , pn_period_year       => l_period_year
97                                    , x_taxpayer_id        => l_taxpayer_id
98                                    , pn_vat_rep_entity_id => p_vat_rep_entity_id
99                                    , pv_period_name       => p_period
101                                    );
102    FND_FILE.PUT_LINE(FND_FILE.LOG,'tax_registration-2');
103    jg_zz_common_pkg.tax_registration(x_tax_registration    => l_trn
104                                    , x_period_start_date  => l_period_start_date
105                                    , x_period_end_date    => l_period_end_date
106                                    , x_status             => l_reporting_mode
107                                    , pn_vat_rep_entity_id => p_vat_rep_entity_id
108                                    , pv_period_name       => p_period
109                                    , pv_source            => 'GL'
110                                    );
111       FND_FILE.PUT_LINE(FND_FILE.LOG,'company_detail-3');
112 
113     l_reporting_mode := JG_ZZ_VAT_REP_UTILITY.get_period_status(pn_vat_reporting_entity_id => p_vat_rep_entity_id
114                                                                  ,pv_tax_calendar_period => p_period
115                                                                  ,pv_tax_calendar_year => null
116                                                                  ,pv_source => NULL
117                                                                  ,pv_report_name => p_callingreport);
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_rep_legal_entity_id
134                                   ,p_vat_reporting_entity_id => P_VAT_REP_ENTITY_ID);
135 
136 
137     FND_FILE.PUT_LINE(FND_FILE.LOG,'get_entities_configuration_dtl - 4');
138 
139    jg_zz_common_pkg.get_entities_configuration_dtl(
140                                   x_calendar_name    => g_tax_calendar_name --l_calendar_name
141                                 , x_enable_register_flag   => l_enable_register_flag
142                                 , x_enable_report_seq_flag => l_enable_report_seq_flag
143                                 , x_enable_alloc_flag      => l_enable_alloc_flag
144                                 , x_enable_annual_alloc_flag => l_enable_annual_alloc_flag
145                                 , x_threshold_amt       => l_threshold_amt
146 				, x_entity_identifier    => g_entity_identifier
147                                 , p_vat_rep_entity_id   => p_vat_rep_entity_id
148                                    );
149 
150    -- For getting the ledger id.
151 
152    OPEN c_get_ledger_id;
153    FETCH c_get_ledger_id INTO g_ledger_id;
154    CLOSE c_get_ledger_id;
155 
156    FND_FILE.PUT_LINE(FND_FILE.LOG,'g_ledger_id :'||g_ledger_id);
157    FND_FILE.PUT_LINE(FND_FILE.LOG,'g_tax_calendar_name:'||g_tax_calendar_name);
158 
159       FND_FILE.PUT_LINE(FND_FILE.LOG,'insert JG_ZZ_VAT_TRX_GT-5');
160    INSERT INTO JG_ZZ_VAT_TRX_GT(
161                                     jg_info_v1
162                                   , jg_info_v2
163                                   , jg_info_v3
164                                   , jg_info_v4
165                                   , jg_info_v5
166                                   , jg_info_v6
167                                   , jg_info_v7
168                                   , jg_info_v8
169                                   , jg_info_v9
170                                   , jg_info_v10
171                                   , jg_info_v11
172                                   , jg_info_v12
173                                   , jg_info_v13
174                                   , jg_info_v14
175                                   , jg_info_v15
176                                   , jg_info_n1
177                                   , jg_info_n2
178                                   , jg_info_v17
179                                   , jg_info_d1
180                                   , jg_info_d2
181                                   , jg_info_v16
182 				  , jg_info_v18
183                                    )
184                              VALUES
185                                    (
186                                     l_func_curr_code      -- curr_code
187                                   , l_company_name        -- l_rep_legal_entity    -- entity_name
188                                   , l_company_name        -- company_name
189                                   , l_registration_number -- registration_number
190                                   , l_country             -- country
191                                   , l_address1            -- address1
192                                   , l_address2            -- address2
193                                   , l_address3            -- address3
194                                   , l_address4            -- address4
195                                   , l_city                -- city
196                                   , l_postal_code         -- postal_code
197                                   , l_contact             -- contact
198                                   , l_phone_number        -- phone_number
199                                   , l_reporting_mode      -- reporting mode
200                                   , l_trn                 -- trn
201                                   , l_rep_legal_entity_id -- legalentity_id
202                                   , l_period_year         -- period_year
203                                   , l_registration_number -- l_taxpayer_id         -- taxpayer_id
204                                   , l_period_start_date   -- period_start_date
205                                   , l_period_end_date     -- period_end_date
206                                   , 'H'                   -- Header record indicator
207 				  , l_enable_report_seq_flag -- Enable Report Seq Flag
208                                    );
209    FND_FILE.PUT_LINE(FND_FILE.LOG,'return-5');
210    RETURN (TRUE);
211 EXCEPTION
212 WHEN OTHERS THEN
213    FND_FILE.PUT_LINE(FND_FILE.LOG,'An unexpected error occured in before report ' ||SUBSTR(SQLERRM,1,200));
214    RETURN (FALSE);
215 END beforeReport;
216 
217 FUNCTION get_entity_identifier RETURN varchar2
218 -- +======================================================================+
219 -- | Name :		get_entity_identifier                             |
220 -- | Description :      This function to accessing the global variable    |
221 -- |                    g_entity_identifier ind the data template         |
222 -- |                                                                      |
223 -- +======================================================================+
224 IS
225 BEGIN
226 
227 RETURN g_entity_identifier;
228 
229 END;
230 
231 
232 FUNCTION get_ledger_id RETURN NUMBER
233 -- +======================================================================+
234 -- | Name :		get_ledger_id                                     |
235 -- | Description :      This function to accessing the global variable    |
236 -- |                    g_ledger_id in the data template                  |
237 -- |                                                                      |
238 -- +======================================================================+
239 IS
240 BEGIN
241 RETURN g_ledger_id;
242 END;
243 
244 FUNCTION get_tax_calendar_name RETURN VARCHAR2
245 -- +======================================================================+
246 -- | Name :		 get_tax_calendar_name                            |
247 -- | Description :      This function to accessing the global variable    |
248 -- |                     g_tax_calendar_name in the data template         |
249 -- |                                                                      |
250 -- +======================================================================+
251 IS
252 BEGIN
253 RETURN  g_tax_calendar_name;
254 END;
255 
256 
257 
258 END JG_ZZ_AUDIT_GL_PKG;