1 PACKAGE AP_ETAX_UTILITY_PKG AUTHID CURRENT_USER AS
2 /* $Header: apetxuts.pls 120.23.12020000.2 2012/11/26 06:12:48 sbonala 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 FUNCTION find_val( p_invoice_dist in number) return number ; --bug10621602
31
32
33 /*=============================================================================
34 | FUNCTION - Get_Event_Type_Code()
35 |
36 | DESCRIPTION
37 | Public function that will get the event type code required to call
38 | eTax services based on the event class code, calling_mode and if
39 | eTax was already called or not.
40 |
41 | PARAMETERS
42 | P_Event_Class_Code - Event class code
43 | P_Calling_Mode - Calling mode
44 | P_eTax_Already_called_flag - Is eTax already called?
45 | P_Event_Type_Code - event type code
46 | P_error_code - Error code to be returned
47 | P_calling_sequence - Calling sequence
48 |
49 | MODIFICATION HISTORY
50 | DATE Author Action
51 | 09-OCT-2003 SYIDNER Created
52 |
53 *============================================================================*/
54
55 FUNCTION Get_Event_Type_Code(
56 P_Event_Class_Code IN VARCHAR2,
57 P_Calling_Mode IN VARCHAR2,
58 P_eTax_Already_called_flag IN VARCHAR2,
59 P_Event_Type_Code OUT NOCOPY VARCHAR2,
60 P_Error_Code OUT NOCOPY VARCHAR2,
61 P_Calling_Sequence IN VARCHAR2) RETURN BOOLEAN;
62
63
64 /*=============================================================================
65 | FUNCTION - Get_Corrected_Invoice_Info()
66 |
67 | DESCRIPTION
68 | This function return the additional information required to populate
69 | the zx_transaction_lines_gt global temporary table for eTax.
70 |
71 | PARAMETERS
72 | P_Corrected_Invoice_Id - Invoice Id for the corrected line
73 | P_corrected_Line_number - Line number for the corrected line
74 | P_Application_Id - Application Id for the corrected invoice
75 | P_Entity_code - entity code required for the event class
76 | P_Event_Class_Code - Event class code for the corrected invoice
77 | P_Invoice_Number - Corrected invoice number
78 | P_Invoice_Date - corrected invoice date
79 | P_error_code - Error code to be returned
80 | P_calling_sequence - Calling sequence
81 |
82 | MODIFICATION HISTORY
83 | DATE Author Action
84 | 13-OCT-2003 SYIDNER Created
85 |
86 *============================================================================*/
87 FUNCTION Get_Corrected_Invoice_Info(
88 P_Corrected_Invoice_Id IN NUMBER,
89 P_Corrected_Line_Number IN NUMBER,
90 P_Application_Id OUT NOCOPY NUMBER,
91 P_Entity_code OUT NOCOPY VARCHAR2,
92 P_Event_Class_Code OUT NOCOPY VARCHAR2,
93 P_Invoice_Number OUT NOCOPY VARCHAR2,
94 P_Invoice_Date OUT NOCOPY DATE,
95 P_Error_Code OUT NOCOPY VARCHAR2,
96 P_Calling_Sequence IN VARCHAR2) RETURN BOOLEAN;
97
98
99 /*=============================================================================
100 | FUNCTION - Get_Prepay_Invoice_Info()
101 |
102 | DESCRIPTION
103 | This function return the additional information required to populate
104 | the zx_transaction_lines_gt global temporary table for eTax.
105 |
106 | PARAMETERS
107 | P_Prepay_Invoice_Id - Invoice Id for the applied prepay line
108 | P_Prepay_Line_number - Line number for the applied prepay line
109 | P_Application_Id - Application Id for the applied prepay invoice
110 | P_Entity_code - entity code required for the event class
111 | P_Event_Class_Code - Event class code for the applied prepay invoice
112 | P_Invoice_Number - Applied Prepayment number
113 | P_Invoice_Date - Applied prepayment invoice date
114 | P_error_code - Error code to be returned
115 | P_calling_sequence - Calling sequence
116 |
117 | MODIFICATION HISTORY
118 | DATE Author Action
119 | 15-OCT-2003 SYIDNER Created
120 |
121 *============================================================================*/
122 FUNCTION Get_Prepay_Invoice_Info(
123 P_Prepay_Invoice_Id IN NUMBER,
124 P_Prepay_Line_Number IN NUMBER,
125 P_Application_Id OUT NOCOPY NUMBER,
126 P_Entity_code OUT NOCOPY VARCHAR2,
127 P_Event_Class_Code OUT NOCOPY VARCHAR2,
128 P_Invoice_Number OUT NOCOPY VARCHAR2,
129 P_Invoice_Date OUT NOCOPY DATE,
130 P_Error_Code OUT NOCOPY VARCHAR2,
131 P_Calling_Sequence IN VARCHAR2) RETURN BOOLEAN;
132
133
134 /*=============================================================================
135 | FUNCTION - Get_Receipt_Info()
136 |
137 | DESCRIPTION
138 | This function return the additional information required to populate
139 | the zx_transaction_lines_gt global temporary table for eTax.
140 |
141 | PARAMETERS
142 | P_Rcv_Transaction_Id - Receipt id
143 | P_Application_Id - Application Id for the Receipt (201)
144 | P_Entity_code - entity code required for the event class
145 | P_Event_Class_Code - Event class code for the receipt
146 | P_Transaction_Date - Transaction date
147 | P_error_code - Error code to be returned
148 | P_calling_sequence - Calling sequence
149 |
150 | MODIFICATION HISTORY
151 | DATE Author Action
152 | 15-OCT-2003 SYIDNER Created
153 |
154 *============================================================================*/
155 FUNCTION Get_Receipt_Info(
156 P_Rcv_Transaction_Id IN NUMBER,
157 P_Application_Id OUT NOCOPY NUMBER,
158 P_Entity_code OUT NOCOPY VARCHAR2,
159 P_Event_Class_Code OUT NOCOPY VARCHAR2,
160 P_Transaction_Date OUT NOCOPY DATE,
161 P_Error_Code OUT NOCOPY VARCHAR2,
162 P_Calling_Sequence IN VARCHAR2) RETURN BOOLEAN;
163
164 /*=============================================================================
165 | FUNCTION - Get_PO_Info()
166 |
167 | DESCRIPTION
168 | This function return the additional information required to populate
172 | P_Po_line_location_id - PO line location
169 | the zx_transaction_lines_gt global temporary table for eTax.
170 |
171 | PARAMETERS
173 | P_Po_Distribution_id - Po distribution
174 | P_Application_Id - Application Id for the PO document (201)
175 | P_Entity_code - entity code required for the event class
176 | P_Event_Class_Code - Event class code for the PO doc
177 | P_PO_Quantity - PO quantity
178 | P_Product_Org_Id - Product Org_id
179 | P_Po_Header_Id - po header id
180 | P_Po_Header_Curr_Conv_Rate - Po Header currency conversion rate
181 | P_error_code - Error code to be returned
182 | P_calling_sequence - Calling sequence
183 |
184 | MODIFICATION HISTORY
185 | DATE Author Action
186 | 15-OCT-2003 SYIDNER Created
187 | 20-OCT-2003 SYIDNER Included po_distribution as a parameter
188 | and modify the function to return Po data
189 | for the call to the determine_recovery serv
190 |
191 *============================================================================*/
192 FUNCTION Get_PO_Info(
193 P_PO_Line_Location_Id IN OUT NOCOPY NUMBER,
194 P_Po_Distribution_Id IN NUMBER,
195 P_Application_Id OUT NOCOPY NUMBER,
196 P_Entity_code OUT NOCOPY VARCHAR2,
197 P_Event_Class_Code OUT NOCOPY VARCHAR2,
198 P_PO_Quantity OUT NOCOPY NUMBER,
199 P_Product_Org_Id OUT NOCOPY NUMBER,
200 P_Po_Header_Id OUT NOCOPY NUMBER,
201 P_Po_Header_Curr_Conv_Rate OUT NOCOPY NUMBER,
202 P_Uom_Code OUT NOCOPY VARCHAR2,
203 P_Dist_Qty OUT NOCOPY NUMBER,
204 P_Ship_Price OUT NOCOPY NUMBER,
205 P_Error_Code OUT NOCOPY VARCHAR2,
206 P_Calling_Sequence IN VARCHAR2) RETURN BOOLEAN;
207
208 /*=============================================================================
209 | FUNCTION - Get_Prepay_Awt_Group_Id()
210 |
211 | DESCRIPTION
212 | This function return the awt_group_id for a parent prepay item line
213 | based on the prepayment distribution id.
214 |
215 | PARAMETERS
216 | P_Prepay_Distribution_id - Distribution Id of the prepayment
217 |
218 | MODIFICATION HISTORY
219 | DATE Author Action
220 | 15-OCT-2003 SYIDNER Created
221 |
222 *============================================================================*/
223 FUNCTION Get_Prepay_Awt_Group_Id(
224 P_Prepay_Distribution_id IN NUMBER,
225 P_Calling_Sequence IN VARCHAR2) RETURN NUMBER;
226
227
228 /*=============================================================================
229 | FUNCTION - Return_Tax_Lines()
230 |
231 | DESCRIPTION
232 | This function handles the return of tax lines. It includes creation,
233 | update, or delete of existing exclusive tax lines in AP if required.
234 | It also handles the update of the total tax amounts. (Inclusive and
235 | self-assessed.
236 |
237 | PARAMETERS
238 | P_Invoice_Header_Rec - Header info
239 | P_error_code - Error code to be returned
240 | P_calling_sequence - Calling sequence
241 |
242 | MODIFICATION HISTORY
243 | DATE Author Action
244 | 15-OCT-2003 SYIDNER Created
245 |
246 *============================================================================*/
247 FUNCTION Return_Tax_Lines(
248 P_Invoice_Header_Rec IN ap_invoices_all%ROWTYPE,
249 P_Error_Code OUT NOCOPY VARCHAR2,
250 P_Calling_Sequence IN VARCHAR2) RETURN BOOLEAN;
251
252 /*=============================================================================
253 | FUNCTION - Return_Tax_Distributions()
254 |
255 | DESCRIPTION
256 | This function handles the return of tax distributions. It includes creation,
257 | update, or delete of existing distributions and TIPV and TERV distributions if
258 | required.
259 | It also handles the creation, update or delete of self-assessed
260 | distributions.
261 |
262 | PARAMETERS
263 | P_Invoice_Header_Rec - Header info
264 | P_All_Error_Messages - Should API return 1 error message or allow
265 | calling point to get them from message stack
266 | P_error_code - Error code to be returned
267 | P_calling_sequence - Calling sequence
268 |
269 | MODIFICATION HISTORY
270 | DATE Author Action
271 | 23-OCT-2003 SYIDNER Created
272 |
273 *============================================================================*/
274 FUNCTION Return_Tax_Distributions(
275 P_Invoice_Header_Rec IN ap_invoices_all%ROWTYPE,
276 P_All_Error_Messages IN VARCHAR2,
277 P_Error_Code OUT NOCOPY VARCHAR2,
278 P_Calling_Sequence IN VARCHAR2) RETURN BOOLEAN;
279
280 /*=============================================================================
281 | FUNCTION - Return_Tax_Quote()
282 |
283 | DESCRIPTION
284 | This function handles the return of tax lines when the calculate service is
285 | ran for quote. This case is specific for recurring invoices and invoice lines
286 | created through distribution sets.
287 |
288 | PARAMETERS
289 | P_Invoice_Header_Rec - Header info
290 | P_error_code - Error code to be returned
291 | P_calling_sequence - Calling sequence
292 |
293 | MODIFICATION HISTORY
294 | DATE Author Action
295 | 03-NOV-2003 SYIDNER Created
296 |
297 *============================================================================*/
298 FUNCTION Return_Tax_Quote(
299 P_Invoice_Header_Rec IN ap_invoices_all%ROWTYPE,
300 P_Error_Code OUT NOCOPY VARCHAR2,
301 P_Calling_Sequence IN VARCHAR2) RETURN BOOLEAN;
302
303 /*=============================================================================
304 | FUNCTION - Return_Default_Import()
305 |
306 | DESCRIPTION
307 | This function handles the return of default values for tax and trx lines
308 | after running the eTax service that validates and defaults info during the
309 | import program. This function will modify the pl/sql tables used in the
310 | import program.
311 |
312 | PARAMETERS
313 | P_Invoice_Header_Rec - Header info
314 | P_All_Error_Messages - Should API return 1 error message or allow
315 | calling point to get them from message stack
316 | P_error_code - Error code to be returned
317 | P_calling_sequence - Calling sequence
318 | P_Invoice_Status -Status flag to check if further processing should be done.--Bug6625518
319 |
320 | MODIFICATION HISTORY
321 | DATE Author Action
322 | 20-JAN-2004 SYIDNER Created
323 |
324 *============================================================================*/
325 FUNCTION Return_Default_Import(
326 P_Invoice_Header_Rec IN OUT NOCOPY AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
327 P_Invoice_Lines_Tab IN OUT NOCOPY AP_IMPORT_INVOICES_PKG.t_lines_table,
328 P_All_Error_Messages IN VARCHAR2,
329 P_Error_Code OUT NOCOPY VARCHAR2,
330 P_Calling_Sequence IN VARCHAR2,
331 P_Invoice_Status OUT NOCOPY VARCHAR2) --Bug6625518
332 RETURN BOOLEAN;
333
334 /*=============================================================================
335 | FUNCTION - Return_Error_Messages()
336 |
337 | DESCRIPTION
338 | This function will handle the return of the error messages from the
339 | eTax services. The services can return 1 or more error messages or
340 | warnings. The calling point will indicate the API if it wants the return of
341 | only 1 error messages through the parameter P_All_Error_Messages = N
342 | eventhough the service returns more than one error message.
343 | If the calling point requires all the error messages, it will need to get them
344 | directly from the message stack.
345 |
346 | PARAMETERS
347 | P_All_Error_Messages - Y or N. It indicades if the function will return
348 | only 1 message or will allow the calling module
349 | to handle the returning of errors.
350 | P_Msg_Count - Number of error messages the eTax function returns.
351 | P_Msg_Data - In case only 1 error is return the text of the name of the
352 | message
353 | P_Error_Code - The error code this function will return if
354 | all_error_messages is N
355 | P_Calling_Sequence - Calling sequence
356 |
357 | MODIFICATION HISTORY
358 | DATE Author Action
359 | 05-NOV-2003 SYIDNER Created
360 |
361 *============================================================================*/
362 FUNCTION Return_Error_Messages(
363 P_All_Error_Messages IN VARCHAR2,
364 P_Msg_Count IN NUMBER,
365 P_Msg_Data IN VARCHAR2,
366 P_Error_Code OUT NOCOPY VARCHAR2,
367 P_Calling_Sequence IN VARCHAR2) RETURN BOOLEAN;
368
369 /*=============================================================================
370 | FUNCTION - Is_Tax_Already_Calc_Inv()
371 |
372 | DESCRIPTION
373 | This function will return TRUE if any taxable line in the invoice has the
374 | tax_already_calculated_flag equals Y. It will return FALSE otherwise.
375 |
376 | PARAMETERS
377 | P_Invoice_Id - Invoice Id
378 | P_Calling_Sequence - calling sequence
379 |
380 | MODIFICATION HISTORY
381 | DATE Author Action
382 | 29-DEC-2003 SYIDNER Created
383 |
384 *============================================================================*/
385 FUNCTION Is_Tax_Already_Calc_Inv(
386 P_Invoice_Id IN NUMBER,
387 P_Calling_Sequence IN VARCHAR2) RETURN BOOLEAN;
388
389 /*=============================================================================
390 | FUNCTION - Is_Tax_Already_Calc_Inv_char()
391 |
392 | DESCRIPTION
393 | This function will return 'Y' if any taxable line in the invoice has the
394 | tax_already_calculated_flag equals Y. It will return 'N' otherwise.
395 |
396 | It is same as the function Is_Tax_Already_Calc_Inv except that it will
397 | return a VARCHAR value instead of BOOLEAN
398 |
399 | PARAMETERS
400 | P_Invoice_Id - Invoice Id
401 | P_Calling_Sequence - calling sequence
402 |
403 | MODIFICATION HISTORY
404 | DATE Author Action
405 | 09-JUL-2004 SMYADAM Created
406 |
407 *============================================================================*/
408 FUNCTION Is_Tax_Already_Calc_Inv_char(
409 P_Invoice_Id IN NUMBER,
410 P_Calling_Sequence IN VARCHAR2) RETURN VARCHAR2;
411
412 /*=============================================================================
413 | FUNCTION - Is_Tax_Already_Dist_Inv()
414 |
415 | DESCRIPTION
416 | This function will return TRUE if any taxable distribution for the invoice
417 | has the tax_already_distributed_flag equals Y. It will return FALSE otherwise.
418 |
419 | PARAMETERS
420 | P_Invoice_Id - Invoice Id
421 | P_Calling_Sequence - calling sequence
422 |
423 | MODIFICATION HISTORY
424 | DATE Author Action
425 | 29-DEC-2003 SYIDNER Created
426 |
427 *============================================================================*/
428 FUNCTION Is_Tax_Already_Dist_Inv(
429 P_Invoice_Id IN NUMBER,
430 P_Calling_Sequence IN VARCHAR2) RETURN BOOLEAN;
431
432 /*=============================================================================
433 | FUNCTION - Get_Dist_Id_For_Tax_Dist_Id()
434 |
435 | DESCRIPTION
436 | This function will return the invoice_distribution_id for an AP TAX (
437 | recoverable, non recoverable or tax variance distribution)
438 | based on the detail_tax_dist_id
439 |
440 | PARAMETERS
441 | P_Tax_Dist_Id - Is the id for a Tax distribution in eTax
442 |
443 | MODIFICATION HISTORY
444 | DATE Author Action
445 | 02-APR-2004 SYIDNER Created
446 |
447 *============================================================================*/
448 FUNCTION Get_Dist_Id_For_Tax_Dist_Id(
449 P_Tax_Dist_Id IN NUMBER ) RETURN NUMBER;
450
451 /*=============================================================================
452 | PROCEDURE - set_tax_security_context()
453 |
454 | DESCRIPTION
455 | This procedure will return the tax effective date. The effective date
456 | is used in the list of values for tax drivers and tax related attributes.
457 |
458 | PARAMETERS
459 | P_Tax_Dist_Id - Is the id for a Tax distribution in eTax
460 | P_Org_Id - Default organization identifier.
461 | P_Legal_Entity_Id - Legal entity identifier.
462 | P_Transaction_Date - Document Transaction Date
463 | P_Related_Doc_Date - Date of the related document. (Eg: Standard PO)
464 | P_Adjusted_Doc_Date - Date of the adjusted document. (Eg: DM/CM applied to Invoice)
465 |
466 | MODIFICATION HISTORY
467 | DATE Author Action
468 | 13-AUG-2004 Sanjay Created
469 *============================================================================*/
470 PROCEDURE set_tax_security_context
471 (p_org_id IN NUMBER,
472 p_legal_entity_id IN NUMBER,
473 p_transaction_date IN DATE,
474 p_related_doc_date IN DATE,
475 p_adjusted_doc_date IN DATE,
476 p_effective_date OUT NOCOPY DATE,
477 p_return_status OUT NOCOPY VARCHAR2,
478 p_msg_count OUT NOCOPY NUMBER,
479 p_msg_data OUT NOCOPY VARCHAR2);
480
481 /*=============================================================================
482 | FUNCTION - get_tipv()
483 |
484 | DESCRIPTION
485 | This function will return the tax invoice price variance.
486 *============================================================================*/
487
488 -- bug10621602 Added three more parameters " p_trx_line_dist_id" and "p_ref_per_trx_cur_unit_nrec"
489
490 FUNCTION get_tipv ( p_rate_tax_factor IN NUMBER ,
491 p_quantity_invoiced IN NUMBER ,
492 p_inv_unit_price IN NUMBER ,
493 p_ref_doc_unit_price IN NUMBER ,
494 p_ref_per_unit_nr_amt IN NUMBER ,
495 p_pc_price_diff IN NUMBER ,
496 p_corrected_inv_id IN NUMBER ,
497 p_line_type IN VARCHAR2 ,
498 p_line_source IN VARCHAR2 ,
499 p_inv_currency_code IN VARCHAR2 ,
500 p_line_match_type IN VARCHAR2 ,
501 p_trx_line_dist_id IN NUMBER ,
502 p_ref_per_trx_cur_unit_nrec IN NUMBER ,
503 p_rec_nrec_tax_dist_id IN NUMBER ) RETURN NUMBER;
504
505 /*=============================================================================
506 | FUNCTION get_tipv_base()
507 |
508 | DESCRIPTION
509 | This function will return the tax invoice price variance in functional currency.
510 *============================================================================*/
511
512 -- bug10621602 Added three more parameters " p_trx_line_dist_id" and "p_ref_per_trx_cur_unit_nrec"
513
514 FUNCTION get_tipv_base
515 ( p_rate_tax_factor IN NUMBER ,
516 p_quantity_invoiced IN NUMBER ,
517 p_inv_unit_price IN NUMBER ,
518 p_ref_doc_unit_price IN NUMBER ,
519 p_ref_per_trx_nrec_amt IN NUMBER ,
520 p_price_diff IN NUMBER ,
521 p_inv_currency_rate IN NUMBER ,
522 p_ref_doc_curr_rate IN NUMBER ,
523 p_adj_doc_curr_rate IN NUMBER ,
524 p_corrected_inv_id IN NUMBER ,
525 p_line_type IN VARCHAR2 ,
526 p_line_source IN VARCHAR2 ,
527 p_inv_currency_code IN VARCHAR2 ,
528 p_base_currency_code IN VARCHAR2 ,
529 p_line_match_type IN VARCHAR2 ,
530 p_trx_line_dist_id IN NUMBER ,
531 p_ref_per_trx_cur_unit_nrec IN NUMBER ,
532 p_rec_nrec_tax_dist_id IN NUMBER) RETURN NUMBER;
533
534 /*=============================================================================
535 | FUNCTION get_exchange_rate_variance()
536 |
537 | DESCRIPTION
538 | This function will return the tax exchange rate variance.
539 *============================================================================*/
540
541 -- bug10621602 Added four more parameters " p_trx_line_dist_id" and "p_ref_per_trx_cur_unit_nrec" and "p_ref_doc_unit_price"
542
543 FUNCTION get_terv
544 ( p_quantity_invoiced IN NUMBER ,
545 p_inv_curr_conv_rate IN NUMBER ,
546 p_ref_doc_curr_conv_rate IN NUMBER ,
547 p_app_doc_curr_conv_rate IN NUMBER ,
548 p_adj_doc_curr_conv_rate IN NUMBER ,
549 p_per_unit_nrec_amt IN NUMBER ,
550 p_ref_doc_per_unit_nrec_amt IN NUMBER ,
551 p_corrected_inv_id IN NUMBER ,
552 p_line_type IN VARCHAR2 ,
553 p_line_source IN VARCHAR2 ,
554 p_base_currency_code IN VARCHAR2 ,
555 p_trx_line_dist_id IN NUMBER ,
556 p_ref_doc_unit_price IN NUMBER ,
557 p_ref_per_trx_cur_unit_nrec IN NUMBER ,
558 p_rec_nrec_tax_dist_id IN NUMBER,
559 p_unit_price IN NUMBER DEFAULT NULL) RETURN NUMBER; /*Bug#10416960*/
560
561 /*=============================================================================
562 | FUNCTION get_exchange_rate_variance()
563 |
564 | DESCRIPTION
565 | This function will return the total tax variance.
566 *============================================================================*/
567
568 -- bug10621602 Added three more parameters " p_trx_line_dist_id" and "p_ref_doc_unit_price"
569
570 FUNCTION get_tv ( p_rate_tax_factor IN NUMBER ,
571 p_quantity_invoiced IN NUMBER ,
572 p_inv_per_unit_nrec IN NUMBER ,
573 p_ref_per_unit_nrec IN NUMBER ,
574 p_inv_per_trx_cur_unit_nrec IN NUMBER ,
575 p_ref_per_trx_cur_unit_nrec IN NUMBER ,
576 p_pc_price_diff IN NUMBER ,
577 p_corrected_inv_id IN NUMBER ,
578 p_line_type IN VARCHAR2 ,
579 p_line_source IN VARCHAR2 ,
580 p_inv_currency_code IN VARCHAR2 ,
581 p_line_match_type IN VARCHAR2 ,
582 p_unit_price IN NUMBER ,
583 p_trx_line_dist_id IN NUMBER ,
584 p_ref_doc_unit_price IN NUMBER ,
585 p_rec_nrec_tax_dist_id IN NUMBER) RETURN NUMBER;
586
587
588 /*=============================================================================
589 | FUNCTION get_exchange_rate_variance()
590 |
591 | DESCRIPTION
592 | This function will return the total tax variance in the functional currency.
593 *============================================================================*/
594
595 -- bug10621602 Added three more parameters " p_trx_line_dist_id" and "p_ref_doc_unit_price"
596
597 FUNCTION get_tv_base ( p_rate_tax_factor IN NUMBER ,
598 p_quantity_invoiced IN NUMBER ,
599 p_inv_per_unit_nrec IN NUMBER ,
600 p_ref_per_unit_nrec IN NUMBER ,
601 p_inv_per_trx_cur_unit_nrec IN NUMBER ,
602 p_ref_per_trx_cur_unit_nrec IN NUMBER ,
603 p_inv_curr_rate IN NUMBER ,
604 p_ref_doc_curr_rate IN NUMBER ,
605 p_pc_price_diff IN NUMBER ,
606 p_corrected_inv_id IN NUMBER ,
607 p_line_type IN VARCHAR2 ,
608 p_line_source IN VARCHAR2 ,
609 p_base_currency_code IN VARCHAR2 ,
610 p_line_match_type IN VARCHAR2 ,
611 p_unit_price IN NUMBER ,
612 p_trx_line_dist_id IN NUMBER ,
613 p_ref_doc_unit_price IN NUMBER ,
614 p_rec_nrec_tax_dist_id IN NUMBER) RETURN NUMBER;
615
616 /*=============================================================================
617 | PROCEDURE - get_header_tax_attr_desc()
618 |
619 | DESCRIPTION
620 | This procedure will return the description of the following tax drivers
621 | stored at the document header.
622 | 1. Taxation Country
623 | 2. Document Sub Type
624 | 3. Related Invoice
625 |
626 | PARAMETERS
627 | P_Taxation_Country - Taxation Country
628 | P_Document_Sub_Type - Document Sub Type
629 | P_Tax_Related_Invoice_Id - Related Invoice
630 |
631 | MODIFICATION HISTORY
632 | DATE Author Action
633 | 13-AUG-2004 Sanjay Created
634 *============================================================================*/
635 PROCEDURE get_header_tax_attr_desc
636 ( p_taxation_country IN VARCHAR2,
637 p_document_sub_type IN VARCHAR2,
638 p_tax_related_inv_id IN NUMBER,
639 p_taxation_country_desc OUT NOCOPY VARCHAR2,
640 p_document_sub_type_desc OUT NOCOPY VARCHAR2,
641 p_tax_related_inv_num OUT NOCOPY VARCHAR2,
642 p_calling_sequence IN VARCHAR2);
643
644 /*=============================================================================
645 | PROCEDURE - get_taxable_line_attr_desc()
646 |
647 | DESCRIPTION
648 | This procedure will return the descriptions of tax drivers on the taxable
649 | line.
650 |
651 | PARAMETERS
652 | P_Taxation_Country - Taxation Country
653 | P_Trx_Bus_Category - Transaction Business Category
654 | P_Prd_Fisc_Class - Product Fiscal Classification
655 | P_User_Fisc_Class - User Defined Fiscal Classification
656 | P_Prim_Int_Use - Primary Intended Use
657 | P_Product_Type - Product Type
658 | P_Product_Category - Product Category
659 | P_Inv_Item_Id - Inventory Item Identifier
660 | P_Org_Id - Organization Identifier
661 |
662 | MODIFICATION HISTORY
663 | DATE Author Action
664 | 13-AUG-2004 Sanjay Created
665 *============================================================================*/
666 PROCEDURE get_taxable_line_attr_desc
667 ( p_taxation_country IN VARCHAR2,
668 p_trx_bus_category IN VARCHAR2,
669 p_prd_fisc_class IN VARCHAR2,
670 p_user_fisc_class IN VARCHAR2,
671 p_prim_int_use IN VARCHAR2,
672 p_product_type IN VARCHAR2,
673 p_product_category IN VARCHAR2,
674 p_inv_item_id IN NUMBER,
675 p_org_id IN NUMBER,
676 p_trx_bus_category_desc OUT NOCOPY VARCHAR2,
677 p_prd_fisc_class_desc OUT NOCOPY VARCHAR2,
678 p_user_fisc_class_desc OUT NOCOPY VARCHAR2,
679 p_prim_int_use_desc OUT NOCOPY VARCHAR2,
680 p_product_type_desc OUT NOCOPY VARCHAR2,
681 p_product_category_desc OUT NOCOPY VARCHAR2,
682 p_calling_sequence IN VARCHAR2);
683
684 /*=============================================================================
685 | PROCEDURE - get_tax_line_attr_desc()
686 |
687 | DESCRIPTION
688 | This procedure will return the descriptions of tax related attributes
689 | on the tax line.
690 |
691 | PARAMETERS
692 | P_Taxation_Country - Taxation Country
693 | P_Tax_Regime_Code - Tax Regime
694 | P_Tax - Tax
695 | P_Tax_Jurisdiction_Code - Tax Jurisidiction
696 | P_Tax_Status_Code - Tax Status
697 |
698 | MODIFICATION HISTORY
699 | DATE Author Action
700 | 13-AUG-2004 Sanjay Created
701 *============================================================================*/
702 PROCEDURE get_tax_line_attr_desc
703 ( p_taxation_country IN VARCHAR2,
704 p_tax_regime_code IN VARCHAR2,
705 p_tax IN VARCHAR2,
706 p_tax_jurisdiction_code IN VARCHAR2,
707 p_tax_status_code IN VARCHAR2,
708 p_tax_regime_code_desc OUT NOCOPY VARCHAR2,
709 p_tax_desc OUT NOCOPY VARCHAR2,
710 p_tax_jurisdiction_desc OUT NOCOPY VARCHAR2,
711 p_tax_status_code_desc OUT NOCOPY VARCHAR2,
712 p_calling_sequence IN VARCHAR2);
713
714
715 /*=============================================================================
716 | PROCEDURE - get_default_tax_det_attribs()
717 |
718 | DESCRIPTION
719 | This procedure will return the default tax drivers based on the
720 | organization identifier.
721 |
722 | PARAMETERS
723 | P_Org_Id - Organization Id
724 | P_Legal_Entity_Id - Legal Entity Id
725 | P_Item_Id - Inventory Item Id
726 | P_Doc_Type - Document Type
727 | P_Trx_Date - Transaction Date
728 |
729 | MODIFICATION HISTORY
730 | DATE Author Action
731 | 13-AUG-2004 Sanjay Created
732 *============================================================================*/
733 PROCEDURE get_default_tax_det_attribs
734 (p_org_id IN NUMBER,
735 p_legal_entity_id IN NUMBER,
736 p_item_id IN NUMBER,
737 p_doc_type IN VARCHAR2,
738 p_trx_date IN DATE,
739 x_return_status OUT NOCOPY VARCHAR2,
740 x_msg_count OUT NOCOPY NUMBER,
741 x_msg_data OUT NOCOPY VARCHAR2,
742 p_country_code OUT NOCOPY VARCHAR2,
743 p_trx_biz_category OUT NOCOPY VARCHAR2,
744 p_intended_use OUT NOCOPY VARCHAR2,
745 p_prod_category OUT NOCOPY VARCHAR2,
746 p_prod_fisc_class_code OUT NOCOPY VARCHAR2,
747 p_calling_sequence IN VARCHAR2);
748
749
750
751 --ETAX: Invwkb
752 /*=============================================================================
753 | FUNCTION - Is_Tax_Dist_Frozen()
754 |
755 | DESCRIPTION
756 | This function will return TRUE when the tax distribution is frozen
757 | as per the following rules, else will return FALSE.
758 |
759 | When the function returns TRUE, then user should not modify the tax
760 | distribution, and vice versa.
761 |
762 | PARAMETERS
763 | P_Invoice_Id - Is the invoice_id of the tax distribution
764 | P_Tax_Dist_Id - Is the id for a Tax distribution in eTax
765 |
766 | USAGE: This function is called from ETAX security functions in APXINWKB.fmb
767 | from the form procedure 'IS_TAX_DIST_FROZEN'.
768 |
769 | MODIFICATION HISTORY
770 | DATE Author Action
771 | 01-JUL-2004 SMYADAM Created
772 |
773 *============================================================================*/
774
775 FUNCTION IS_TAX_DIST_FROZEN(P_Invoice_Id IN NUMBER,
776 P_Tax_Dist_Id IN NUMBER,
777 P_Calling_Sequence IN VARCHAR2) RETURN BOOLEAN;
778
779
780 /*=============================================================================
781 | FUNCTION - Is_Tax_Dist_Frozen()
782 |
783 | DESCRIPTION
784 | This function will return TRUE when Detail Tax line can be deleted in ETAX,
785 | else will return FALSE.
786 |
787 | When the function returns TRUE, then user can delete the TAX line else
788 | should not be allowed to delete the TAX line.
789 |
790 | PARAMETERS
791 | P_Invoice_Id - Is the invoice_id of the of the Invoice which owns this
792 | detail tax line indirectly through the summary tax line.
793 | P_Detail_Tax_Line_Id - Is the id for a Detail Tax Line in eTax
794 |
795 | USAGE: This function is called from ETAX security functions in APXINWKB.fmb
796 | from the form procedure 'IS_TAX_LINE_DELETE_ALLOWED'.
797 |
798 | MODIFICATION HISTORY
799 | DATE Author Action
800 | 04-JUL-2004 SMYADAM Created
801 |
802 *============================================================================*/
803 FUNCTION IS_TAX_LINE_DELETE_ALLOWED(P_Invoice_Id IN NUMBER,
804 P_Detail_Tax_Line_Id IN NUMBER,
805 P_Calling_Sequence IN VARCHAR2) RETURN BOOLEAN;
806
807 -- Bug 4887847: Added function Get_Line_Class to populate a new attribute that
808 -- is required for tax calculation and reporting purposes.
809
810 /*=============================================================================
811 | FUNCTION - Get_Line_Class()
812 |
813 | DESCRIPTION
814 | This function will return the line class based on the invoice document type
815 | invoice line type and matching information.
816 |
817 *============================================================================*/
818
819 FUNCTION Get_Line_Class(
820 P_Invoice_Type_Lookup_Code IN VARCHAR2,
821 P_Inv_Line_Type IN VARCHAR2,
822 P_Line_Location_Id IN NUMBER,
823 P_Line_Class OUT NOCOPY VARCHAR2,
824 P_Error_Code OUT NOCOPY VARCHAR2,
825 P_Calling_Sequence IN VARCHAR2) RETURN BOOLEAN;
826
827 /*=============================================================================
828 | FUNCTION - Get_Converted_Price()
829 |
830 | DESCRIPTION
831 | This function will return the unit price in receipts UOM if the Receipt
832 | and Purchase Order UOM are different.
833 |
834 *============================================================================*/
835
836 FUNCTION Get_Converted_Price(
837 X_Invoice_Distribution_Id IN NUMBER) RETURN NUMBER;
838
839 /*=============================================================================
840 | FUNCTION - Get_Max_Dist_Num_Self
841 |
842 | DESCRIPTION
843 | This function will return the maximum distribution line number of self
844 | assessed tax distributions.
845 |
846 *============================================================================*/
847
848 FUNCTION Get_Max_Dist_Num_Self
849 (X_invoice_id IN NUMBER,
850 X_line_number IN NUMBER) RETURN NUMBER;
851
852 /*=============================================================================
853 | FUNCTION - Is_Tax_Already_Dist_Inv_char()
854 |
855 | DESCRIPTION
856 | This function will return 'Y' if any taxable distribution has the
857 | tax_already_calculated_flag equals Y. It will return 'N' otherwise.
858 |
859 *============================================================================*/
860
861 FUNCTION Is_Tax_Already_Dist_Inv_Char(
862 P_Invoice_Id IN NUMBER,
863 P_Calling_Sequence IN VARCHAR2) RETURN VARCHAR2;
864
865 /*=============================================================================
866 | FUNCTION - Get_Prepay_Pay_Awt_Group_Id()
867 |
868 | DESCRIPTION
869 | This function return the awt_group_id for a parent prepay item line
870 | based on the prepayment distribution id.
871 | Added for bug8345264
872 |
873 | PARAMETERS
874 | P_Prepay_Distribution_id - Distribution Id of the prepayment
875 |
876 | MODIFICATION HISTORY
877 | DATE Author Action
878 | 30-MAR-2009 ASANSARI Created
879 |
880 *============================================================================*/
881 FUNCTION Get_Prepay_Pay_Awt_Group_Id(
882 P_Prepay_Distribution_id IN NUMBER,
886 | FUNCTION - Is_Inclusive_Flag_Updatable()
883 P_Calling_Sequence IN VARCHAR2) RETURN NUMBER;
884
885 /*=============================================================================
887 |
888 | DESCRIPTION
889 | This function is called by Ebtax to make the Inclusive Check Box
890 | on Detail Tax Window editable based on return status by this
891 | function.Added for ER 6772098
892 | RETURN TRUE : Allow To Override Inclusive Checkbox
893 | RETURN FALUSE : Don't Allow To Override Inclusive Checkbox
894 |
895 |
896 | PARAMETERS
897 | p_invoice_id - Invoice Id of the Invoice open on workbench
898 | p_line_number - Invoice Line Number of Non Tax Line for which
899 | Detail Tax line is being overriden
900 | (Inclusive Check Box)
901 |
902 | MODIFICATION HISTORY
903 | DATE Author Action
904 | 31-JUL-2009 hchaudha Created
905 |
906 *============================================================================*/
907 FUNCTION is_inclusive_flag_updatable
908 (p_invoice_id IN NUMBER,
909 p_line_number IN NUMBER,
910 p_error_code IN OUT NOCOPY VARCHAR2,
911 p_calling_sequence IN VARCHAR2) Return Boolean;
912
913 /*=============================================================================
914 | FUNCTION - Is_Incl_Tax_Driver_Updatable()
915 |
916 | DESCRIPTION
917 | Called from : AP_ETAX_SERVICES_PKG.Populate_Lines_GT()
918 | APINLIN.pld
919 | APXINWKB.fmb
920 | RETURN TRUE : Allow To Override Tax drivers
921 | RETURN FALUSE : Don't Allow To Override Tax drivers
922 |
923 |
924 | PARAMETERS
925 | p_invoice_id - Invoice Id of the Invoice
926 | p_line_number - Invoice Line Number
927 |
928 | MODIFICATION HISTORY
929 | DATE Author Bug Action
930 | 02-Feb-2010 ANARUN 9068689 Created
931 |
932 ============================================================================*/
933
934 FUNCTION Is_Incl_Tax_Driver_Updatable(
935 p_invoice_id IN NUMBER,
936 p_line_number IN NUMBER,
937 p_calling_sequence IN VARCHAR2 )
938 RETURN BOOLEAN ;
939
940 /*=============================================================================
941 | PROCEDURE - Get_Default_CCID()
942 |
943 | DESCRIPTION
944 | Called from : APXIISIM.fmb
945 | APXRICAD.fmb
946 | APXINLIN.pld
947 | apamtpob.pls
948 | apamtrcb.pls
949 | apiimvtb.pls
950 | apmatchb.pls
951 | apothmtb.pls
952 | aprcvmtb.pls
953 |
954 | This procedure should be called from all code flows which make a call
955 | to ZX_AP_TAX_CLASSIFICATN_DEF_PKG.get_default_tax_classification() and
956 | the return value ( x_derived_ccid ) should be passed as the input
957 | parameter p_code_combination_id to the ZX API. The logic in the
958 | procedure is based on the code changes done by Bugs 6908977, 7350421
959 | and 8230574.
960 |
961 | MODIFICATION HISTORY
962 | DATE Author Bug Action
963 | 23-Feb-2011 ANARUN 10050094 Created
964 |
965 ============================================================================*/
966 PROCEDURE Get_Default_CCID ( p_invoice_id IN NUMBER DEFAULT NULL,
967 p_default_dist_ccid IN NUMBER DEFAULT NULL,
968 p_match_type IN VARCHAR2 DEFAULT NULL,
969 p_po_line_location_id IN NUMBER DEFAULT NULL,
970 p_po_distribution_id IN NUMBER DEFAULT NULL,
971 p_rcv_shipment_line_id IN NUMBER DEFAULT NULL,
972 p_rcv_transaction_id IN NUMBER DEFAULT NULL,
973 p_line_type_lookup_code IN VARCHAR2 DEFAULT NULL,
974 p_reference_key1 IN VARCHAR2 DEFAULT NULL,
975 p_reference_key2 IN VARCHAR2 DEFAULT NULL,
976 p_invoice_line_number IN NUMBER DEFAULT NULL,
977 p_distribution_set_id IN NUMBER DEFAULT NULL,
978 p_calling_sequence IN VARCHAR2 ,
979 x_derived_ccid OUT NOCOPY NUMBER
980 ) ;
981
982
983 /*=============================================================================
984 | PROCEDURE - Get_Default_CCID()
985 |
986 | DESCRIPTION
987 | Called from : apetxsrb.pls
988 | This procedure should be called to get the CCID generated from projects.
989 | MODIFICATION HISTORY
990 | DATE Author Bug Action
991 | 25-Nov-2011 PGAYEN 13399833 Created
992 |
993 ============================================================================*/
994
995 FUNCTION GET_CCID_FROM_PROJECTS
996 ( p_invoice_id IN ap_invoice_distributions_all.invoice_id%TYPE,
997 p_line_number IN ap_invoice_distributions_all.invoice_line_number%TYPE,
998 p_ccid OUT NOCOPY ap_invoice_distributions_all.dist_code_combination_id%TYPE ) RETURN BOOLEAN;
999
1000
1001 /*=============================================================================
1002 | FUNCTION - IS_LINE_POSTED_ENCUMBERED()
1003 |
1004 | DESCRIPTION
1005 | Called from : APXINWKB.fmb
1006 | RETURN TRUE : INCLUSIVE TAX LINE NOT ALLOWED
1007 | RETURN FALUSE : INCLUSIVE TAX LINE ALLOWED
1008 |
1009 |
1010 | PARAMETERS
1011 | p_invoice_id - Invoice Id of the Invoice
1012 | p_line_number - Invoice Line Number
1013 |
1014 | MODIFICATION HISTORY
1015 | DATE Author Bug Action
1016 | 15-Nov-2011 HCHAUDHA 11768207 Created
1017 |
1018 ============================================================================*/
1019
1020 FUNCTION IS_LINE_POSTED_ENCUMBERED(
1021 p_invoice_id IN NUMBER,
1022 p_line_number IN NUMBER,
1023 p_calling_sequence IN VARCHAR2 )
1024 RETURN BOOLEAN ;
1025
1026 END AP_ETAX_UTILITY_PKG;