DBA Data[Home] [Help]

PACKAGE BODY: APPS.XLE_THIRDPARTY

Source


1 PACKAGE BODY XLE_THIRDPARTY AS
2 /* $Header: xlethpab.pls 120.10 2005/11/25 11:31:17 bsilveir ship $ */
3 
4 G_PKG_NAME CONSTANT VARCHAR2(30):=' XLE_THIRDPARTY';
5 
6 
7 /*==============================================================================+
8  | PROCEDURE                                                                 	|
9  |    Get_LegalInformation		                                     	|
10  |                                                                           	|
11  | DESCRIPTION                                                               	|
12  |    Get Business Entity's legal information 				     	|
13  |	   --> Legal Name							|
14  |         --> Registration Number						|
15  |         --> Date Of Birth							|
16  |         --> Place Of Birth							|
17  |	   --> Company Activity Code						|
18  |	   --> Legal Address							|
19  |									  	|
20  | SCOPE - PUBLIC     								|
21  |                                                                          	|
22  |                                                                           	|
23  | MODIFICATION HISTORY                                                      	|
24  |     17-JUN-2004  	Yvonne RAKOTONIRAINY      	Created	             	|
25  |									  	|
26  +==============================================================================*/
27 
28 PROCEDURE Get_LegalInformation(
29 
30   	--   *****  Standard API parameters *****
31  	p_api_version           	IN	NUMBER,
32   	p_init_msg_list	        	IN	VARCHAR2,
33   	p_commit			IN	VARCHAR2,
34   	x_return_status         	OUT     NOCOPY  VARCHAR2,
35   	x_msg_count	        	OUT	NOCOPY NUMBER,
36 	x_msg_data			OUT	NOCOPY VARCHAR2,
37 
38 	--   *****  Business Entity information parameters *****
39 	p_business_entity_type          IN      VARCHAR2,
40 	p_business_entity_id            IN      NUMBER,
41 	p_business_entity_site_id       IN      NUMBER,
42 	p_country               	IN      VARCHAR2,
43 	p_legal_function	        IN      VARCHAR2,
44         p_legislative_category          IN      VARCHAR2,
45 	x_legal_information_rec		OUT     NOCOPY LegalInformation_Rec)
46 
47 
48 IS
49 
50 l_api_name	    CONSTANT VARCHAR2(30) 	:='Get_LegalInformation';
51 l_api_version       CONSTANT NUMBER 		:=1.0;
52 
53 
54 --   *****  Business entity type is SUPPLIER *****
55 -- For Italy
56 CURSOR  case1_legal_information_cur IS
57   SELECT pvs.vendor_site_code,
58   	 pv.num_1099,
59 	 pv.global_attribute2,
60 	 pv.global_attribute3,
61 	 pv.standard_industry_class,
62 	 pvs.address_line1,
63          pvs.address_line2,
64          pvs.address_line3,
65          pvs.city,
66          pvs.zip,
67 	 pvs.province,
68 	 pvs.country,
69 	 pvs.state
70   FROM   PO_VENDOR_SITES_ALL pvs,
71  	 PO_VENDORS pv
72   WHERE  pv.vendor_id=p_business_entity_id
73  	 AND pvs.vendor_site_id=p_business_entity_site_id
74 	 AND pvs.country=p_country
75 	 AND pv.vendor_id=pvs.vendor_id;
76 
77 -- For Spain, Greece
78 CURSOR  case2_legal_information_cur IS
79   SELECT decode(pvs.country,'ES',pv.vendor_name,'GR',pvs.vendor_site_code),
80 	 pv.num_1099,
81 	 pv.global_attribute2,
82 	 pv.global_attribute3,
83 	 pv.standard_industry_class,
84 	 pvs.address_line1,
85   	 pvs.address_line2,
86          pvs.address_line3,
87          pvs.city,
88          pvs.zip,
89 	 pvs.province,
90 	 pvs.country,
91          pvs.state
92   FROM   PO_VENDOR_SITES_ALL pvs,
93 	 PO_VENDORS pv
94   WHERE  pv.vendor_id=p_business_entity_id
95          AND pvs.tax_reporting_site_flag='Y'
96 	 AND pvs.country=p_country
97 	 AND pv.vendor_id=pvs.vendor_id;
98 
99 
100 
101 BEGIN
102 
103   x_msg_count				:=	NULL;
104   x_msg_data				:=	NULL;
105 
106 
107   -- Standard call to check for call compatibility.
108   IF NOT FND_API.Compatible_API_Call ( 	l_api_version,
109   					p_api_version,
110    	       	    	                l_api_name,
111 		    	                G_PKG_NAME ) THEN
112     RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
113   END IF;
114 
115   -- Initialize message list if p_init_msg_list is set to TRUE.
116   IF FND_API.to_Boolean( p_init_msg_list ) THEN
117     FND_MSG_PUB.initialize;
118   END IF;
119 
120   -- Initialize API return status to success
121   x_return_status := FND_API.G_RET_STS_SUCCESS;
122 
123    /*-----------------------------------------------+
124    |   ========  START OF API BODY  ============    |
125    +-----------------------------------------------*/
126 
127   --   *****  Business entity type is SUPPLIER *****
128   IF p_business_entity_type='SUPPLIER' THEN
129 
130     -- Legal Information for Italy
131     IF p_country='IT' THEN
132 
133       OPEN case1_legal_information_cur;
137         x_legal_information_rec.date_of_birth,
134       FETCH case1_legal_information_cur INTO
135       	x_legal_information_rec.legal_name,
136         x_legal_information_rec.registration_number,
138         x_legal_information_rec.place_of_birth,
139 	x_legal_information_rec.company_activity_code,
140         x_legal_information_rec.address_line1,
141         x_legal_information_rec.address_line2,
142         x_legal_information_rec.address_line3,
143         x_legal_information_rec.city,
144         x_legal_information_rec.zip,
145         x_legal_information_rec.province,
146         x_legal_information_rec.country,
147 	x_legal_information_rec.state;
148 
149         IF case1_legal_information_cur%NOTFOUND THEN
150 	  --specific xle message under creation fnd message used as workaround
151           FND_MESSAGE.SET_NAME('FND','FND_GRANTS_RECORD_NOT_FOUND');
152           FND_MSG_PUB.Add;
153           x_return_status := FND_API.G_RET_STS_ERROR;
154         END IF;
155 
156 
157       CLOSE case1_legal_information_cur;
158 
159 
160     -- Legal Information for Spain and Greece
161     ELSIF p_country in ('ES','GR') THEN
162 
163       OPEN case2_legal_information_cur;
164       FETCH case2_legal_information_cur INTO
165       	x_legal_information_rec.legal_name,
166         x_legal_information_rec.registration_number,
167         x_legal_information_rec.date_of_birth,
168         x_legal_information_rec.place_of_birth,
169 	x_legal_information_rec.company_activity_code,
170         x_legal_information_rec.address_line1,
171         x_legal_information_rec.address_line2,
172         x_legal_information_rec.address_line3,
173         x_legal_information_rec.city,
174         x_legal_information_rec.zip,
175         x_legal_information_rec.province,
176         x_legal_information_rec.country,
177 	x_legal_information_rec.state;
178 
179         IF case2_legal_information_cur%NOTFOUND THEN
180 	  --specific xle message under creation fnd message used as workaround
181           FND_MESSAGE.SET_NAME('FND','FND_GRANTS_RECORD_NOT_FOUND');
182           FND_MSG_PUB.Add;
183           x_return_status := FND_API.G_RET_STS_ERROR;
184         END IF;
185 
186 
187       CLOSE case2_legal_information_cur;
188 
189     END IF;
190 
191   END IF;
192 
193 
194   -- End of API body.
195 
196   -- Standard call to get message count and if count is 1,
197   --get message info.
198   FND_MSG_PUB.Count_And_Get( 	p_count         	=>      x_msg_count ,
199   				p_data          	=>      x_msg_data );
200 
201  EXCEPTION
202 
203       WHEN FND_API.G_EXC_ERROR THEN
204            x_return_status := FND_API.G_RET_STS_ERROR ;
205            FND_MSG_PUB.Count_And_Get(  p_count         	=>      x_msg_count,
206         		               p_data          	=>      x_msg_data);
207 
208       WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
209     	   x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
210     	   FND_MSG_PUB.Count_And_Get(p_count         	=>      x_msg_count,
211                                      p_data         	=>      x_msg_data);
212       WHEN OTHERS THEN
213     	  x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
214       	  IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
215             FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,
216     	    			     l_api_name);
217     	  END IF;
218     	  FND_MSG_PUB.Count_And_Get( p_count         	=>      x_msg_count,
219         		             p_data          	=>      x_msg_data );
220 
221 
222 END Get_LegalInformation;
223 
224 
225 Procedure Get_TP_VATRegistration_PTY
226    (
227     p_api_version           IN	NUMBER,
228   	p_init_msg_list	     	IN	VARCHAR2,
229   	p_commit		        IN	VARCHAR2,
230   	p_effective_date        IN  zx_registrations.effective_from%Type,
231   	x_return_status         OUT NOCOPY  VARCHAR2,
232   	x_msg_count		        OUT	NOCOPY NUMBER,
233 	x_msg_data		        OUT	NOCOPY VARCHAR2,
234 	p_party_id              IN  NUMBER,
235 	p_party_type            IN  VARCHAR2,
236 	x_registration_number   OUT NOCOPY  NUMBER
237    )
238    IS
239 
240    l_api_name			CONSTANT VARCHAR2(30):= 'Get_TP_VATRegistration_PTY';
241    l_api_version        CONSTANT NUMBER := 1.0;
242    l_commit             VARCHAR2(100);
243    l_init_msg_list     VARCHAR2(100);
244 
245 
246   BEGIN
247 
248 
249     IF p_init_msg_list IS NULL THEN
250       l_init_msg_list := FND_API.G_FALSE;
251     ELSE
252 	  l_init_msg_list := p_init_msg_list;
253     END IF;
254 
255     IF p_commit IS NULL THEN
256       l_commit := FND_API.G_FALSE;
257     ELSE
258       l_commit := p_commit;
259     END IF;
260 
261     -- Standard call to check for call compatibility.
262     IF NOT FND_API.Compatible_API_Call ( 	l_api_version        	,
263         	    	    	    	 	p_api_version        	,
264    	       	    	 			l_api_name 	    	,
265 		    	    	    	    	G_PKG_NAME )
266 	THEN
267 		RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
268 	END IF;
269 	-- Initialize message list if p_init_msg_list is set to TRUE.
270 
271 	IF FND_API.to_Boolean( l_init_msg_list ) THEN
272 		FND_MSG_PUB.initialize;
273 	END IF;
274 
275 	--  Initialize API return status to success
276     x_return_status := FND_API.G_RET_STS_SUCCESS;
277 
278 	-- API body
279 
280 
281 	  /* x_registration_number := ZX_TCM_CONTROL_PKG.Get_Default_Tax_Reg (
282 			   							p_party_id,
283  								        p_party_type,
284 									    p_effective_date,
285                                         p_init_msg_list,
286 								    	x_return_status,
287 							            x_msg_count,
288 									    x_msg_data
289        ); */
290 
291 
292 
293     x_registration_number := ZX_API_PUB.get_default_tax_reg
294                                 (
295                             p_api_version  => 1.0 ,
296                             p_init_msg_list => NULL,
297                             p_commit=> NULL,
298                             p_validation_level => NULL,
299                             x_return_status => x_return_status,
300                             x_msg_count => x_msg_count,
301                             x_msg_data  => x_msg_data,
302                             p_party_id => p_party_id,
303                             p_party_type => p_party_type,
304                             p_effective_date =>p_effective_date );
305 
306 
307 	-- Standard call to get message count and if count is 1, get message info.
308 	FND_MSG_PUB.Count_And_Get
309     	(  	p_count         	=>      x_msg_count     	,
310         	p_data          	=>      x_msg_data
311     	);
312 
313 
314 EXCEPTION
315 	WHEN OTHERS THEN
316 	    x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
317 	    x_msg_data := SQLERRM;
318 END;
319 
320 
321 
322 END  XLE_THIRDPARTY;