DBA Data[Home] [Help]

PACKAGE BODY: APPS.JG_EXTENDED_WITHHOLDING_PKG

Source


1 PACKAGE BODY JG_EXTENDED_WITHHOLDING_PKG AS
2 /* $Header: jgexawtb.pls 120.15 2005/10/26 00:15:04 dbetanco ship $ */
3 
4 
5 
6 /**************************************************************************
7  *                          Public Procedures                             *
8  **************************************************************************/
9 
10 
11 /**************************************************************************
12  *                                                                        *
13  * Name       : Jg_Do_Extended_Withholding                                *
14  * Purpose    : Regional Extended Routine for the Withholding Tax         *
15  *              Calculation                                               *
16  *                                                                        *
17  **************************************************************************/
18 FUNCTION JG_DO_EXTENDED_WITHHOLDING
19               (P_Invoice_Id             IN     Number,
20                P_Awt_Date               IN     Date,
21                P_Calling_Module         IN     Varchar2,
22                P_Amount                 IN     Number,
23                P_Payment_Num            IN     Number     Default null,
24                P_Checkrun_Name          IN     Varchar2   Default null,
25                P_Checkrun_id            IN     Number     Default null,
26                P_Last_Updated_By        IN     Number,
27                P_Last_Update_Login      IN     Number,
28                P_Program_Application_Id IN     Number     Default null,
29                P_Program_Id             IN     Number     Default null,
30                P_Request_Id             IN     Number     Default null,
31                P_Invoice_Payment_Id     IN     Number     Default null,
32                P_Check_Id               IN     Number     Default null)
33                RETURN NUMBER
34 IS
35 
36     l_country_code    Varchar2(10);
37     l_awt_success     Varchar2(2000);
38 
39     l_ou_id           NUMBER;
40 
41 BEGIN
42 
43     l_awt_success     := 'SUCCESS';
44 
45     ------------------------
46     -- Get the Country Code
47     ------------------------
48     fnd_profile.get('ORG_ID',l_ou_id);
49     l_country_code := jg_zz_shared_pkg.get_country(l_ou_id, NULL);
50 
51     -------------------------------------------------
52     -- Execute the Argentine Withholding Tax Routine
53     -------------------------------------------------
54     IF (l_country_code = 'AR') THEN
55         Jl_Ar_Ap_Withholding_Pkg.Jl_Ar_Ap_Do_Withholding
56                        (P_Invoice_Id,
57                         P_Awt_Date,
58                         P_Calling_Module,
59                         P_Amount,
60                         P_Payment_Num,
61                         P_Checkrun_Name,
62                         p_checkrun_id,
63                         P_Last_Updated_By,
64                         P_Last_Update_Login,
65                         P_Program_Application_Id,
66                         P_Program_Id,
67                         P_Request_Id,
68                         l_awt_success,
69                         P_Invoice_Payment_Id,
70                         P_Check_Id);
71     -------------------------------------------------
72     -- Execute the Colombian Withholding Tax Routine
73     -------------------------------------------------
74     ELSIF (l_country_code = 'CO') THEN
75            Jl_Co_Ap_Withholding_Pkg.Jl_Co_Ap_Do_Withholding
76                        (P_Invoice_Id,
77                         P_Awt_Date,
78                         P_Calling_Module,
79                         P_Amount,
80                         P_Payment_Num,
81                         P_Last_Updated_By,
82                         P_Last_Update_Login,
83                         P_Program_Application_Id,
84                         P_Program_Id,
85                         P_Request_Id,
86                         l_awt_success);
87 
88     END IF;
89 
90     ----------------------------
91     -- Return AWT Success Value
92     ----------------------------
93     IF (l_awt_success = 'SUCCESS') THEN
94         RETURN Ap_Extended_Withholding_Pkg.TRUE_VALUE;
95     ELSE
96         RETURN Ap_Extended_Withholding_Pkg.FALSE_VALUE;
97     END IF;
98 
99 END JG_DO_EXTENDED_WITHHOLDING;
100 
101 
102 /**************************************************************************
103  *                                                                        *
104  * Name       : Jg_Undo_Extended_Withholding                              *
105  * Purpose    : Regional Extended Routine for the Withholding Tax         *
106  *              Reversion                                                 *
107  *                                                                        *
108  **************************************************************************/
109 FUNCTION JG_UNDO_EXTENDED_WITHHOLDING
110               (P_Parent_Id              IN     Number,
111                P_Calling_Module         IN     Varchar2,
112                P_Awt_Date               IN     Date,
113                P_New_Invoice_Payment_Id IN     Number     Default null,
114                P_Last_Updated_By        IN     Number,
115                P_Last_Update_Login      IN     Number,
116                P_Program_Application_Id IN     Number     Default null,
117                P_Program_Id             IN     Number     Default null,
118                P_Request_Id             IN     Number     Default null,
119                P_Dist_Line_No           IN     Number     Default null,
120                P_New_Invoice_Id         IN     Number     Default null,
121                P_New_Dist_Line_No       IN     Number     Default null)
122                RETURN NUMBER
123 IS
124     l_country_code    Varchar2(10);
125     l_awt_success     Varchar2(2000);
126 
127     l_ou_id          NUMBER;
128 
129 BEGIN
130 
131     l_awt_success     := 'SUCCESS';
132 
133     ------------------------
134     -- Get the Country Code
135     ------------------------
136     fnd_profile.get('ORG_ID',l_ou_id);
137     l_country_code := jg_zz_shared_pkg.get_country(l_ou_id, NULL);
138 
139     -------------------------------------------------
140     -- Execute the Argentine Withholding Tax Routine
141     -------------------------------------------------
142     IF (l_country_code = 'AR') THEN
143         Jl_Ar_Ap_Withholding_Pkg.Jl_Ar_Ap_Undo_Withholding
144                                    (P_Parent_Id,
145                                     P_Calling_Module,
146                                     P_Awt_Date,
147                                     P_Last_Updated_By,
148                                     P_Last_Update_Login,
149                                     P_Program_Application_Id,
150                                     P_Program_Id,
151                                     P_Request_Id);
152 
153     -------------------------------------------------
154     -- Execute the Colombian Withholding Tax Routine
155     -------------------------------------------------
156     ELSIF (l_country_code = 'CO') THEN
157         null;
158 
159     END IF;
160 
161     ----------------------------
162     -- Return AWT Success Value
163     ----------------------------
164     IF (l_AWT_Success = 'SUCCESS') THEN
165         RETURN Ap_Extended_Withholding_Pkg.TRUE_VALUE;
166     ELSE
167         RETURN Ap_Extended_Withholding_Pkg.FALSE_VALUE;
168     END IF;
169 
170 END JG_UNDO_EXTENDED_WITHHOLDING;
171 
172 
173 
174 
175 /**************************************************************************
176  *                                                                        *
177  * Name       : Jg_Undo_Temp_Ext_Withholding                              *
178  * Purpose    : Regional Extended Routine to Reverse Temporary            *
179  *              Withholding Distributions                                 *
180  *                                                                        *
181  **************************************************************************/
182 FUNCTION JG_UNDO_TEMP_EXT_WITHHOLDING
183               (P_Invoice_Id             IN     Number,
184                P_Vendor_Id              IN     Number     Default null,
185                P_Payment_Num            IN     Number,
186                P_Checkrun_Name          IN     Varchar2,
187                P_Checkrun_ID            IN     Number,
188                P_Undo_Awt_Date          IN     Date,
189                P_Calling_Module         IN     Varchar2,
190                P_Last_Updated_By        IN     Number,
191                P_Last_Update_Login      IN     Number,
192                P_Program_Application_Id IN     Number     Default null,
193                P_Program_Id             IN     Number     Default null,
194                P_Request_Id             IN     Number     Default null)
195                RETURN NUMBER
196 IS
197     l_country_code    Varchar2(10);
198     l_awt_success     Varchar2(2000);
199 
200     l_ou_id           NUMBER;
201 
202 BEGIN
203 
204     l_awt_success     := 'SUCCESS';
205 
206     ------------------------
207     -- Get the Country Code
208     ------------------------
209     fnd_profile.get('ORG_ID',l_ou_id);
210     l_country_code := jg_zz_shared_pkg.get_country(l_ou_id, NULL);
211 
212     -------------------------------------------------
213     -- Execute the Argentine Withholding Tax Routine
214     -------------------------------------------------
215     IF (l_country_code = 'AR') THEN
216         Jl_Ar_Ap_Withholding_Pkg.Jl_Ar_Ap_Undo_Temp_Withholding
217                                    (P_Invoice_Id,
218                                     P_Payment_Num,
219                                     P_Checkrun_Name,
220                                     p_Checkrun_id,
221                                     P_Undo_Awt_Date,
222                                     P_Calling_Module,
223                                     P_Last_Updated_By,
224                                     P_Last_Update_Login,
225                                     P_Program_Application_Id,
226                                     P_Program_Id,
227                                     P_Request_Id);
228     -------------------------------------------------
229     -- Execute the Colombian Withholding Tax Routine
230     -------------------------------------------------
231     ELSIF (l_country_code = 'CO') THEN
232         null;
233 
234     END IF;
235 
236     ----------------------------
237     -- Return AWT Success Value
238     ----------------------------
239     IF (l_AWT_Success = 'SUCCESS') THEN
240         RETURN Ap_Extended_Withholding_Pkg.TRUE_VALUE;
241     ELSE
242         RETURN Ap_Extended_Withholding_Pkg.FALSE_VALUE;
243     END IF;
244 
245 END JG_UNDO_TEMP_EXT_WITHHOLDING;
246 
247 
248 
249 
250 /**************************************************************************
251  *                                                                        *
252  * Name       : Jg_Ext_Withholding_Default                                *
253  * Purpose    : Regional Extended Routine to Default Withholding Tax      *
254  *              Information                                               *
255  *               -- Bug 4559472 : R12 KI                                  *
256  **************************************************************************/
257 FUNCTION JG_EXT_WITHHOLDING_DEFAULT (P_Invoice_Id     IN   Number,
258                                      P_Inv_Line_Num   IN   Number,
259                                      P_Inv_Dist_Id    IN   ap_invoice_distributions_all.invoice_distribution_id%TYPE,
260                                      P_Calling_Module IN   Varchar2,
261                                      P_Parent_Dist_ID IN   Number)
262                                      RETURN NUMBER
263 IS
264 
265     l_country_code    Varchar2(10);
266 
267     l_ou_id           NUMBER;
268 
269 BEGIN
270     ------------------------
271     -- Get the Country Code
272     ------------------------
273     fnd_profile.get('ORG_ID',l_ou_id);
274     l_country_code := jg_zz_shared_pkg.get_country(l_ou_id, NULL);
275 
276     ------------------------------------------------
277     -- Execute the Argentine/Colombian Withholding
278     -- Tax Defaulting Routine
279     --
280     -- Payment Schedules Defaulting for Brazil
281     -- Validate DUE_DATE for Business Day Calendar for Brazil
282     -- Carry out Bank Transfer CollDoc Association for Brazil
283     ------------------------------------------------
284     IF (l_country_code = 'AR' OR
285         l_country_code = 'CO') THEN
286 
287         --
288         -- Bug 4559472 : R12 KI
289         --
290         Jl_Zz_Ap_Awt_Default_Pkg.Supp_Wh_Def(P_Invoice_Id,
291                                              P_Inv_Line_Num,
292                                              P_Inv_Dist_Id,
293                                              P_Calling_Module,
294                                              P_Parent_Dist_ID);
295     ELSIF (l_country_code = 'BR') THEN
296         Jl_Br_Ap_Pay_Sched_GDF_PKG.Suppl_Def_Pay_Sched_GDF(P_Invoice_Id);
297         -- Brazilian AP/PO Tax has been obsolete in R12
298         -- bug#4535578- obsolete Brazilian AP/PO tax feature
299         -- Jl_Br_Ap_Create_Tax_PKG.call_match_nomatch_proc(P_Invoice_Id);
300     END IF;
301 
302     ----------------------------
303     -- Return AWT Success Value
304     ----------------------------
305     RETURN Ap_Extended_Withholding_Pkg.TRUE_VALUE;
306 
307 END JG_EXT_WITHHOLDING_DEFAULT;
308 
309 
310 /**************************************************************************
311  *                                                                        *
312  * Name       : Jg_Extended_Match                                         *
313  * Purpose    : Regional Extended Routine for Matching                    *
314  *              Bug 4559478 : R12 KI                                      *
315  **************************************************************************/
316 PROCEDURE JG_EXTENDED_MATCH
317                     (P_Credit_Id	      IN     Number,
318                      P_Invoice_Id             IN     Number	Default null,
319                      P_Inv_Line_Num           IN     Number     Default null,
320                      P_Distribution_id        IN     Number     Default null,
321                      P_Parent_Dist_ID         IN     Number     Default null)
322 
323 IS
324 
325     l_country_code    Varchar2(10);
326 
327     l_ou_id           NUMBER;
328 
329 BEGIN
330     ------------------------
331     -- Get the Country Code
332     ------------------------
333     fnd_profile.get('ORG_ID',l_ou_id);
334     l_country_code := jg_zz_shared_pkg.get_country(l_ou_id, NULL);
335 
336     -------------------------------------------------
337     -- Execute the Extended Matching Routine
338     -------------------------------------------------
339     IF (l_country_code = 'AR' OR l_country_code = 'CO') THEN
340 
341         --
342         -- Bug 4559478 : R12 KI
343         --
344         Jl_Zz_Ap_Withholding_Pkg.Jl_Zz_Ap_Extended_Match
345                     (P_Credit_Id,
346                      P_Invoice_Id,
347                      P_Inv_Line_Num,
348                      P_Distribution_id,
349                      P_Parent_Dist_ID
350                      );
351     END IF;
352 
353 END JG_EXTENDED_MATCH;
354 
355 
356 /**************************************************************************
357  *                                                                        *
358  * Name       : Jg_Extended_Insert_Dist                                   *
359  * Purpose    : Regional Extended Routine for Insertion                   *
360  *                                                                        *
361  **************************************************************************/
362 PROCEDURE JG_EXTENDED_INSERT_DIST
363                     (P_Invoice_Id	      	IN	Number,
367                      P_GL_Date			IN	Date,
364                      P_Invoice_Distribution_id  IN      Number,    -- Add new Column
365                      P_Distribution_Line_Number	IN      Number,
366                      P_Line_Type		IN	Varchar2,
368                      P_Period_Name		IN	Varchar2,
369                      P_Type_1099		IN	Varchar2,
370                      P_Income_Tax_Region	IN	Varchar2,
371                      P_Amount			IN	Number,
372                      P_Tax_Code_ID              IN      Number,   -- Add new Column
373                      P_Code_Combination_Id	IN	Number,
374                      P_PA_Quantity		IN 	Number,
375                      P_Description		IN	Varchar2,
376                      P_tax_recoverable_flag     IN      Varchar2, -- Add new Column
377                      P_tax_recovery_rate        IN      Number,   -- Add new Column
378                      P_tax_code_override_flag   IN      Varchar2, -- Add new Column
379                      P_tax_recovery_override_flag IN    Varchar2, -- Add new Column
380                      P_po_distribution_id       IN      Number,   -- Add new Column
381                      P_Attribute_Category	IN	Varchar2,
382                      P_Attribute1		IN	Varchar2,
383                      P_Attribute2		IN	Varchar2,
384                      P_Attribute3		IN	Varchar2,
385                      P_Attribute4		IN	Varchar2,
386                      P_Attribute5		IN	Varchar2,
387                      P_Attribute6		IN	Varchar2,
388                      P_Attribute7		IN	Varchar2,
389                      P_Attribute8		IN	Varchar2,
390                      P_Attribute9		IN	Varchar2,
391                      P_Attribute10		IN	Varchar2,
392                      P_Attribute11		IN	Varchar2,
393                      P_Attribute12		IN	Varchar2,
394                      P_Attribute13		IN	Varchar2,
395                      P_Attribute14		IN	Varchar2,
396                      P_Attribute15		IN	Varchar2,
397  		     P_Calling_Sequence		IN	Varchar2
398  		     )
399 IS
400     l_country_code    Varchar2(10);
401 
402     l_ou_id           NUMBER;
403 
404 BEGIN
405     -------------------------------------------
406     -- Stubbed out
407     -------------------------------------------
408     NULL;
409     ------------------------
410     -- Get the Country Code
411     ------------------------
412     -- fnd_profile.get('ORG_ID',l_ou_id);
413     -- l_country_code := jg_zz_shared_pkg.get_country(l_ou_id, NULL);
414 
415     -------------------------------------------------
416     -- Execute the Extended Insertion Routine
417     -------------------------------------------------
418     /* Bug 4535582
419     IF (l_country_code = 'AR' OR l_country_code = 'CO') THEN
420         Jl_Zz_Ap_Withholding_Pkg.Jl_Zz_Ap_Ext_Insert_Dist
421                     (P_Invoice_Id,
422                      P_Invoice_Distribution_id,    -- Add new column
423                      P_Distribution_Line_Number,
424                      P_Line_Type,
425                      P_GL_Date,
426                      P_Period_Name,
427                      P_Type_1099,
428                      P_Income_Tax_Region,
429                      P_Amount,
430                      P_Tax_Code_ID,                -- Add new column
431                      P_Code_Combination_Id,
432                      P_PA_Quantity,
433                      P_Description,
434                      P_tax_recoverable_flag,       -- Add new Column
435                      P_tax_recovery_rate,          -- Add new Column
436                      P_tax_code_override_flag,     -- Add new Column
437                      P_tax_recovery_override_flag, -- Add new Column
438                      P_po_distribution_id,         -- Add new Column
439                      P_Attribute_Category,
440                      P_Attribute1,
441                      P_Attribute2,
442                      P_Attribute3,
443                      P_Attribute4,
444                      P_Attribute5,
445                      P_Attribute6,
446                      P_Attribute7,
447                      P_Attribute8,
448                      P_Attribute9,
452                      P_Attribute13,
449                      P_Attribute10,
450                      P_Attribute11,
451                      P_Attribute12,
453                      P_Attribute14,
454                      P_Attribute15,
455  		     P_Calling_Sequence
456  		     );
457     END IF;
458     */
459 END JG_EXTENDED_INSERT_DIST;
460 
461 /**************************************************************************
462  *                                                                        *
463  * Name       : Jg_Withholding_Prepay                                     *
464  * Purpose    : Regional Extended Routine for Insertion on Prepay line    *
465  *                                                                        *
466  **************************************************************************/
467 
468 FUNCTION Jg_Ext_Withholding_Prepay
469                (P_prepay_dist_id      IN Number,
470           	P_invoice_id          IN Number,
471                 -- Bug 4559474 : R12 KI
472                 P_inv_dist_id         IN Number,
473           	P_user_id             IN Number,
474           	P_last_update_login   IN Number,
475                 P_calling_sequence    IN Varchar2
476                 )
477 RETURN NUMBER
478 IS
479 
480 l_country_code            VARCHAR2(10);
481 l_calling_sequence        VARCHAR2(2000);
482 
483 l_ou_id                   NUMBER;
484 
485 BEGIN
486     ------------------------
487      --  Return the value in P_calling_sequece.
488      -----------------------
489      l_calling_sequence := p_calling_sequence||'Jg_Ext_Withholding_Prepay';
490     ------------------------
491     -- Get the Country Code
492     ------------------------
493     fnd_profile.get('ORG_ID',l_ou_id);
494     l_country_code := jg_zz_shared_pkg.get_country(l_ou_id, NULL);
495 
496     ------------------------------------------------
497     -- Execute the Argentine/Colombian Withholding
498     -- Tax Defaulting Prepayment Routine
499     ------------------------------------------------
500     IF (l_country_code = 'AR' OR
501         l_country_code = 'CO') THEN
502 
503         --
504         -- Bug 4559474 : R12 KI
505         --
506         Jl_Zz_Ap_Awt_Default_PKG.Carry_Withholdings_Prepay(
507                                                            P_prepay_dist_id,
508                                                            P_Invoice_Id,
509                                                            -- Bug 4559474
510                                                            P_inv_dist_id,
511                                                            P_user_id,
512                                                            P_last_update_login,
513                                                            P_calling_sequence
514                                                            );
515     END IF;
516 
517     ----------------------------
518     -- Return AWT Success Value
519     ----------------------------
520     RETURN Ap_Extended_Withholding_Pkg.TRUE_VALUE;
521 
522 END JG_EXT_WITHHOLDING_PREPAY;
523 
524 END JG_EXTENDED_WITHHOLDING_PKG;