DBA Data[Home] [Help]

PACKAGE: APPS.AP_ETAX_UTILITY_PKG

Source


1 PACKAGE AP_ETAX_UTILITY_PKG AS
2 /* $Header: apetxuts.pls 120.15 2007/12/13 07:59:31 suchhabr ship $ */
3 
4 /*=============================================================================
5  |  FUNCTION - Get_Event_Class_Code()
6  |
7  |  DESCRIPTION
8  |      Public function that will get the event class code required to call
9  |      eTax services based on the invoice type
10  |
11  |  PARAMETERS
12  |      P_Invoice_Type_Lookup_Code - Invoice Type
13  |      P_Event_Class_Code - event class code
14  |      P_error_code - Error code to be returned
15  |      P_calling_sequence -  Calling sequence
16  |
17  |  MODIFICATION HISTORY
18  |    DATE          Author         Action
19  |    08-OCT-2003   SYIDNER        Created
20  |
21  *============================================================================*/
22 
23   FUNCTION Get_Event_Class_Code(
24              P_Invoice_Type_Lookup_Code    IN VARCHAR2,
25              P_Event_Class_Code            OUT NOCOPY VARCHAR2,
26              P_Error_Code                  OUT NOCOPY VARCHAR2,
27              P_Calling_Sequence            IN VARCHAR2) RETURN BOOLEAN;
28 
29 
30 /*=============================================================================
31  |  FUNCTION - Get_Event_Type_Code()
32  |
33  |  DESCRIPTION
34  |      Public function that will get the event type code required to call
35  |      eTax services based on the event class code, calling_mode and if
36  |      eTax was already called or not.
37  |
38  |  PARAMETERS
39  |      P_Event_Class_Code - Event class code
40  |      P_Calling_Mode - Calling mode
41  |      P_eTax_Already_called_flag - Is eTax already called?
42  |      P_Event_Type_Code - event type code
43  |      P_error_code - Error code to be returned
44  |      P_calling_sequence -  Calling sequence
45  |
46  |  MODIFICATION HISTORY
47  |    DATE          Author         Action
48  |    09-OCT-2003   SYIDNER        Created
49  |
50  *============================================================================*/
51 
52   FUNCTION Get_Event_Type_Code(
53              P_Event_Class_Code            IN VARCHAR2,
54              P_Calling_Mode                IN VARCHAR2,
55              P_eTax_Already_called_flag    IN VARCHAR2,
56              P_Event_Type_Code             OUT NOCOPY VARCHAR2,
57              P_Error_Code                  OUT NOCOPY VARCHAR2,
58              P_Calling_Sequence            IN VARCHAR2) RETURN BOOLEAN;
59 
60 
61 /*=============================================================================
62  |  FUNCTION - Get_Corrected_Invoice_Info()
63  |
64  |  DESCRIPTION
65  |      This function return the additional information required to populate
66  |      the zx_transaction_lines_gt global temporary table for eTax.
67  |
68  |  PARAMETERS
69  |      P_Corrected_Invoice_Id - Invoice Id for the corrected line
70  |      P_corrected_Line_number - Line number for the corrected line
71  |      P_Application_Id - Application Id for the corrected invoice
72  |      P_Entity_code - entity code required for the event class
73  |      P_Event_Class_Code - Event class code for the corrected invoice
74  |      P_Invoice_Number - Corrected invoice number
75  |      P_Invoice_Date - corrected invoice date
76  |      P_error_code - Error code to be returned
77  |      P_calling_sequence -  Calling sequence
78  |
79  |  MODIFICATION HISTORY
80  |    DATE          Author         Action
81  |    13-OCT-2003   SYIDNER        Created
82  |
83  *============================================================================*/
84   FUNCTION Get_Corrected_Invoice_Info(
85              P_Corrected_Invoice_Id        IN NUMBER,
86              P_Corrected_Line_Number       IN NUMBER,
87              P_Application_Id              OUT NOCOPY NUMBER,
88              P_Entity_code                 OUT NOCOPY VARCHAR2,
89              P_Event_Class_Code            OUT NOCOPY VARCHAR2,
90              P_Invoice_Number              OUT NOCOPY VARCHAR2,
91              P_Invoice_Date                OUT NOCOPY DATE,
92              P_Error_Code                  OUT NOCOPY VARCHAR2,
93              P_Calling_Sequence            IN VARCHAR2) RETURN BOOLEAN;
94 
95 
96 /*=============================================================================
97  |  FUNCTION - Get_Prepay_Invoice_Info()
98  |
99  |  DESCRIPTION
100  |      This function return the additional information required to populate
101  |      the zx_transaction_lines_gt global temporary table for eTax.
102  |
103  |  PARAMETERS
104  |      P_Prepay_Invoice_Id - Invoice Id for the applied prepay line
105  |      P_Prepay_Line_number - Line number for the applied prepay line
106  |      P_Application_Id - Application Id for the applied prepay invoice
107  |      P_Entity_code - entity code required for the event class
108  |      P_Event_Class_Code - Event class code for the applied prepay invoice
109  |      P_Invoice_Number - Applied Prepayment number
110  |      P_Invoice_Date - Applied prepayment invoice date
111  |      P_error_code - Error code to be returned
112  |      P_calling_sequence -  Calling sequence
113  |
114  |  MODIFICATION HISTORY
115  |    DATE          Author         Action
116  |    15-OCT-2003   SYIDNER        Created
117  |
118  *============================================================================*/
119   FUNCTION Get_Prepay_Invoice_Info(
120              P_Prepay_Invoice_Id        IN NUMBER,
121              P_Prepay_Line_Number       IN NUMBER,
122              P_Application_Id              OUT NOCOPY NUMBER,
123              P_Entity_code                 OUT NOCOPY VARCHAR2,
124              P_Event_Class_Code            OUT NOCOPY VARCHAR2,
125              P_Invoice_Number              OUT NOCOPY VARCHAR2,
126              P_Invoice_Date                OUT NOCOPY DATE,
127              P_Error_Code                  OUT NOCOPY VARCHAR2,
128              P_Calling_Sequence            IN VARCHAR2) RETURN BOOLEAN;
129 
130 
131 /*=============================================================================
132  |  FUNCTION - Get_Receipt_Info()
133  |
134  |  DESCRIPTION
135  |      This function return the additional information required to populate
136  |      the zx_transaction_lines_gt global temporary table for eTax.
137  |
138  |  PARAMETERS
139  |      P_Rcv_Transaction_Id - Receipt id
140  |      P_Application_Id - Application Id for the Receipt (201)
141  |      P_Entity_code - entity code required for the event class
142  |      P_Event_Class_Code - Event class code for the receipt
143  |      P_Transaction_Date - Transaction date
144  |      P_error_code - Error code to be returned
145  |      P_calling_sequence -  Calling sequence
146  |
147  |  MODIFICATION HISTORY
148  |    DATE          Author         Action
149  |    15-OCT-2003   SYIDNER        Created
150  |
151  *============================================================================*/
152   FUNCTION Get_Receipt_Info(
153              P_Rcv_Transaction_Id          IN NUMBER,
154              P_Application_Id              OUT NOCOPY NUMBER,
155              P_Entity_code                 OUT NOCOPY VARCHAR2,
156              P_Event_Class_Code            OUT NOCOPY VARCHAR2,
157              P_Transaction_Date            OUT NOCOPY DATE,
158              P_Error_Code                  OUT NOCOPY VARCHAR2,
159              P_Calling_Sequence            IN VARCHAR2) RETURN BOOLEAN;
160 
161 /*=============================================================================
162  |  FUNCTION - Get_PO_Info()
163  |
164  |  DESCRIPTION
165  |      This function return the additional information required to populate
166  |      the zx_transaction_lines_gt global temporary table for eTax.
167  |
168  |  PARAMETERS
169  |      P_Po_line_location_id - PO line location
170  |      P_Po_Distribution_id - Po distribution
171  |      P_Application_Id - Application Id for the PO document (201)
172  |      P_Entity_code - entity code required for the event class
173  |      P_Event_Class_Code - Event class code for the PO doc
174  |      P_PO_Quantity - PO quantity
175  |      P_Product_Org_Id - Product Org_id
176  |      P_Po_Header_Id - po header id
177  |      P_Po_Header_Curr_Conv_Rate - Po Header currency conversion rate
178  |      P_error_code - Error code to be returned
179  |      P_calling_sequence -  Calling sequence
180  |
181  |  MODIFICATION HISTORY
182  |    DATE          Author         Action
183  |    15-OCT-2003   SYIDNER        Created
184  |    20-OCT-2003   SYIDNER        Included po_distribution as a parameter
185  |                                 and modify the function to return Po data
186  |                                 for the call to the determine_recovery serv
187  |
188  *============================================================================*/
189   FUNCTION Get_PO_Info(
190              P_PO_Line_Location_Id         IN OUT NOCOPY NUMBER,
191              P_Po_Distribution_Id          IN NUMBER,
192              P_Application_Id              OUT NOCOPY NUMBER,
193              P_Entity_code                 OUT NOCOPY VARCHAR2,
194              P_Event_Class_Code            OUT NOCOPY VARCHAR2,
195              P_PO_Quantity                 OUT NOCOPY NUMBER,
196              P_Product_Org_Id              OUT NOCOPY NUMBER,
197              P_Po_Header_Id                OUT NOCOPY NUMBER,
198              P_Po_Header_Curr_Conv_Rate    OUT NOCOPY NUMBER,
199              P_Uom_Code                    OUT NOCOPY VARCHAR2,
200              P_Dist_Qty                    OUT NOCOPY NUMBER,
201              P_Ship_Price                  OUT NOCOPY NUMBER,
202              P_Error_Code                  OUT NOCOPY VARCHAR2,
203              P_Calling_Sequence            IN VARCHAR2) RETURN BOOLEAN;
204 
205 /*=============================================================================
206  |  FUNCTION - Get_Prepay_Awt_Group_Id()
207  |
208  |  DESCRIPTION
209  |      This function return the awt_group_id for a parent prepay item line
210  |      based on the prepayment distribution id.
211  |
212  |  PARAMETERS
213  |      P_Prepay_Distribution_id - Distribution Id of the prepayment
214  |
215  |  MODIFICATION HISTORY
216  |    DATE          Author         Action
217  |    15-OCT-2003   SYIDNER        Created
218  |
219  *============================================================================*/
220   FUNCTION Get_Prepay_Awt_Group_Id(
221              P_Prepay_Distribution_id    IN NUMBER,
222              P_Calling_Sequence          IN VARCHAR2) RETURN NUMBER;
223 
224 
225 /*=============================================================================
226  |  FUNCTION - Return_Tax_Lines()
227  |
228  |  DESCRIPTION
229  |      This function handles the return of tax lines.  It includes creation,
230  |      update, or delete of existing exclusive tax lines in AP if required.
231  |      It also handles the update of the total tax amounts. (Inclusive and
232  |      self-assessed.
233  |
234  |  PARAMETERS
235  |      P_Invoice_Header_Rec - Header info
236  |      P_error_code - Error code to be returned
237  |      P_calling_sequence -  Calling sequence
238  |
239  |  MODIFICATION HISTORY
240  |    DATE          Author         Action
241  |    15-OCT-2003   SYIDNER        Created
242  |
243  *============================================================================*/
244   FUNCTION Return_Tax_Lines(
245              P_Invoice_Header_Rec        IN ap_invoices_all%ROWTYPE,
246              P_Error_Code                OUT NOCOPY VARCHAR2,
247              P_Calling_Sequence          IN VARCHAR2) RETURN BOOLEAN;
248 
249 /*=============================================================================
250  |  FUNCTION - Return_Tax_Distributions()
254  |      update, or delete of existing distributions and TIPV and TERV distributions if
251  |
252  |  DESCRIPTION
253  |      This function handles the return of tax distributions.  It includes creation,
255  |      required.
256  |      It also handles the creation, update or delete of self-assessed
257  |      distributions.
258  |
259  |  PARAMETERS
260  |      P_Invoice_Header_Rec - Header info
261  |      P_All_Error_Messages - Should API return 1 error message or allow
262  |                             calling point to get them from message stack
263  |      P_error_code - Error code to be returned
264  |      P_calling_sequence -  Calling sequence
265  |
266  |  MODIFICATION HISTORY
267  |    DATE          Author         Action
268  |    23-OCT-2003   SYIDNER        Created
269  |
270  *============================================================================*/
271   FUNCTION Return_Tax_Distributions(
272              P_Invoice_Header_Rec        IN ap_invoices_all%ROWTYPE,
273              P_All_Error_Messages        IN VARCHAR2,
274              P_Error_Code                OUT NOCOPY VARCHAR2,
275              P_Calling_Sequence          IN VARCHAR2) RETURN BOOLEAN;
276 
277 /*=============================================================================
278  |  FUNCTION - Return_Tax_Quote()
279  |
280  |  DESCRIPTION
281  |      This function handles the return of tax lines when the calculate service is
282  |      ran for quote.  This case is specific for recurring invoices and invoice lines
283  |      created through distribution sets.
284  |
285  |  PARAMETERS
286  |      P_Invoice_Header_Rec - Header info
287  |      P_error_code - Error code to be returned
288  |      P_calling_sequence -  Calling sequence
289  |
290  |  MODIFICATION HISTORY
291  |    DATE          Author         Action
292  |    03-NOV-2003   SYIDNER        Created
293  |
294  *============================================================================*/
295   FUNCTION Return_Tax_Quote(
296              P_Invoice_Header_Rec        IN ap_invoices_all%ROWTYPE,
297              P_Error_Code                OUT NOCOPY VARCHAR2,
298              P_Calling_Sequence          IN VARCHAR2) RETURN BOOLEAN;
299 
300 /*=============================================================================
301  |  FUNCTION - Return_Default_Import()
302  |
303  |  DESCRIPTION
304  |      This function handles the return of default values for tax and trx lines
305  |      after running the eTax service that validates and defaults info during the
306  |      import program.  This function will modify the pl/sql tables used in the
307  |      import program.
308  |
309  |  PARAMETERS
310  |      P_Invoice_Header_Rec - Header info
311  |      P_All_Error_Messages - Should API return 1 error message or allow
312  |                             calling point to get them from message stack
313  |      P_error_code - Error code to be returned
314  |      P_calling_sequence -  Calling sequence
315  |	P_Invoice_Status -Status flag to check if further processing should be done.--Bug6625518
316  |
317  |  MODIFICATION HISTORY
318  |    DATE          Author         Action
319  |    20-JAN-2004   SYIDNER        Created
320  |
321  *============================================================================*/
322   FUNCTION Return_Default_Import(
323              P_Invoice_Header_Rec        IN OUT NOCOPY AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
324              P_Invoice_Lines_Tab         IN OUT NOCOPY AP_IMPORT_INVOICES_PKG.t_lines_table,
325              P_All_Error_Messages        IN VARCHAR2,
326              P_Error_Code                OUT NOCOPY VARCHAR2,
327              P_Calling_Sequence          IN VARCHAR2,
328 	     P_Invoice_Status		 OUT NOCOPY VARCHAR2) --Bug6625518
329 	     RETURN BOOLEAN;
330 
331 /*=============================================================================
332  |  FUNCTION - Return_Error_Messages()
333  |
334  |  DESCRIPTION
335  |      This function will handle the return of the error messages from the
336  |      eTax services.  The services can return 1 or more error messages or
337  |      warnings.  The calling point will indicate the API if it wants the return of
338  |      only 1 error messages through the parameter P_All_Error_Messages = N
339  |      eventhough the service returns more than one error message.
340  |      If the calling point requires all the error messages, it will need to get them
341  |      directly from the message stack.
342  |
343  |  PARAMETERS
344  |      P_All_Error_Messages - Y or N.  It indicades if the function will return
345  |                             only 1 message or will allow the calling module
346  |                             to handle the returning of errors.
347  |      P_Msg_Count - Number of error messages the eTax function returns.
348  |      P_Msg_Data - In case only 1 error is return the text of the name of the
349  |                   message
350  |      P_Error_Code - The error code this function will return if
351  |                     all_error_messages is N
352  |      P_Calling_Sequence - Calling sequence
353  |
354  |  MODIFICATION HISTORY
355  |    DATE          Author         Action
356  |    05-NOV-2003   SYIDNER        Created
357  |
358  *============================================================================*/
359   FUNCTION Return_Error_Messages(
360              P_All_Error_Messages        IN VARCHAR2,
364              P_Calling_Sequence          IN VARCHAR2) RETURN BOOLEAN;
361              P_Msg_Count                 IN NUMBER,
362              P_Msg_Data                  IN VARCHAR2,
363              P_Error_Code                OUT NOCOPY VARCHAR2,
365 
366 /*=============================================================================
367  |  FUNCTION - Is_Tax_Already_Calc_Inv()
368  |
369  |  DESCRIPTION
370  |    This function will return TRUE if any taxable line in the invoice has the
371  |    tax_already_calculated_flag equals Y.  It will return FALSE otherwise.
372  |
373  |  PARAMETERS
374  |    P_Invoice_Id - Invoice Id
375  |    P_Calling_Sequence - calling sequence
376  |
377  |  MODIFICATION HISTORY
378  |    DATE          Author         Action
379  |    29-DEC-2003   SYIDNER        Created
380  |
381  *============================================================================*/
382   FUNCTION Is_Tax_Already_Calc_Inv(
383              P_Invoice_Id                IN NUMBER,
384              P_Calling_Sequence          IN VARCHAR2) RETURN BOOLEAN;
385 
386   /*=============================================================================
387   |  FUNCTION - Is_Tax_Already_Calc_Inv_char()
388   |
389   |  DESCRIPTION
390   |    This function will return 'Y' if any taxable line in the invoice has the
391   |    tax_already_calculated_flag equals Y.  It will return 'N' otherwise.
392   |
393   |	It is same as the function Is_Tax_Already_Calc_Inv except that it will
394   |	 return a VARCHAR value instead of BOOLEAN
395   |
396   |  PARAMETERS
397   |    P_Invoice_Id - Invoice Id
398   |    P_Calling_Sequence - calling sequence
399   |
400   |  MODIFICATION HISTORY
401   |    DATE          Author         Action
402   |    09-JUL-2004   SMYADAM        Created
403   |
404   *============================================================================*/
405   FUNCTION Is_Tax_Already_Calc_Inv_char(
406   	     P_Invoice_Id		IN NUMBER,
407 	     P_Calling_Sequence		IN VARCHAR2) RETURN VARCHAR2;
408 
409 /*=============================================================================
410  |  FUNCTION - Is_Tax_Already_Dist_Inv()
411  |
412  |  DESCRIPTION
413  |    This function will return TRUE if any taxable distribution for the invoice
414  |    has the tax_already_distributed_flag equals Y.  It will return FALSE otherwise.
415  |
416  |  PARAMETERS
417  |    P_Invoice_Id - Invoice Id
418  |    P_Calling_Sequence - calling sequence
419  |
420  |  MODIFICATION HISTORY
421  |    DATE          Author         Action
422  |    29-DEC-2003   SYIDNER        Created
423  |
424  *============================================================================*/
425   FUNCTION Is_Tax_Already_Dist_Inv(
426              P_Invoice_Id                IN NUMBER,
427              P_Calling_Sequence          IN VARCHAR2) RETURN BOOLEAN;
428 
429 /*=============================================================================
430  |  FUNCTION - Get_Dist_Id_For_Tax_Dist_Id()
431  |
432  |  DESCRIPTION
433  |    This function will return the invoice_distribution_id for an AP TAX (
434  |    recoverable, non recoverable or tax variance distribution)
435  |    based on the detail_tax_dist_id
436  |
437  |  PARAMETERS
438  |    P_Tax_Dist_Id - Is the id for a Tax distribution in eTax
439  |
440  |  MODIFICATION HISTORY
441  |    DATE          Author         Action
442  |    02-APR-2004   SYIDNER        Created
443  |
444  *============================================================================*/
445   FUNCTION Get_Dist_Id_For_Tax_Dist_Id(
446              P_Tax_Dist_Id               IN NUMBER ) RETURN NUMBER;
447 
448 /*=============================================================================
449  |  PROCEDURE - set_tax_security_context()
450  |
451  |  DESCRIPTION
452  |    This procedure will return the tax effective date. The effective date
453  |    is used in the list of values for tax drivers and tax related attributes.
454  |
455  |  PARAMETERS
456  |    P_Tax_Dist_Id       - Is the id for a Tax distribution in eTax
457  |    P_Org_Id            - Default organization identifier.
458  |    P_Legal_Entity_Id   - Legal entity identifier.
459  |    P_Transaction_Date  - Document Transaction Date
460  |    P_Related_Doc_Date  - Date of the related document.  (Eg: Standard PO)
461  |    P_Adjusted_Doc_Date - Date of the adjusted document. (Eg: DM/CM applied to Invoice)
462  |
463  |  MODIFICATION HISTORY
464  |    DATE          Author  Action
465  |    13-AUG-2004   Sanjay  Created
466  *============================================================================*/
467   PROCEDURE set_tax_security_context
468 				(p_org_id		IN NUMBER,
469 				 p_legal_entity_id	IN NUMBER,
470 				 p_transaction_date	IN DATE,
471 				 p_related_doc_date	IN DATE,
472 				 p_adjusted_doc_date	IN DATE,
473 				 p_effective_date	OUT NOCOPY DATE,
474 				 p_return_status	OUT NOCOPY VARCHAR2,
475 				 p_msg_count		OUT NOCOPY NUMBER,
476 				 p_msg_data		OUT NOCOPY VARCHAR2);
477 
478 /*=============================================================================
479  |  FUNCTION - get_tipv()
480  |
481  |  DESCRIPTION
482  |    This function will return the tax invoice price variance.
483  *============================================================================*/
484   FUNCTION get_tipv ( p_rate_tax_factor		IN NUMBER   ,
488 		      p_ref_per_unit_nr_amt	IN NUMBER   ,
485 		      p_quantity_invoiced	IN NUMBER   ,
486 		      p_inv_unit_price		IN NUMBER   ,
487 		      p_ref_doc_unit_price	IN NUMBER   ,
489 		      p_pc_price_diff		IN NUMBER   ,
490 		      p_corrected_inv_id	IN NUMBER   ,
491 		      p_line_type		IN VARCHAR2 ,
492 		      p_line_source		IN VARCHAR2 ,
493 		      p_inv_currency_code	IN VARCHAR2 ,
494 		      p_line_match_type		IN VARCHAR2 ) RETURN NUMBER;
495 
496 /*=============================================================================
497  |  FUNCTION get_tipv_base()
498  |
499  |  DESCRIPTION
500  |    This function will return the tax invoice price variance in functional currency.
501  *============================================================================*/
502   FUNCTION get_tipv_base
503 		( p_rate_tax_factor		IN NUMBER ,
504 		  p_quantity_invoiced		IN NUMBER ,
505 		  p_inv_unit_price		IN NUMBER ,
506 		  p_ref_doc_unit_price		IN NUMBER ,
507 		  p_ref_per_trx_nrec_amt	IN NUMBER ,
508 		  p_price_diff			IN NUMBER ,
509 		  p_inv_currency_rate		IN NUMBER ,
510 		  p_ref_doc_curr_rate		IN NUMBER ,
511 		  p_adj_doc_curr_rate		IN NUMBER ,
512 		  p_corrected_inv_id		IN NUMBER ,
513 		  p_line_type			IN VARCHAR2 ,
514 		  p_line_source			IN VARCHAR2 ,
515 		  p_inv_currency_code		IN VARCHAR2 ,
516 		  p_base_currency_code		IN VARCHAR2 ,
517 		  p_line_match_type		IN VARCHAR2 ) RETURN NUMBER;
518 
519 /*=============================================================================
520  |  FUNCTION get_exchange_rate_variance()
521  |
522  |  DESCRIPTION
523  |    This function will return the tax exchange rate variance.
524  *============================================================================*/
525   FUNCTION get_terv
526 		( p_quantity_invoiced		IN NUMBER   ,
527 		  p_inv_curr_conv_rate		IN NUMBER   ,
528 		  p_ref_doc_curr_conv_rate	IN NUMBER   ,
529 		  p_app_doc_curr_conv_rate	IN NUMBER   ,
530 		  p_adj_doc_curr_conv_rate	IN NUMBER   ,
531 		  p_per_unit_nrec_amt		IN NUMBER   ,
532 		  p_ref_doc_per_unit_nrec_amt	IN NUMBER   ,
533 		  p_corrected_inv_id		IN NUMBER   ,
534 		  p_line_type			IN VARCHAR2 ,
535 		  p_line_source			IN VARCHAR2 ,
536 		  p_base_currency_code		IN VARCHAR2 ) RETURN NUMBER;
537 
538 /*=============================================================================
539  |  FUNCTION get_exchange_rate_variance()
540  |
541  |  DESCRIPTION
542  |    This function will return the total tax variance.
543  *============================================================================*/
544   FUNCTION get_tv ( p_rate_tax_factor		IN NUMBER   ,
545 		    p_quantity_invoiced		IN NUMBER   ,
546 		    p_inv_per_unit_nrec         IN NUMBER   ,
547 		    p_ref_per_unit_nrec         IN NUMBER   ,
548 		    p_inv_per_trx_cur_unit_nrec IN NUMBER   ,
549 		    p_ref_per_trx_cur_unit_nrec	IN NUMBER   ,
550 		    p_pc_price_diff		IN NUMBER   ,
551 		    p_corrected_inv_id		IN NUMBER   ,
552 		    p_line_type			IN VARCHAR2 ,
553 		    p_line_source		IN VARCHAR2 ,
554 		    p_inv_currency_code		IN VARCHAR2 ,
555 		    p_line_match_type		IN VARCHAR2 ,
556 		    p_unit_price		IN NUMBER   ) RETURN NUMBER;
557 
558 
559 /*=============================================================================
560  |  FUNCTION get_exchange_rate_variance()
561  |
562  |  DESCRIPTION
563  |    This function will return the total tax variance in the functional currency.
564  *============================================================================*/
565   FUNCTION get_tv_base ( p_rate_tax_factor		IN NUMBER   ,
566 			 p_quantity_invoiced		IN NUMBER   ,
567 			 p_inv_per_unit_nrec		IN NUMBER   ,
568 			 p_ref_per_unit_nrec		IN NUMBER   ,
569 			 p_inv_per_trx_cur_unit_nrec	IN NUMBER   ,
570 			 p_ref_per_trx_cur_unit_nrec	IN NUMBER   ,
571 			 p_inv_curr_rate		IN NUMBER   ,
572 			 p_ref_doc_curr_rate		IN NUMBER   ,
573 			 p_pc_price_diff		IN NUMBER   ,
574 			 p_corrected_inv_id		IN NUMBER   ,
575 			 p_line_type			IN VARCHAR2 ,
576 			 p_line_source			IN VARCHAR2 ,
577 		         p_base_currency_code		IN VARCHAR2 ,
578 			 p_line_match_type		IN VARCHAR2 ,
579 			 p_unit_price			IN NUMBER   ) RETURN NUMBER;
580 
581 /*=============================================================================
582  |  PROCEDURE - get_header_tax_attr_desc()
583  |
584  |  DESCRIPTION
585  |    This procedure will return the description of the following tax drivers
586  |    stored at the document header.
587  |    1. Taxation Country
588  |    2. Document Sub Type
589  |    3. Related Invoice
590  |
591  |  PARAMETERS
592  |    P_Taxation_Country        - Taxation Country
593  |    P_Document_Sub_Type       - Document Sub Type
594  |    P_Tax_Related_Invoice_Id  - Related Invoice
595  |
596  |  MODIFICATION HISTORY
597  |    DATE          Author  Action
598  |    13-AUG-2004   Sanjay  Created
599  *============================================================================*/
600   PROCEDURE get_header_tax_attr_desc
601                 ( p_taxation_country            IN         VARCHAR2,
602                   p_document_sub_type           IN         VARCHAR2,
603                   p_tax_related_inv_id          IN         NUMBER,
604                   p_taxation_country_desc       OUT NOCOPY VARCHAR2,
605                   p_document_sub_type_desc      OUT NOCOPY VARCHAR2,
606                   p_tax_related_inv_num         OUT NOCOPY VARCHAR2,
607                   p_calling_sequence            IN         VARCHAR2);
608 
609 /*=============================================================================
610  |  PROCEDURE - get_taxable_line_attr_desc()
611  |
612  |  DESCRIPTION
613  |    This procedure will return the descriptions of tax drivers on the taxable
614  |    line.
615  |
616  |  PARAMETERS
617  |    P_Taxation_Country        - Taxation Country
618  |    P_Trx_Bus_Category        - Transaction Business Category
619  |    P_Prd_Fisc_Class          - Product Fiscal Classification
620  |    P_User_Fisc_Class         - User Defined Fiscal Classification
621  |    P_Prim_Int_Use            - Primary Intended Use
622  |    P_Product_Type            - Product Type
623  |    P_Product_Category        - Product Category
624  |    P_Inv_Item_Id             - Inventory Item Identifier
625  |    P_Org_Id                  - Organization Identifier
626  |
627  |  MODIFICATION HISTORY
628  |    DATE          Author  Action
629  |    13-AUG-2004   Sanjay  Created
630  *============================================================================*/
631   PROCEDURE get_taxable_line_attr_desc
632                 ( p_taxation_country            IN         VARCHAR2,
633                   p_trx_bus_category            IN         VARCHAR2,
634                   p_prd_fisc_class              IN         VARCHAR2,
635                   p_user_fisc_class             IN         VARCHAR2,
636                   p_prim_int_use                IN         VARCHAR2,
637                   p_product_type                IN         VARCHAR2,
638                   p_product_category            IN         VARCHAR2,
639                   p_inv_item_id                 IN         NUMBER,
640                   p_org_id                      IN         NUMBER,
641                   p_trx_bus_category_desc       OUT NOCOPY VARCHAR2,
642                   p_prd_fisc_class_desc         OUT NOCOPY VARCHAR2,
643                   p_user_fisc_class_desc        OUT NOCOPY VARCHAR2,
644                   p_prim_int_use_desc           OUT NOCOPY VARCHAR2,
645                   p_product_type_desc           OUT NOCOPY VARCHAR2,
646                   p_product_category_desc       OUT NOCOPY VARCHAR2,
647                   p_calling_sequence            IN         VARCHAR2);
648 
649 /*=============================================================================
650  |  PROCEDURE - get_tax_line_attr_desc()
651  |
652  |  DESCRIPTION
653  |    This procedure will return the descriptions of tax related attributes
654  |    on the tax line.
655  |
656  |  PARAMETERS
657  |    P_Taxation_Country        - Taxation Country
658  |    P_Tax_Regime_Code         - Tax Regime
659  |    P_Tax                     - Tax
660  |    P_Tax_Jurisdiction_Code   - Tax Jurisidiction
661  |    P_Tax_Status_Code         - Tax Status
662  |
663  |  MODIFICATION HISTORY
664  |    DATE          Author  Action
665  |    13-AUG-2004   Sanjay  Created
666  *============================================================================*/
667   PROCEDURE get_tax_line_attr_desc
668                 ( p_taxation_country            IN         VARCHAR2,
669                   p_tax_regime_code             IN         VARCHAR2,
670                   p_tax                         IN         VARCHAR2,
671                   p_tax_jurisdiction_code       IN         VARCHAR2,
672                   p_tax_status_code             IN         VARCHAR2,
673                   p_tax_regime_code_desc        OUT NOCOPY VARCHAR2,
674                   p_tax_desc                    OUT NOCOPY VARCHAR2,
675                   p_tax_jurisdiction_desc       OUT NOCOPY VARCHAR2,
676                   p_tax_status_code_desc        OUT NOCOPY VARCHAR2,
677                   p_calling_sequence            IN         VARCHAR2);
678 
679 
680 /*=============================================================================
681  |  PROCEDURE - get_default_tax_det_attribs()
682  |
683  |  DESCRIPTION
684  |    This procedure will return the default tax drivers based on the
685  |    organization identifier.
686  |
687  |  PARAMETERS
688  |    P_Org_Id          - Organization Id
689  |    P_Legal_Entity_Id - Legal Entity Id
690  |    P_Item_Id         - Inventory Item Id
691  |    P_Doc_Type        - Document Type
692  |    P_Trx_Date        - Transaction Date
693  |
694  |  MODIFICATION HISTORY
698   PROCEDURE get_default_tax_det_attribs
695  |    DATE          Author  Action
696  |    13-AUG-2004   Sanjay  Created
697  *============================================================================*/
699                         (p_org_id               IN NUMBER,
700                          p_legal_entity_id      IN NUMBER,
701                          p_item_id              IN NUMBER,
702                          p_doc_type             IN VARCHAR2,
703                          p_trx_date             IN DATE,
704                          x_return_status        OUT NOCOPY VARCHAR2,
705                          x_msg_count            OUT NOCOPY NUMBER,
706                          x_msg_data             OUT NOCOPY VARCHAR2,
707                          p_country_code         OUT NOCOPY VARCHAR2,
708                          p_trx_biz_category     OUT NOCOPY VARCHAR2,
709                          p_intended_use         OUT NOCOPY VARCHAR2,
710                          p_prod_category        OUT NOCOPY VARCHAR2,
711                          p_prod_fisc_class_code OUT NOCOPY VARCHAR2,
712                          p_calling_sequence     IN VARCHAR2);
713 
714 
715 
716  --ETAX: Invwkb
717  /*=============================================================================
718  |  FUNCTION - Is_Tax_Dist_Frozen()
719  |
720  |  DESCRIPTION
721  |    This function will return TRUE when the tax distribution is frozen
722  |    as per the following rules, else will return FALSE.
723  |
724  |    When the function returns TRUE, then user should not modify the tax
725  |    distribution, and vice versa.
726  |
727  |  PARAMETERS
728  |    P_Invoice_Id  - Is the invoice_id of the tax distribution
729  |    P_Tax_Dist_Id - Is the id for a Tax distribution in eTax
730  |
731  |  USAGE: This function is called from ETAX security functions in APXINWKB.fmb
732  |         from the form procedure 'IS_TAX_DIST_FROZEN'.
733  |
734  |  MODIFICATION HISTORY
735  |    DATE          Author         Action
736  |    01-JUL-2004   SMYADAM        Created
737  |
738  *============================================================================*/
739 
740  FUNCTION IS_TAX_DIST_FROZEN(P_Invoice_Id IN NUMBER,
741 			     P_Tax_Dist_Id IN NUMBER,
742 			     P_Calling_Sequence IN VARCHAR2) RETURN BOOLEAN;
743 
744 
745  /*=============================================================================
746  |  FUNCTION - Is_Tax_Dist_Frozen()
747  |
748  |  DESCRIPTION
749  |    This function will return TRUE when Detail Tax line can be deleted in ETAX,
750  |    else will return FALSE.
751  |
752  |    When the function returns TRUE, then user can delete the TAX line else
753  |	should not be allowed to delete the TAX line.
754  |
755  |  PARAMETERS
756  |    P_Invoice_Id  - Is the invoice_id of the of the Invoice which owns this
757  |		      detail tax line indirectly through the summary tax line.
758  |    P_Detail_Tax_Line_Id - Is the id for a Detail Tax Line in eTax
759  |
760  |  USAGE: This function is called from ETAX security functions in APXINWKB.fmb
761  |         from the form procedure 'IS_TAX_LINE_DELETE_ALLOWED'.
762  |
763  |  MODIFICATION HISTORY
764  |    DATE          Author         Action
765  |    04-JUL-2004   SMYADAM        Created
766  |
767  *============================================================================*/
768  FUNCTION IS_TAX_LINE_DELETE_ALLOWED(P_Invoice_Id IN NUMBER,
769  				     P_Detail_Tax_Line_Id IN NUMBER,
770  				     P_Calling_Sequence IN VARCHAR2) RETURN BOOLEAN;
771 
772  -- Bug 4887847: Added function Get_Line_Class to populate a new attribute that
773  --              is required for tax calculation and reporting purposes.
777  |
774 
775 /*=============================================================================
776  |  FUNCTION - Get_Line_Class()
778  |  DESCRIPTION
779  |    This function will return the line class based on the invoice document type
780  |    invoice line type and matching information.
781  |
782  *============================================================================*/
783 
784  FUNCTION Get_Line_Class(
785              P_Invoice_Type_Lookup_Code    IN  VARCHAR2,
786              P_Inv_Line_Type               IN  VARCHAR2,
787              P_Line_Location_Id            IN  NUMBER,
788              P_Line_Class                  OUT NOCOPY VARCHAR2,
789              P_Error_Code                  OUT NOCOPY VARCHAR2,
790              P_Calling_Sequence            IN  VARCHAR2) RETURN BOOLEAN;
791 
792 /*=============================================================================
793  |  FUNCTION - Get_Converted_Price()
794  |
795  |  DESCRIPTION
796  |    This function will return the unit price in receipts UOM if the Receipt
797  |    and Purchase Order UOM are different.
798  |
799  *============================================================================*/
800 
801  FUNCTION Get_Converted_Price(
802 	    X_Invoice_Distribution_Id IN NUMBER) RETURN NUMBER;
803 
804 /*=============================================================================
805  |  FUNCTION - Get_Max_Dist_Num_Self
806  |
807  |  DESCRIPTION
808  |    This function will return the maximum distribution line number of self
809  |    assessed tax distributions.
810  |
811  *============================================================================*/
812 
813  FUNCTION Get_Max_Dist_Num_Self
814                         (X_invoice_id  IN NUMBER,
815                          X_line_number IN NUMBER) RETURN NUMBER;
816 
817  /*=============================================================================
818  |  FUNCTION - Is_Tax_Already_Dist_Inv_char()
819  |
820  |  DESCRIPTION
821  |    This function will return 'Y' if any taxable distribution has the
822  |    tax_already_calculated_flag equals Y.  It will return 'N' otherwise.
823  |
824  *============================================================================*/
825 
826  FUNCTION Is_Tax_Already_Dist_Inv_Char(
827              P_Invoice_Id       IN NUMBER,
828              P_Calling_Sequence IN VARCHAR2) RETURN VARCHAR2;
829 
830 END AP_ETAX_UTILITY_PKG;