DBA Data[Home] [Help]

PACKAGE: APPS.AP_ETAX_SERVICES_PKG

Source


1 PACKAGE AP_ETAX_SERVICES_PKG AUTHID CURRENT_USER AS
2 /* $Header: apetxsrs.pls 120.17.12020000.3 2012/12/18 11:15:40 nbshaik ship $ */
3 
4   -- Define structure to pass tax hold codes to release
5   TYPE Rel_Hold_Codes_Type IS TABLE OF ap_holds_all.hold_lookup_code%TYPE INDEX BY BINARY_INTEGER;
6 
7    --bug10621602  starts
8    -- Created an record structure for capturing the retainage information
9    -- This information will be used in calculating the variances such as TIPV , TV , TERV
10 
11   TYPE Inv_ret_dists IS RECORD(
12 
13   amount                          ap_invoice_distributions_all.amount%TYPE,
14   retainage_rate                  po_lines_all.retainage_rate%TYPE,
15   retained_amount                 ap_invoice_distributions_all.amount%TYPE,
16   retained_invoice_dist_id        ap_invoice_distributions_all.retained_invoice_dist_id%TYPE,
17   related_retainage_dist_id       ap_invoice_distributions_all.related_retainage_dist_id%TYPE,
18   quantity_invoiced               ap_invoice_distributions_all.quantity_invoiced%TYPE,
19   unit_price                      ap_invoice_distributions_all.unit_price%TYPE
20   );
21 
22    TYPE ret_dists_tab IS TABLE OF Inv_ret_dists INDEX BY VARCHAR2(200);  --bug14155552, changed to INDEX BY VARCHAR2 from PLS_INTEGER
23 
24    ret_dists   ret_dists_tab;
25 
26   --bug 10621602 ended
27 
28 /*=============================================================================
29  |  FUNCTION - Calculate()
30  |
31  |  DESCRIPTION
32  |      Public function that will call the calculate_tax service for
33  |      calculation and recalculation.
34  |      This API assumes the calling code controls the commit cycle.
35  |      This function returns TRUE if the call to the service is successful.
36  |      Otherwise, FALSE.
37  |
38  |  PARAMETERS
39  |      P_Invoice_Id - invoice id
40  |      P_Line_Number - This parameter will be used to allow this API to
41  |                      calculate tax only for the line specified in this
42  |                      parameter.  Additionally, this parameter will be used
43  |                      to determine the PREPAY line created for prepayment
44  |                      unapplications.
45  |      P_Calling_Mode - calling mode.  Identifies which service to call
46  |      P_All_Error_Messages - Should API return 1 error message or allow
47  |                             calling point to get them from message stack
48  |      P_error_code - Error code to be returned
49  |      P_calling_sequence -  Calling sequence
50  |
51  |  MODIFICATION HISTORY
52  |    DATE          Author         Action
53  |    07-OCT-2003   SYIDNER        Created
54  |
55  *============================================================================*/
56   FUNCTION Calculate(
57              P_Invoice_id              IN NUMBER,
58              P_Line_Number             IN NUMBER,
59              P_Calling_Mode            IN VARCHAR2,
60              P_All_Error_Messages      IN VARCHAR2,
61              P_Error_Code              OUT NOCOPY VARCHAR2,
62              P_Calling_Sequence        IN VARCHAR2) RETURN BOOLEAN;
63 
64 /*=============================================================================
65  |  FUNCTION - Calculate_Import()
66  |
67  |  DESCRIPTION
68  |      Public function that will call the calculate_tax service for
69  |      calculation and recalculation from the import program.
70  |      This new calling mode is required to avoid the repopulation of the eTax
71  |      global temp tables
72  |      This API assumes the calling code controls the commit cycle.
73  |      This function returns TRUE if the call to the service is successful.
74  |      Otherwise, FALSE.
75  |
76  |  PARAMETERS
77  |      P_Invoice_Id - invoice id
78  |      P_Calling_Mode - calling mode.  Identifies which service to call
79  |      P_Interface_Invoice_Id - Interface invoice id
80  |      P_All_Error_Messages - Should API return 1 error message or allow
81  |                             calling point to get them from message stack
82  |      P_error_code - Error code to be returned
83  |      P_calling_sequence -  Calling sequence
84  |
85  |  MODIFICATION HISTORY
86  |    DATE          Author         Action
87  |    14-JAN-2004   SYIDNER        Created
88  |
89  *============================================================================*/
90   FUNCTION Calculate_Import(
91              P_Invoice_Id              IN NUMBER,
92              P_Calling_Mode            IN VARCHAR2,
93              P_Interface_Invoice_Id    IN NUMBER,
94              P_All_Error_Messages      IN VARCHAR2,
95              P_Error_Code              OUT NOCOPY VARCHAR2,
96              P_Calling_Sequence        IN VARCHAR2) RETURN BOOLEAN;
97 
98 /*=============================================================================
99  |  FUNCTION - Distribute()
100  |
101  |  DESCRIPTION
102  |      Public function that will call the determine_recovery service for
103  |      distribution and redistribution.
104  |      This API assumes the calling code controls the commit cycle.
105  |      This function returns TRUE if the call to the service is successful.
106  |      Otherwise, FALSE.
107  |
108  |  PARAMETERS
109  |      P_Invoice_Id - invoice id
110  |      P_Line_Number - This parameter will be used to allow this API to
111  |                      distribute tax only for the line specified in this
112  |                      parameter.
113  |      P_Calling_Mode - calling mode.  Identifies which service to call
114  |      P_All_Error_Messages - Should API return 1 error message or allow
115  |                             calling point to get them from message stack
116  |      P_error_code - Error code to be returned
117  |      P_calling_sequence -  Calling sequence
118  |
119  |  MODIFICATION HISTORY
120  |    DATE          Author         Action
121  |    07-OCT-2003   SYIDNER        Created
122  |
123  *============================================================================*/
124   FUNCTION Distribute(
125              P_Invoice_id              IN NUMBER,
126              P_Line_Number             IN NUMBER,
127              P_Calling_Mode            IN VARCHAR2,
128              P_All_Error_Messages      IN VARCHAR2,
129              P_Error_Code              OUT NOCOPY VARCHAR2,
130              P_Calling_Sequence        IN VARCHAR2) RETURN BOOLEAN;
131 
132 /*=============================================================================
133  |  FUNCTION - Distribute_Import()
134  |
135  |  DESCRIPTION
136  |      Public function that will call the determine_recovery service for
137  |      distribution during the import.  This API will called only in the case
138  |      TAX-ONLY lines exist in the invoice.
139  |      This API assumes the calling code controls the commit cycle.
140  |      This function returns TRUE if the call to the service is successful.
141  |      Otherwise, FALSE.
142  |
143  |  PARAMETERS
144  |      P_Invoice_Id - invoice id
145  |      P_Calling_Mode - calling mode.  Identifies which service to call
146  |      P_All_Error_Messages - Should API return 1 error message or allow
147  |                             calling point to get them from message stack
148  |      P_error_code - Error code to be returned
149  |      P_calling_sequence -  Calling sequence
150  |
151  |  MODIFICATION HISTORY
152  |    DATE          Author         Action
153  |    20-JAN-2004   SYIDNER        Created
154  |
155  *============================================================================*/
156   FUNCTION Distribute_Import(
157              P_Invoice_id              IN NUMBER,
158              P_Calling_Mode            IN VARCHAR2,
159              P_All_Error_Messages      IN VARCHAR2,
160              P_Error_Code              OUT NOCOPY VARCHAR2,
161              P_Calling_Sequence        IN VARCHAR2) RETURN BOOLEAN;
162 
163 /*=============================================================================
164  |  FUNCTION - Import_Interface()
165  |
166  |  DESCRIPTION
167  |      Public function that will call the import_document_with_tax service for
168  |      distribution and redistribution.
169  |      This API assumes the calling code controls the commit cycle.
170  |      This function returns TRUE if the call to the service is successful.
171  |      Otherwise, FALSE.
172  |
173  |  PARAMETERS
174  |      P_Invoice_Id - invoice id
175  |      P_Calling_Mode - calling mode.  Identifies which service to call
176  |      P_Interface_Invoice_Id - Interface invoice id
177  |      P_All_Error_Messages - Should API return 1 error message or allow
181  |
178  |                             calling point to get them from message stack
179  |      P_error_code - Error code to be returned
180  |      P_calling_sequence -  Calling sequence
182  |  MODIFICATION HISTORY
183  |    DATE          Author         Action
184  |    07-OCT-2003   SYIDNER        Created
185  |
186  *============================================================================*/
187   FUNCTION Import_Interface(
188              P_Invoice_id              IN NUMBER,
189              P_Calling_Mode            IN VARCHAR2,
190              P_Interface_Invoice_Id    IN NUMBER,
191              P_All_Error_Messages      IN VARCHAR2,
192              P_Error_Code              OUT NOCOPY VARCHAR2,
193              P_Calling_Sequence        IN VARCHAR2) RETURN BOOLEAN;
194 
195 /*=============================================================================
196  |  FUNCTION - Reverse_Invoice()
197  |
198  |  DESCRIPTION
199  |      Public function that will call the reverse_document_distribution
200  |      service for quick credit (full reversal.)
201  |      This API assumes the calling code controls the commit cycle.
202  |      This function returns TRUE if the call to the service is successful.
203  |      Otherwise, FALSE.
204  |
205  |  PARAMETERS
206  |      P_Invoice_Id - invoice id
207  |      P_Calling_Mode - calling mode.  Identifies which service to call
208  |      P_All_Error_Messages - Should API return 1 error message or allow
209  |                             calling point to get them from message stack
210  |      P_error_code - Error code to be returned
211  |      P_calling_sequence -  Calling sequence
212  |
213  |  MODIFICATION HISTORY
214  |    DATE          Author         Action
215  |    07-OCT-2003   SYIDNER        Created
216  |
217  *============================================================================*/
218   FUNCTION Reverse_Invoice(
219              P_Invoice_id              IN NUMBER,
220              P_Calling_Mode            IN VARCHAR2,
221              P_All_Error_Messages      IN VARCHAR2,
222              P_Error_Code              OUT NOCOPY VARCHAR2,
223              P_Calling_Sequence        IN VARCHAR2) RETURN BOOLEAN;
224 
225 /*=============================================================================
226  |  FUNCTION - Override_Tax()
227  |
228  |  DESCRIPTION
229  |      Public function that will call the override_tax service.
230  |      This API assumes the calling code controls the commit cycle.
231  |      This function returns TRUE if the call to the service is successful.
232  |      Otherwise, FALSE.
233  |
234  |  PARAMETERS
235  |      P_Invoice_Id         - invoice id
236  |      P_Calling_Mode       - calling mode.  Identifies which service to call
237  |      P_Override_Status    - override_status parameter returned by the eTax
238  |                             UI (Tax lines and summary lines window).
239  |      P_Event_id	     - Indicates a specific instance of the override event.
240  |                             Tax line windows will return an event_id when there
241  |                             are any user overrides.
242  |      P_All_Error_Messages - Should API return 1 error message or allow
243  |                             calling point to get them from message stack
244  |      P_error_code         - Error code to be returned
245  |      P_calling_sequence   -  Calling sequence
246  |
247  |  MODIFICATION HISTORY
248  |    DATE          Author         Action
249  |    07-OCT-2003   SYIDNER        Created
250  |
251  *============================================================================*/
252 
253   FUNCTION Override_Tax(
254              P_Invoice_id              IN NUMBER,
255              P_Calling_Mode            IN VARCHAR2,
256              P_Override_Status         IN VARCHAR2,
257              P_Event_Id		       IN NUMBER,
258              P_All_Error_Messages      IN VARCHAR2,
259              P_Error_Code              OUT NOCOPY VARCHAR2,
260              P_Calling_Sequence        IN VARCHAR2) RETURN BOOLEAN;
261 
262 /*=============================================================================
263  |  FUNCTION - Override_Recovery()
264  |
265  |  DESCRIPTION
266  |      Public function that will call the override_recovery service.
267  |      This API assumes the calling code controls the commit cycle.
268  |      This function returns TRUE if the call to the service is successful.
269  |      Otherwise, FALSE.
270  |
271  |  PARAMETERS
272  |      P_Invoice_Id - invoice id
273  |      P_Calling_Mode - calling mode.  Identifies which service to call
274  |      P_All_Error_Messages - Should API return 1 error message or allow
275  |                             calling point to get them from message stack
276  |      P_error_code - Error code to be returned
277  |      P_calling_sequence -  Calling sequence
278  |
279  |  MODIFICATION HISTORY
280  |    DATE          Author         Action
281  |    07-OCT-2003   SYIDNER        Created
282  |
283  *============================================================================*/
284   FUNCTION Override_Recovery(
285              P_Invoice_id              IN NUMBER,
286              P_Calling_Mode            IN VARCHAR2,
287              P_All_Error_Messages      IN VARCHAR2,
288              P_Error_Code              OUT NOCOPY VARCHAR2,
289              P_Calling_Sequence        IN VARCHAR2) RETURN BOOLEAN;
290 
291 --Bug7592845
292 /*=============================================================================
293  |  FUNCTION - Freeze_itm_Distributions()
294  |
295  |  DESCRIPTION
296  |      Public function that will call the freeze_tax_dists_for_items service.
297  |      This API assumes the calling code controls the commit cycle.
298  |      This function returns TRUE if the call to the service is successful.
299  |      Otherwise, FALSE.
300  |
301  |  PARAMETERS
302  |      P_Invoice_header_rec - invoice record
303  |      P_Calling_Mode - calling mode.  Identifies which service to call
304  |      P_Event_Class_Code - Event class code for the invoice type
305  |      P_All_Error_Messages - Should API return 1 error message or allow
306  |                             calling point to get them from message stack
307  |      P_error_code - Error code to be returned
308  |      P_calling_sequence -  Calling sequence
309  |
310  |  MODIFICATION HISTORY
311  |    DATE                  Author                             Action
312  |    11-DEC-2008   SCHITLAP/HCHAUDHA        Created
313  |
314  *============================================================================*/
315   FUNCTION Freeze_itm_Distributions(
316              P_Invoice_Header_Rec      IN ap_invoices_all%ROWTYPE,
317              P_Calling_Mode            IN VARCHAR2,
318              P_Event_Class_Code        IN VARCHAR2,
319              P_All_Error_Messages      IN VARCHAR2,
320              P_Error_Code              OUT NOCOPY VARCHAR2,
321              P_Calling_Sequence        IN VARCHAR2) RETURN BOOLEAN;
322 --Bug7592845
323 
324 /*=============================================================================
325  |  FUNCTION - Freeze_Distributions()
326  |
327  |  DESCRIPTION
328  |      Public function that will call the freeze_tax_distributions service.
329  |      This API assumes the calling code controls the commit cycle.
330  |      This function returns TRUE if the call to the service is successful.
331  |      Otherwise, FALSE.
332  |
333  |  PARAMETERS
334  |      P_Invoice_header_rec - invoice record
335  |      P_Calling_Mode - calling mode.  Identifies which service to call
336  |      P_Event_Class_Code - Event class code for the invoice type
337  |      P_All_Error_Messages - Should API return 1 error message or allow
338  |                             calling point to get them from message stack
339  |      P_error_code - Error code to be returned
340  |      P_calling_sequence -  Calling sequence
341  |
342  |  MODIFICATION HISTORY
343  |    DATE          Author         Action
344  |    07-OCT-2003   SYIDNER        Created
345  |
346  *============================================================================*/
347   /*FUNCTION Freeze_Distributions(
348              P_Invoice_Header_Rec      IN ap_invoices_all%ROWTYPE,
349              P_Calling_Mode            IN VARCHAR2,
350              P_Event_Class_Code        IN VARCHAR2,
351              P_All_Error_Messages      IN VARCHAR2,
352              P_Error_Code              OUT NOCOPY VARCHAR2,
353              P_Calling_Sequence        IN VARCHAR2) RETURN BOOLEAN;*/
354 --Bug7592845
355 
356 /*=============================================================================
357  |  FUNCTION - Global_Document_Update()
358  |
359  |  DESCRIPTION
360  |      Public function that will call the global_document_update service to
361  |      inform eTax of a cancellation of an invoice, the freeze after the
362  |      invoice is validated (meaning is ready to reporting), and the unfreeze
363  |      of an invoice because it has to be modified after it was validated.
364  |      This API assumes the calling code controls the commit cycle.
365  |      This function returns TRUE if the call to the service is successful.
366  |      Otherwise, FALSE.
367  |
368  |  PARAMETERS
369  |      P_Invoice_Id - invoice id
370  |      P_Calling_Mode - calling mode.  Identifies which service to call
371  |      P_All_Error_Messages - Should API return 1 error message or allow
372  |                             calling point to get them from message stack
373  |      P_error_code - Error code to be returned
374  |      P_calling_sequence -  Calling sequence
375  |
376  |  MODIFICATION HISTORY
377  |    DATE          Author         Action
378  |    07-OCT-2003   SYIDNER        Created
379  |                                 Added p_line_number so that the same
380  |                                 routine can be used while discarding
381  |                                 an invoice line.
382  *============================================================================*/
383   FUNCTION Global_Document_Update(
384              P_Invoice_id              IN NUMBER,
385              P_Line_Number	       IN NUMBER DEFAULT NULL,
386              P_Calling_Mode            IN VARCHAR2,
387              P_All_Error_Messages      IN VARCHAR2,
388              P_Error_Code              OUT NOCOPY VARCHAR2,
389              P_Calling_Sequence        IN VARCHAR2) RETURN BOOLEAN;
390 
391 /*=============================================================================
392  |  FUNCTION - Release_Tax_Holds()
393  |
394  |  DESCRIPTION
395  |      Public function that will call the global_document_update service to
396  |      inform eTax the release of tax holds by the user.
397  |      This function returns TRUE if the call to the service is successful.
398  |      Otherwise, FALSE.
399  |
400  |  PARAMETERS
401  |      P_Invoice_Id - invoice id
402  |      P_Calling_Mode - calling mode.  Identifies which service to call
403  |      P_Tax_Hold_Code - Tax hold codes released in AP
404  |      P_All_Error_Messages - Should API return 1 error message or allow
405  |                             calling point to get them from message stack
406  |      P_error_code - Error code to be returned
407  |      P_calling_sequence -  Calling sequence
408  |
409  |  MODIFICATION HISTORY
410  |    DATE          Author         Action
411  |    05-NOV-2003   SYIDNER        Created
412  |
413  *============================================================================*/
414   FUNCTION Release_Tax_Holds(
415              P_Invoice_id              IN NUMBER,
416              P_Calling_Mode            IN VARCHAR2,
417              P_Tax_Hold_Code           IN Rel_Hold_Codes_Type,
418              P_All_Error_Messages      IN VARCHAR2,
419              P_Error_Code              OUT NOCOPY VARCHAR2,
420              P_Calling_Sequence        IN VARCHAR2) RETURN BOOLEAN;
421 
422 /*=============================================================================
423  |  FUNCTION - Mark_Tax_Lines_Deleted()
424  |
425  |  DESCRIPTION
426  |      Public function that will call the mark_tax_lines_deleted service.
427  |      This API assumes the calling code controls the commit cycle.
428  |      This function returns TRUE if the call to the service is successful.
429  |      Otherwise, FALSE.
430  |
431  |  PARAMETERS
432  |      P_Invoice_Id - invoice id
433  |      P_Calling_Mode - calling mode.  Identifies which service to call
434  |      P_Line_Number_To_Delete - Tax Line to delete
435  |      P_All_Error_Messages - Should API return 1 error message or allow
436  |                             calling point to get them from message stack
437  |      P_error_code - Error code to be returned
438  |      P_calling_sequence -  Calling sequence
439  |
440  |  MODIFICATION HISTORY
441  |    DATE          Author         Action
442  |    07-OCT-2003   SYIDNER        Created
443  |    05-NOV-2003   SYIDNER        Included new P_Line_Number_To_Delete
444  |                                 parameter
445  |
446  *============================================================================*/
447   FUNCTION Mark_Tax_Lines_Deleted(
448              P_Invoice_id              IN NUMBER,
449              P_Calling_Mode            IN VARCHAR2,
450              P_Line_Number_To_Delete   IN NUMBER,
451              P_All_Error_Messages      IN VARCHAR2,
452              P_Error_Code              OUT NOCOPY VARCHAR2,
453              P_Calling_Sequence        IN VARCHAR2) RETURN BOOLEAN;
454 
455 --bug 9343533
456 /*=============================================================================
457  |  FUNCTION - Mark_Tax_Lines_Deleted()
458  |
459  |  DESCRIPTION
460  |      Public function that will call the mark_tax_lines_deleted service.
461  |      This API assumes the calling code controls the commit cycle.
462  |      This function returns TRUE/FALSE as varchar2 for bug 9343533
463  |
464  |  PARAMETERS
465  |      P_Invoice_Id - invoice id
466  |      P_Calling_Mode - calling mode.  Identifies which service to call
467  |      P_Line_Number_To_Delete - Tax Line to delete
468  |      P_All_Error_Messages - Should API return 1 error message or allow
469  |                             calling point to get them from message stack
470  |      P_error_code - Error code to be returned
471  |      P_calling_sequence -  Calling sequence
472  |      P_dummy - dummy variable to differentiate from existing
473  |                Mark_Tax_Lines_Deleted API
474  |
475  |  MODIFICATION HISTORY
476  |    DATE              Author                  Action
477  |    25-MAR-2010   DCSHANMU        Created
478  |
479  *============================================================================*/
480   FUNCTION Mark_Tax_Lines_Deleted(
481              P_Invoice_id              IN NUMBER,
482              P_Calling_Mode            IN VARCHAR2,
483              P_Line_Number_To_Delete   IN NUMBER,
484              P_All_Error_Messages      IN VARCHAR2,
485              P_Error_Code              OUT NOCOPY VARCHAR2,
486              P_Calling_Sequence        IN VARCHAR2,
487              p_dummy                   IN VARCHAR2) RETURN VARCHAR2;
488 
489 /*=============================================================================
490  |  FUNCTION - Validate_Invoice()
491  |
492  |  DESCRIPTION
493  |      Public function that will call the validate_document_for_tax service.
494  |      This API assumes the calling code controls the commit cycle.
495  |      This function returns TRUE if the call to the service is successful.
496  |      Otherwise, FALSE.
497  |
498  |  PARAMETERS
499  |      P_Invoice_Id - invoice id
500  |      P_Calling_Mode - calling mode.  Identifies which service to call
501  |      P_All_Error_Messages - Should API return 1 error message or allow
502  |                             calling point to get them from message stack
503  |      P_error_code - Error code to be returned
504  |      P_calling_sequence -  Calling sequence
505  |
506  |  MODIFICATION HISTORY
507  |    DATE          Author         Action
508  |    07-OCT-2003   SYIDNER        Created
509  |
510  *============================================================================*/
511   FUNCTION Validate_Invoice(
512              P_Invoice_id              IN NUMBER,
513              P_Calling_Mode            IN VARCHAR2,
514              P_All_Error_Messages      IN VARCHAR2,
515              P_Error_Code              OUT NOCOPY VARCHAR2,
516              P_Calling_Sequence        IN VARCHAR2) RETURN BOOLEAN;
517 
518 /*=============================================================================
519  |  FUNCTION - Validate_Default_Import()
520  |
521  |  DESCRIPTION
522  |      Public function that will call the validate_and_default_tax_attr service.
523  |      This API assumes the calling code controls the commit cycle.
524  |      This function returns TRUE if the call to the service is successful.
525  |      Otherwise, FALSE.
526  |      This API will validate the taxable and tax lines to be imported regarding
527  |      tax.  The lines will be passed to this API using the pl/sql structures
528  |      defined in the import process.
529  |      The service validate_and_default_tax_attr will default any possible tax
530  |      value, and this API will modify the pl/sql structures with the defaulted
531  |      tax info.
532  |
533  |  PARAMETERS
534  |      p_invoice_rec - record defined in the import program for the invoice header
535  |      p_invoice_lines_tab - array with the taxable and tax lines
536  |      P_Calling_Mode - calling mode.  Identifies which service to call
537  |      P_All_Error_Messages - Should API return 1 error message or allow
538  |                             calling point to get them from message stack
539  |      p_invoice_status - returns N if the invoice should be rejected.
540  |      P_error_code - Error code to be returned
541  |      P_calling_sequence -  Calling sequence
542  |
543  |  MODIFICATION HISTORY
544  |    DATE          Author         Action
545  |    20-JAN-2004   SYIDNER        Created
546  |
547  *============================================================================*/
548   FUNCTION Validate_Default_Import(
549      /*        P_Invoice_Rec             IN OUT NOCOPY
550                AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
551              p_invoice_lines_tab       IN OUT NOCOPY
552                AP_IMPORT_INVOICES_PKG.t_lines_table, */ --bug 15862708
553              P_Invoice_Rec_table             IN OUT NOCOPY
554                AP_IMPORT_INVOICES_PKG.t_invoice_table,
555              p_invoice_lines_table       IN OUT NOCOPY
556                AP_IMPORT_INVOICES_PKG.t_lines_table,
557              P_Calling_Mode            IN VARCHAR2,
558              P_All_Error_Messages      IN VARCHAR2,
559              p_invoice_status          OUT NOCOPY VARCHAR2,
560              P_Error_Code              OUT NOCOPY VARCHAR2,
561              P_Calling_Sequence        IN VARCHAR2) RETURN BOOLEAN;
562 
563 /*=============================================================================
564  |  FUNCTION - Populate_Headers_GT()
565  |
566  |  DESCRIPTION
567  |      This function will get additional information required to populate the
568  |      ZX_TRANSACTION_HEADERS_GT
569  |      This function returns TRUE if the insert to the temp table goes
570  |      through successfully.  Otherwise, FALSE.
571  |
572  |  PARAMETERS
573  |      P_Invoice_Header_Rec - record with invoice header information
574  |      P_Calling_Mode - calling mode. it is used to
575  |      P_eTax_Already_called_flag - Flag to know if this is the first time tax
576  |                                   has been called
577  |      P_Event_Class_Code - Evnet class code
578  |      P_Event_Type_Code - Event Class Code
579  |      P_error_code - Error code to be returned
580  |      P_calling_sequence -  Calling sequence
581  |
582  |  MODIFICATION HISTORY
583  |    DATE          Author         Action
584  |    07-OCT-2003   SYIDNER        Created
585  |
586  *============================================================================*/
587   FUNCTION Populate_Headers_GT(
588              P_Invoice_Header_Rec        IN ap_invoices_all%ROWTYPE,
589              P_Calling_Mode              IN VARCHAR2,
590              P_eTax_Already_called_flag  IN VARCHAR2,
591              P_Event_Class_Code          OUT NOCOPY VARCHAR2,
592              P_Event_Type_Code           OUT NOCOPY VARCHAR2,
593              P_Error_Code                OUT NOCOPY VARCHAR2,
594              P_Calling_Sequence          IN VARCHAR2) RETURN BOOLEAN;
595 
596 /*=============================================================================
597  |  FUNCTION - Populate_Header_Import_GT()
598  |
599  |  DESCRIPTION
600  |    This function will get additional information required to populate the
601  |    ZX_TRANSACTION_HEADERS_GT from the import array structure.
602  |    This function returns TRUE if the insert to the temp table goes
603  |    through successfully.  Otherwise, FALSE.
604  |
605  |  PARAMETERS
606  |    P_Invoice_Header_Rec - record with invoice header information
607  |    P_Calling_Mode - calling mode. it is used to
608  |    P_Event_Class_Code - Event class code
609  |    P_Event_Type_Code - Event type code
610  |    P_error_code - Error code to be returned
611  |    P_calling_sequence -  Calling sequence
612  |
613  |  MODIFICATION HISTORY
614  |    DATE          Author         Action
615  |    20-JAN-2004   SYIDNER        Created
616  |
617 *============================================================================*/
618   FUNCTION Populate_Header_Import_GT(
619              P_Invoice_Header_Rec        IN AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
620              P_Calling_Mode              IN VARCHAR2,
621              P_Event_Class_Code          OUT NOCOPY VARCHAR2,
622              P_Event_Type_Code           OUT NOCOPY VARCHAR2,
623              P_Error_Code                OUT NOCOPY VARCHAR2,
624              P_Calling_Sequence          IN VARCHAR2) RETURN BOOLEAN;
625 
626 /*=============================================================================
627  |  FUNCTION - Populate_Lines_GT()
628  |
629  |  DESCRIPTION
630  |      This function will get additional information required to populate the
631  |      ZX_TRANSACTION_LINES_GT
632  |      This function returns TRUE if the population of the temp table goes
633  |      through successfully.  Otherwise, FALSE.
634  |
635  |  PARAMETERS
636  |      P_Invoice_Header_Rec - record with invoice header information
637  |      P_Calling_Mode - calling mode. it is used to
638  |      P_Event_Class_Code - Event class code for document
639  |      P_Line_Number - prepay line number to be unapplied
640  |      P_error_code - Error code to be returned
641  |      P_calling_sequence -  Calling sequence
642  |
643  |  MODIFICATION HISTORY
644  |    DATE          Author         Action
645  |    09-OCT-2003   SYIDNER        Created
646  |
647  *============================================================================*/
648   FUNCTION Populate_Lines_GT(
649              P_Invoice_Header_Rec      IN ap_invoices_all%ROWTYPE,
650              P_Calling_Mode            IN VARCHAR2,
651              P_Event_Class_Code        IN VARCHAR2,
652              P_Line_Number             IN NUMBER DEFAULT NULL,
653              P_Error_Code              OUT NOCOPY VARCHAR2,
654              P_Calling_Sequence        IN VARCHAR2) RETURN BOOLEAN;
655 
656 /*=============================================================================
657  |  FUNCTION - Populate_Lines_Import_GT()
658  |
659  |  DESCRIPTION
660  |      This function will get additional information required to populate the
661  |      ZX_TRANSACTION_LINES_GT
662  |      This function returns TRUE if the population of the temp table goes
663  |      through successfully.  Otherwise, FALSE.
664  |
665  |  PARAMETERS
666  |      P_Invoice_Header_Rec - record with invoice header information
667  |      P_Invoice_Lines_Tab - List of trx and tax lines for the invoice
668  |        existing in the ap_invoice_lines_interface table
669  |      P_Calling_Mode - calling mode. it is used to
670  |      P_Event_Class_Code - Event class code for document
671  |      P_error_code - Error code to be returned
672  |      P_calling_sequence -  Calling sequence
673  |
674  |  MODIFICATION HISTORY
675  |    DATE          Author         Action
676  |    20-JAN-2004   SYIDNER        Created
677  |
678  *============================================================================*/
679   FUNCTION Populate_Lines_Import_GT(
680              P_Invoice_Header_Rec      IN AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
681              P_Inv_Line_List           IN AP_IMPORT_INVOICES_PKG.t_lines_table,
682              P_Calling_Mode            IN VARCHAR2,
683              P_Event_Class_Code        IN VARCHAR2,
684              P_Error_Code              OUT NOCOPY VARCHAR2,
685              P_Calling_Sequence        IN VARCHAR2) RETURN BOOLEAN;
686 
687 /*=============================================================================
688  |  FUNCTION - Populate_Tax_Lines_GT()
689  |
690  |  DESCRIPTION
691  |      This function will get additional information required to populate the
692  |      ZX_TRANSACTION_LINES_GT, and  ZX_IMPORT_TAX_LINES_GT.
693  |      There is no need to populate ZX_TRX_TAX_LINK_GT since any tax line
694  |      manually created is assume to be allocated to all the ITEM lines in the
695  |      invoice.
696  |      This function returns TRUE if the population of the temp table goes
697  |      through successfully.  Otherwise, FALSE.
701  |      P_Calling_Mode - calling mode. it is used to
698  |
699  |  PARAMETERS
700  |      P_Invoice_Header_Rec - record with invoice header information
702  |      P_Event_Class_Code - Event class code for document
703  |      P_Tax_only_Flag - Indicates if the invoice is tax only
704  |      P_Inv_Rcv_Matched - determine if the invoice has any line matched to a
705  |                          receipt
706  |      P_error_code - Error code to be returned
707  |      P_calling_sequence -  Calling sequence
708  |
709  |  MODIFICATION HISTORY
710  |    DATE          Author         Action
711  |    06-FEB-2004   SYIDNER        Created
712  |
713  *============================================================================*/
714   FUNCTION Populate_Tax_Lines_GT(
715              P_Invoice_Header_Rec      IN ap_invoices_all%ROWTYPE,
716              P_Calling_Mode            IN VARCHAR2,
717              P_Event_Class_Code        IN VARCHAR2,
718              P_Tax_Only_Flag           IN VARCHAR2,
719              P_Inv_Rcv_Matched         IN OUT NOCOPY VARCHAR2,
720              P_Error_Code              OUT NOCOPY VARCHAR2,
721              P_Calling_Sequence        IN VARCHAR2) RETURN BOOLEAN;
722 
723 /*=============================================================================
724  |  FUNCTION - Populate_Distributions_GT()
725  |
726  |  DESCRIPTION
727  |      This function will get additional information required to populate the
728  |      ZX_DISTRIBUTION_LINES_GT
729  |      This function returns TRUE if the population of the temp table goes
730  |      through successfully.  Otherwise, FALSE.
731  |
732  |  PARAMETERS
733  |      P_Invoice_Header_Rec - record with invoice header information
734  |      P_Calling_Mode - calling mode. it is used to
735  |      P_Event_Class_Code - Event class code for document
736  |      P_Event_Type_Code - Evnet type code
737  |      P_error_code - Error code to be returned
738  |      P_calling_sequence -  Calling sequence
739  |
740  |  MODIFICATION HISTORY
741  |    DATE          Author         Action
742  |    20-OCT-2003   SYIDNER        Created
743  |
744  *============================================================================*/
745   FUNCTION Populate_Distributions_GT(
746              P_Invoice_Header_Rec      IN ap_invoices_all%ROWTYPE,
747              P_Calling_Mode            IN VARCHAR2,
748              P_Event_Class_Code        IN VARCHAR2,
749              P_Event_Type_Code         IN VARCHAR2,
750              P_Error_Code              OUT NOCOPY VARCHAR2,
751              P_Calling_Sequence        IN VARCHAR2) RETURN BOOLEAN;
752 
753 
754 /*=============================================================================
755  |  FUNCTION - Update_AP()
756  |
757  |  DESCRIPTION
758  |      This function will handle the return of values from the eTax repository
759  |      This will be called from all the functions that call the etax services
760  |      in the case the call is successfull.
761  |
762  |  PARAMETERS
763  |      P_Invoice_header_rec - Invoice header info
764  |      P_Calling_Mode - calling mode.
765  |      P_All_Error_Messages - Should API return 1 error message or allow
766  |                             calling point to get them from message stack
767  |      P_error_code - Error code to be returned
768  |      P_calling_sequence -  Calling sequence
769  |
770  |  MODIFICATION HISTORY
771  |    DATE          Author         Action
772  |    20-OCT-2003   SYIDNER        Created
773  |
774  *============================================================================*/
775   FUNCTION Update_AP(
776              P_Invoice_header_rec      IN ap_invoices_all%ROWTYPE,
777              P_Calling_Mode            IN VARCHAR2,
778              P_All_Error_Messages      IN VARCHAR2,
779              P_Error_Code              OUT NOCOPY VARCHAR2,
780              P_Calling_Sequence        IN VARCHAR2) RETURN BOOLEAN;
781 
782 /*=============================================================================
783  |  FUNCTION - Calculate_Quote ()
784  |
785  |  DESCRIPTION
786  |      This function will return the tax amount and indicate if it is inclusive.
787  |      This will be called from the recurring invoices form. This is a special
788  |      case, as the invoices for which the tax is to be calculated are not yet
789  |      saved to the database and eBTax global temporary tables are populated
790  |      based on the parameters. A psuedo-line is inserted into the GTT and
791  |      removed after the tax amount is calculated.
792  |
793  |  PARAMETERS
794  |      P_Invoice_header_rec 	- Invoice header info
795  |      P_Invoice_Lines_Rec	- Invoice lines info
796  |      P_Calling_Mode 		- Calling mode. (CALCULATE_QUOTE)
797  |      P_All_Error_Messages 	- Should API return 1 error message or allow
798  |                                calling point to get them from message stack
799  |      P_error_code 		- Error code to be returned
800  |      P_calling_sequence 	- Calling sequence
801  |
802  |  MODIFICATION HISTORY
803  |    DATE          Author         Action
804  |    13-AUG-2003   Sanjay         Created
805  *============================================================================*/
806   FUNCTION CALCULATE_QUOTE(
807              P_Invoice_Header_Rec      	IN  ap_invoices_all%ROWTYPE,
808              P_Invoice_Lines_Rec	IN  ap_invoice_lines_all%ROWTYPE,
809              P_Calling_Mode            	IN  VARCHAR2,
810              P_Tax_Amount		OUT NOCOPY NUMBER,
811 	     P_Tax_Amt_Included		OUT NOCOPY VARCHAR2,
812              P_Error_Code              	OUT NOCOPY VARCHAR2,
813              P_Calling_Sequence         IN  VARCHAR2) RETURN BOOLEAN;
814 
815  -- Bug 5110693: Added the new function to generate tax for recouped prepay distributions.
816 
817 /*=============================================================================
818  |  FUNCTION - Generate_Recouped_Tax ()
819  |
820  |  DESCRIPTION
821  |      This function will generate tax distribitons for recouped prepay
822  |      distributions.
823  |
824  *============================================================================*/
825   FUNCTION Generate_Recouped_Tax(
826              P_Invoice_id              IN NUMBER,
827 	     P_Invoice_Line_Number     IN NUMBER,
828              P_Calling_Mode            IN VARCHAR2,
829              P_All_Error_Messages      IN VARCHAR2,
830              P_Error_Code              OUT NOCOPY VARCHAR2,
831              P_Calling_Sequence        IN VARCHAR2) RETURN BOOLEAN;
832 
833  -- Bug 5185023: Added the new function to delete preview tax distributions
834 
835 /*=============================================================================
836  |  FUNCTION - Delete_Tax_Distributions ()
837  |
838  |  DESCRIPTION
839  |      This function will delete tax distributions in the etax schema that
840  |      were generated for preview item distributions. This is called in the
841  |      invoice workbench prior to deleting preview distributions.
842  |
843  *============================================================================*/
844 
845   FUNCTION Delete_Tax_Distributions
846                         (p_invoice_id         IN  ap_invoice_distributions_all.invoice_id%Type,
847                          p_calling_mode       IN  VARCHAR2,
848                          p_all_error_messages IN  VARCHAR2,
849                          p_error_code         OUT NOCOPY VARCHAR2,
850                          p_calling_sequence   IN  VARCHAR2) RETURN BOOLEAN;
851 
852 /*=============================================================================
853  |  FUNCTION - Calculate_Tax_Receipt_Match ()
854  |
855  |  DESCRIPTION
856  |      This function will synch tax repository for tax matched to receipts.
857  |
858  *============================================================================*/
859 
860   FUNCTION Calculate_Tax_Receipt_Match(
861 			P_Invoice_Id              IN  NUMBER,
862 			P_Calling_Mode            IN  VARCHAR2,
863 			P_All_Error_Messages      IN  VARCHAR2,
864 			P_Error_Code              OUT NOCOPY VARCHAR2,
865 			P_Calling_Sequence        IN  VARCHAR2) RETURN BOOLEAN;
866 
867 
868 /*=============================================================================
869  |  FUNCTION - Bulk_Populate_Headers_GT ()
870  |
871  |  DESCRIPTION
872  |      This function will populate the invoice headers to the tax staging table
873  |      in bulk during invoice validation.
874  |
875  *============================================================================*/
876 
877   FUNCTION Bulk_Populate_Headers_GT
878 			(p_validation_request_id IN  NUMBER,
879 			 p_calling_mode		 IN  VARCHAR2,
880 	     	 p_error_code		 OUT NOCOPY VARCHAR2) RETURN BOOLEAN;
881 
882   ------
883   TYPE org_rec Is RECORD(
884          bill_to_location_id       hr_all_organization_units.location_id%type);
885 
886   TYPE org_tab IS TABLE OF org_rec
887   INDEX BY PLS_INTEGER;
888 
889   g_org_attributes      org_tab;
890   ------
891 
892   TYPE supplier_site_rec Is RECORD(
893          location_id     ap_supplier_sites_all.location_id%type,
894          fob_lookup_code ap_supplier_sites_all.fob_lookup_code%type);
895 
896   TYPE supplier_site_tab IS TABLE OF supplier_site_rec
897   INDEX BY PLS_INTEGER;
898 
899   g_site_attributes     supplier_site_tab;
900   ------
901 
902   TYPE fsp_rec Is RECORD(
903          inventory_organization_id financials_system_params_all.inventory_organization_id%type);
904 
905   TYPE fsp_tab IS TABLE OF fsp_rec
906   INDEX BY PLS_INTEGER;
907 
908   g_fsp_attributes      fsp_tab;
909 
910   ------
911 
912 
913   --Bugfix: 5565310
914   PROCEDURE get_po_tax_attributes
915                   (p_application_id               IN  NUMBER,
916 		           p_org_id                       IN  NUMBER,
917 		           p_entity_code                  IN  VARCHAR2,
918 		           p_event_class_code             IN  VARCHAR2,
919 		           p_trx_level_type               IN  VARCHAR2,
920 		           p_trx_id                       IN  NUMBER,
921 		           p_trx_line_id                  IN  NUMBER,
922 		           x_line_intended_use            OUT NOCOPY VARCHAR2,
923 		           x_product_type                 OUT NOCOPY VARCHAR2,
924 		           x_product_category             OUT NOCOPY VARCHAR2,
925 		           x_product_fisc_classification  OUT NOCOPY VARCHAR2,
926 		           x_user_defined_fisc_class      OUT NOCOPY VARCHAR2,
927 		           x_assessable_value             OUT NOCOPY NUMBER,
928 		           x_tax_classification_code      OUT NOCOPY VARCHAR2);
929 
930   --bug 8495005 fix starts
931   PROCEDURE get_po_tax_attributes
932                   (p_application_id               IN  NUMBER,
933 		           p_org_id                       IN  NUMBER,
934 		           p_entity_code                  IN  VARCHAR2,
935 		           p_event_class_code             IN  VARCHAR2,
936 		           p_trx_level_type               IN  VARCHAR2,
937 		           p_trx_id                       IN  NUMBER,
938 		           p_trx_line_id                  IN  NUMBER,
939 		           x_line_intended_use            OUT NOCOPY VARCHAR2,
940 		           x_product_type                 OUT NOCOPY VARCHAR2,
941 		           x_product_category             OUT NOCOPY VARCHAR2,
942 		           x_product_fisc_classification  OUT NOCOPY VARCHAR2,
943 		           x_user_defined_fisc_class      OUT NOCOPY VARCHAR2,
944 		           x_assessable_value             OUT NOCOPY NUMBER,
945 		           x_tax_classification_code      OUT NOCOPY VARCHAR2,
946 			       x_taxation_country		OUT NOCOPY VARCHAR2,
947 			       x_trx_biz_category		OUT NOCOPY VARCHAR2);
948   --bug 8495005 fix ends
949 
950 -- Bug 7570234 Start
951   PROCEDURE synchronize_for_doc_seq
952                 	(p_invoice_id       		  IN NUMBER ,
953 	           	     p_calling_sequence 		  IN VARCHAR2 ,
954 		             x_return_status    		  OUT NOCOPY VARCHAR2);
955 -- Bug 7570234 End
956 
957    --Bug9819170
958 
959    PROCEDURE synchronize_tax_dff
960              (p_invoice_id                 IN NUMBER ,
961              p_invoice_dist_id            IN NUMBER   DEFAULT NULL,
962              p_related_id                 IN NUMBER   DEFAULT NULL,
963              p_detail_tax_dist_id         IN NUMBER   DEFAULT NULL,
964              p_line_type_lookup_code      IN VARCHAR2 DEFAULT NULL,
965              p_invoice_line_number        IN NUMBER,
966              p_distribution_line_number   IN NUMBER,
967              P_ATTRIBUTE1                 IN VARCHAR2,
968              P_ATTRIBUTE2                 IN VARCHAR2,
969              P_ATTRIBUTE3                 IN VARCHAR2,
970              P_ATTRIBUTE4                 IN VARCHAR2,
971              P_ATTRIBUTE5                 IN VARCHAR2,
972              P_ATTRIBUTE6                 IN VARCHAR2,
973              P_ATTRIBUTE7                 IN VARCHAR2,
974              P_ATTRIBUTE8                 IN VARCHAR2,
975              P_ATTRIBUTE9                 IN VARCHAR2,
976              P_ATTRIBUTE10                IN VARCHAR2,
977              P_ATTRIBUTE11                IN VARCHAR2,
978              P_ATTRIBUTE12                IN VARCHAR2,
979              P_ATTRIBUTE13                IN VARCHAR2,
980              P_ATTRIBUTE14                IN VARCHAR2,
981              P_ATTRIBUTE15                IN VARCHAR2,
982              P_ATTRIBUTE_CATEGORY         IN VARCHAR2,
983        	     p_calling_sequence           IN VARCHAR2 ,
984              x_return_status             OUT NOCOPY VARCHAR2);
985 
986    --Bug9819170
987 
988 
989 END AP_ETAX_SERVICES_PKG;